We want to store our login informations in a nagios only-readable file.
root@lurch:~# touch /etc/nagios/private/custom.ini
root@lurch:~# chown root.nagios /etc/nagios/private/custom.ini
root@lurch:~# chmod 640 /etc/nagios/private/custom.ini
In this example Im going to create an [https] section which includes the credentials for my login web page. This file, which will be passed to --extra-opts= plugin argument, could contains all the options listed by ./check_http -h command in the literally form. For instance:
./check_http -h
...
-a, --authorization=AUTH_PAIR
Username:password on sites with basic authentication
...
Then:
root@lurch:~# su - nagios
nagios@lurch:~$ vim /etc/nagios/private/custom.ini
[https]
authorization = *user*:*password*
Let's write the 'commands' section. I want to call this command like 'check_https_auth'
nagios@lurch:~$ vim /etc/nagios/objects/commands.cfg
# zmo: check_https_auth
define command{
command_name check_https_auth
command_line $USER1$/check_http -H $ARG1$ -I $HOSTADDRESS$ -s $ARG2$ --ssl -c $ARG3$ -u $ARG4$ --extra-opts=https@/etc/nagios/private/custom.ini
}
Nessun commento:
Posta un commento