event handler options
Posted: Fri Jan 10, 2020 7:19 am
Hello
im tryng to make a event handler that basically sends service alarms to outside system.
1) Created a nagiosxi command: $USER1$/event_handler_test.sh $NOTIFICATIONTYPE$ $SERVICEDESC$ $HOSTNAME$ $HOSTADDRESS$ $SERVICESTATE$ $LONGDATETIME$ $SERVICEOUTPUT$ $SERVICEOUTPUT$ $NOTIFICATIONCOMMENT$
2) Created a script:
#!/bin/bash
NOTIFICATIONTYPE=$1
SERVICEDESC=$2
HOSTNAME=$3
HOSTADDRESS=$4
SERVICESTATE=$5
LONGDATETIME=$6
SERVICEOUTPUT=$7
NOTIFICATIONCOMMENT=$8
echo $NOTIFICATIONTYPE $SERVICEDESC $HOSTNAME $HOSTADDRESS $SERVICESTATE $LONGDATETIME $SERVICEOUTPUT $NOTIFICATIONCOMMENT > /tmp/hostinfo.txt
The problem is that not all the variables give out info, like SERVICEOUTPUT. Is event handler somehow limited? Or i should use some other option to get status information?
If i get it working, then the idea is to curl it out to the outside system.
Thank you.
im tryng to make a event handler that basically sends service alarms to outside system.
1) Created a nagiosxi command: $USER1$/event_handler_test.sh $NOTIFICATIONTYPE$ $SERVICEDESC$ $HOSTNAME$ $HOSTADDRESS$ $SERVICESTATE$ $LONGDATETIME$ $SERVICEOUTPUT$ $SERVICEOUTPUT$ $NOTIFICATIONCOMMENT$
2) Created a script:
#!/bin/bash
NOTIFICATIONTYPE=$1
SERVICEDESC=$2
HOSTNAME=$3
HOSTADDRESS=$4
SERVICESTATE=$5
LONGDATETIME=$6
SERVICEOUTPUT=$7
NOTIFICATIONCOMMENT=$8
echo $NOTIFICATIONTYPE $SERVICEDESC $HOSTNAME $HOSTADDRESS $SERVICESTATE $LONGDATETIME $SERVICEOUTPUT $NOTIFICATIONCOMMENT > /tmp/hostinfo.txt
The problem is that not all the variables give out info, like SERVICEOUTPUT. Is event handler somehow limited? Or i should use some other option to get status information?
If i get it working, then the idea is to curl it out to the outside system.
Thank you.