Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
rendicott
Great script!
@zarisha
To avoid the "WARNING: No SNMP response from -C! Make sure host is up and SNMP is configured properly." message make sure that you add the additional $ after "$HOSTADDRESS" in the command definition. The OP was missing it and it fixed my problem.
The following line in the OP:
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS -C $ARG1$ -x $ARG2 -w $ARG3$ -c
Should be:
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2 -w $ARG3$ -c
@zarisha
To avoid the "WARNING: No SNMP response from -C! Make sure host is up and SNMP is configured properly." message make sure that you add the additional $ after "$HOSTADDRESS" in the command definition. The OP was missing it and it fixed my problem.
The following line in the OP:
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS -C $ARG1$ -x $ARG2 -w $ARG3$ -c
Should be:
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -x $ARG2 -w $ARG3$ -c
At first this wasn't working on 3.2.1
I could see it trying to process the command when I tail nagios.log but it wasn't actually setting the downtime. I manually set a downtime through the web interface while watching the nagios.log and saw that the web interface was adding an extra parameter [0] (in between FIXED[1] and DYNDOWNDURATION[7200]) to the command that the perl script wasn't.
Perl Script:
SCHEDULE_HOST_DOWNTIME;ATLSQL1;1356546900;1356552400;1;7200;Nagios;ScheduledDowntime_TEST_ATLSQL1
SCHEDULE_HOST_DOWNTIME;ATLSQL1;1356546900;1356552400;1;0;7200;Nagios;ScheduledDowntime_TEST_ATLSQL1
So I modified the printf line of the "sched_downtime" perl script to hard code that extra zero:
Before:
printf $CMD "[$EpochTime] SCHEDULE_HOST_DOWNTIME;$Hostname;$DownStartEpoch;$DownEndEpoch;$Fixed;$DynDownDuration;$Username;$Comments\n";
After:
printf $CMD "[$EpochTime] SCHEDULE_HOST_DOWNTIME;$Hostname;$DownStartEpoch;$DownEndEpoch;$Fixed;0;$DynDownDuration;$Username;$Comments\n";
Now it works great, thanks!
I could see it trying to process the command when I tail nagios.log but it wasn't actually setting the downtime. I manually set a downtime through the web interface while watching the nagios.log and saw that the web interface was adding an extra parameter [0] (in between FIXED[1] and DYNDOWNDURATION[7200]) to the command that the perl script wasn't.
Perl Script:
SCHEDULE_HOST_DOWNTIME;ATLSQL1;1356546900;1356552400;1;7200;Nagios;ScheduledDowntime_TEST_ATLSQL1
SCHEDULE_HOST_DOWNTIME;ATLSQL1;1356546900;1356552400;1;0;7200;Nagios;ScheduledDowntime_TEST_ATLSQL1
So I modified the printf line of the "sched_downtime" perl script to hard code that extra zero:
Before:
printf $CMD "[$EpochTime] SCHEDULE_HOST_DOWNTIME;$Hostname;$DownStartEpoch;$DownEndEpoch;$Fixed;$DynDownDuration;$Username;$Comments\n";
After:
printf $CMD "[$EpochTime] SCHEDULE_HOST_DOWNTIME;$Hostname;$DownStartEpoch;$DownEndEpoch;$Fixed;0;$DynDownDuration;$Username;$Comments\n";
Now it works great, thanks!