Discussion:
Alert Message manipulation
Awesomeface
2012-10-08 18:18:38 UTC
Permalink
Awesomeface [http://community.zenoss.org/people/Awesomeface] created the discussion

"Alert Message manipulation"

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

--------------------------------------------------------------
Hi, I had a question or two about the alert messages within zenoss.

The messages for one of our alerts, is somewhat cryptic.  I know what it means because I set it up, but this goes to our level 1 staff onsite who generally see an odd looking, somewhat cryptic automated message and delete it.

So, knowing zenoss runs in python, and the alert messages run in python string expressions, I was wondering if there was either another dictionary key within the messages to pull the OID value that tripped the alert to begin with.  Or if not, is it possible put a small bit python code within the message body to pull a value out of the {message: "some message"}.

Essentially, what I'm trying to do is turn

'Threshold of diskpace free low or not met: current value 5'

into

'The disk on server x is filling up!  Currnetly at 5% free!!! fire and panic!!!'




Version is 3.2
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
jmp242
2012-10-08 18:27:07 UTC
Permalink
jmp242 [http://community.zenoss.org/people/jmp242] created the discussion

"Re: Alert Message manipulation"

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

--------------------------------------------------------------
You could transform the actual event, which will edit it in both the WebUI and in the alert. OR you can take a look at the alerting rule setup to edit just the alerting rule (but this is more limited)...

--
James Pulver
ZCA Member
LEPP Computer Group
Cornell University
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Awesomeface
2012-10-09 17:20:24 UTC
Permalink
Awesomeface [http://community.zenoss.org/people/Awesomeface] created the discussion

"Re: Alert Message manipulation"

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

--------------------------------------------------------------
Thanks guys, once I found some documentation on the transform, it turned out to be exactly what we were looking for.
--------------------------------------------------------------

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

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
alex0cy
2012-10-09 09:40:07 UTC
Permalink
alex0cy [http://community.zenoss.org/people/alex0cy] created the discussion

"Re: Alert Message manipulation"

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

--------------------------------------------------------------
You can use the following event transform under /Perf/Filesystem
        if f.name() != evt.component and f.id != evt.component: continue
        # Extract the used blocks from the event's message
        import re
        m = re.search("threshold of [^:]+: current value ([\d\.]+)", evt.message)
        if not m: continue
        # Get the total blocks from the model. Adjust by specified offset.
        totalBlocks = f.totalBlocks * getattr(device, "zFileSystemSizeOffset", 1.0)
        totalBytes = totalBlocks * f.blockSize
        usedBytes = None
        currentValue = float(m.groups()[0])
            usedBytes = currentValue * f.blockSize
            usedBytes = totalBytes - (currentValue * 1048576)
            continue
        # Calculate the used percent and amount free.
        usedBlocks = float(m.groups()[0])
        p = (usedBytes / totalBytes) * 100 + 5
        from Products.ZenUtils.Utils import convToUnits
        free = convToUnits(totalBytes - usedBytes - totalBytes * .05)
        # Make a nicer summary
        evt.summary = "%s : %3.1f%% used (%s free)" % (evt.component, p, free)
        evt.message = evt.summary
        break
--------------------------------------------------------------

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

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