How To monitor RTSP streaming videos using openRTSP and Zenoss

 Python, Zenoss  No Responses »
Dec 302011
 

Since I do currently work for a streaming company, that would imply that we should have some type of monitoring for our RTSP streams spacer . You will 1st need to get the openRTSP command.

  • You will need to download the openRTSP command from www.live555.com/openRTSP/
  • Or if you are running Zenoss on top of Debian you can just run a apt-get install livemedia-utils

Once you do that, all you have to do next is to download my script and have a valid server to point at and a path to test… Example below.. Download

./check_rtsp.py -d remote_server -p /iphone/2012
OK /iphone/2012, test completed successfull against remote_server |status=0

or with stats…

./check_rtsp.py -d remote_server -p /iphone/2012 -s
OK /iphone/2012, test completed successfull against remote_server |status=0 num_packets_received=16 num_packets_lost=0 elapsed_measurement_time=3.000073 kBytes_received_total=16.309000
measurement_sampling_interval_ms=1000 kbits_per_second_min=29.245485 kbits_per_second_ave=43.489608
kbits_per_second_max=51.737449 packet_loss_percentage_min=0.000000 packet_loss_percentage_ave=0.000000
packet_loss_percentage_max=0.000000 inter_packet_gap_ms_min=0.018000 inter_packet_gap_ms_ave=161.139313
inter_packet_gap_ms_max=901.439000 subsession=video/H264 num_packets_received=61 num_packets_lost=0
elapsed_measurement_time=3.000073 kBytes_received_total=27.630000 measurement_sampling_interval_ms=1000
kbits_per_second_min=0.000000 kbits_per_second_ave=73.678207 kbits_per_second_max=122.923442
packet_loss_percentage_min=0.000000 packet_loss_percentage_ave=0.000000 packet_loss_percentage_max=0.000000
inter_packet_gap_ms_min=0.009000 inter_packet_gap_ms_ave=24.794672 inter_packet_gap_ms_max=528.923000

So you can trend the different stats that openRTSP provides in Zenoss..

 Posted by dynasty at 10:26 pm  Tagged with: openRTSP, Zenoss

How To Monitor and get Bind 9 stats using Zenoss

 Python, SNMP, Zenoss  No Responses »
Dec 282011
 

Hey guys, here is another Python script by me spacer . 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” »

 Posted by dynasty at 9:27 pm  Tagged with: Bind9, Python, Zenoss

How To monitor NodeJS using the Stats plugin that comes with Cluster using Zenoss.

 HowTo, NodeJS, Python, Zenoss  No Responses »
Dec 282011
 

We needed a way to monitor all of our NodeJS instances in Zenoss and not just a simple TCP connection. Since we were already using the Cluster plugin for NodeJS ‘learnboost.github.com/cluster/’ and we are using the stats plugin for Cluster ‘learnboost.github.com/cluster/docs/stats.html’. We decided to write a quick python script to connect to the stats plugin and parse that data to represent it to Zenoss.

You have 2 options… Run this script by itself using Zenoss to connect to the host or if you are using a socket connection or connecting to localhost only then use SNMP.

Download Here .. Download

  • ( IN SNMP ) Options are modifiable ‘exec CheckClusterLiveStats /usr/local/bin/check_clusterlive_stats.py -t tcp -c localhost:8888
  • Or directly in Zenoss ‘/usr/local/bin/check_clusterlive_stats.py -t tcp -c remotehost:8888′

This script can be used to connect to a TCP socket or to a local file socket. Example output from Zenoss Test Command…

Using SNMP Preparing Command...
Executing command /usr/local/zenoss/libexec/check_snmp -H 127.0.0.1 -o .1.3.6.1.4.1.8072.1.3.2.3.1.1.21.67.104.101.99.107.67.108.117.115.116.101.114.76.105.118.101.83.116.97.116.115 -C readonly -R OK against 127.0.0.1
SNMP OK - "Deaths Has not increased, Deaths count is 0 NodeJS cluster OK |restarts=0 workers=4 deaths=0 connections_total=193463 connections_active=0" |

Using Command only...
Preparing Command...
Executing command /usr/local/zenoss/libexec/check_clusterlive_stats.py -t tcp -c remotehost:8888
"Deaths Has not increased, Deaths count is 0 NodeJS cluster OK |restarts=0 workers=4 deaths=0 connections_total=193463 connections_active=0" |

The command above you can run with out snmp. The reason we use snmp because we only allow the stats plugin to run on the localhost interface. So we use snmp to execute the script and in return, it returns the results.

Here is the help output..
check_clusterlive_stats.py -h
Usage: check_clusterlive_stats.py arg --contype=socket|tcp --connection=pathto socket|host:port

Options:
  -h, --help            show this help message and exit
  -t CONTYPE, --contype=CONTYPE
                        socket or tcp
  -c CONNECTION, --connection=CONNECTION
                        /tmp/cluster-repl.sock or localhost:8888
  -w TIMEOUT, --timeout=TIMEOUT
                        int of how long you want this script to wait until it
                        times out

 

 Posted by dynasty at 12:31 am

How To Monitor Http Status Codes using Zenoss and Snmp.

 HowTo, Python, Zenoss  No Responses »
Dec 272011
 

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

 Posted by dynasty at 7:52 pm  Tagged with: HTTP Codes, Monitor 404, Python, Zenoss

HowTo add Aggregate Data Graphs from existing datapoints in Zenoss

 Python, Zenoss  No Responses »
Dec 092011
 

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… spacer 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

 

 Posted by dynasty at 11:16 pm  Tagged with: Aggregate, Python, Zenoss

HowTo backup all of your Zenoss Templates the easy way.

 Python, Zenoss  2 Responses »
Feb 122010
 

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.” »

 Posted by dynasty at 8:19 pm  Tagged with: Python, Python HowTo's, Zenoss, ZenPacks

HowTo monitor the Netscaler using Python and Soap instead of SNMP

 Netscaler, Python, Zenoss  3 Responses »
Feb 072010
 

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” »

 Posted by dynasty at 9:29 pm  Tagged with: Netscaler, OID, Python, Python HowTo's, SNMP, SOAP, Suds.

How to get information from the Netscaler using Python and Suds.

 Netscaler, Python, Zenoss  No Responses »
Feb 012010
 

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 = "nsip/api/NSConfig.wsdl"
>>> from suds.xsd.doctor import *
>>> imp = Import('schemas.xmlsoap.org/soap/encoding/')
>>> imp.filter.add("urn:NSConfig")
>>> d = ImportDoctor(imp)
>>> client = Client(url, doctor=d, location="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.” »

 Posted by dynasty at 1:22 pm  Tagged with: howto, Netscaler, Python, Python HowTo's, Suds.

Today’s task!

 Blog, Python, VMware  3 Responses »
Oct 052009
 

Today I was given a task to have my manager emailed once a day. If any of our Data Stores in ESX 3.5 are over 80% utilized. So I said to my self. What would be the easiest way to do this???? Well I’ve written two scripts in the past, that could help me accomplish that. The first script VMstoragePool.py will list all of the Data Stores in Vmware and its utilization. The 2nd script is check_datastore.py, and this script will return OK, WARNING, or CRITICAL, depending on the thresholds you set. So by effectively combining the 2 scripts I was able to get what I want. Example below…

python VMstoragePool.py -u "https://esxhostA" -a "login passwd" |grep "DataStore Name" |awk {'print $3'} |for line in `xargs`;do python check_datastore.py -u "https://esxhostA" -a "login passwd" -d $line -w 80 -c 90 -m "GB"|grep -P "WARNING|CRITICAL";done|mail user@domain.com
CRITICAL XythosVol2 57GB Avail 94% used |avail=57
WARNING XythosVol1 62GB Avail 87% used |avail=62
WARNING LinuxVol1 57GB Avail 88% used |avail=57
WARNING WinVol1 75GB Avail 84% used |avail=75
WARNING BBSCVOL1 122GB Avail 88% used |avail=122
CRITICAL NSSharedVOL1 46GB Avail 95% used |avail=46

 

So I can run this script in cron once a day and pipe the output to email him directly. Simple yet effective! On a side note, I fixed both chec_datastore.py and VMstoragePool.py to effectivly parse passwd’s that used characters like !@#$%^.

Both scripts can be downlaoded here..
check_datastore.py == Download

VMstoragePool.py == Download

 Posted by dynasty at 7:08 pm  Tagged with: Dynastys Blog, Today's task!

Network Device Manager update 0.22

 LD Device Manager, Python  No Responses »
Oct 022009
 

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 www.linuxdynasty.org/howto-manage-your-networked-devices-using-python-and-pexpect.html

 Posted by dynasty at 7:47 pm  Tagged with: LD Network manager, Network Device Manager, Python, Threading
 Older Entries
spacer

Forums

  • General Help for this site..
  • Zenoss

Forum Topics

  • Script downloads, 13 days ago

Categories

  • Blog (4)
  • CIM (1)
  • Cisco (2)
  • Clustering (4)
  • HowTo (3)
  • LD Device Manager (5)
  • Netscaler (2)
  • NodeJS (1)
  • Port Report Projects (4)
  • Python (17)
  • Shell (1)
  • SNMP (2)
  • Uncategorized (4)
  • VMware (2)
  • Zenoss (15)

twitter

  • Our posibilites are sometimes stifled by the people we work with… Either directly or indirectly 1 month ago
  • I earned the Globe Trotter(25) sticker on @GetGlue! bit.ly/bSiIoR 1 year ago
  • I earned the Lurker sticker on @GetGlue! bit.ly/91qL69 1 year ago
  • No caffeine in 2 days..... I am so sleepy!!!! 1 year ago
  • The lines are off the hook just to get into olivanders 1 year ago

Recent Comments

  • dynasty on HowTo setup GFS2 with Clustering
  • Bubbagump on HowTo setup GFS2 with Clustering
  • dynasty on Script to fix VMWare ESX 3.5 NIC Reordering after kickstart
  • dynasty on Begun Development of Web Server and Database for Port Report and Device Manager
  • dynasty on HowTo Send Splunk Alerts To Zenoss, And make them Look Like Splunk

Archives

  • December 2011
  • September 2011
  • September 2010
  • August 2010
  • April 2010
  • March 2010
  • February 2010
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • Jun
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.