Windows

Check logged on user

Description:

Checks if a specific user is logged on to a specific system.

Current Version

2.0

Last Release Date

2015-08-26

Compatible With

  • Nagios 4.x

Owner

License

GPL


Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Project Files
Project Photos
Project Notes
This script checks if a specific user is logged on to a specific system. The script will cath any error. Status is OK if the user is logged on, and CRITICAL if not. The computername, name of the domain and username are variable, so the script will accept any supplied value as an argument. --------- Syntax: --------- get_user.ps1 computername domain user - For a remote system, the parameter computername can be a hostname, or an IP address. For the local machine, you can use localhost or a dot (.) as valid values. - The parameter domain is the name of the domain (if the user is a domain user), or the computername (for a local user). - The parameter user is the user logon name. -------- Notes: -------- - PowerShell scripts must be allowed to run on the target computer (PowerShell Script Execution Policy). - Disconnected user sessions are recognized as logged on users. Which in fact is correct, because with a disconnected session, the user is still logged on to the system. ---------------------------- Installation instructions: ---------------------------- - Put the Powershell script in the C:Program FilesNSClient++Scripts directory. - In the nsclient.ini file, in the section [/settings/external scripts/scripts], add the following line: check_user=cmd /c echo scripts\check_user.ps1 computername domain user; exit $LastExitCode | powershell.exe -command - - Restart the NSClient - On the Nagios server, create a service with the following check command: check_command check_nrpe!check_user! - Restart Nagios
Reviews (1) Add a Review
Works fine, after some adjustments.
by Unigarant, March 31, 2017
It works fine, we just use the check_nrpe command with user_logon as a parameter.

Also we changed the variables to the following format:
$hostname=some.domain.com
$domain=domain.com
$user=domainuser

If we left the variables as they where ([string]$param,]) we would get a syntax error.

And last: . as a hostname does not work for us. Nor does localhost. FQDN works fine. Might have something to do with checking a domain user/machine.

We have a working check, so happy campers. Thanks!
Helpful? Yes  No 
Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4 (1)
Favorites
0
Views
26,839