[Nagios-users] How to determine the login duration of current user?

Kevin Davison kdavison at innosphere.ca
Fri Oct 15 15:19:49 UTC 2010


I've been playing around with going a little further. I may have to script something after all.

Currently I'm using nrpe with CheckWMI to query the LastLogon in Win32_NetworkLoginProfile. This is working pretty good in testing...almost. The query returns the username and the date/time. So I get something like "david LastLogon:20101015111042". I can get a result by putting an impossible number for MaxWarn and MaxCrit. The snag here is now comparing that date/time to the current date/time and determining the difference.


# ./check_nrpe -H 192.168.10.208 -p 5666 -c CheckWMIValue -a 'Query=SELECT Caption, LastLogon FROM Win32_NetworkLoginProfile WHERE Caption="admin"' MaxWarn=5 MaxCrit=5 Check:LastLogon=LastLogon AliasCol=Caption
Admin LastLogon: 20100907155325 > critical

-----Original Message-----
From: Greg Pangrazio [mailto:pangrazi at gmail.com] 
Sent: October-14-10 10:58 AM
To: Nagios Users List
Subject: Re: [Nagios-users] How to determine the login duration of current user?

Another option would be to check the number of logged in users via
check_nt or wmi.

Say you have the service check set to 5 min and the retry set to 5 min
(or what ever is convenient) you then divide the time "x" from above
by 5 and that is the number of retries before an alert.

As soon as someone logs in the service would go back to OK and the
"timeout" would restart.

not as elegant as the vmware solution but much cheaper.

Greg Pangrazio
pangrazi at gmail.com




On Thu, Oct 14, 2010 at 9:29 AM, Kevin Davison <kdavison at innosphere.ca> wrote:
> I like the sound of that. I agree with you on the passive vs active issue. I often find that setting something up active gets me where I need to go faster and then I never get back to finding a passive way to do it. We'll need to make the modification to each of the VM's (~200) but I think that will do what I want. I'll take a look at doing that. Thank you very much!
>
> -----Original Message-----
> From: Diego Roccia [mailto:diego.roccia at gmail.com]
> Sent: October-14-10 9:34 AM
> To: Nagios Users List
> Subject: Re: [Nagios-users] How to determine the login duration of current user?
>
>  There's another solution: you could setup a logon script that sends
> an nsca every time a user login to the server. Then, you can check the
> service  freshness against a 1 or 2 days threshold. It's a completely
> different approach, but I prefer to use passive checks when I need to
> trigger user created events, as I think it makes more sense (and less
> load and traffic) than checking continously the logs.
>
> Diego
>
>
> On Thu, Oct 14, 2010 at 3:22 PM, C. Bensend <benny at bennyvision.com> wrote:
>>
>>> VMware's version of this is VDI - it's pretty good, but it's not cheap -
>>> it needs a special kind of ESX license so you can't run those desktops
>>> on your existing servers, they need to be on dedicated ESX/VDI servers.
>>
>> This statement is not accurate, at least not in our locale.  While
>> VDI *does* require a separate license, it will run just fine on
>> existing ESX infrastructure and does not have to be on a separate,
>> "special" ESX host.  We have many virtual desktops and some of them
>> are intermingled with our virtual servers.
>>
>> Good idea/bad idea is still an exercise left up to the reader.  :)
>>
>> Benny
>>
>>
>> --
>> "Because you have arms like noodles, while I am vigorous and
>> burly."                               -- Hodgins, "Bones"
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Beautiful is writing same markup. Internet Explorer 9 supports
>> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
>> Spend less time writing and  rewriting code and more time creating great
>> experiences on the web. Be a part of the beta today.
>> http://p.sf.net/sfu/beautyoftheweb
>> _______________________________________________
>> Nagios-users mailing list
>> Nagios-users at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/nagios-users
>> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
>> ::: Messages without supporting info will risk being sent to /dev/null
>>
>
>
>
> --
> Diego Roccia
> diego.roccia (at) gmail (dot) com
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null




More information about the Nagios-users mailing list