Hi,
I have configured an HTTP URL service to monitor on Nagios XI if in any case, it's down then the notification messages should call to the endpoint HTTP URL. Instead of email/or SMS notification, it should go to the direct HTTP endpoint.
How can we configure this on Nagios Xi.please your support on this if anyone has an idea about this?
notification status to endpoint http URL
Re: notification status to endpoint http URL
Sure, you can use an Event Handler to execute an arbitrary command. That command can send an HTTP request off to your server.
1. Create file on the Nagios XI system. In this case I'll just call it /tmp/send-curl-command.sh. Make sure it's chmodded +x.
2. Create a Command in the CCM. In this case I'll call it notify-curl
Command Name: notify-curl
Command Line: /tmp/send-curl-command.sh $HOSTADDRESS$
Command Type: misc command
Active: Yes
3. Edit the host in the CCM and set the Check Settings -> Event Handler to notify-curl, and enable it.
There are probably more variables you can insert into the command line, but that's the basic gist of one way to do it.
1. Create file on the Nagios XI system. In this case I'll just call it /tmp/send-curl-command.sh. Make sure it's chmodded +x.
Code: Select all
#!/bin/sh
HOSTADDRESS=$1
curl -s "https://example.com/path/to/notification?HOSTADDRESS=$HOSTADDRESS"Command Name: notify-curl
Command Line: /tmp/send-curl-command.sh $HOSTADDRESS$
Command Type: misc command
Active: Yes
3. Edit the host in the CCM and set the Check Settings -> Event Handler to notify-curl, and enable it.
There are probably more variables you can insert into the command line, but that's the basic gist of one way to do it.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.
Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Re: notification status to endpoint http URL
thanks for your reply ,again we have issue with proxy server to post the messages, so i have added noproxy via below script, but still i could not get any logs ,
Pls your support for the curl script that to be configured on to sent status messages to dest url.
And also how can i check the log file of this cmd notify-curl.
#!/bin/sh
HOSTADDRESS=$1
HOSTSTATE=$2
SERVICESTATE=$3
curl --noproxy "*" "http://10.x.x.x?HOSTADDRESS=$HOSTADDRES ... $HOSTSTATE" >/tmp/curllog
Pls your support for the curl script that to be configured on to sent status messages to dest url.
And also how can i check the log file of this cmd notify-curl.
#!/bin/sh
HOSTADDRESS=$1
HOSTSTATE=$2
SERVICESTATE=$3
curl --noproxy "*" "http://10.x.x.x?HOSTADDRESS=$HOSTADDRES ... $HOSTSTATE" >/tmp/curllog
Re: notification status to endpoint http URL
You'll want to use a & to separate arguments to the script. E.g. "https://example.com/foo.php?bar=baz&qux=quux"
And I'm pretty sure you need a slash (/) after the hostname in your URL.
Rewritten:
As for getting the logs out, run the following command on the HTTP server 10.x.x.x:
And I'm pretty sure you need a slash (/) after the hostname in your URL.
Rewritten:
Code: Select all
#!/bin/sh
HOSTADDRESS=$1
HOSTSTATE=$2
SERVICESTATE=$3
curl --noproxy "*" "http://10.x.x.x/?HOSTADDRESS=$HOSTADDRESS&HOSTSTATE=$HOSTSTATE" >/tmp/curllogCode: Select all
(CentOS / RHEL)
tail -f /var/log/httpd/access_log |grep HOSTADDRESS
(Ubuntu / Debian)
tail -f /var/log/apache2/access.log |grep HOSTADDRESSIf you didn't get an 8% raise over the course of the pandemic, you took a pay cut.
Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.