How do I re-use manually created sensors over and over

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
caw001sbm
Posts: 7
Joined: Tue May 07, 2019 6:30 pm

How do I re-use manually created sensors over and over

Post by caw001sbm »

Hello,

I am trying to figure out how to be able to re-use a manually created sensor. I am trying to load up all of the postgres sensors that are not available out of the box with the wizard configurations.

However, when you have to specify the host in the check command, I am failing to see how we would be able to use this sensor on multiple hosts even if we added all of the hosts using the Manage Hosts button.

The check command in $ARG1$ we are using in this case (and most others) is:

-H 10.1.1.118 --port=5432 --dbuser=nagiossvc --dbname=database --dbpass="yougotme" --action=checckpoint

Since a host IP is included in the check command, how could the possibly be used over and over?

We have approx 10 PGSQL servers to monitor, and having to create the same sensor 10x for 30 commands is going to be really rough.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How do I re-use manually created sensors over and over

Post by scottwilkerson »

If you changed the $ARG1$ field for each of these checks to be

Code: Select all

-H $HOSTADDRESS$
You could then run the Bulk Host Cloning Wizard to clone these checks to other servers
https://assets.nagios.com/downloads/nag ... Wizard.pdf
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
caw001sbm
Posts: 7
Joined: Tue May 07, 2019 6:30 pm

Re: How do I re-use manually created sensors over and over

Post by caw001sbm »

Here is the command that I am using.

/usr/local/nagios/libexec/check_postgres.pl -H $HOSTADDRESS$ --port=6613 --dbuser=nagiossvc --dbname=postgres --dbpass="yougotme" --action=backends

ERROR: could not translate host name "$" to address: Temporary failure in name resolution



However I am able to ping it by name from the linux host.

itadmin@testhqnagios2:~$ ping devhqdwlx
PING devhqdwlx.sbmgroup.local (10.1.1.46) 56(84) bytes of data.
64 bytes from devhqdwlx.sbmgroup.local (10.1.1.46): icmp_seq=1 ttl=64 time=0 ms
64 bytes from devhqdwlx.sbmgroup.local (10.1.1.46): icmp_seq=2 ttl=64 time=0 ms
64 bytes from devhqdwlx.sbmgroup.local (10.1.1.46): icmp_seq=3 ttl=64 time=1ms
^C
--- devhqdwlx.sbmgroup.local ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2032ms
rtt min/avg/max/mdev = 0.622/0.861/1.233/0.266 ms
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How do I re-use manually created sensors over and over

Post by scottwilkerson »

You can't run it from the command line like that, nagios is going to replace $HOSTADDRESS$ with the address of the host this is running at when it executes the check
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked