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.
How do I re-use manually created sensors over and over
-
- 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
If you changed the $ARG1$ field for each of these checks to be
You could then run the Bulk Host Cloning Wizard to clone these checks to other servers
https://assets.nagios.com/downloads/nag ... Wizard.pdf
Code: Select all
-H $HOSTADDRESS$
https://assets.nagios.com/downloads/nag ... Wizard.pdf
Re: How do I re-use manually created sensors over and over
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
/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
-
- 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
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