![]() |
![]() |
Subject: | Zenoss 5.1.1 - Trigger through Command action |
Author: | [Not Specified] |
Posted: | 2016-03-28 02:16 |
We are working on moving Zenoss 4.2.5 to Zenoss 5.1.1, we are using python scripts to trigger notification to external sources. In content section of notification we have configured to call the script with event parameters passed as variables as below:
Command is /opt/zenoss/libexec/
Clear Command is /opt/zenoss/libexec/
Environment Variables - ZENHOME=/opt/zenoss
I want to replicate this same in 5.1.1 I understand in UI I can see put the same, but in which directory I should place my script in 5.1.1 and what would be Environment Variables as there is no /opt/zenoss/libeexec directory in 5.1.1
Thank you,
Subject: | You'll want to roll this |
Author: | Andrew Kirch |
Posted: | 2016-04-12 09:53 |
You'll want to roll this script into a ZenPack. Ifyou look at at one of the notification ZenPacks in our ZenPack Catalog, I think you'll find some examples to help.
Andrew Kirch
akirch@gvit.com
Need Zenoss support, consulting or custom development Look no further. Email or PM me!
Ready for Distributed Topology (collectors) for Zenoss 5 Coming May 1st from GoVanguard
Subject: | It is definitely easier to |
Author: | Jim R |
Posted: | 2016-04-15 09:30 |
It is definitely easier to add things like this to a ZP in the contect of Zenoss 5.
The HipChat ZenPack is a pretty generic model for doing it, there is not a whole lot of complexity to it.http://wiki.zenoss.org/ZenPack:HipChat_Notifications
You could still use scripts in libexec, you'll just need to have your zenpack make the directory and copy/link the scripts at install time. If you look in the __init__.py in a newly created ZP you will see where you can add code to do that.
Subject: | Gowrish.ec, |
Author: | [Not Specified] |
Posted: | 2016-04-21 02:06 |
Gowrish.ec,
Great question man. You'll need to connect to an instance, drop your scripts there, exit the connection and commit the instance. It's much easier than it sounds.
Here's an example:
[root@Zenoss01 ~]# serviced service shell -s InstallingMyBossScript -i zope bash
I0421 03:03:00.014269 12546 server.go:341] Connected to the control center at port 10.10.10.115:4979
I0421 03:03:00.402030 12546 server.go:442] Acquiring image from the dfs...
I0421 03:03:00.403465 12546 server.go:444] Acquired! Starting shell
Trying to connect to logstash server... 127.0.0.1:5042
Connected to logstash server.
[root@f33e29812d1b /]# su zenoss
[zenoss@f33e29812d1b /]$ cd /opt/zenoss/libexec/
[zenoss@f33e29812d1b libexec]$ touch myBossScript.py
[zenoss@f33e29812d1b libexec]$ chmod a+x myBossScript.py
[zenoss@f33e29812d1b libexec]$ exit
exit
[root@f33e29812d1b /]# exit
exit
[root@Zenoss01 ~]# serviced snapshot commit InstallingMyBossScript
ce3whm88z9hlbxm1vuv51x8rk_20160421-070444
Let me know if you have any questions!
ZenMaster Shane William Scott (Hackman238)
CTO
GoVanguard Inc.
sscott@gvit.com
Need Zenoss support, consulting or custom development Look no further. Email or PM me!
Ready for Distributed Topology (collectors) for Zenoss 5 Coming May 1st from GoVanguard
Subject: | Hi Shane, |
Author: | [Not Specified] |
Posted: | 2016-04-22 06:05 |
Hi Shane,
Thank you for your help, Yes i followed above steps and i was able to put script. Now i need to modify my script. So i tried to connect to that container through service atatch
Could you please help on this please.
Thank you,
Gowrish
Subject: | Hi Shane, |
Author: | [Not Specified] |
Posted: | 2016-04-25 07:07 |
Hi Shane,
As per above, I could place my scipt to trigget notifications through command line. When I called the script manually from the container it works perfectly file.However through notifcations its failing with below error:
2016-04-25 11:58:30,377 ERROR zen.zenactiond: invalid literal for int() with base 10: ''
Traceback (most recent call last):
File "/opt/zenoss/Products/ZenEvents/zenactiond.py", line 120, in processSignal
action.execute(notification, signal)
File "/opt/zenoss/Products/ZenModel/actions.py", line 675, in execute
self._execute(notification, signal)
File "/opt/zenoss/Products/ZenModel/actions.py", line 729, in _execute
timeout=int(notification.content['action_timeout']),
ValueError: invalid literal for int() with base 10: ''
2016-04-25 11:58:30,377 ERROR zen.zenactiond: Error executing action snaplogic
2016-04-25 11:58:30,383 INFO zen.zenactiond: Event:'e3598ca4-fa82-11e5-873d-0242ac11000b|10.00.00.00||/Status/Ping|5|10.00.00.00 is DOWN!' Trigger:snaplogic Action:command Status:FAIL Target: Info:
/opt/zenoss/libexec/scriptname.py 'New' '5' '10.00.00.00' '/Status/Ping' '10.00.00.00 is DOWN!' '0242ac11-001e-a74f-11e6-0ad00b67b5b8' '' >
Started Excecuting
printing events
New 5 10.00.00.00 /Status/Ping 10.00.00.00 is DOWN! 0242ac11-001e-a74f-11e6-0ad00b67b5b8 None
*******************
[{"Description": null, "Summary": "10.00.00.00 is DOWN!", "AlertType": "New", "ElementManagerEventID": "/Status/Ping", "ElementManagerAlertID": "", "LinkSuffix": "", "ElementManagerUniqueCIID": "10.00.00.00", "TicketIdentifier": "", "ElementManagerID": "0242ac11-001e-a74f-11e6-0ad00b67b5b8", "AlertCriticality": "5"}]
*******************
200:OK
Subject: | Idea for this |
Author: | Larry Virden |
Posted: | 2016-05-06 09:39 |
So I am a newbie with regards to Zenoss and python, but when i web searchedthis error:
invalid literal for int() with base 10: ''
it appeared to mean something like there was an attempt to use an empty string as a number or as an argument to the int() function.
< |
Previous zenoss AWS amazon ec2 |
Next Trying to resolve an issue we see in Control Center |
> |