First:  any time you run a zenoss command you should be running as the zenoss 
user.  So, log on (or su) to the zenoss user and run the command "zendmd".  
Once you're in that command you'll get a prompt that looks like so:

Code:
Welcome to zenoss dmd command shell!
use zhelp() to list commands
>>>


>From there you'll type in the "for...." statement.  On the second line your 
>prompt will change to "...." and you will need to indent this statement.  Type 
>that one in and hit enter twice.  It should work...and once it does work, type 
>"commit()" to commit that to the database.  So you're entire session will look 
>like this:

Code:
[EMAIL PROTECTED] ~]$ zendmd
Welcome to zenoss dmd command shell!
use zhelp() to list commands
>>> for ip in dmd.Networks._getOb('192.168.2.0').ipaddresses():
...     dmd.DeviceLoader.loadDevice(ip.id, discoverProto=None)
...
(stuff gets done)
>>> commit()
>>> Ctrl-D



To add one or two devices at a time you can do it in the GUI clicking "Add 
Device", setting the Device Name, choosing "/Devices/Ping" as the device class, 
and choosing "none" as the discovery protocol.

Alternatively, I had to load a bunch of ping-only devices the other day and I 
didn't want to do it in the GUI, yet every time I tried `zenbatchload` it 
wanted to do an snmp discovery on them.  So, I hacked up a file. ;-)  If you 
want to use zenbatchload to load in ping-only devices, you can patch the file 
$ZENHOME/Products/ZenModel/BatchDeviceLoader.py with the following diff:


Code:
--- BatchDeviceLoader.py.orig   2008-02-05 15:40:30.000000000 -0500
+++ BatchDeviceLoader.py        2008-02-05 15:56:37.000000000 -0500
@@ -62,10 +62,15 @@
             rawDevices = "/Discovered\n" + rawDevices
         sections = [re.split(_sp, x) for x in re.split(_r, rawDevices)]
         finalList = []
+        proto = "snmp"
         for s in sections:
             path, devs = s[0], s[1:]
             if not path.startswith('/'): path = '/' + path
-            finalList += [{'deviceName':x,'devicePath':path} for x in devs]
+            if path.startswith("/Devices/Ping"):
+                proto = "none"
+            else:
+                proto = "snmp"
+            finalList += 
[{'deviceName':x,'devicePath':path,'discoverProto':proto} for x in devs]
         return finalList
 
 if __name__=='__main__':


(It's ugly, and definitely a hack, but it works.)

Now, just create a file that looks like this:

Code:
/Devices/Ping
device1
device2
deveice3
/Devices/Server/Windows
windows1
/Devices/Server/Linux
asdfasdf
asdfasdf


The devices that are under "/Devices/Ping" will have their discovery protocol 
set to "none" (You can always move them later if you want to), and the devices 
under the other classes will get loaded into those respective classes with snmp 
discovery turned on.

Oh, and I'm running 2.1.2.

--seth




-------------------- m2f --------------------

Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=16169#16169

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to