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

Use a zendmd script as standalone program

VERSION 1 
Created on: Sep 14, 2009 11:55 AM by Noel Brockett - Last Modified:  Sep 14, 2009 11:55 AM by Noel Brockett

Wouldn't it be cool to run a python script directly without using the zendmd program?

 

This is quite easy to do.
The zendmd creates a python env special for zenoss.

 

When you have a zendmd script which you have created or downloaded somewhere you would add something to run it without zendmd.

just use this code:

 

#!/usr/bin/env python
import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
from transaction import commit

dmd = ZenScriptBase(connect=True).dmd

#add your script here

#EOF

 

Save the file somewhere on the zenoss server and make it executable.

 

# chmod +x your-python-script.py

 

Now you are able to just run your script.

 

./your-python-script.py
Comments (3)