Dynamic hostname in check (and not %HOSTNAME%)
Posted: Thu Dec 06, 2018 7:40 am
All our servers have two network interfaces, one for management and one for applications. Nagios runs over the management interface and its full hostname is <servername>.mgt.domain.name which in DNS points to its management interface. <servername>.domain.name points to the application network interface.
I want to check the expiry date of the SSL certificate of the Apache web application.
Unfortunately $HOSTNAME$ has the value of <servername>.mgt.domain.name and to run my check I need <servername>.domain.name. I cannot really change this in my organization.
I nagios I can do this command on the nagios server, using ncpa and check_http to check the remote server:
While this works great, this would require to create a check for each server I want to monitor with its name hard coded. I'm trying to create something like this:
This does not work. I hope you get my point, I need to dynamically fill in the host name, does anybody know of a way? I don't mind writing my own plugin, but I still do not see how to solve this issue.
I want to check the expiry date of the SSL certificate of the Apache web application.
Unfortunately $HOSTNAME$ has the value of <servername>.mgt.domain.name and to run my check I need <servername>.domain.name. I cannot really change this in my organization.
I nagios I can do this command on the nagios server, using ncpa and check_http to check the remote server:
Code: Select all
./check_ncpa.py -t secrettoken -H server1.mgt.domain.name -P 5693 -M 'plugins/check_http' -a '-I server1.domain.name -ssl -p443 -sni -C 60' Code: Select all
./check_ncpa.py -t secrettoken -H server1.mgt.domain.name -P 5693 -M 'plugins/check_http' -a '-I $(hostname -s).domain.name -ssl -p443 -sni -C 60'