Nagios Alerts :Custom
Nagios Alerts :Custom
tried the old google search nothing really comes up. is there a way to get an alert pull data from a different location for info? ex servers info not just IP, service down, name etc
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios Alerts :Custom
What type of information are you looking for?LuisN wrote:tried the old google search nothing really comes up. is there a way to get an alert pull data from a different location for info? ex servers info not just IP, service down, name etc
Re: Nagios Alerts :Custom
I am currently setting up a dev env where we use DCIM app for host information - contact info thats updated on the fly, metric data URL that is on a different system ( not using perf data ) , and insert graphical data from a different source as well. i have API's in all the other platforms , just looking to see if i can utilize that info all in 1 Notification
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios Alerts :Custom
You can modify your notification command to collect this external data and inject it into the message.
Re: Nagios Alerts :Custom
Is there an example of such?
would i be able to run another command_line param ?
would i be able to run another command_line param ?
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios Alerts :Custom
So the default notification command looks something like this
You can change this to run your own script, such as
Then inside of /path/to/your/custom/handler.sh you parse the arguments passed from nagios, and add in whatever you need to collect the other information from the external system.
Code: Select all
define command {
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
Code: Select all
define command {
command_name notify-host-by-email
command_line /path/to/your/custom/handler.sh "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTSTATE$" "$HOSTADDRESS$" "$HOSTOUTPUT" "$LONGDATETIME$" "$CONTACTEMAIL$"
}
Re: Nagios Alerts :Custom
Yeah thats how i figured id do it. thanks for the confirmation!
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios Alerts :Custom
Sounds good, locking threadLuisN wrote:Yeah thats how i figured id do it. thanks for the confirmation!