![]() |
![]() |
Subject: | transform on OS Process |
Author: | [Not Specified] |
Posted: | 2016-04-27 11:16 |
Ok I am trying to write a simple transform on os process and hitting a bit of a wall. What I want to do is include part of the process name from the OS process in the summary. Currently when the OS process dies or is restarted I get a message similar to:
Process set contains 0 running processes: CMIS GSAD |
I want to change the sumary to include some information about the exact process which has stoppped/restarted. So I wrote the following transform:
if device: evt.device = device.titleOrId()
match = re.search("/Processes/CMIS/osProcessClasses/CMIS GW", evt.eventKey)
if match:
evt.eventClassKey ='75313'
c = evt.Component.split(' ')
p = c[0]
s = p.split('-')
spid = s[1]
evt.summary = 'The CMIS gateway process for SPID: %s has stopped' % (spid)
This transform is failing because the component field I am trying to manipulate is not what I thought I was. If I look at the event I see the following information for the component:
cmipGw-LSMSSP01 js/systems/gw/config/gwSub.cfg -A 13 -T -l /opt/cjs/systems/gw/logs/cmipGw.13008.log |
However when I changed my transform to just dump the full component into the summary:
if device: evt.device = device.titleOrId()
match = re.search("/Processes/CMIS/osProcessClasses/CMIS GW", evt.eventKey)
if match:
evt.eventClassKey ='75313'
#c = evt.Component.split(' ')
#p = c[0]
#s = p.split('-')
#spid = s[1]
evt.summary = 'The CMIS gateway process for SPID: %s has stopped' % (evt.component)
I see the following in the event summary:
The CMIS gateway process for SPID: zport_dmd_Processes_CMIS_osProcessClasses_CMIS_20GW_122066310d4ab4097c69f79d54269b37 has stopped
So it seems the component that is displayed on the event console is not the evt.component field for the OS process. How can I find the correct varaible to perform the transform on
Thanks,
John
Subject: | ok I figured it out. The data |
Author: | [Not Specified] |
Posted: | 2016-05-06 08:22 |
ok I figured it out. The data I am looking for is not in the evt.component field but actually under the device.os.processes array. So my latest code is:
if device: evt.device = device.titleOrId()
match = re.search("/Processes/test/osProcessClasses/test", evt.eventKey)
if match:
evt.eventClassKey ='75313'
for f in device.os.processes():
if f.id != evt.component: continue
process_name = f.name()
proc_part = process_name.split(' ')
p = proc_part[0]
s = p.split('-')
spid = s[1]
evt.summary = 'The gateway process for client: %s has stopped,' % (spid)
my question at this point is there any documentation on this I found this by trudging through about 100 google searches, dmd, other transforms, hours of trial and error etc. This is not the best way to be developing code. It was a good learning experience but I would have been in deep doo doo if I needed to turn this simple transform around in quick order.
< |
Previous Zenoss 4.2.5 Event Class Links Not Working |
Next Sizing requirements for HA setup on Virtual SAN |
> |