Dynamic hostname in check (and not %HOSTNAME%)

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ritalinux
Posts: 1
Joined: Thu Apr 19, 2018 4:30 am

Dynamic hostname in check (and not %HOSTNAME%)

Post by ritalinux »

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:

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' 
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:

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' 
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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Dynamic hostname in check (and not %HOSTNAME%)

Post by cdienger »

An option would be to populate another field - like $HOSTNOTES$ OR $HOSTNOTESURL$ for example - on the host to hold the application interface's name and then configure the service to use this new field. These can be populated under the "Misc Settings" tab of the host's config.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked