Creating A Custom Notification?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Sjwdavies
Posts: 3
Joined: Mon Apr 16, 2018 5:04 am

Creating A Custom Notification?

Post by Sjwdavies »

Hi there,

Firstly - what a great product. It's so powerful, I can't believe i've never deployed this solution in our business before!

My question is regarding custom notifications. We're based in the UK and I'd like certain members of the team to receive text notifications when an alert is generated. We use a service called FireText and they have a great API. I've written the script below and it's in place on the Server running NagiosXI, on CentOS 7:

(File location /usr/bin/notify-host-by-firetext.sh, file permissions 777)

Code: Select all

#!/bin/bash

type=$1
host=$2

curl "https://www.firetext.co.uk/api/sendsms?username=development@xxx&password=xxx&message=Type%3A%20${type}%0AHost%3A%20${host}&from=NagiosXI&to=07527552110" >> /var/log/firetext.log
echo "" >> /var/log/firetext.log
I've tested this from the command line and it indeed works and i receive a text message with the variables in it I pass to the script.

I've also created a NagiosXI custom command called ''notify-host-by-firetext', and added it to the Alert Settings for the nagiosadmin user (the only user I have for now):

Code: Select all

/usr/bin/notify-host-by-firetext.sh $NOTIFICATIONTYPE$ $HOSTNAME$ $HOSTSTATE$ $HOSTADDRESS$ $HOSTOUTPUT$
This command has been created as a 'Misc Command'.

The problem I have is that the above doesn't appear to be working. I can generate an outage, I receive the email notification, but not a text notification.

Do you know where i'm going wrong?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Creating A Custom Notification?

Post by scottwilkerson »

When you tested it form the command line did you test it as the nagios user?

What are the permissions of this file? Is it writable by nagios?

Code: Select all

ls -al /var/log/firetext.log
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Sjwdavies
Posts: 3
Joined: Mon Apr 16, 2018 5:04 am

Re: Creating A Custom Notification?

Post by Sjwdavies »

scottwilkerson wrote:When you tested it form the command line did you test it as the nagios user?

What are the permissions of this file? Is it writable by nagios?

Code: Select all

ls -al /var/log/firetext.log
Thanks, great questions. I tested it as root but it has 777 permissions...
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Creating A Custom Notification?

Post by scottwilkerson »

Can you test it as nagios

Code: Select all

sudo su nagios -c '/usr/bin/notify-host-by-firetext.sh arg arg arg ...'
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Sjwdavies
Posts: 3
Joined: Mon Apr 16, 2018 5:04 am

Re: Creating A Custom Notification?

Post by Sjwdavies »

@scottwilkerson - I think you were right. I think it was a permissions issue on the log file.

I've got it working now.

Nagios is Amazing!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Creating A Custom Notification?

Post by scottwilkerson »

Sjwdavies wrote:@scottwilkerson - I think you were right. I think it was a permissions issue on the log file.

I've got it working now.

Nagios is Amazing!
Excellent! Glad to hear it is sorted out.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked