TECHZEN Zenoss User Community ARCHIVE  

Using Transforms from ZenOss 3.2.1

Subject: Using Transforms from ZenOss 3.2.1
Author: [Not Specified]
Posted: 2014-10-28 04:09

Hi there,

Currently I'm using ZenOss 3.2.1 but I have a new ZenOss 4.2.5 version up and running including all my devices.
The problem is that I cannot use this version right now because I need to make use of transforms.

In ZenOss 3.2.1 this is working, but I don't know how to make this happen in ZenOss 4.2.5.

Below you can find a piece of my transform that will check if a router is online and if not only the router will send an alert (and not all devices connected to that router). This is also done for my switches.
I found this wiki (http://wiki.zenoss.org/Transforms_-_Suppress_hosts_behind_down_router) but I cannot found a way to use this in my transforms script.

This is a piece of my transforms:
##########################################################################################
# Location Maxima
##########################################################################################
if device and device.location().id == 'Maxima':
# Router
if device.id != "10.147.254.1":
loc_router = device.findDevice("10.147.254.1")
if loc_router.getPingStatus() > 0:
evt._action = 'history'
evt.severity = 0
# Switch(es)
elif device.id != "10.147.254.2" and device.id != "10.147.254.3" and device.id != "10.147.254.4":
loc_switch = device.findDevice("10.147.254.2")
if loc_switch.getPingStatus() > 0:
evt._action = 'history'
evt.severity = 0
loc_switch = device.findDevice("10.147.254.3")
if loc_switch.getPingStatus() > 0:
evt._action = 'history'
evt.severity = 0
loc_switch = device.findDevice("10.147.254.4")
if loc_switch.getPingStatus() > 0:
evt._action = 'history'
evt.severity = 0
##########################################################################################
# Location Meuleweie
##########################################################################################
if device and device.location().id == 'Meuleweie':
# Router
if device.id != "10.140.254.1":
loc_router = device.findDevice("10.140.254.1")
if loc_router.getPingStatus() > 0:
evt._action = 'history'
evt.severity = 0
# Switch(es)
elif device.id != "10.140.254.2" and device.id != "10.140.254.3":
loc_switch = device.findDevice("10.140.254.2")
if loc_switch.getPingStatus() > 0:
evt._action = 'history'
evt.severity = 0
loc_switch = device.findDevice("10.140.254.3")
if loc_switch.getPingStatus() > 0:
evt._action = 'history'
evt.severity = 0

Can anyone help me to change this into a working version for ZenOss 4.2.5
What do I need to change.

Thanks for you help,
Edwin.



Subject: I assume that you do have
Author: Jane Curry
Posted: 2014-10-28 06:11

I assume that you do have indentation in your transform code This is Python and it really cares about indentations to interpret your logic.

Although some things have changed a little in 4.x, this code looks like it should be OK.

have you found my document on Managing Events - http://www.skills-1st.co.uk/papers/jane/zenoss4-events/

Cheers,
Jane

Email: jane.curry@skills-1st.co.uk    Web: https://www.skills-1st.co.uk



Subject: Yes, my code make use of
Author: [Not Specified]
Posted: 2014-10-28 07:26

Yes, my code make use of indentations but in this forum is won't show up correctly.
I will take a look at your papers, thanks.



< Previous
Zenoss Repeat Notification defaults to 5 minutes
  Next
persist changes to container
>