The script below I created to sync up Zenoss with the Citrix Netscalers. What this will do essentially is make sure that all of our devices in Zenoss are in the correct Systems in Zenoss. So for instance lets say we have a cluster called Foo-Cluster and we have 100 devices that are in that cluster as per the netscaler. This script will move those 100 devices into that System aka {Cluster} in Zenoss.

The reason this is so important is that when you update the Citrix Netscaler you will also have to update Zenoss, but if you run this script in cron then you will not have to update Zenoss at all. This script was written in Python This script was tested with Zenoss 2.0.2, Also some modifications may have to be made to fit your environment.

Please post any questions to this script here http://linuxdynasty.org/phpBB3/viewtopic.php?f=5&t=3
You can download the script here  … zenoss_netscaler_snmp.py

 

Continue reading “Syncing up Zenoss with the Citrix Netscaler using Python” »

 

For those Zenoss users out there, this script will send a emailof devices that are in the discovered class.

So once you receive this email you will know that you need to move those devices into there appropriate classes.

#!/bin/env python#Copyright (C) 2008  Allen Sanabria

#This program is free software; you can redistribute it and/or modify#it under the terms of the GNU General Public License as published by#the Free Software Foundation; either version 2 of the License, or#(at your option) any later version.

#This program is distributed in the hope that it will be useful,#but WITHOUT ANY WARRANTY; without even the implied warranty of#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License along#with this program; if not, write to the Free Software Foundation, Inc.,#51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.###############################################################Created by Allen Sanabria aka LinuxDynasty aka PrNino69#This script is to check how many devices are in the#Discovered Class#Started Nov 28th#Completed, Nov 28th##############################################################

import os, sysfrom re import subfrom string import splitfrom string import joinfrom urllib import urlopenfrom smtplib import SMTPfrom time import sleep

user = "zenoss"passwd = 'zenoss'util = '@zenoss'base = "http://%s:%s%s:8080" % (user,passwd,util)discovered_url = urlopen(base+'/zport/dmd/Devices/Discovered/getSubDevices').read()discovered_sub = sub("<Device at /zport/dmd/Devices/Discovered/devices/|>|^[|]$|,", "", discovered_url)discovered_list = list(split(discovered_sub))

message = """nThe boxes below were discovered in the last run of zendisc.nThey are all located under /Devices/Discovered Class.n                     Please move Devices to appropriate Device class, if one does not exist please create one.n                     This script runs on the zenoss (cc17-22) server."""devices = sub(",|[|]", "n", str(discovered_list))BODY = join((message, devices),"n")print BODYFROM = "zenoss@linuxdynasty.org"TO = "sa@linuxdynasty.org"SUBJECT = "Devices That Were Discovered During The Network Scan!"body = join(("From: %s" % FROM, "To: %s" % TO, "Subject: %s" % SUBJECT, "", BODY), "n")server = SMTP('localhost')server.set_debuglevel(1)server.sendmail(FROM, [TO], body)sleep(10)server.quit()
© 2011 LinuxDynasty Suffusion theme by Sayontan Sinha

Warning: fopen(/home/dynasty/linuxdynasty.org/wp-content/plugins/wp-google-plus-one/lib/standard.txt) [function.fopen]: failed to open stream: No such file or directory in /home/dynasty/linuxdynasty.org/wp-content/plugins/wp-google-plus-one/plusone.php on line 104

Warning: fread(): supplied argument is not a valid stream resource in /home/dynasty/linuxdynasty.org/wp-content/plugins/wp-google-plus-one/plusone.php on line 105

Warning: fclose(): supplied argument is not a valid stream resource in /home/dynasty/linuxdynasty.org/wp-content/plugins/wp-google-plus-one/plusone.php on line 106
.