Difference between revisions of "List all the Devices running specific service"

From Zenoss Wiki
Jump to: navigation, search
(One intermediate revision by the same user not shown)
Line 1: Line 1:
We might come across a scenario where we wish to list all the devices which are running certain service. One can tackle such request with few lines of codes.
 
  
<syntaxhighlight lang=python>
+
We might come across a scenario where we wish to list all the devices which are running certain service. One can tackle such request with few lines of codes .
for d in dmd.Devices.getSubDevices():   
+
 
 +
 
 +
<pre>for d in dmd.Devices.getSubDevices():   
 
   for s in d.os.winservices():       
 
   for s in d.os.winservices():       
 
     if s.id=="XXXXX":   
 
     if s.id=="XXXXX":   
       d.id,s.getStatusString()
+
       d.id,s.getStatusString()</pre>
</syntaxhighlight>
+
 
+
Replace XXX with desired service name. Use above code with ZenDMD and get the desired list.
+
  
[[Category:Tips]]
+
Replace XXX with desired service name.Use above code with ZenDMD and get the desired list
[[Category:ZenDMD]]
+

Revision as of 17:42, 15 October 2013

We might come across a scenario where we wish to list all the devices which are running certain service. One can tackle such request with few lines of codes .


for d in dmd.Devices.getSubDevices():   
   for s in d.os.winservices():      
     if s.id=="XXXXX":   
       d.id,s.getStatusString()

Replace XXX with desired service name.Use above code with ZenDMD and get the desired list