0

I use Nagios Core 3.5.1. In order to skip the HTTP authentication (guest user without password could also be tedious), I turn off the Nagios authentication based on this article. (even though turning off authentication is not recommended in any situation)

The great thing right now is every one could go to my Nagios address to view, but not able to change anything. However, this unfortunately also disable my ability to reschedule a check, etc. Because I can not log out guest and log in my authenticated account.

So I give up rescheduling a check on the web interface, but turning to do so in command line. I am wondering if there is a way to reschedule a check on command line?

Any insight would be gratefully appreciated!

2

Scheduling a check on the command line is pretty easy. You need to enable the external commands (command list). Then all you need is the name of the service, the name of the host, and the unix_time for when you want the check to run.

Here are a couple examples

NAGIOS_CMD_SOCKET='/var/lib/nagios3/rw/nagios.cmd'
# schedule a service check
/usr/bin/printf "[%lu] SCHEDULE_FORCED_SVC_CHECK;%s;%s;%s\n" \
                  $(date +%s) \
                  "host_name" \
                  "service_name" \
                  $(date +%s) | tee -a $NAGIOS_CMD_SOCKET

# schedule a host check
/usr/bin/printf "[%lu] SCHEDULE_HOST_CHECK;%s;%s\n" \
                 $(date +%s) \
                 "host_name" \
                 $(date +%s) | tee -a $NAGIOS_CMD_SOCKET

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.