Testing Script to Schedule Downtime - Newbie needs help! =)
Posted: Mon Sep 10, 2012 2:50 pm
First off thank you for reading my post! First time here, so any input is much appreciated!
I am working on an integration project where we are gathering planned outages from another system. Once that info is gathered and formatted we are then passing the scheduled outage info to nagios. We are in the midst of automating scheduled downtime in this way .
As such I am ready to start testing scheduled downtime in our nagios system using a script. I am completely new to nagios scripting and want to gather any/all ideas you may offer.
Currently I have written a test script based on things I have seen online thus far. what I have written is a test script using hardcoded values..
the script is currently not registering downtime for the test instance in our system. As such I want to ask if any of you know or see anything funny in the script ...its a simply 3 liner using hardcoded values for now, my main goal is to get the script working first and foremost, I can refine other things later..
Start Script Code
#!/bin/sh
NAGIOS_CMD="/usr/local/nagios/var/rw/nagios.cmd"
echo "SCHEDULE_HOST_DOWNTIME;FCFSPRE;2012-09-07 18:00:00;2012-09-07 22:00:00;1;0;7200;CMS Migration Team;CHG0030530" >>$NAGIOS_CMD
echo $NAGIOS_CMD "is the nagios control file"
End Script Code
My Questions:
1) I read that if the downtime is fixed then duration is ignored. As such, should I strip out the '7200' in the parameters being passed?
After I run my test script the control file still has a size of 0. It has an updated date/time stamp however other than this I am not sure
of a practical way of testing if the script worked ( other than the obvious which would be to use the web UI and see if the host has the downtime scheduled).
This is my first time testing in Nagios so I want to make sure my methodology is correct.
Again ANY input you have is much appreciated!
I am working on an integration project where we are gathering planned outages from another system. Once that info is gathered and formatted we are then passing the scheduled outage info to nagios. We are in the midst of automating scheduled downtime in this way .
As such I am ready to start testing scheduled downtime in our nagios system using a script. I am completely new to nagios scripting and want to gather any/all ideas you may offer.
Currently I have written a test script based on things I have seen online thus far. what I have written is a test script using hardcoded values..
the script is currently not registering downtime for the test instance in our system. As such I want to ask if any of you know or see anything funny in the script ...its a simply 3 liner using hardcoded values for now, my main goal is to get the script working first and foremost, I can refine other things later..
Start Script Code
#!/bin/sh
NAGIOS_CMD="/usr/local/nagios/var/rw/nagios.cmd"
echo "SCHEDULE_HOST_DOWNTIME;FCFSPRE;2012-09-07 18:00:00;2012-09-07 22:00:00;1;0;7200;CMS Migration Team;CHG0030530" >>$NAGIOS_CMD
echo $NAGIOS_CMD "is the nagios control file"
End Script Code
My Questions:
1) I read that if the downtime is fixed then duration is ignored. As such, should I strip out the '7200' in the parameters being passed?
After I run my test script the control file still has a size of 0. It has an updated date/time stamp however other than this I am not sure
of a practical way of testing if the script worked ( other than the obvious which would be to use the web UI and see if the host has the downtime scheduled).
This is my first time testing in Nagios so I want to make sure my methodology is correct.
Again ANY input you have is much appreciated!