Page 2 of 2

Re: rapid response url help

Posted: Thu Jan 16, 2020 1:32 pm
by scottwilkerson
You could add a $USERn$ macro in the resources.cfg on each of the instances and then reference that.

e.g. add to /usr/local/nagios/etc/resource.cfg

Code: Select all

$USER20$=http://prdnagxi01.example.net/nagiosxi/
Then reference $USER20$ in commands

Re: rapid response url help

Posted: Fri Jan 17, 2020 8:07 am
by jenstar13
it does not look like the standard macros work in this

Code: Select all

#Link to HOST test
$USER21$=http://prdnagxi01.example.net/nagios/cgi-bin/extinfo.cgi?type=1&host=$HOSTNAME$
Gives
http://prdprdnagxi01.example.net/nagios ... xample.net
&host should be &host=prdftp01.example.net

Code: Select all

#Link to service test
$USER20$=http://prdnagxi01.example.net/nagios/cgi-bin/extinfo.cgi?type=2&host=$HOSTNAME$&service=$SERVICEDESC$
Same for this it replaces HOSTNAME with the Nagios server, and leaves service blank

Re: rapid response url help

Posted: Fri Jan 17, 2020 8:20 am
by scottwilkerson
I was just suggesting adding the user macro as just the base URL

Code: Select all

$USER20$=http://prdnagxi01.example.net/nagiosxi/
and then building the whole URL you are looking for either in your command or in your script.

You can't put a $HOSTNAME$ or $SERVICEDESC$ in the resources.cfg as it isn't populated yet, the macros populate when it know what host/service it is running for.