Page 1 of 1
issue with script execution in event handler
Posted: Fri Oct 09, 2015 6:44 am
by sangeetha
hi,
I tried a sample script explained for setting up event handler in Nagios XI using the link below
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
but somehow, the hostinfo.txt files is not getting created under tmp dir. could someone please help me to fnd what is the issue.
Thank you upfront.
need to contact a member about event handler topic
Posted: Fri Oct 09, 2015 7:19 am
by sangeetha
hi Admin,
I need to know the solution for the post on the issue the member(ganeshanrs1983) had for creating hostinfo.txt file on localhost on executing a eventhandler. Please help me ASAP.
https://support.nagios.com/forum/viewto ... 54#p111984
Re: need to contact a member about event handler topic
Posted: Fri Oct 09, 2015 2:28 pm
by ssax
Please post the output of this command:
Code: Select all
ls -l /usr/local/nagios/libexec/cevent_handler_test.sh
Please go to Configure > Core Config Manager
- Click on services and click the blue disk icon next to the service with the event handler on it.
- Click on commands and click the blue disk icon next to the command for the event handler.
Please post all of that information so that we can take a look at it.
Thank you
Re: need to contact a member about event handler topic
Posted: Mon Oct 12, 2015 2:29 am
by sangeetha
here is the output.
-rwxr-xr-x 1 nagios nagios 276 Oct 9 11:35 /usr/local/nagios/libexec/event_handler_test.sh
this event handler is configured for host. output is this
define host {
host_name event_handler_test
address 127.0.0.1
check_command check_dummy!0!!!!!!!
max_check_attempts 5
check_interval 5
retry_interval 1
check_period xi_timeperiod_24x7
event_handler event_handler_test
event_handler_enabled 1
notification_period xi_timeperiod_24x7
register 1
}
Code: Select all
###############################################################################
#
# Check command configuration file
#
# Created by: Nagios Core Config Manager 2.3.3
# Date: 2015-10-12 08:28:10
# Version: Nagios 3.x config file
#
# --- DO NOT EDIT THIS FILE BY HAND ---
# Nagios CCM will overwrite all manual settings during the next update if you
# would like to edit files manually, place them in the 'static' directory or
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################
define command {
command_name API_login_v1_response.sh
command_line $USER1$/API_login_v1_response.sh
}
define command {
command_name check-host-alive
command_line $USER1$/check_icmp -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
}
define command {
command_name check-host-alive-http
command_line $USER1$/check_http -H $HOSTADDRESS$
}
define command {
command_name check_api_response
command_line $USER1$/check_api_response.sh
}
define command {
command_name check_api_response_V2
command_line $USER1$/check_api_response_V2.sh
}
define command {
command_name Check_app_v1_healthcheck.sh
command_line $USER1$/Check_app_v1_healthcheck.sh
}
define command {
command_name check_bpi
command_line /usr/bin/php $USER1$/check_bpi.php $ARG1$
}
define command {
command_name check_dhcp
command_line $USER1$/check_dhcp $ARG1$
}
define command {
command_name check_dir
command_line $USER1$/check_dir -d $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
}
define command {
command_name check_dns
command_line $USER1$/check_dns -H $HOSTNAME$ $ARG1$
}
define command {
command_name check_dummy
command_line $USER1$/check_dummy $ARG1$ $ARG2$
}
define command {
command_name check_em01_humidity
command_line $USER1$/check_em01.pl --type=hum --hum=$ARG1$,$ARG2$ $HOSTADDRESS$
}
define command {
command_name check_em01_light
command_line $USER1$/check_em01.pl --type=illum --illum=$ARG1$,$ARG2$ $HOSTADDRESS$
}
define command {
command_name check_em01_temp
command_line $USER1$/check_em01.pl --type=temp --temp=$ARG1$,$ARG2$ $HOSTADDRESS$
}
define command {
command_name check_em08_contacts
command_line $USER1$/check_em08 $HOSTADDRESS$ C
}
define command {
command_name check_em08_humidity
command_line $USER1$/check_em08 $HOSTADDRESS$ H $ARG1$ $ARG2$ $ARG3$
}
define command {
command_name check_em08_light
command_line $USER1$/check_em08 $HOSTADDRESS$ I $ARG1$ $ARG2$ $ARG3$
}
define command {
command_name check_em08_rtd
command_line $USER1$/check_em08 $HOSTADDRESS$ R $ARG1$ $ARG2$ $ARG3$
}
define command {
command_name check_em08_temp
command_line $USER1$/check_em08 $HOSTADDRESS$ T $ARG1$ $ARG2$ $ARG3$
}
define command {
command_name check_em08_voltage
command_line $USER1$/check_em08 $HOSTADDRESS$ V $ARG1$ $ARG2$ $ARG3$
}
define command {
command_name check_email_delivery
command_line $USER1$/check_email_delivery $ARG1$
}
define command {
command_name check_esx3_guest
command_line $USER1$/check_esx3.pl -H "$HOSTADDRESS$" -f "$ARG1$" -N "$ARG2$" -l "$ARG3$"$ARG4$
}
define command {
command_name check_esx3_host
command_line $USER1$/check_esx3.pl -H "$HOSTADDRESS$" -f "$ARG1$" -l "$ARG2$"$ARG3$
}
define command {
command_name check_exchange_rbl
command_line $USER1$/check_bl -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_ftp
command_line $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_ftp_fully
command_line $USER1$/check_ftp_fully "$ARG1$" "$ARG2$" "$ARG3$" $HOSTNAME$
}
define command {
command_name check_hpjd
command_line $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_icmp
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$
}
define command {
command_name check_imap
command_line $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_local_disk
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}
define command {
command_name check_local_load
command_line $USER1$/check_load -w $ARG1$ -c $ARG2$
}
define command {
command_name check_local_mrtgtraf
command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
}
define command {
command_name check_local_procs
command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
}
define command {
command_name check_local_swap
command_line $USER1$/check_swap -w $ARG1$ -c $ARG2$
}
define command {
command_name check_local_users
command_line $USER1$/check_users -w $ARG1$ -c $ARG2$
}
define command {
command_name check_mailserver_rbl
command_line $USER1$/check_bl -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_mongodb_database
command_line $USER1$/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$ -u $ARG5$ -p $ARG6$ -d $ARG7$ -D
}
define command {
command_name check_mongodb_server
command_line $USER1$/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$ -u $ARG5$ -p $ARG6$ -D --all-databases
}
define command {
command_name check_nagiosxi_performance
command_line /usr/bin/php $USER1$/check_nagios_performance.php $ARG1$ $ARG2$ $ARG3$
}
define command {
command_name check_nagios_performance
command_line $USER1$/check_nagios_performance -o $ARG1$ $ARG2$
}
define command {
command_name check_nagios_proc_usage
command_line $USER1$/check_nagios_proc_usage $ARG1$ $ARG2$
}
define command {
command_name check_none
command_line /bin/true
}
define command {
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$
}
define command {
command_name check_nrpeversion
command_line $USER1$/check_nrpe -H $HOSTADDRESS$
}
define command {
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p $USER7$ -s $USER8$ -v $ARG1$ $ARG2$
}
define command {
command_name check_php_snmp_bandwidth
command_line $USER1$/get_snmp.php -H=$HOSTADDRESS$ -C=$ARG1$ -2 -I=$ARG2$ -u -w=$ARG3$ -c=$ARG4$ -d=$ARG5$
}
define command {
command_name check_ping
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
}
define command {
command_name check_pop
command_line $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_proc_usage
command_line $USER1$/check_proc_usage -p $ARG1$ $ARG2$
}
define command {
command_name check_radius_server_adv
command_line $USER1$/check_radius_adv -r $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_smtp
command_line $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_snmp_int
command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG1$ -2 -n $ARG2$ -f -k -w $ARG3$ -c $ARG4$ $ARG5$
}
define command {
command_name check_ssh
command_line $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
}
define command {
command_name check_ssh_expect
command_line $USER1$/check_ssh_expect.pl -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$ $ARG3$
}
define command {
command_name check_tcp
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
}
define command {
command_name check_udp
command_line $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
}
define command {
command_name Check_users_v1_healthcheck.sh
command_line $USER1$/Check_users_v1_healthcheck.sh
}
define command {
command_name Check_website_v1_responsetime.sh
command_line $USER1$/Check_website_v1_responsetime.sh -w $ARG1$ -c $ARG2$ -u $ARG3$
}
define command {
command_name check_xi_by_ssh
command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ $ARG1$ $ARG2$
}
define command {
command_name check_xi_deface
command_line $USER1$/check_http -H $HOSTADDRESS$ -r '$ARG1$' -u '$ARG2$' $ARG3$
}
define command {
command_name check_xi_domain_v2
command_line $USER1$/check_domain.php -d $ARG1$ $ARG2$ $ARG3$
}
define command {
command_name check_xi_host_http
command_line $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_host_ping
command_line $USER1$/check_icmp -H $HOSTADDRESS$ -w $ARG1$,$ARG2$ -c $ARG3$,$ARG4$ -p 5
}
define command {
command_name check_xi_mssql_database
command_line $USER1$/check_mssql_database.py -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_mssql_query
command_line $USER1$/check_mssql -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_mssql_server
command_line $USER1$/check_mssql_server.py -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_mysql_health
command_line $USER1$/check_mysql_health $ARG1$
}
define command {
command_name check_xi_mysql_query
command_line $USER1$/check_mysql_health $ARG1$
}
define command {
command_name check_xi_nagiosxiserver
command_line /usr/bin/php $USER1$/check_nagiosxiserver.php $ARG1$
}
define command {
command_name check_xi_ncpa_agent
command_line $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_nna
command_line $USER1$/check_nna.py -H $HOSTADDRESS$ -K $ARG1$ $ARG2$
}
define command {
command_name check_xi_oraclequery
command_line /usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib ORACLE_HOME=/usr/lib/oracle/11.2/client $USER1$/check_oracle_health $ARG1$
}
define command {
command_name check_xi_oracleserverspace
command_line /usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib ORACLE_HOME=/usr/lib/oracle/11.2/client $USER1$/check_oracle_health $ARG1$
}
define command {
command_name check_xi_oracletablespace
command_line /usr/bin/env LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib ORACLE_HOME=/usr/lib/oracle/11.2/client $USER1$/check_oracle_health $ARG1$
}
define command {
command_name check_xi_postgres
command_line $USER1$/check_postgres.pl $ARG1$
}
define command {
command_name check_xi_postgres_db
command_line $USER1$/check_postgres.pl $ARG1$
}
define command {
command_name check_xi_postgres_query
command_line $USER1$/check_postgres.pl $ARG1$
}
define command {
command_name check_xi_service_dns
command_line $USER1$/check_dns -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_dnsquery
command_line $USER1$/check_dns $ARG1$
}
define command {
command_name check_xi_service_ftp
command_line $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_hpjd
command_line $USER1$/check_hpjd -H $HOSTADDRESS$ -C $ARG1$
}
define command {
command_name check_xi_service_http
command_line $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_http_cert
command_line $USER1$/check_http -H $HOSTADDRESS$ -C $ARG1$
}
define command {
command_name check_xi_service_http_content
command_line $USER1$/check_http -H $HOSTADDRESS$ --onredirect=follow -s "$ARG1$"
}
define command {
command_name check_xi_service_ifoperstatus
command_line $USER1$/check_ifoperstatus -H $HOSTADDRESS$ -C $ARG1$ -k $ARG2$
}
define command {
command_name check_xi_service_ifoperstatusnag
command_line $USER1$/check_ifoperstatnag $ARG1$ $ARG2$ $HOSTADDRESS$
}
define command {
command_name check_xi_service_imap
command_line $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_ldap
command_line $USER1$/check_ldap -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_mrtgtraf
command_line $USER1$/check_rrdtraf -f /var/lib/mrtg/$ARG1$ -w $ARG2$ -c $ARG3$ -l $ARG4$
}
define command {
command_name check_xi_service_nagioslogserver
command_line $USER1$/check_nagioslogserver.php $ARG1$
}
define command {
command_name check_xi_service_none
command_line $USER1$/check_dummy 0 "Nothing to monitor"
}
define command {
command_name check_xi_service_nsclient
command_line $USER1$/check_nt -H $HOSTADDRESS$ -s "$ARG1$" -p 12489 -v $ARG2$ $ARG3$ $ARG4$
}
define command {
command_name check_xi_service_ping
command_line $USER1$/check_icmp -H $HOSTADDRESS$ -w $ARG1$,$ARG2$ -c $ARG3$,$ARG4$ -p 5
}
define command {
command_name check_xi_service_pop
command_line $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_smtp
command_line $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_snmp_linux_load
command_line $USER1$/check_snmp_load_wizard.pl -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_snmp_linux_process
command_line $USER1$/check_snmp_process_wizard.pl -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_snmp_linux_storage
command_line $USER1$/check_snmp_storage_wizard.pl -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_snmp_watchguard
command_line $USER1$/check_snmp_generic.pl -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_snmp_win_load
command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_snmp_win_process
command_line $USER1$/check_snmp_process.pl -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_snmp_win_service
command_line $USER1$/check_snmp_win.pl -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_snmp_win_storage
command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_ssh
command_line $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
}
define command {
command_name check_xi_service_tcp
command_line $USER1$/check_tcp -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_udp
command_line $USER1$/check_udp -H $HOSTADDRESS$ $ARG1$
}
define command {
command_name check_xi_service_webinject
command_line $USER1$/check_webinject.sh $ARG1$
}
define command {
command_name check_xi_service_wmiplus
command_line $USER1$/check_wmi_plus.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -m $ARG3$ $ARG4$
}
define command {
command_name check_xi_service_wmiplus_authfile
command_line $USER1$/check_wmi_plus.pl -H $HOSTADDRESS$ -A $ARG1$ -m $ARG2$ $ARG3$
}
define command {
command_name event_handler_test
command_line “$USER1$/event_handler_test.sh
}
define command {
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
define command {
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
define command {
command_name notify_host_xi_contact
command_line /usr/bin/php /usr/local/nagiosxi/scripts/contact_notification_handler.php --contactemail="$CONTACTEMAIL$" --subject="** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" --message="***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"
}
define command {
command_name notify_service_xi_contact
command_line /usr/bin/php /usr/local/nagiosxi/scripts/contact_notification_handler.php --contactemail="$CONTACTEMAIL$" --subject="** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$ $SERVICEDESC$ is $SERVICESTATE$ **" --message="***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$"
}
define command {
command_name process-host-perfdata-file-bulk
command_line /bin/mv /usr/local/nagios/var/host-perfdata /usr/local/nagios/var/spool/xidpe/$TIMET$.perfdata.host
}
define command {
command_name process-host-perfdata-file-pnp-bulk
command_line /bin/mv /usr/local/nagios/var/host-perfdata /usr/local/nagios/var/spool/perfdata/host-perfdata.$TIMET$
}
define command {
command_name process-host-perfdata-pnp-normal
command_line /usr/bin/perl /usr/local/nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
define command {
command_name process-service-perfdata-file-bulk
command_line /bin/mv /usr/local/nagios/var/service-perfdata /usr/local/nagios/var/spool/xidpe/$TIMET$.perfdata.service
}
define command {
command_name process-service-perfdata-file-pnp-bulk
command_line /bin/mv /usr/local/nagios/var/service-perfdata /usr/local/nagios/var/spool/perfdata/service-perfdata.$TIMET$
}
define command {
command_name process-service-perfdata-pnp-normal
command_line /usr/bin/perl /usr/local/nagios/libexec/process_perfdata.pl
}
define command {
command_name xi_host_event_handler
command_line /usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_event.php --handler-type=host --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --lasthoststate=$LASTHOSTSTATE$ --lasthoststateid=$LASTHOSTSTATEID$ --hoststatetype=$HOSTSTATETYPE$ --currentattempt=$HOSTATTEMPT$ --maxattempts=$MAXHOSTATTEMPTS$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --hostoutput="$HOSTOUTPUT$" --longhostoutput="$LONGHOSTOUTPUT$" --hostdowntime=$HOSTDOWNTIME$
}
define command {
command_name xi_host_notification_handler
command_line /usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=host --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --lasthoststate=$LASTHOSTSTATE$ --lasthoststateid=$LASTHOSTSTATEID$ --hoststatetype=$HOSTSTATETYPE$ --currentattempt=$HOSTATTEMPT$ --maxattempts=$MAXHOSTATTEMPTS$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --hostoutput="$HOSTOUTPUT$" --longhostoutput="$LONGHOSTOUTPUT$" --datetime="$LONGDATETIME$"
}
define command {
command_name xi_service_event_handler
command_line /usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_event.php --handler-type=service --host="$HOSTNAME$" --service="$SERVICEDESC$" --hostaddress="$HOSTADDRESS$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --servicestate=$SERVICESTATE$ --servicestateid=$SERVICESTATEID$ --lastservicestate=$LASTSERVICESTATE$ --lastservicestateid=$LASTSERVICESTATEID$ --servicestatetype=$SERVICESTATETYPE$ --currentattempt=$SERVICEATTEMPT$ --maxattempts=$MAXSERVICEATTEMPTS$ --serviceeventid=$SERVICEEVENTID$ --serviceproblemid=$SERVICEPROBLEMID$ --serviceoutput="$SERVICEOUTPUT$" --longserviceoutput="$LONGSERVICEOUTPUT$" --servicedowntime=$SERVICEDOWNTIME$
}
define command {
command_name xi_service_notification_handler
command_line /usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=service --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --service="$SERVICEDESC$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --servicestate=$SERVICESTATE$ --servicestateid=$SERVICESTATEID$ --lastservicestate=$LASTSERVICESTATE$ --lastservicestateid=$LASTSERVICESTATEID$ --servicestatetype=$SERVICESTATETYPE$ --currentattempt=$SERVICEATTEMPT$ --maxattempts=$MAXSERVICEATTEMPTS$ --serviceeventid=$SERVICEEVENTID$ --serviceproblemid=$SERVICEPROBLEMID$ --serviceoutput="$SERVICEOUTPUT$" --longserviceoutput="$LONGSERVICEOUTPUT$" --datetime="$LONGDATETIME$"
}
###############################################################################
#
# Check command configuration file
#
# END OF FILE
#
###############################################################################
Re: need to contact a member about event handler topic
Posted: Mon Oct 12, 2015 2:31 am
by sangeetha
and here is my event_handler_test.sh content
#!/bin/bash
HOSTNAME=$1
HOSTSTATE=$2
HOSTSTATETYPE=$3
HOSTOUTPUT=$4
DATE=$(date) #sets the DATE variable to the output of the 'date' command
echo "The host $HOSTNAME has changed to a $HOSTSTATETYPE $HOSTSTATE state at $DATE with the error:
$HOSTOUTPUT" > ~/test/hostinfo.txt
Re: need to contact a member about event handler topic
Posted: Mon Oct 12, 2015 1:19 pm
by ssax
Please go to Configure > Core Config Manager > Commands
- Edit your event_handler_test command and remove the " from the beginning of the command, save, and apply configuration.
Re: need to contact a member about event handler topic
Posted: Thu Oct 15, 2015 6:57 am
by sangeetha
hi,
Thank you.
i had tried that earlier, but didnt work. as soon as i changed the path from ~/test/hostinfo.txt to /tmp/hostinfo.txt, it worked!!!
Re: need to contact a member about event handler topic
Posted: Thu Oct 15, 2015 3:08 pm
by rkennedy
Nice to see that you were able to fix it! I will now close this out, but feel free to open another thread if you need more assistance.