Discussion:
Monitoring Windows Server 2008 DHCP Scopes
Gustavo Lorenzi
2013-04-16 17:13:11 UTC
Permalink
Gustavo Lorenzi [http://community.zenoss.org/people/gustavoclorenzi] created the discussion

"Monitoring Windows Server 2008 DHCP Scopes"

To view the discussion, visit: http://community.zenoss.org/message/72864#72864

--------------------------------------------------------------
Hello Guys,
I'm trying to implement a function in my Zenoss 4.2.3 that monitor the dhcp leases based on events, but no success until now.

Zenoss shows messages like this in events:

Resource:          raovmserv05
Component:          Microsoft-Windows-DHCP-Server
Event Class:          /Win
Status:          New
Message:          Scope, 10.0.38.0, is 100 percent full with only 0 IP addresses remaining.

But generates a warning.

I want to turn that kind of event to critical, but dont know how to do it.

Maybe if he check an event like:

"is 100 percent full with only"
"is 99 percent full with only"
"is 98 percent full with only"
"is 97 percent full with only"
"is 96 percent full with only"
"is 95 percent full with only"

If i could create an critical event, transforming messages like thos will can work great, because I have several DHCP scopes.

How can I do ?

Thanks
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72864#72864]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
guyverix
2013-04-17 16:09:06 UTC
Permalink
guyverix [http://community.zenoss.org/people/guyverix] created the discussion

"Re: Monitoring Windows Server 2008 DHCP Scopes"

To view the discussion, visit: http://community.zenoss.org/message/72876#72876

--------------------------------------------------------------
This is untested, but the logic should be sound..


import.re
if evt.component == 'Microsoft-Windows-DHCP-Server':
  msg=evt.summary
  if re.match (".*percent full with only*.", msg):
    evt.severity=5
  else
    evt.severity=3
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72876#72876]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Gustavo Lorenzi
2013-04-17 18:35:19 UTC
Permalink
Gustavo Lorenzi [http://community.zenoss.org/people/gustavoclorenzi] created the discussion

"Re: Monitoring Windows Server 2008 DHCP Scopes"

To view the discussion, visit: http://community.zenoss.org/message/72896#72896

--------------------------------------------------------------
In which field should I fill out this information?
I'm new at this type of event processing.

In Event Classes i've created an *Event ClassMapping:*

Loading Image... http://img834.imageshack.us/img834/3070/eventce.png
Thanks for now =)
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72896#72896]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jcurry
2013-04-18 11:21:27 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: Monitoring Windows Server 2008 DHCP Scopes"

To view the discussion, visit: http://community.zenoss.org/message/72890#72890

--------------------------------------------------------------
Hi Gustavo,
Can we just back up a touch.  You have created a mapping at the /Events level - the top of the Event Class tree.  I would be far more tempted to create your new class further down the tree.  Your original event appears to be of class /Win so I would suggest you create either a mapping at the /Win level or I personally would create a new event subclass there.  So, go to the Event Classes panel, navigate down /Win and then use the dropdown beside "SubClasses" to "Add New Organizer".  You can call it whatever you like - Microsoft-Windows-DHCP-Server would be a good candidate.  That gets you a new class.  Reason for creating a whole new class is that it makes it easier to then create alerts (emails, pages,..) that select on that particular problem.  This new class isn't essential but i would suggest it may serve you well in the future.

Now you want to move the mapping that you have created from /Event to /Win/Microsoft-Windows-DHCP-Server.  Simply navigate to your mapping, click the selection box alongside and use the dropdown menu to Move Mappings.
Check that your specific events now map to this new class.

Your screenshot shows the transform in red.  This means that there is a problem with it - probably some sort of syntax error.

Do you have a colon at the end of each if statement (I can see you have on the first but can't see the second)?
Python is very picky on its indentation.  It doesn't matter how many spaces you have at each level of the structure but it must be the same number of spaces.

Cheers,
Jane
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72890#72890]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Gustavo Lorenzi
2013-04-18 20:11:28 UTC
Permalink
Gustavo Lorenzi [http://community.zenoss.org/people/gustavoclorenzi] created the discussion

"Re: Monitoring Windows Server 2008 DHCP Scopes"

To view the discussion, visit: http://community.zenoss.org/message/72902#72902

--------------------------------------------------------------
Ok,

Got how to do it, but I've tried to correct the script and got no success on it :(
Im not the best person on scripting...

Anybody know where is the error on it ?

Thanks
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72902#72902]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jcurry
2013-04-18 21:58:52 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: Monitoring Windows Server 2008 DHCP Scopes"

To view the discussion, visit: http://community.zenoss.org/message/72892#72892

--------------------------------------------------------------
Please can you post exactly what you have in your transform?  Unfortunately, the earlier screenshot doesn't show all of it.

Cheers,
Jane
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72892#72892]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Gustavo Lorenzi
2013-04-22 11:54:40 UTC
Permalink
Gustavo Lorenzi [http://community.zenoss.org/people/gustavoclorenzi] created the discussion

"Re: Monitoring Windows Server 2008 DHCP Scopes"

To view the discussion, visit: http://community.zenoss.org/message/72920#72920

--------------------------------------------------------------
Hello,

Exactly as guyverix posted:

import.re
if evt.component == 'Microsoft-Windows-DHCP-Server':
  msg=evt.summary
  if re.match (".*percent full with only*.", msg):
    evt.severity=5
  else:
    evt.severity=3

Thank you
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72920#72920]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jcurry
2013-04-22 14:08:29 UTC
Permalink
jcurry [http://community.zenoss.org/people/jcurry] created the discussion

"Re: Monitoring Windows Server 2008 DHCP Scopes"

To view the discussion, visit: http://community.zenoss.org/message/72925#72925

--------------------------------------------------------------
Sorry - can see the problem.  For some reason there is a spurious dot between import and re in the first line - it should just be a space ie.

import re

Then it works for me.
Cheers,
Jane
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/72925#72925]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Gustavo Lorenzi
2013-04-29 20:10:09 UTC
Permalink
Gustavo Lorenzi [http://community.zenoss.org/people/gustavoclorenzi] created the discussion

"Re: Monitoring Windows Server 2008 DHCP Scopes"

To view the discussion, visit: http://community.zenoss.org/message/73018#73018

--------------------------------------------------------------
Thank you,

It worked, the correct code is:

import re
if evt.component == 'Microsoft-Windows-DHCP-Server':
  msg=evt.summary
  if re.match (".*percent full with only*.", msg):
    evt.severity=5
  else:
    evt.severity=3
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/73018#73018]

Start a new discussion in zenoss-users at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...