Archived community.zenoss.org | full text search
Skip navigation
Currently Being Moderated

Copy a template/Lock Filesystems

VERSION 2  Click to view document history
Created on: Sep 14, 2009 11:21 AM by Noel Brockett - Last Modified:  Mar 22, 2010 1:44 PM by Matt Ray

Do you already know what the zendmd is? This is far the most advanced part of zenoss. Let me give you some tips to enhance zenoss.

Intro

Do you already know what the zendmd is? This is far the most advanced part of zenoss.

 

Here you can do nearly anything which is not possible using the web interface. Although it requires to create python scripts.


Let me explain my frequently used things

 

 

Copy a template to an other device ?

 

so okay, lets say you have a cluster and you want to copy a template for node1 to node2 because you both want to have it the same performance data.

 

This is a easy task for the zendmd.


Start-up a ssh session to you zenoss server and login as user zenoss.

 

This is very important !

 

Replace the bold parts in the code by your details.

 

# su zenoss
# zendmd
source_device = find("source.device.id")
dest_device = find("destination.device.id")

template = getattr(source_device.rrdTemplates, 'TemplateName')
dest_device._setObject(template.id, template._getCopy(dest_device))

commit()

 

 

Lock all filesystems of a class?

 

I needed to have a way to lock all filesystems which were in a certain class.
I created a class called /Devices/Server/Linux/Novell

 

This script will loop trough all the devices of the class and lock the filesystems.
Please replace the "Devices.Server.Linux.Novell" with the correct path.

 

for d in dmd.Devices.Server.Linux.Novell.getSubDevices():
        print "working on %s" % d.id
        for f in d.os.filesystems():
                print "locking %s" % f.id
                f.lockFromDeletion()
commit()

 

It's also possible to use f.lockFromUpdates() or just use both.

ff

 

More tips to come in near future

Comments (0)