Difference between revisions of "ZenDMD Tip Renaming Modifying Device Properties"

From Zenoss Wiki
Jump to: navigation, search
(Added more details)
(Category, formatting)
 
Line 6: Line 6:
 
On Zenoss Master Server , run following command as zenoss user .<br />
 
On Zenoss Master Server , run following command as zenoss user .<br />
  
:zenoss-master-server>zendmd
+
<console>
 +
$ ##i##zenoss-master-server > zendmd
 +
</console>
  
 
To find the device path , run following command
 
To find the device path , run following command
 
Parameter can be Ip address or Device titile in Zenoss.<br />
 
Parameter can be Ip address or Device titile in Zenoss.<br />
  
<pre>
+
<console>
 
+
 
>>>d = find=("Parameter")
 
>>>d = find=("Parameter")
 
>>>d
 
>>>d
 
+
</console>
</pre>
+
<br />
+
  
 
Output of above command would look like below :<br />
 
Output of above command would look like below :<br />
Line 24: Line 23:
  
 
To fetch the property of device :
 
To fetch the property of device :
<pre>
+
<console>
 
>>>d.id
 
>>>d.id
 
>>>d.title
 
>>>d.title
</pre>
+
</console>
  
 
Script to modify the properties would look like :<br />
 
Script to modify the properties would look like :<br />
  
<pre>
+
<syntaxhighlight lang=python>
 
for dev in dmd.Devices.XYYZ.XXX.getSubDevices():
 
for dev in dmd.Devices.XYYZ.XXX.getSubDevices():
 
     if dev.id =="current value or paramter used in previously"
 
     if dev.id =="current value or paramter used in previously"
 
  dev.renameDevice("Desired-name")
 
  dev.renameDevice("Desired-name")
</pre>
+
</syntaxhighlight>
 +
 
 
Harmless Error :
 
Harmless Error :
 
At times , we might see an error when tried above command . You can ignore and go ahead with verification of changes made.  
 
At times , we might see an error when tried above command . You can ignore and go ahead with verification of changes made.  
  
<pre>
 
 
  ERROR Zope.ZCatalog uncatalogObject unsuccessfully attempted to uncatalog an object with a uid of <Device at XXX.XXX.XXX.XX>.
 
  ERROR Zope.ZCatalog uncatalogObject unsuccessfully attempted to uncatalog an object with a uid of <Device at XXX.XXX.XXX.XX>.
</pre>
 
  
 
To know more function same as renameDevice() please have a look at Device.py file available under  
 
To know more function same as renameDevice() please have a look at Device.py file available under  
<pre>
+
 
$ZENHOME/Products/ZenModel  
+
$ZENHOME/Products/ZenModel  
</pre>
+
 
 +
[[Category:Tips]]
 +
[[Category:ZenDMD]]

Latest revision as of 14:21, 20 November 2013

We wish to modify certain properties of Devices configured in Zenoss. Easy and reliable way of doing would be to use zendmd console with a small script

Getting into zendmd console :

On Zenoss Master Server , run following command as zenoss user .

$ zenoss-master-server > zendmd

To find the device path , run following command Parameter can be Ip address or Device titile in Zenoss.

>>>d = find=("Parameter")
>>>d

Output of above command would look like below :

<Device at /zport/dmd/Devices/XYYZ/XXX/YYY/devices/device-id>

To fetch the property of device :

>>>d.id
>>>d.title

Script to modify the properties would look like :

for dev in dmd.Devices.XYYZ.XXX.getSubDevices():
    if dev.id =="current value or paramter used in previously"
	  dev.renameDevice("Desired-name")

Harmless Error : At times , we might see an error when tried above command . You can ignore and go ahead with verification of changes made.

ERROR Zope.ZCatalog uncatalogObject unsuccessfully attempted to uncatalog an object with a uid of <Device at XXX.XXX.XXX.XX>.

To know more function same as renameDevice() please have a look at Device.py file available under

$ZENHOME/Products/ZenModel