Newest Downloads

Mar.08

  [zenoss@zenoss2 ~]$ python Zenoss_Template_Manager.py -husage: Examples: python Zenoss_Templa...

Feb.01

python queryns.py -husage: queryns.py [options] arg --username=username --password=password --net...

Programming HowTo's
HowTo backup all of your Zenoss Templates the easy way.
Programming HowTo's - Python HowTo's
Written by Allen Sanabria   
Friday, 12 February 2010 15:19

Recently I had to prepare for a Zenoss upgrade. During my prep work I had to create a zenpack of all of our Templates. For those of you who use Zenoss, you know how many templates you can start to accumulate in a short amount of time. You can have Templates attached to single Devices, to SubClasses, and to Classes. Now if you have a few devices this is not a big deal. But if you have a couple hundred to a couple of thousand devices, this could be a real hassle.

Now you can take a ton of your time and review Class by Class and Device by Device until you finally finish. You will eventually get it all in a Zenpack....... Well lucky for you guys I created a Python Script that runs as the Zenoss user and create a Zenpack for you. All you have to do is pick a name for the ZenPack and optionally the Device Class you want to scan. The script will scan the Device Class that you specified ( or by default scan the entire /Device Class and its Sub Classes). It will then create the ZenPack with all the locally attached Device Templates. I am thinking of also adding the Events class as part of the next release of this script.

Update 1.0.1, I added the --unique option. If you decide to use this option, This Zenpack will only add, The Device Templates that are not already part of an existing ZenPack. I also added the --verbose option, so that you can see which Device Templates are being added or being dismissed.

You can download the script here

 Download Create ZenPack
File Title:Create ZenPack (Details)
File Type:py
File Version:1.0.1
File Size:6.44 Kb
License:
File Author:Allen Sanabria
File HomePage:
Downloads:13
Rating: ( Votes)
Your Vote:



Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! Yahoo! Free Joomla PHP extensions, software, information and tutorials.
Last Updated on Monday, 01 March 2010 11:20
Read more...
 
HowTo monitor the Netscaler using Python and Soap instead of SNMP
Programming HowTo's - Python HowTo's
Written by Allen Sanabria   
Sunday, 07 February 2010 16:29

In this HowTo, I will show you how you can get statistics off of the Netscaler without using SNMP. You might be asking why would I want to do that?? Well like many other devices that support SNMP, the Netscaler makes use of dynamic OID creation. For those of you that do not understand what I mean. Dynamic OID creation, is the way that Networking devices give OID's to variables that are not static in the device itself.

Here are some common static variables/OID's, amongst most devices out there.

  • CPU Utilization
  • Disk Utilization
  • Memory Utilization
  • TCP Statistics

Here are some common, non-static variables/OID's..

  • A Load Balanced Virtual Server
  • Statistics about LUNS
  • Statistics about Services

Now you can get these statistics off of the SNMP based device. But if and when this device is rebooted, more then likely the OID has changed. Now you are stuck with the task, of finding the new OID. Since the Netscalers have a SOAP Based API, we can get those same statistics with out ever needing to know the OID.

Here I have attached a script that I wrote, using Python and Suds to connect to the Netscaler. This script works perfectly with Zenoss and its DataPoint structure.

 Download Get Netscaler Stats
File Title:Get Netscaler Stats (Details)
File Type:py
File Version:1.0.1
File Size:10.00 Kb
License:
File Author:Allen Sanabria
File HomePage:
Downloads:8
Rating: ( Votes)
Your Vote:



Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! Yahoo! Free Joomla PHP extensions, software, information and tutorials.
Last Updated on Thursday, 11 February 2010 10:46
Read more...
 
How to get information from the Netscaler using Python and Suds.
Programming HowTo's - Python HowTo's
Written by Allen Sanabria   
Monday, 01 February 2010 08:22

Recently I just started to use the Citrix Netscalers again ( Load Balancers ). Being the person that I am, I wanted a way to grab the information using the SOAP API.
Now Citrix has a ton of documentation for Perl/C/C# and Java ( None for Python ). SOAP client support has not been the best for Python, in my opinion.
I know you have soappy/ZSI, which I have had issues with consuming Broken WSDL files ( Having to fix the Broken WSDL file manually, SUCKS!).

Just 2 weeks ago, I encounterd SUDS. This module is by far, the best SOAP client for Python.
There documentation is simple and straight to the point, with a bunch of nice samples to get you on your way.

Install SUDS before proceeding further. You can get suds from here. https://fedorahosted.org/suds/
Connection to my netscaler was as simple as this...

Python 2.4.3 (#1, Sep  3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from suds.client import Client
>>> url = "http://nsip/api/NSConfig.wsdl"
>>> from suds.xsd.doctor import *
>>> imp = Import('http://schemas.xmlsoap.org/soap/encoding/')
>>> imp.filter.add("urn:NSConfig")
>>> d = ImportDoctor(imp)
>>> client = Client(url, doctor=d, location="http://nsip/soap/")
>>> client.service.login(username="login", password="pass")
(simpleResult){
rc = 0
message = "Done"
}
>>>


Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! Yahoo! Free Joomla PHP extensions, software, information and tutorials.
Last Updated on Monday, 01 February 2010 21:26
Read more...
 
Swatch Startup Script
Programming HowTo's - Shell HowTo's
Written by Allen Sanabria   
Thursday, 12 November 2009 16:46

I've been using Swatch for quite a while now and I never invested the time to  create a quick startup script. Today, I decided to create one and it works just fine under Centos and Ubuntu Server. You can download it here..

 Download Swatch Startup Script
File Title:Swatch Startup Script (Details)
File Type:sh
File Version:1.0
File Size:1.37 Kb
License:
File Author:Allen Sanabria
File HomePage:
Downloads:47
Rating: ( Votes)
Your Vote:



Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! Yahoo! Free Joomla PHP extensions, software, information and tutorials.
Last Updated on Thursday, 12 November 2009 16:51
Read more...
 
HowTo get CDP neighbor information through Python and SNMP
Programming HowTo's - Python HowTo's
Written by Allen Sanabria   
Thursday, 10 September 2009 18:57

This new script is for Network Engineers and System Engineers a like. Though I must admit it is more for the System Engineers who do not have access to the command line on the CDP enabled device. Have you ever wanted to know what CDP enabled devces ( and info related to those devices ) that were directly connected to your your Core Switch? But you just do not have the access to get that info. But you do have access to the monitoring system, which has SNMP access to the Core Switch.

Well this is where my script comes into play... Stay tuned for updates, as I'm planning on adding to this script. So you can run it with the detail option and a detail port option. Please post any support related question in the forums here..http://www.linuxdynasty.org/forums/Scripting/scripting/sh_cdp_neighbor_help

Revision 1.2 9/13/2009
  • Catch all CDP connected switches, even if there is more then 1 switch seen through 1 port.

Revision 1.1 9/11/2009

  • Added --type option ( --type=detail )
Revision 1.0 9/10/2009
  • This script is the equivalent of sho cdp nei on a cisco switch, but this is using snmp.
When you log into a switch and run a show cdp neighbor, your info might look a little like this..

show cdp neighbor
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone

Device ID Local Intrfce Holdtme Capability Platform Port ID
71_5th_SW1 Gig 10/15 145 S I WS-C2960G-Gig 0/48
D_M1001_V180_SW1 Gig 1/42 132 S I WS-C2960G-Gig 0/1
D_M1001_V181_SW1 Gig 1/46 136 S I WS-C2960G-Gig 0/1
D_M1001_V181_SW2 Gig 1/47 166 S I WS-C2960G-Gig 0/1
D_M1001_V180_SW3 Gig 1/43 147 S I WS-C2960G-Gig 0/1
D_M1001_V181_SW3 Gig 1/48 158 S I WS-C2960G-Gig 0/1
D_M1001_V180_SW2 Gig 1/41 141 S I WS-C2960G-Gig 0/1
D_M1001_V181_SW4 Gig 1/44 179 S I WS-C2960G-Gig 0/1
D_M1001_V180_SW4 Gig 1/40 145 S I WS-C3560G-Gig 0/1
D_M701_V177_SW4 Gig 10/7 174 S I WS-C2970G-Gig 0/25
D_M701_V177_SW1 Gig 10/6 154 S I WS-C2970G-Gig 0/25
Router Gig 10/1 162 R S WS-C6513 Gig 9/9
Router1 Gig 10/14 168 R S WS-C6513 Gig 9/16
79_18th_Fl_SW1 Gig 10/12 174 S I WS-C2960G-Gig 0/48
D_1700_V187_SW1 Gig 10/13 129 S I WS-C3560G-Gig 0/28
D_1700_V187_SW3 Gig 10/10 146 S I WS-C2960G-Gig 0/48
D_1700_V187_SW2 Gig 10/9 148 S I WS-C2960G-Gig 0/48
D_522_V176_SW1 Gig 10/3 121 S I WS-C2970G-Gig 0/25
D_522_V176_SW4 Gig 10/4 125 S I WS-C2970G-Gig 0/25
D_CL001_V200_SW1 Gig 10/11 125 S I WS-C2960G-Gig 0/24
2W_4507R Gig 7/2 147 R S I WS-C4507R Gig 3/9

Now this is how it will look if you run sh_cdp_neighbor.py script...



Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! Yahoo! Free Joomla PHP extensions, software, information and tutorials.
Last Updated on Saturday, 12 September 2009 23:14
Read more...
 
HowTo find the port on a switch that a host belongs to, the easy way, part 2
Programming HowTo's - Python HowTo's
Written by Allen Sanabria   
Sunday, 12 April 2009 17:07

 

In my previous HowTO, I created the get_port.py script. Now this script did the job, but had a few faults in it.

  • Major fault was the fact that the script could not match multiple MAC
    Addresses per port
  • Also if the port had multiple MAC Addresses it usually would fail while doing the search
  • Better error checking. For example if you searched by IP Address before, the error was ambiguous.
    Now the error will say the IP Address you are looking for is not in the ARP Table

This script has been heavily tested on Cisco Core Switches and on Cisco Catalyst Switches. So far no issues like in the previous one.
I will post some of my output below so you can get an idea on how the script works.

Also to see the script in action immediately, you should run the command like this..

python port_report.py -d 192.168.101.1 -c public -n "1/40"

The reason you should run the above first, is that if the ip address you are searching for is not in the ARP table you will not get any results. Also I have already seen instance where a someone runs the script and uses the search for mac function and it does not return a mac. One reason this happens, is because the mac you are searching for is not on the switch you are walking or not part of any vlan.So by passing a port, the script  will scan every vlan on the switch for MAC Addresses connected to that port.This script uses the dot1d tables to get the MAC info as per the CISCO website.

Update 1.1

  • Fixed Port Matching...
  • Now for the -n option you can pass the port number '1/1' or the Port Name as per ifName "Gi1/1"
    1. Pysnmp
    2. Pyasn1
    3. SNMP Access to the switch you want to talk too and its community string.

  • Three things you will need for this script to work..

    1. install python-setuptools
    2. then run easy_install pysnmp
    3. and easy_install pyasn1
  • To make your life easier you should do the following

    I am using the following revisions from the python cheese shop pysnmp 4.1.7a  and pyasn1 0.0.6a

    You can download the script here
    port_report.py

     Download LD Port Report
    File Title:LD Port Report (Details)
    File Type:py
    File Version:1.13
    File Size:43.83 Kb
    License:
    File Author:Allen Sanabria
    File HomePage:
    Downloads:338
    Rating: ( Votes)
    Your Vote:

    Please post anything related to this script on this forum link http://www.linuxdynasty.org/forums/Scripting/scripting/port_report
    Unless it is just a comment, thank you...

    Also if you download this script on other Platforms besides Cisco, please let me know if it works, so I can added under platforms supported.



    Add this page to your favorite Social Bookmarking websites
    Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! Yahoo! Free Joomla PHP extensions, software, information and tutorials.
Last Updated on Tuesday, 08 September 2009 11:12
Read more...
 
<< Start < Prev 1 2 3 4 Next > End >>

Page 1 of 4