Which user is login on which computer

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Which user is login on which computer

Postby alidar » Mon Jun 11, 2018 2:56 am

Hello

Can we see that which user is login on which computer by nagios core?


Regards
alidar
 
Posts: 26
Joined: Wed Apr 11, 2018 7:15 am

Re: Which user is login on which computer

Postby mcapra » Mon Jun 11, 2018 6:53 am

Sure, but the actual implementation would depend on the authentication method being used (sometimes) as well as the operating system itself (all the time).

Here's an older post I made where I do a Windows-based "logged in users" check via Powershell using and older NSClient++ version as the agent:
https://support.nagios.com/forum/viewtopic.php?f=6&t=39658#p191894

You could expand on that Powershell following the nagios plugin development guidelines if you wanted richer output.

There's a few different options available on the Nagios Exchange as well:
https://exchange.nagios.org/index.php?option=com_mtree&task=search&Itemid=74&searchword=logged%20on%20user
Former Nagios employee
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 3423
Joined: Thu May 05, 2016 3:54 pm

Re: Which user is login on which computer

Postby cdienger » Mon Jun 11, 2018 3:20 pm

Thanks for the assist, @mcapra!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
cdienger
Support Tech
 
Posts: 1902
Joined: Tue Feb 07, 2017 11:26 am

Re: Which user is login on which computer

Postby alidar » Tue Jun 12, 2018 1:41 am

In old post, I copied this script. Can you tell me where I will put this script.

The following powershell script (I named it check_users.ps1) worked against my Windows 7 machine:

Code: Select all
$computername = 'localhost'

$user = Get-WMIObject Win32_Process -filter 'name="explorer.exe"' -computername $ComputerName |
ForEach-Object { $owner = $_.GetOwner(); '{0}\{1}' -f $owner.Domain, $owner.User } |
Sort-Object | Get-Unique

if(!$user) {Write-Host ""}
else {Write-Host $user}


My NSClient++ (0.4.x) command configuration:

Code: Select all
[/settings/external scripts/scripts]
check_users = cmd /c echo scripts\check_users.ps1; exit($lastexitcode) | powershell.exe -command -


I am using NCPA client. How I can use on NCPA?
alidar
 
Posts: 26
Joined: Wed Apr 11, 2018 7:15 am

Re: Which user is login on which computer

Postby mcapra » Tue Jun 12, 2018 6:49 am

Here's the official documentation for using custom scripts/plugins with NCPA:
https://support.nagios.com/kb/article/nagios-xi-using-scripts-plugins-with-ncpa-722.html

It has a section which includes a sample Powershell script. Let us know if some part of that documentation is unclear or isn't working correctly.
Former Nagios employee
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 3423
Joined: Thu May 05, 2016 3:54 pm

Re: Which user is login on which computer

Postby tgriep » Tue Jun 12, 2018 3:42 pm

Thanks @mcapra for the help. @alidar let us know if you have any further questions.
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!
User avatar
tgriep
Madmin
 
Posts: 7058
Joined: Thu Oct 30, 2014 9:02 am


Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 14 guests