Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
|
nagiosnotificationunipager [2018/04/05 17:00] dh3wr angelegt |
nagiosnotificationunipager [2018/04/05 17:15] (aktuell) dh3wr [Installation] |
||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ====== Notification to Pager from Nagios via Unipager ====== | + | ====== Notification to Pager from Nagios via UniPager ====== |
| - | FIXME | + | |
| + | There is a possibility to send notification to a pager via the DAPNET-Core. Look [[nagiosnotification|here]]. However, if in case of a failure the DAPNET-Core is not reachable, you may want to send a paging call directly via your unipager. | ||
| + | |||
| + | FIXME UNTESTED | ||
| + | |||
| + | ===== Installation ===== | ||
| + | Get the python script from [[https://github.com/dh3wr/UniPager-SendWebsocket|https://github.com/dh3wr/UniPager-SendWebsocket]]. Copy the file ''unipager_send.py'' to ''/usr/local/bin'' or whereever you want it to be. | ||
| + | |||
| + | ===== Define commands to send paging calls ===== | ||
| + | Edit ''commands.cfg'' and add the following lines: | ||
| + | <code> | ||
| + | # 'notify-host-by-pager' command definition | ||
| + | define command{ | ||
| + | command_name notify-host-by-pager-on-unipager | ||
| + | command_line /usr/bin/python /usr/local/bin/unipager_send.py --hostname $USER14$ --password $USER15$ --ric $$ --msg "NAGIOS $NOTIFICATIONTYPE$: $HOSTNAME$ $HOSTSTATE$" | ||
| + | } | ||
| + | |||
| + | # 'notify-service-by-pager' command definition | ||
| + | define command{ | ||
| + | command_name notify-service-by-pager-on-unipager | ||
| + | command_line /usr/bin/python /usr/local/bin/unipager_send.py --hostname $USER$ --password $USER$ --ric $address2$ --msg "NAGIOS $NOTIFICATIONTYPE$: $HOSTNAME$ $SERVICEDESC$ $SERVICESTATE$" | ||
| + | } | ||
| + | |||
| + | </code> | ||
| + | |||
| + | ===== Define UniPager hostname and password ===== | ||
| + | As you see, there are macros ''$USER13$'' and ''$USER14$'' used. They should contain the hostname of the Unipager and the password, if defined. Define them in the ''resource.cfg'': | ||
| + | <code> | ||
| + | $USER13$=unipager.yourdomain.com | ||
| + | $USER14$=VERYSCECRETPASSWORD | ||
| + | </code> | ||
| + | |||
| + | ===== Setup contacts ===== | ||
| + | Edit ''contacts.cfg'' and add the pager subscriber as set in DAPNET and the notification commands: | ||
| + | <code> | ||
| + | define contact{ | ||
| + | contact_name dh3wr | ||
| + | alias Ralf Wilke | ||
| + | service_notifications_enabled 1 | ||
| + | host_notifications_enabled 1 | ||
| + | service_notification_period 24x7 | ||
| + | host_notification_period 24x7 | ||
| + | service_notification_options w,u,c,r | ||
| + | host_notification_options d,r | ||
| + | service_notification_commands notify-service-by-email,notify-service-by-pager-on-unipager | ||
| + | host_notification_commands notify-host-by-email,notify-host-by-pager-on-unipager | ||
| + | email spam@myemail.cl | ||
| + | pager dh3wr | ||
| + | address1 dl-nw | ||
| + | address2 123456 | ||
| + | } | ||
| + | |||
| + | </code> | ||
| + | The ''address2'' entry defines the RIC to send the message to. Remember to add the commands just created. | ||
| + | |||
| + | ===== Assign the contact to the host or service ===== | ||
| + | Either use the template or define at each host and service the contacts you want to notify. | ||
| + | <code> | ||
| + | define host{ | ||
| + | name generic-host-rwthafu ; The name of this host template | ||
| + | notifications_enabled 1 ; Host notifications are enabled | ||
| + | event_handler_enabled 1 ; Host event handler is enabled | ||
| + | flap_detection_enabled 1 ; Flap detection is enabled | ||
| + | failure_prediction_enabled 1 ; Failure prediction is enabled | ||
| + | process_perf_data 1 ; Process performance data | ||
| + | retain_status_information 1 ; Retain status information across program restarts | ||
| + | retain_nonstatus_information 1 ; Retain non-status information across program restarts | ||
| + | check_command check-host-alive | ||
| + | max_check_attempts 10 | ||
| + | notification_interval 0 | ||
| + | notification_period 24x7 | ||
| + | notification_options d,u,r | ||
| + | contacts rwthafu,dh3wr | ||
| + | register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! | ||
| + | } | ||
| + | </code> | ||