Send Nagios Alert Notification Using DaDaPush
Nagios is an open source software that can be used for network and infrastructure monitoring. Nagios will monitor servers, switches, applications and services. It alerts the System Administrator when something went wrong and also alerts back when the issues has been rectified.
– Monitor your entire IT infrastructure.
– Identify problems before they occur.
– Know immediately when problems arise.
– Share availability data with stakeholders.hypothetical question
– Detect security breaches.
– Plan and budget for IT upgrades.
– Reduce downtime and business losses.
DaDaPush is a real-time notifications app. Anyone can send real-time notifications through our API without coding and maintaining your own app for iOS or Android devices.
Step 1: Install Nagios DaDaPush Notification Plugin
git clone https://github.com/dadapush/nagios-dadapush-notification-plugin cd nagios-dadapush-notification-plugin cp nagios-dadapush.sh /usr/local/nagios/libexec/ chmod +x /usr/local/nagios/libexec/nagios-dadapush.sh
Step 2: Create DaDaPush Channel
go to https://www.dadapush.com/channel/list and press “new channel” button for creating new Channel.
the channel token look like this: ctITmPr7aZkaTmPr7aZkaTmPr7aZkaTmPr7aZkaTmPr7aZka
Step 3: Nagios configuration
Create the command definitions in your Nagios configuration:
define command { command_name notify-host-by-dadapush command_line /usr/local/nagios/libexec/nagios-dadapush.sh -a "$NOTIFICATIONTYPE$" -b "$HOSTNAME$" -c "$HOSTSTATE$" -d "$HOSTOUTPUT$" -T "DADAPUSH_CHANNEL_TOKEN" } define command { command_name notify-service-by-dadapush command_line /usr/local/nagios/libexec/nagios-dadapush.sh -a "$NOTIFICATIONTYPE$" -b "$HOSTNAME$" -e "$SERVICEDESC$" -f "$SERVICESTATE$" -g "$SERVICEOUTPUT$" -T "DADAPUSH_CHANNEL_TOKEN" }
replace “DADAPUSH_CHANNEL_TOKEN” with your channel token.
Create the contact definition in your Nagios configuration:
define contact { contact_name dadapush alias dadapush service_notification_period 24x7 host_notification_period 24x7 service_notification_options w,u,c,r host_notification_options d,r host_notification_commands notify-host-by-dadapush service_notification_commands notify-service-by-dadapush }
The service_notification_options directive is used to define the service states for which notifications can be sent out to this contact. Valid options are a combination of one or more of the following:
w: Notify on WARNING service states
u: Notify on UNKNOWN service states
c: Notify on CRITICAL service states
r: Notify on service RECOVERY (OK states)
f: Notify when the service starts and stops FLAPPING
n (none): Do not notify the contact on any type of service notifications
The host_notification_options directive is used to define the host states for which notifications can be sent out to this contact. Valid options are a combination of one or more of the following:
d: Notify on DOWN host states
u: Notify on UNREACHABLE host states
r: Notify on host RECOVERY (UP states)
f: Notify when the host starts and stops FLAPPING
s: Send notifications when host or service scheduled downtime starts and ends
n (none): Do not notify the contact on any type of host notifications.
Add the contact to a contact group in your Nagios configuration:
define contactgroup{ contactgroup_name network-admins alias Network Administrators members email, dadapush }
Now the configuration is finished. Before applying the new configuration, run the following command to check for any error or mistake:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are no errors, restart the nagios service:
Step 4: test Nagios notifications
Now that we have everything configured how can we be sure that our notifications are working? use the check_dummy plugin (from the Nagios Plugins pack) and set it up to return a CRITICAL status, for example:
Other status codes you can return are:
0 - OK 1 - Warning 2 - Critical 3 - Unknown
from WordPress https://blog.dadapush.com/2019/08/04/send-nagios-alert-notification-using-dadapush/