Hello, I would like to chek if a specific user is logged on to a windows server.
I have Nagios 5.8.6
I use NCPA client
I have found this topic on Nagios Exchange:
https://exchange.nagios.org/directory/P ... er/details
but this plugin seems to be developed to work with NSCLIENT++
How can I make it work with NCPA? or are there any other similar plugin or builtin check on NCPA?
Thanks in advance.
Checks if a specific user is logged on to a Windows system.
-
- Posts: 22
- Joined: Fri Jan 29, 2021 12:06 pm
Re: Checks if a specific user is logged on to a Windows syst
hi
What version of Windows server are you running?
Thanks
What version of Windows server are you running?
Thanks
Re: Checks if a specific user is logged on to a Windows syst
Hi
Here is what I came up with, it's rough but works.
Create a file called check_user.ps1 and put it in C:\Program Files (x86)\Nagios\NCPA\plugins on the remote Windows machine.
check_user.ps1:
In Nagios set it up as shown, with the $ARG1$ shown:
-t 'gjstoken' -P 5693 -M 'plugins/check_user.ps1' -a 'administrator'
Thanks
Here is what I came up with, it's rough but works.
Create a file called check_user.ps1 and put it in C:\Program Files (x86)\Nagios\NCPA\plugins on the remote Windows machine.
check_user.ps1:
Code: Select all
$exitcode=2
if (((quser) | Out-String).contains($Args[0])) {
$exitcode=0
}
Write-Host("User checked was: " + $Args[0])
#Write-Host($exitcode)
exit $exitcode
-t 'gjstoken' -P 5693 -M 'plugins/check_user.ps1' -a 'administrator'
Thanks
You do not have the required permissions to view the files attached to this post.
-
- Posts: 22
- Joined: Fri Jan 29, 2021 12:06 pm
Re: Checks if a specific user is logged on to a Windows syst
Awsome!!, It works like a charm!, Thanks a lot!
Re: Checks if a specific user is logged on to a Windows syst
Hi
Glad it's working for you.
Have a good day!
Glad it's working for you.
Have a good day!