Using NRPE to Count Users Signed in Help

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
hglod
Posts: 9
Joined: Fri Oct 11, 2019 7:14 am

Using NRPE to Count Users Signed in Help

Post by hglod »

Hi everyone I am relatively new to Nagios however over the past month I have gotten it up and running to ping our devices on the network. Next step is to count the number of users we have signed into our server farm and it's giving me some trouble. For reference I have used this https://support.nagios.com/forum/viewto ... =7&t=40102 post and this script https://exchange.nagios.org/directory/P ... 29/details to get started with NRPE. I am testing using an old Windows desktop with NSClient++ installed and Nagios Core running on a Raspberry Pi.

So when I run "./check_nrpe -H 192.168.0.99 -c check_users 2 3 cadprod.com\administrator" from my Pi I pull this error:
***********************
operable program or batch file.
Argument "$ARG1$" isn't numeric in numeric ge (>=) at (eval 24) line 41.
Argument "$ARG2$" isn't numeric in numeric lt (<) at (eval 24) line 41.
Critical: 0 users logged in
Active Sessions:
***********************

Any ideas? I have attached my nsclient.ini for reference. Let me know if you would like to see any other config files.
nsclient.ini
(1.25 KiB) Downloaded 107 times
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Using NRPE to Count Users Signed in Help

Post by scottwilkerson »

Try

Code: Select all

./check_nrpe -H 192.168.0.99 -c check_users -a 2 3 'cadprod.com\administrator'
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
hglod
Posts: 9
Joined: Fri Oct 11, 2019 7:14 am

Re: Using NRPE to Count Users Signed in Help

Post by hglod »

I pull the error "Exception processing request: Request command contained illegal metachars!" which I have noticed previously when I use the -a option.

If I don't include -a I pull the same error from the OP.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Using NRPE to Count Users Signed in Help

Post by scottwilkerson »

hglod wrote:Exception processing request: Request command contained illegal metachars!
Ya this is because of the \

You will need to add the following to the [/settings/NRPE/server] section of the nsclient.ini

Code: Select all

allow nasty characters = 1
Then restart nsclient++
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
hglod
Posts: 9
Joined: Fri Oct 11, 2019 7:14 am

Re: Using NRPE to Count Users Signed in Help

Post by hglod »

Actually I missed a line in the OP from the first error. The full error is:

'query' is not recognized as an internal or external command,
operable program or batch file.
Argument "$ARG1$" isn't numeric in numeric ge (>=) at (eval 24) line 41.
Argument "$ARG2$" isn't numeric in numeric lt (<) at (eval 24) line 41.
Critical: 0 users logged in
Active Sessions:
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Using NRPE to Count Users Signed in Help

Post by scottwilkerson »

scottwilkerson wrote:
hglod wrote:Exception processing request: Request command contained illegal metachars!
Ya this is because of the \

You will need to add the following to the [/settings/NRPE/server] section of the nsclient.ini

Code: Select all

allow nasty characters = 1
Then restart nsclient++
Then try the command again with the -a
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
hglod
Posts: 9
Joined: Fri Oct 11, 2019 7:14 am

Re: Using NRPE to Count Users Signed in Help

Post by hglod »

After allowing nasty characters I get "Arguments not allowed see nsclient.log for details" and the error in the log is:

2019-10-11 09:17:23: error:c:\source\master\modules\CheckExternalScripts\CheckExternalScripts.cpp:360: Arguments not allowed in CheckExternalScripts set /settings/external scripts/allow arguments=true

But I already have it set to true in my .ini.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Using NRPE to Count Users Signed in Help

Post by scottwilkerson »

You may need to add this to the [/settings/external scripts] section too

Code: Select all

allow nasty characters = 1
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
hglod
Posts: 9
Joined: Fri Oct 11, 2019 7:14 am

Re: Using NRPE to Count Users Signed in Help

Post by hglod »

Getting the exact same error and the same log entry after allowing nasty chars in external scripts.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Using NRPE to Count Users Signed in Help

Post by scottwilkerson »

hglod wrote:Getting the exact same error and the same log entry after allowing nasty chars in external scripts.
Can you re-share your nsclient.ini

thanks
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked