Notifications to WhatsAPP

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
peter.romfeld.hk
Posts: 7
Joined: Wed Sep 11, 2013 11:24 pm

Notifications to WhatsAPP

Post by peter.romfeld.hk »

Hi,

I am using WhatsAPI, a bit customized for my needs. Its working fine from the commandline:
/usr/lib64/nagios/plugins/send_whatsapp.php args1 args2 args3 args4 args5 args6 CONTACTPAGER

But Nagios is not executing it, here my config:

commands.cfg:
# 'notify-host-by-xmpp' command definition
define command{
command_name notify-host-by-xmpp
command_line /usr/lib64/nagios/plugins/send_alert.php $NOTIFICATIONTYPE$ $HOSTNAME$ $HOSTSTATE$ $HOSTADDRESS$ $HOSTOUTPUT$ $LONGDATETIME$ $CONTACTPAGER$
}

# 'notify-service-by-xmpp' command definition
define command{
command_name notify-service-by-xmpp
command_line /usr/lib64/nagios/plugins/send_alert.php $NOTIFICATIONTYPE$ $SERVICEDESC$ $HOSTALIAS$ $HOSTADDRESS$ $SERVICESTATE$ $LONGDATETIME$ $CONTACTPAGER$
}

templates.cfg:
define contact{
name xmpp-contact
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-xmpp
host_notification_commands notify-host-by-xmpp
register 0
service_notification_period 24x7
host_notification_period 24x7
}

contacts.cfg
define contact{
contact_name peter
use xmpp-contact
alias peter sms
pager mynumber
}

define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members alerts, peter
}

I had the same config for my send_sms.py script which was working just fine.
In the logs i see that nagios actually trigger the notification. but in the php log i dont see that nagios executed it
[1388980882] SERVICE NOTIFICATION: peter;region-nagios;NAGIOS;OK;notify-service-by-xmpp;NAGIOS OK: 2 processes, status log updated 9 seconds ago
peter.romfeld.hk
Posts: 7
Joined: Wed Sep 11, 2013 11:24 pm

Re: Notifications to WhatsAPP

Post by peter.romfeld.hk »

solved with using yowsup.
you need to define countycode, autodetect not working. I am using my own python script to generate the message and forward it to yowsup-cli
Locked