Using arguments in Alias commands NSClient++

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
cfgriffith
Posts: 83
Joined: Tue Jan 15, 2013 4:22 pm

Re: Using arguments in Alias commands NSClient++

Post by cfgriffith »

Ah thats probably the issue, I will get back to you tomorrow after testing.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Using arguments in Alias commands NSClient++

Post by abrist »

Great. Let us know.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
cfgriffith
Posts: 83
Joined: Tue Jan 15, 2013 4:22 pm

Re: Using arguments in Alias commands NSClient++

Post by cfgriffith »

So I got it working now with the allow arguments command

On the config:
alias_service = checkServiceState CheckAll "exclude=ShellHWDetection" "exclude=clr_optimization_v4.0.30319_32" "exclude=clr_optimization_v4.0.30319_64" "exclude=clr_optimization_v2.0.50727_32" "exclude=clr_optimization_v4.0.30319_32" "exclude=SysmonLog" "exclude=VMUpgradeHelper" "exclude=HealthService" "exclude=0193831367257817mcinstcleanup" "exclude=iphlpsvc" "exclude=stisvc" "exclude=SplunkForwarder" "exlude=TSM Client Scheduler" "exclude=Contego_Spop" exclude=$ARG1$ exclude=$ARG2$ exclude=$ARG3$

Apparently it works without the quotes on the exclude statements.

On Nagios XI:
check_nrpe!/usr/local/nagios/libexec/check_nrpe -H tsmreport.stkate.pvt -c alias_service -a "IBMWAS70Service - Tivoli Integrated Portal - TIPProfile_Port_16310"


However, I want to know how to utilize the $ARG2$ and $ARG3$ if I have to exclude multiple services, to do that would I just do this?


On Nagios XI:
check_nrpe!/usr/local/nagios/libexec/check_nrpe -H tsmreport.stkate.pvt -c alias_service -a "IBMWAS70Service - Tivoli Integrated Portal - TIPProfile_Port_16310" "Blah1" "Blah2"

or is there additional commands I need to run?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Using arguments in Alias commands NSClient++

Post by slansing »

Those additional $ARGs$ can be used in whatever way you like, to add more services "If you want to use the other $ARGs$ instead of the first one in one string, simply add the services there how you have them previously defined. One thing to note, if you really do have all of your services in one double quotation, this may not work.. which means you would have to resort back to just using $ARG1$
cfgriffith
Posts: 83
Joined: Tue Jan 15, 2013 4:22 pm

Re: Using arguments in Alias commands NSClient++

Post by cfgriffith »

So it would only work if I did it this way? "exclude=$ARG1$" "exclude=$ARG2$" "exclude=$ARG3$" and not this way? exclude=$ARG1$ exclude=$ARG2$ exclude=$ARG3$
For more than one service exclusion: which is currently work, just its not currently at quotes and at the end of the command like this: exclude=$ARG1$


And what would the command I use to call that up look like? Like this: check_nrpe!/usr/local/nagios/libexec/check_nrpe -H tsmreport.stkate.pvt -c alias_service -a "IBMWAS70Service - Tivoli Integrated Portal - TIPProfile_Port_16310" "Blah1" "Blah2"

to exclude the additional service Blah1 and Blah2
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Using arguments in Alias commands NSClient++

Post by lmiltchev »

So it would only work if I did it this way? "exclude=$ARG1$" "exclude=$ARG2$" "exclude=$ARG3$" and not this way? exclude=$ARG1$ exclude=$ARG2$ exclude=$ARG3$
For more than one service exclusion: which is currently work, just its not currently at quotes and at the end of the command like this: exclude=$ARG1$
You don't have to many args - you can have only $ARG1$ in the NSC.ini file, and run a check like so:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <client_IP> -c alias_service -a "exclude=<service1> exclude=<service2> exclude=<service3> ..."
It's entirely up to you to decide how to set this up.
Be sure to check out our Knowledgebase for helpful articles and solutions!
cfgriffith
Posts: 83
Joined: Tue Jan 15, 2013 4:22 pm

Re: Using arguments in Alias commands NSClient++

Post by cfgriffith »

Sorry but please clarify, so your saying the example I gave in the post above yours wouldn't work? If it doesn't I should use the example you just provided?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Using arguments in Alias commands NSClient++

Post by slansing »

Yes, he was explaining the reasoning behind using only $ARG1$ in the nsclient++ config files. I would suggest using ludmil's suggestion as it would be the fastest way to get this configured. Don't forget to restart the nsclient++ service after saving the config file!
cfgriffith
Posts: 83
Joined: Tue Jan 15, 2013 4:22 pm

Re: Using arguments in Alias commands NSClient++

Post by cfgriffith »

So, this:

On the config:
alias_service = checkServiceState CheckAll "exclude=ShellHWDetection" "exclude=clr_optimization_v4.0.30319_32" "exclude=clr_optimization_v4.0.30319_64" "exclude=clr_optimization_v2.0.50727_32" "exclude=clr_optimization_v4.0.30319_32" "exclude=SysmonLog" "exclude=VMUpgradeHelper" "exclude=HealthService" "exclude=0193831367257817mcinstcleanup" "exclude=iphlpsvc" "exclude=stisvc" "exclude=SplunkForwarder" "exlude=TSM Client Scheduler" "exclude=Contego_Spop" $ARG1$

Would be fine, even though the ARG is not in quotes, to do this?:

/usr/local/nagios/libexec/check_nrpe -H <client_IP> -c alias_service -a "exclude=<service1> exclude=<service2> exclude=<service3> ..."

If so that's great, although I was under the impression each exclude statement had to be in quotations to work, I.e: "exclude=<service1>" "exclude=<service2>" "exclude=<service3>" If thats not true, than what your suggesting should work.

Let me know if that's what you mean and I'll give it a shot.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Using arguments in Alias commands NSClient++

Post by slansing »

They may need to be in quotes themselves, in which case you may need to hard code it in the NSC.ini file. Are you adding an additional group of services in $ARG1$ that you do not have listed already in that big alias_service list? When you manually run a check from the Nagios CLI what does it return?
Locked