XI for Windows 2008 R2: how to check specific account logon

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

XI for Windows 2008 R2: how to check specific account logon

Post by dlukinski »

Hello XI support

Please advice how to check if specific account is logged on to the server (and remain logged on)
- so that we monitor and alert if account logged off (some application account)
- Windows 2008 R2

/Dimitri
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: XI for Windows 2008 R2: how to check specific account lo

Post by lmiltchev »

Are you talking about monitoring a service or a process? Can you give us a specific example?
Be sure to check out our Knowledgebase for helpful articles and solutions!
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: XI for Windows 2008 R2: how to check specific account lo

Post by dlukinski »

lmiltchev wrote:Are you talking about monitoring a service or a process? Can you give us a specific example?
Monitor account (user) XYZ logged to the server, alert when logs off (some applications require this kind to "running" RDP session by certain account
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: XI for Windows 2008 R2: how to check specific account lo

Post by rkennedy »

I found this script, would it work for you? https://exchange.nagios.org/directory/P ... er/details
Former Nagios Employee
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: XI for Windows 2008 R2: how to check specific account lo

Post by dlukinski »

rkennedy wrote:I found this script, would it work for you? https://exchange.nagios.org/directory/P ... er/details

Partially. Followed instructions

ini looks this way:
[/settings/external scripts/scripts]
check_user=cmd /c echo scripts\\check_user.ps1 ZZTP-APL01 RES svc_ZZZsrv1; exit $LastExitCode | powershell.exe -command-


XI end shows this:
OK Missing expression after unary operator '-'.
At line:1 char:2

+ - <<<< command-

+ CategoryInfo : ParserError: (-:String) [], ParentContainsErrorR

ecordException

+ FullyQualifiedErrorId : MissingExpressionAfterOperator
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: XI for Windows 2008 R2: how to check specific account lo

Post by rkennedy »

Can you try changing it to be (space after command but before the -) -

Code: Select all

check_user=cmd /c echo scripts\\check_user.ps1 ZZTP-APL01 RES svc_ZZZsrv1; exit $LastExitCode | powershell.exe -command -
Let us know if that helps.
Former Nagios Employee
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: XI for Windows 2008 R2: how to check specific account lo

Post by dlukinski »

rkennedy wrote:Can you try changing it to be (space after command but before the -) -

Code: Select all

check_user=cmd /c echo scripts\\check_user.ps1 ZZTP-APL01 RES svc_ZZZsrv1; exit $LastExitCode | powershell.exe -command -
Let us know if that helps.
This is what I get when trying to "test" from XI GUI:

COMMAND: /usr/local/nagios/libexec/check_nrpe -H 10.72.129.49 -t 30 -c check_user
OUTPUT: File C:\Program Files\NSClient++\scripts\check_user.ps1 cannot be loaded becaus
e the execution of scripts is disabled on this system. Please see "get-help abo
ut_signing" for more details.
At line:1 char:24
+ scripts\\check_user.ps1 <<<< DEHP-APL01 RES svc_stahlsrv1; exit $LastExitCod

INI file attached.
e
+ CategoryInfo : NotSpecified: (:) [], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: XI for Windows 2008 R2: how to check specific account lo

Post by lmiltchev »

OUTPUT: File C:\Program Files\NSClient++\scripts\check_user.ps1 cannot be loaded becaus
e the execution of scripts is disabled on this system. Please see "get-help abo
ut_signing" for more details.
Are you allowed to run PS scrips on this system? Can you open a powershell terminal, type the following command, and show the output?

Code: Select all

Get-ExecutionPolicy
Be sure to check out our Knowledgebase for helpful articles and solutions!
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: XI for Windows 2008 R2: how to check specific account lo

Post by dlukinski »

lmiltchev wrote:
OUTPUT: File C:\Program Files\NSClient++\scripts\check_user.ps1 cannot be loaded becaus
e the execution of scripts is disabled on this system. Please see "get-help abo
ut_signing" for more details.
Are you allowed to run PS scrips on this system? Can you open a powershell terminal, type the following command, and show the output?

Code: Select all

Get-ExecutionPolicy
You right: restricted
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: XI for Windows 2008 R2: how to check specific account lo

Post by hsmith »

Is that something you're going to be able to fix?
Former Nagios Employee.
me.
Locked