Discussion:
Passing string data from custom script to ZenOss
Denny Verstrepen
2012-03-08 10:15:54 UTC
Permalink
Denny Verstrepen [http://community.zenoss.org/people/dennie1982] created the discussion

"Passing string data from custom script to ZenOss"

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

--------------------------------------------------------------
Hi all,

Maybe the answer is trivial, but I am struggling to find a solution to my problem. Let me explain:

I've written a python script that processes all certificates stored in a directory and will output the amount of days left until the certificate - which first will expire - actually will expire. ZenOss will run this script by the check_by_ssh plugin.

E.g.:

In directory 'certsdir' we have 3 certificates: a.cer (still valid for 365 days), b.cer (still valid for 5 days), c.cer (still valid for 60 days). The script will process this certificates and will output: "*b.cer is about to expire (5 day(s) left) | daysleft=5*".

We have implemented different tresholds to trigger alerts so we can take action to update the certificate. The problem is I can't get the name of the certificate in the alert, which for us would be very nice (so we don't need to run the script manually again to get the name).

I could change the script that it will output: "*b.cer is about to expire (5 day(s) left) | daysleft=5 certificate=b.cer*", but how can I pass this information into my event? Is this possible at all? Or will I need to change my approach and start sending SNMP traps?

Denny
--------------------------------------------------------------

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

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-03-08 13:06:09 UTC
Permalink
jmp242 [http://community.zenoss.org/people/jmp242] created the discussion

"Re: Passing string data from custom script to ZenOss"

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

--------------------------------------------------------------
It's tricky, but you may want to set the "threshold logic" for this in the script. If the script returns 1 or 2 so Zenoss knows it's an error, the info before the "|" will be put in the subject of the event.

--
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/65060#65060]

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]
Denny Verstrepen
2012-03-08 13:49:42 UTC
Permalink
Denny Verstrepen [http://community.zenoss.org/people/dennie1982] created the discussion

"Re: Passing string data from custom script to ZenOss"

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

--------------------------------------------------------------
Hi James,

Thanks for the reply. But I am afraid I don't quite follow:

I could adapt the script that it will output something like: "*b.cer | errortreshold=2*", but I don't see the difference with "*b.cer is about to expire (5 day(s) left) | daysleft=5*". Because whether you trigger on 'errortreshold' or 'daysleft', I can't find anything in de event details referencing the bit before the '|'.

Or am I missing something? What exactly do you mean with the subject of the event (can't see a reference to subject in the event details)

Denny
--------------------------------------------------------------

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

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]
joanypony
2012-03-09 00:28:54 UTC
Permalink
joanypony [http://community.zenoss.org/people/joanypony] created the discussion

"Re: Passing string data from custom script to ZenOss"

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

--------------------------------------------------------------
Hi Denny,
What version of Zenoss are you using? I had similar issues getting openmanage output from my nagios plugins when I was using 3.0.3 (which component had failed, etc..). I could only get the status, not the data and was starting to look into traps. I then had an opportunity to upgrade to 3.2.1  and it all just worked suddenly.

If upgrading isn't an option for you, event transforms were what was recommended to me to get helpful data displayed - this thread was recommended to me - http://community.zenoss.org/thread/17278 http://community.zenoss.org/thread/17278

Hope that's of some help..

Regards,
Joan
--------------------------------------------------------------

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

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]
Denny Verstrepen
2012-03-12 14:48:35 UTC
Permalink
Denny Verstrepen [http://community.zenoss.org/people/dennie1982] created the discussion

"Re: Passing string data from custom script to ZenOss"

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

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

Your advice leaded me in the right direction.
--------------------------------------------------------------

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

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...