Hey guys, here is another Python script by me :-) . The reason for this script, is to give you the capabilities to monitor and graph Bind 9 stats. This script will be executed through SNMP.. We will be using the UCD-MIB 1.3.6.1.4.1.2021.8.1

The stats are from named.stats... Here is an example of named.stats..
cat /var/cache/bind/named.stats
+++ Statistics Dump +++ (1325089261)
++ Incoming Requests ++
            83318718 QUERY
++ Incoming Queries ++
            54293282 A
                1929 NS
                3186 CNAME
                  27 SOA
            13645272 PTR
                7921 MX
                 781 TXT
            15224426 AAAA
                 200 SRV
                   1 NAPTR
                1271 A6
                  95 DS
                   2 NSEC
                  66 SPF
              140257 ANY
                   2 Others

You can download the script here .. Download

Continue reading “How To Monitor and get Bind 9 stats using Zenoss” »

 

We needed a way to monitor a few different type of HTTP Status Codes, specifically… ( 400, 404, 500, 503, 504, 200 ). This list is modifiable within the script. Though I’m thinking of turning this list into an option, since everyone might not one to gather the count just for those mentioned above.

So In order to get this data, you will need to use SNMP and install logtail. To make this script work you will need to have an snmpd exec statement in the snmpd.conf file and a crontab entry for the script to run as often as you like.

This script has been tested, using Nginx and Ruby On Rails.
You can download the script here.. Download

  • On cron, remember this is modifiable ‘* * * * * /usr/local/bin/get_http_codes.py -d “/var/log/nginx” -f “www-access.log” >/tmp/errorcount.txt’
  • In snmpd.conf without quotes ‘exec GetHttpStats /bin/cat /tmp/errorcount.txt

In Zenoss you will have to use the check_snmp nagios command or the inherent snmp check from zenoss. The oid you need to use is the UCDavis OID. For instance I’m using 2 exec statements in snmpd.conf, so the OID I am using for this check is this one ‘.1.3.6.1.4.1.2021.8.1.101.2‘ The command I’m using in zenoss is like this ‘check_snmp -H ${dev/manageIp} -C readonly -P 2c -o .1.3.6.1.4.1.2021.8.1.101.2

The current options for get_http_codes.py is ‘-d‘ which is the directory where the log file is located and ‘-f ‘ the name of the logfile. This script uses logtail so that I can always get the difference from the last time I scanned the log file.

The purpose of this script is so that you can graph or create a threshold of how many of the below Http Error Codes you are getting between every check. For instance we run this check every 30 seconds in Cron and in Zenoss and we divide the results by 30 so we can get how many of the error codes are happening per second.
Example of the output of the script is ‘SNMP OK – “Nginx Codes OK|count200=181 count400=1 count404=0 count500=0 count503=0 count504=0″ |

If you have any feature request or have any questions, please leave a comment. Thank you

 

Recently I had to aggregate the amount of 200, 400, 404, 500, 503,  and 504 HTTP 1.1 Codes from all of our Nginx and Ruby On Rails systems. So I decided to write a quick plugin for Zenoss that all you need to do is pass the devices or Device Class you want to aggregate the data from and the DataPoint name.

Also this makes it simple to use the Zenoss Thresholds and create Aggregate Reports based on the datapoints you use with out having to do some fancy python coding… :) Enjoy

 

Example..

python AllenZenossAggregate.py -h
Usage: AllenZenossAggregate.py -d "nginx-1" -d "nginx-2" -p "nginx_codes_count200"
OK Aggregate for devices  nginx-1 nginx-2 is 34|aggregate=34
     AllenZenossAggregate.py -o "/Server/Linux/Nginx" -p "nginx_codes_count200"
OK Aggregate for /Server/Linux/Nginx class is 22|aggregate=22
 Options:
  -h, --help            show this help message and exit
  -d DEVICE, --device=DEVICE
                        The device you want to grab the datapoints from.
  -o ORGANIZER, --organizer=ORGANIZER
                        The Class you want to get your list of devices from.
  -p DPOINTS, --dpoints=DPOINTS
                        Name of DataPoint nginx_codes_count200

Download

 

 

I’ve come to realize, that CIM is the new SNMP, but on steroids. Most new SAN, NAS, Network, and Operating Systems now support CIM/WBEM. To me it is easier to gather statistics and information through CIM, then it is through SNMP. In this article I am going to give you a script that will allow you to query the 3par for Disk IO stats. You will be able to grab Disk IO stats on a per Volume, per Port, or per Disk basis.You will also be able to search for a Volume, Port, or Disk, instead of just dumping all the Volumes, Ports, or Disk.

Before you download this script, you will need to download pywbem from sourceforge and install it. .

get3ParIOstats.py == Download

All the data that you get from the script, must be saved as a COUNTER and not a GAUGE.

Here is an example of searching for statistics by DISK for DISK 2:6:1..

python get3parIOstats.py -u "http://3par" -a 'login passwd' -s '2:6:1' --diskOK|2:6:1_ReadIOs=67236384 2:6:1_WriteIOs=28457131 2:6:1_TotalIOs=95693515

Continue reading “HowTo get 3par disk IO stats into Zenoss” »

 

Good Afternoon my fellow Zenoss users. here I bring you another Python tool to use with Zenoss. This tool will allow you to list all of your alerting rules, either by Group, User, or Query. If you are like me and have over 100 Alerting Rules. Managing these rules are more then a pain in the butt. Especially when you create a new rule and you know you created it correctly, but it just does not work… Well you might have another conflicting rule. Well what do you do in this situation?? You can go through each rule manually and sooner or later you will find it.

Or you can use my tool to find it for you. You might ask… How will yout tool find the conflicting rule for me??? Well to be honest it will not find the rule for you. What it can do is search all the rules for a certain query. Which can return one or more alerting rules if they are similiar in nature. or you can have the tool, list all of your Alerting rules. Or you can have the script list all of your alerting rules by group or user. The toll will report back to you The Group/User, The Alerting Rules attached to that Group/user, and the Schedules Attached to that Alerting Rules.

Where this tool really helped me, was when the DST changed happened. None of my schedules were working anymore, so the work around is to move all the schedules ahead of time. Using this script I found all my schedules very quickly, with out haveing to go through each of my alerting rules one by one.

Download

Continue reading “How to find Alerting Rules using the Zenoss API” »

 

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

Continue reading “HowTo backup all of your Zenoss Templates the easy way.” »

 

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

Continue reading “HowTo monitor the Netscaler using Python and Soap instead of SNMP” »

 

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 linux2Type "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" }
>>>

Continue reading “How to get information from the Netscaler using Python and Suds.” »

 

We are please to announce the release of Network Device Manager 0.22. Release notes below..

Revision 0.22 10/02/2009

  • Threading has been implemented into the script. Drastic Speed increase!!
    It use to take about 18 minutes to run this script against 285 devices. It now just takes me 23 seconds.
  • Better error checking!

{quickdown:49}

To see how to use the tool above, please check this link http://www.linuxdynasty.org/howto-manage-your-networked-devices-using-python-and-pexpect.html

 

Here is another quick update for today. This time it is for ldNetDeviceManager.py.
Revision .21 10/01/2009

  • Can now save output to a file. using the –save option

{quickdown:49}

Continue reading “LD Network Device Manager update .21” »

© 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
.