First of all a happy New Year to all of you...
To start 2014 with some new ideas......
At the moment each of our Windows servers has two passive services, one named EVT_Application and one named EVT_System that receives passive events from the application or system eventlog.
We would really like to build a bash script that executes a process_service_check_result with OK result for each passive service staring with EVT_ in warning state. At the moment I have a quick action through the actions component pointing to a bash script that will do this for one service.
Code: Select all
HOSTNAME=$1
SERVICENAME=$2
now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'
/usr/bin/printf "[%lu] PROCESS_SERVICE_CHECK_RESULT;$HOSTNAME;$SERVICENAME;0;OK - Manual Reset\n" $now > $commandfile
As my bash knowledge is limited and I have no idea where to start, I would like to ask some questions:
- Is my above idea realistic? Or is it too complex?
- is it possible to somehow list all the services found in "Open Service Problems"? As I do not want to reset passive services that are not in the "Open service Problems" view, I would need to create an array of all services starting with EVT_* in warning state in "Open Service Problems" with their respective host and than loop through the array and send each item to the commandfile.
Any help / advice is very welcome.
Willem