HI
My intention is to have a script triggered in case of any NOTIFICATION . For that :
1. I have created a CONTACT ( not the user ) , in nagios.
2. Created a custom script and added it under _commands
3. I mapped that script/command under CONTACT's "Manage Host and Service Notofocation Command"
4. Time period is 24x7
If I send cutom notifcation , my script gets executed and everything works fine . However for a normal failure it never gets executed . I do not see it under Notification dashboard as well .
If I create USER ( which internally creates CONTACT as well ) , then everything works fine even for normal failure .
However I do not want to create a USER , I only want to create CONTACT . Why is that behavior ??
Nagios Contact not triggering the custom script
Nagios Contact not triggering the custom script
You do not have the required permissions to view the files attached to this post.
Re: Nagios Contact not triggering the custom script
Can you show us the actual configs for the contact, and host & service notification command that the contact is using?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Nagios Contact not triggering the custom script
Contact:
define contact {
contact_name Infra_Test_L2_Middleware
alias Test L2 Middleware Team
host_notification_period 24x7
service_notification_period 24x7
host_notification_commands notify-host-by-snt
service_notification_commands notify-service-by-snt
}
HOST NOTIFICATION COMMAND
define command {
command_name notify-host-by-snt
command_line $USER1$/nagios_mulesoft.py --source="nagios" --node="$HOSTNAME$" --type "$NOTIFICATIONTYPE$" --resource "Host" --metric_name "Host Status" --event_class "nagios alert" --severity "$HOSTSTATE$" --description "$HOSTOUTPUT$" --time_of_event "$SHORTDATETIME$" --env_type "$HOSTGROUPNAMES$" --contact "$CONTACTNAME$"
}
SERVICE NOTIFICATION COMMAND
define command {
command_name notify-service-by-snt
command_line $USER1$/nagios_mulesoft.py --source="nagios" --node="$HOSTNAME$" --type "$NOTIFICATIONTYPE$" --resource "$SERVICEDESC$" --metric_name "$SERVICEDESC$" --event_class "nagios alert" --severity "$SERVICESTATE$" --description "$SERVICEOUTPUT$" --time_of_event "$SHORTDATETIME$" --env_type "$HOSTGROUPNAMES$" --contact "$CONTACTNAME$"
}
define contact {
contact_name Infra_Test_L2_Middleware
alias Test L2 Middleware Team
host_notification_period 24x7
service_notification_period 24x7
host_notification_commands notify-host-by-snt
service_notification_commands notify-service-by-snt
}
HOST NOTIFICATION COMMAND
define command {
command_name notify-host-by-snt
command_line $USER1$/nagios_mulesoft.py --source="nagios" --node="$HOSTNAME$" --type "$NOTIFICATIONTYPE$" --resource "Host" --metric_name "Host Status" --event_class "nagios alert" --severity "$HOSTSTATE$" --description "$HOSTOUTPUT$" --time_of_event "$SHORTDATETIME$" --env_type "$HOSTGROUPNAMES$" --contact "$CONTACTNAME$"
}
SERVICE NOTIFICATION COMMAND
define command {
command_name notify-service-by-snt
command_line $USER1$/nagios_mulesoft.py --source="nagios" --node="$HOSTNAME$" --type "$NOTIFICATIONTYPE$" --resource "$SERVICEDESC$" --metric_name "$SERVICEDESC$" --event_class "nagios alert" --severity "$SERVICESTATE$" --description "$SERVICEOUTPUT$" --time_of_event "$SHORTDATETIME$" --env_type "$HOSTGROUPNAMES$" --contact "$CONTACTNAME$"
}
Re: Nagios Contact not triggering the custom script
These look fine. Let's check a few more things. Give us an example of a host or a service that sent to hard non-OK state, but the script was not triggered.
We need to see:
- the config for this particular host/service, including any templates that are used by this object
- a screenshot of the State History report, showing the host/service is a hard, non-ok state (Reports > State History > <your host/service> > Run)
- a screenshot of the Notifications report from the same time period (Reports > Notifications > <your host/service> > Run)
We need to see:
- the config for this particular host/service, including any templates that are used by this object
- a screenshot of the State History report, showing the host/service is a hard, non-ok state (Reports > State History > <your host/service> > Run)
- a screenshot of the Notifications report from the same time period (Reports > Notifications > <your host/service> > Run)
Be sure to check out our Knowledgebase for helpful articles and solutions!