eventhandler

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
alain1988
Posts: 1
Joined: Fri Sep 07, 2018 8:23 am

eventhandler

Post by alain1988 »

Hy,

i am attemting to create an event handler for my windows services but cant get it working.

what i have done is :

installed ns client on the windows side configured the base install (ip port etc).

created a script called restart_service.bat

Code: Select all

@echo off
net stop %1
net start %1
@exit 0
i created a script alias restart_service= scripts\restart_service.bat $ARG1$ and a script command restart_service = scripts\restart_service.bat $ARG1$

on the linux side i created a script and placed it in the libex folder :

Code: Select all

#!/bin/sh
case "$1" in
OK)
;;
WARNING)
;;
UNKNOWN)
;;
CRITICAL)
/usr/local/nagios/libexec/check_nrpe -H "$2" -p 5666 -c restart_service -a "$3"
;;
esac
exit 0

and then i created a new command in commands.cfg

Code: Select all

#restart sevice
define command{
        command_name    restart_service
        command_line    $USER1$/restart_service $SERVICESTATE$ $HOSTADDRESS$
}

then i adjusted my server.cfg, but when is stop my service on the windows machine it does not restart how can i fix this ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: eventhandler

Post by scottwilkerson »

We have a topic on the settings needed for this setup here
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

If you cannot restart the nsclient agent, I would look to the nsclient log to see what the error is after trying to restart
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked