Place an ARG inside another ARG in Service Check

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jvaira
Posts: 59
Joined: Tue Dec 22, 2015 7:40 pm

Place an ARG inside another ARG in Service Check

Post by jvaira »

Hello,
I am trying to create a service check using the check_nrpe command where $ARG3$ will be referenced within $ARG2$. The following is a specific example.
$ARG1$ CheckCounter
$ARG2$ -a "Counter:$ARG3$-Avg-Disk-Writes-Sec=\\Cluster CSVFS($ARG3$)\\Writes/sec" ShowAll MaxWarn=99999999 MaxCrit=99999999
$ARG3$ CSV10

If I test this out by using the run check command everything looks good, however when I look at status information under service status I see the following error. Failed to poll counter: -Avg-Disk-Writes-Sec PdhAddCounter failed: c0000bc0: Unable to parse the counter path. Check the format and syntax of the specified path.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Place an ARG inside another ARG in Service Check

Post by benjaminsmith »

Hello @jvaira,

I would recommend defining this as a custom macro and then using this macro in your check commands.
check_arg.png
Nagios XI - Macros and Custom Object Variables
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
jvaira
Posts: 59
Joined: Tue Dec 22, 2015 7:40 pm

Re: Place an ARG inside another ARG in Service Check

Post by jvaira »

Hello Ben,
I tried that and am now getting the following error instead Failed to poll counter: PdhCollectQueryData failed: : 800007d5: No data to return.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Place an ARG inside another ARG in Service Check

Post by benjaminsmith »

Hi,

Did you re-start Nagios Core after making changes to the resource.cfg file?

Code: Select all

systemctl restart nagios
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
jvaira
Posts: 59
Joined: Tue Dec 22, 2015 7:40 pm

Re: Place an ARG inside another ARG in Service Check

Post by jvaira »

Hello,
I set this up as a free variable within the service check and then applied config. Would modifying the resource.cfg file be different?
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Place an ARG inside another ARG in Service Check

Post by benjaminsmith »

Hi,

Yeah, you'll want to use the user macros and add those to the /usr/local/nagios/etc/resource.cfg file . Take a look at the following guide:

https://assets.nagios.com/downloads/nag ... Macros.pdf
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
jvaira
Posts: 59
Joined: Tue Dec 22, 2015 7:40 pm

Re: Place an ARG inside another ARG in Service Check

Post by jvaira »

Hello Ben,
This did the trick, thank you. Just for my own understanding can you please explain why the free variables within the service do not work in this situation. I have used those for quite a few things in the past and never had an issue.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Place an ARG inside another ARG in Service Check

Post by benjaminsmith »

Hello @jvaira,

The custom or free variable can work as well. What version of Nagios XI are you using? Also, you'll need to add SERVICE or HOST in front of the variable.
In order to prevent name collision among custom variables from different object types, Nagios prepends "_HOST", "_SERVICE", or "_CONTACT" to the beginning of custom host, service, or contact variables, respectively, in macro and environment variable names. The table below shows the corresponding macro and environment variable names for the custom variables that were defined in the example above.
https://assets.nagios.com/downloads/nag ... tvars.html
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked