Permalink
Browse files

- Imported 31 gmetric scripts from Gmetric Script Repository: http://…

…ganglia.info/gmetric

- Re-organized existing gmetric scripts in github repository
1 parent 9572dc3 commit ea4b4ae0b8144ef37377acf0175baead4fe29213 Ganglia Development Team committed Aug 18, 2010
Showing with 2,358 additions and 0 deletions.
  1. +17 −0 backup/netbackup_jobs/README
  2. +14 −0 backup/netbackup_jobs/netbackup_jobs.sh
  3. 0 {memcached → cache/memcached.pl}/ganglia_memcached.pl
  4. +17 −0 cache/memcached.sh/README
  5. +201 −0 cache/memcached.sh/memcached.sh
  6. +17 −0 database/mysql_replication/README
  7. +52 −0 database/mysql_replication/mysql_replication.py
  8. 0 {mysql → database/mysql_stats}/ganglia_mysql_stats.pl
  9. +17 −0 database/mysql_threads/README
  10. +34 −0 database/mysql_threads/mysql_threads.sh
  11. +17 −0 database/oracle_connections/README
  12. +5 −0 database/oracle_connections/oracle_connections.sh
  13. 0 disk/{ → diskio.pl}/ganglia_disk_stats.pl
  14. +17 −0 disk/diskio.py/README
  15. +58 −0 disk/diskio.py/diskio.py
  16. +17 −0 disk/diskusage/README
  17. +21 −0 disk/diskusage/diskusage.pl
  18. +17 −0 health/hplog_fanspeed/README
  19. +36 −0 health/hplog_fanspeed/hplog_fanspeed.pl
  20. +17 −0 health/ipmi_temp/README
  21. +53 −0 health/ipmi_temp/ipmi_temp.sh
  22. +17 −0 health/lm_sensors/README
  23. +44 −0 health/lm_sensors/lm_sensors.sh
  24. +17 −0 hpc/pbs_jobs/README
  25. +17 −0 hpc/pbs_jobs/pbs_jobs.sh
  26. +17 −0 hpc/sge_jobs/README
  27. +44 −0 hpc/sge_jobs/sge_jobs.sh
  28. +17 −0 http/apache_error/README
  29. +122 −0 http/apache_error/apache_error.pl
  30. 0 { → http}/haproxy/gmetric_haproxy.sh
  31. 0 { → http}/lighttpd/gmetric_lighttpd.sh
  32. 0 mail/{ → powermta}/ganglia_powermta.php
  33. +17 −0 mail/qmail/README
  34. +69 −0 mail/qmail/qmail.php
  35. +17 −0 network/connections_list/README
  36. +39 −0 network/connections_list/connections_list.pl
  37. +17 −0 network/ib_perf/README
  38. +105 −0 network/ib_perf/ib_perf.py
  39. +17 −0 network/lvs_active_inactive_connections/README
  40. +32 −0 network/lvs_active_inactive_connections/lvs_active_inactive_connections.sh
  41. +17 −0 network/lvs_connections/README
  42. +32 −0 network/lvs_connections/lvs_connections.sh
  43. +17 −0 network/lvs_connections_enhanced/README
  44. +39 −0 network/lvs_connections_enhanced/lvs_connections_enhanced.sh
  45. +17 −0 network/tcp_established/README
  46. +4 −0 network/tcp_established/tcp_established.sh
  47. +17 −0 network/tcp_established_time_wait/README
  48. +17 −0 network/tcp_established_time_wait/tcp_established_time_wait.sh
  49. +17 −0 network/webpage_loadtime/README
  50. +46 −0 network/webpage_loadtime/webpage_loadtime.py
  51. +17 −0 nfs/nfs_client_calls/README
  52. +54 −0 nfs/nfs_client_calls/nfs_client_calls.sh
  53. +17 −0 nfs/nfs_stats/README
  54. +124 −0 nfs/nfs_stats/nfs_stats.pl
  55. 0 nfs/{ → nfs_stats_vvuksan}/ganglia_nfs_stats.pl
  56. +17 −0 power/apc_stats/README
  57. +59 −0 power/apc_stats/apc_stats.pl
  58. +17 −0 system/filehandles_inuse_2.4_kernel/README
  59. +15 −0 system/filehandles_inuse_2.4_kernel/filehandles_inuse_2.4_kernel.sh
  60. +17 −0 system/io_user_load/README
  61. +20 −0 system/io_user_load/io_user_load.sh
  62. +17 −0 system/logged_in_users/README
  63. +18 −0 system/logged_in_users/logged_in_users.sh
  64. +17 −0 system/per_user_stats/README
  65. +64 −0 system/per_user_stats/per_user_stats.pl
  66. +17 −0 system/per_user_stats_ustat/README
  67. +366 −0 system/per_user_stats_ustat/per_user_stats_ustat.pl
  68. +17 −0 system/resource_usage_rank/README
  69. +27 −0 system/resource_usage_rank/resource_usage_rank.sh
@@ -0,0 +1,17 @@
+Gmetric script pulled from http://ganglia.info/gmetric
+
+If you are the author of the script, and have an updated version, please fork the repo and
+submit a pull request. For additional information about the repository, please see the
+README in the repository top-level.
+
+Author: Jordi Prats Catala (CESCA)
+
+Description:
+
+Measures the number of active and queued jobs on NetBackup
+
+Language: Bash
+
+Category: Backup Monitoring::NetBackup
+
+Dependencies: Netbackup, grep, wc
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+### Author: Jordi Prats Catala - CESCA - 2007
+### License to use, modify, and distribute under the GPL
+### http://www.gnu.org/licenses/gpl.txt
+
+ACTIVE=`/usr/openv/netbackup/bin/admincmd/bpdbjobs -noheader | grep Active | wc -l`
+QUEUE=`/usr/openv/netbackup/bin/admincmd/bpdbjobs -noheader | grep -i Queued | wc -l`
+
+VALUEACTIVE=${ACTIVE## * }
+/usr/bin/gmetric -t uint16 -n NB_active_jobs -v$VALUEACTIVE -u '#'
+
+VALUEQUEUE=${QUEUE## * }
+/usr/bin/gmetric -t uint16 -n NB_queued_jobs -v$VALUEQUEUE -u '#'
@@ -0,0 +1,17 @@
+Gmetric script pulled from http://ganglia.info/gmetric
+
+If you are the author of the script, and have an updated version, please fork the repo and
+submit a pull request. For additional information about the repository, please see the
+README in the repository top-level.
+
+Author: Ben Hartshorne
+
+Description:
+
+Measures MemCache: num objects, bypets used, num connections, hit percentage
+
+Language: bash
+
+Category: Application::memcached
+
+Dependencies: memcached 1.1.13+
@@ -0,0 +1,201 @@
+#!/bin/bash
+
+### $Id: mcd_gmetric.sh 16661 2006-11-07 00:56:33Z ben $
+
+### This script queries a memcached server running
+### on localhost and reports a few statistics to
+### ganglia.
+### It reports
+### *mcd_curr_items - the number of objects stored
+### *mcd_curr_bytes - current bytes used
+### *mcd_curr_conns - current number of connections
+### *mcd_hit_perc - hits / gets for current time duration
+### (current hit percentage)
+### For more description on any of these metrics,
+### see the protocols.txt file in the MCD docs.
+
+### Copyright Simply Hired, Inc. 2006
+### License to use, modify, and distribute under the GPL
+### http://www.gnu.org/licenses/gpl.txt
+
+VERSION=1.0
+
+GMETRIC="/usr/bin/gmetric"
+GMETRIC_ARGS="-c /etc/gmond.conf"
+STATEFILE="/var/lib/ganglia/metrics/mcd.stats"
+ERROR_NOTROOT="/tmp/mcd_gmetric_notroot"
+ERROR_CANT_CONNECT="/tmp/mcd_gmetric_cant_connect"
+ERROR_CREATE="/tmp/mcd_gmetric_create_statefile_failed"
+ERROR_GETS_EMPTY="/tmp/mcd_gets_empty"
+
+MCD_CONF="/etc/sysconfig/memcached"
+
+# get system configuration
+if [ -e ${MCD_CONF} ]
+then
+ source ${MCD_CONF}
+ MCD_PORT=${PORT}
+fi
+MCD_PORT=${MCD_PORT:-11211}
+
+date=`date +%s`
+
+if [ $UID -ne 0 ]
+then
+ if [ -e $ERROR_NOTROOT ] ; then exit 1; fi
+ echo "Error: this script must be run as root."
+ touch $ERROR_NOTROOT
+ exit 1
+fi
+rm -f $ERROR_NOTROOT
+
+if [ "x$1" == "x-h" ]
+then
+ echo "Usage: mcd_gmetric.sh [--clean]"
+ echo " --clean delete all tmp files"
+ exit 0
+fi
+
+if [ "x$1" == "x--clean" ]
+then
+ rm -f $STATEFILE $ERROR_NOTROOT $ERROR_CANT_CONNECT $ERROR_CREATE
+ retval=$?
+ if [ $retval -ne 0 ]
+ then
+ echo "failed to clean up."
+ exit 1
+ else
+ echo "All cleaned up."
+ exit 0
+ fi
+fi
+
+# if the GMETRIC program isn't installed, compain
+if [ ! -e $GMETRIC ]
+then
+ if [ -e $ERROR_GMETRIC ] ; then exit 1; fi
+ echo ""
+ echo "Error: GMETRIC doesn't seem to be installed."
+ echo "$GMETRIC doesn't exist."
+ echo ""
+ touch $ERROR_GMETRIC
+ exit 1
+fi
+
+# get current statistics
+exec 3>&2 #turn off STDERR
+exec 2>/dev/null
+stats_array=(`echo "stats" | nc localhost $MCD_PORT`)
+retval=$?
+exec 2>&1 #turn on STDERR
+exec 3>&-
+
+if [ $retval -ne 0 ]
+then
+ if [ -e $ERROR_CANT_CONNECT ] ; then exit 1 ; fi
+ echo "I can't connect to mcd."
+ echo "Bummer. "
+ touch $ERROR_CANT_CONNECT
+ exit 1
+fi
+
+mcd_curr_items=`echo ${stats_array[23]}|tr -c -d [0-9]` #this tr thing is because there's a trailing ^M on the string from netcat that breaks bc.
+mcd_curr_bytes=`echo ${stats_array[29]}|tr -c -d [0-9]`
+mcd_curr_conns=`echo ${stats_array[32]}|tr -c -d [0-9]`
+mcd_total_gets=`echo ${stats_array[41]}|tr -c -d [0-9]`
+mcd_total_sets=`echo ${stats_array[44]}|tr -c -d [0-9]`
+mcd_total_hits=`echo ${stats_array[47]}|tr -c -d [0-9]`
+
+if [ -z "$mcd_total_gets" ]
+then
+# this actually happens rather often for some reason, so I'm just going to fail silently.
+# if [ -e $ERROR_GETS_EMPTY ] ; then exit 1 ; fi
+# echo ""
+# echo "ERROR: mcd_total_gets empty."
+# echo ""
+ exit 1
+fi
+rm -f $ERROR_GETS_EMPTY
+
+
+# save and turn off /STDERR for the statefile tests
+exec 3>&2
+exec 2>/dev/null
+
+# if the statefile doesn't exist, we either havn't
+# run yet or there's something bigger wrong.
+if [ ! -e $STATEFILE ]
+then
+ if [ ! -d `dirname $STATEFILE` ]
+ then
+ mkdir -p `dirname $STATEFILE`
+ fi
+ echo "$date $mcd_curr_items $mcd_curr_bytes $mcd_curr_conns $mcd_total_gets $mcd_total_sets $mcd_total_hits" > $STATEFILE
+ if [ ! -e $STATEFILE ]
+ then
+ # if it didn't exist and we couldn't create
+ # it, we should just scream bloody murder and die.
+ # only scream once though...
+ if [ -e $ERROR_CREATE ]
+ then
+ exit 1
+ fi
+ echo ""
+ echo "ERROR: couldn't create $STATEFILE"
+ echo ""
+ touch $ERROR_CREATE
+ exit 1
+ fi
+ echo "Created statefile. Exitting."
+ exit 0
+fi
+
+# restore stderr
+exec 2>&3
+exec 3>&-
+
+old_stats_array=(`cat $STATEFILE`)
+old_date=${old_stats_array[0]}
+old_mcd_curr_items=${old_stats_array[1]}
+old_mcd_curr_bytes=${old_stats_array[2]}
+old_mcd_curr_conns=${old_stats_array[3]}
+old_mcd_total_gets=${old_stats_array[4]}
+old_mcd_total_sets=${old_stats_array[5]}
+old_mcd_total_hits=${old_stats_array[6]}
+
+echo "$date $mcd_curr_items $mcd_curr_bytes $mcd_curr_conns $mcd_total_gets $mcd_total_sets $mcd_total_hits" > $STATEFILE
+
+time_diff=$(($date - $old_date))
+mcd_total_gets_diff=$(($mcd_total_gets - $old_mcd_total_gets))
+mcd_total_sets_diff=$(($mcd_total_sets - $old_mcd_total_sets))
+mcd_total_hits_diff=$(($mcd_total_hits - $old_mcd_total_hits))
+
+if [ $time_diff -eq 0 ]
+then
+ if [ -e $ERROR_TIMEDIFF ] ; then exit 1 ; fi
+ echo "something is broken."
+ echo "time_diff is 0."
+ touch $ERROR_TIMEDIFF
+ exit 1
+fi
+
+# none of these numbers should be less than 1, but if they are, just send back 1.
+if [ $mcd_total_gets_diff -le 1 ] ; then mcd_total_gets_diff=1 ; fi
+if [ $mcd_total_sets_diff -le 1 ] ; then mcd_total_sets_diff=1 ; fi
+if [ $mcd_total_hits_diff -le 1 ] ; then mcd_total_hits_diff=1 ; fi
+
+mcd_gets_per_sec=`echo "scale=3;${mcd_total_gets_diff}/${time_diff}"|bc`
+mcd_sets_per_sec=`echo "scale=3;${mcd_total_sets_diff}/${time_diff}"|bc`
+mcd_hits_per_sec=`echo "scale=3;${mcd_total_hits_diff}/${time_diff}"|bc`
+mcd_hit_perc=`echo "scale=3; ${mcd_total_hits_diff} * 100 / ${mcd_total_gets_diff}" | bc`
+
+
+$GMETRIC $GMETRIC_ARGS --name="mcd_seconds_measured" --value=${time_diff} --type=uint32 --units="secs"
+$GMETRIC $GMETRIC_ARGS --name="mcd_items_cached" --value=${mcd_curr_items} --type=uint32 --units="items"
+$GMETRIC $GMETRIC_ARGS --name="mcd_bytes_used" --value=${mcd_curr_bytes} --type=uint32 --units="bytes"
+$GMETRIC $GMETRIC_ARGS --name="mcd_conns" --value=${mcd_curr_conns} --type=uint32 --units="connections"
+$GMETRIC $GMETRIC_ARGS --name="mcd_gets" --value=${mcd_gets_per_sec} --type=float --units="gps"
+$GMETRIC $GMETRIC_ARGS --name="mcd_sets" --value=${mcd_sets_per_sec} --type=float --units="sps"
+$GMETRIC $GMETRIC_ARGS --name="mcd_cache_hits" --value=${mcd_hits_per_sec} --type=float --units="hps"
+$GMETRIC $GMETRIC_ARGS --name="mcd_cache_hit%" --value=${mcd_hit_perc} --type=float --units="%"
+
@@ -0,0 +1,17 @@
+Gmetric script pulled from http://ganglia.info/gmetric
+
+If you are the author of the script, and have an updated version, please fork the repo and
+submit a pull request. For additional information about the repository, please see the
+README in the repository top-level.
+
+Author: C Viven Rajendra
+
+Description:
+
+gmetric to monitor mysql replication delay between master and slave
+
+Language: Python
+
+Category: MYSQL replication
+
+Dependencies: None
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+###############################################################
+# gmetric to monitor mysql replication delay between master and slave
+# put this in a cronjob on the slave for every minute or 5 mins or however
+# often you desire it to run, be sure to check the parameters
+# given below
+###############################################################
+# REQs: python, gmetric
+# DATE: 01 July 2008
+# C Viven Rajendra, vivenrajendra@gmail.com
+###############################################################
+import commands, os
+
+#########################################
+# change these to the appropriate values
+username = "root"
+use_passwd = True # change this to False if you do not use a password to connect
+password = "db"
+## do not change below two default values unless you have done it on your machine
+mcast_channel = '239.2.11.71'
+mcast_port = 8649
+##########################################
+
+
+
+# mysql -u root -pdb -e 'show slave status\G' | grep 'Seconds_Behind_Master'
+
+## do not touch anything below unless you are sure of what you are doing ##########
+
+if __name__ == "__main__":
+ gmetricCommand_usingPassword = "mysql -u " + username + " -p" + password +" -e 'show slave status\G' | grep 'Seconds_Behind_Master'"
+ gmetricCommand_withoutPassword = "mysql -u " + username + " -e 'show slave status\G' | grep 'Seconds_Behind_Master'"
+ s = None
+ o = None
+ if use_passwd:
+ s,o = commands.getstatusoutput(gmetricCommand_usingPassword)
+ else:
+ s,o = commands.getstatusoutput(gmetricCommand_withoutPassword)
+ print "status", s
+ print "output", o
+ if o == "" or s!=0 or s==256:
+ print "Error : Probabaly, this is not a slave."
+ elif s==0:
+ o = o.split()
+ print o[0]
+ print o[1]
+ if o[1] == "NULL":
+ print "Error : Probabaly, slave cannot connect to master or try 'mysql>start slave'."
+ else:
+ gangliaMetric = "/usr/bin/gmetric --name=mysql_SecondsBehindMaster --value=" + str(o[1]) + " --type=uint8 --units=seconds --mcast_channel='" + mcast_channel +"' --mcast_port=" + str(mcast_port)
+ print gangliaMetric
+ res = os.system(gangliaMetric)
@@ -0,0 +1,17 @@
+Gmetric script pulled from http://ganglia.info/gmetric
+
+If you are the author of the script, and have an updated version, please fork the repo and
+submit a pull request. For additional information about the repository, please see the
+README in the repository top-level.
+
+Author: Steve Traylen
+
+Description:
+
+Publishes the number of mysql threads ( active connections).
+
+Language: bash
+
+Category: Database :: MySQL :: Connections
+
+Dependencies: mysql
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Source a conf file read only by root to get the mysql USER
+# we should use.
+if [ ! -f /etc/mysql-threads-gmetric.conf ] ; then
+ echo "/etc/mysql-threads-gmetric.conf does not exist"
+ exit 1
+fi
+
+. /etc/mysql-threads-gmetric.conf
+
+# Check there is a gmond.conf file.
+if [ ! -f /etc/gmond.conf ] ; then
+ echo "/etc/gmond.conf does not exist"
+ exit 1
+fi
+
+# Work out what multicast channel we are on (rather assumes there is only one space).
+MCAST=`grep '^mcast_channel' /etc/gmond.conf | cut -d' ' -f 2`
+PORT=`grep '^mcast_port' /etc/gmond.conf | cut -d' ' -f 2`
+TTL=`grep '^mcast_ttl' /etc/gmond.conf | cut -d' ' -f 2`
+
+[ -z "$MCAST" ] && MCAST="239.2.11.70"
+[ -z "$PORT" ] && PORT=8649
+[ -z "$TTL" ] && TTL=1
+
+
+STRING=`mysqladmin -u $USER status`
+THREADS=`echo $STRING | sed 's/.*Threads: \([0-9]*\) .*/\1/'`
+
+
+gmetric -tuint32 -c$MCAST -p$PORT -l$TTL -x180 -d300 -nmysql_threads -v$THREADS
+
+
@@ -0,0 +1,17 @@
+Gmetric script pulled from http://ganglia.info/gmetric
+
+If you are the author of the script, and have an updated version, please fork the repo and
+submit a pull request. For additional information about the repository, please see the
+README in the repository top-level.
+
+Author: Craig Simpson
+
+Description:
+
+Reports number of Oracle Client Connections
+
+Language: sh
+
+Category: Network :: Oracle Connections
+
+Dependencies: ps netstat grep
Oops, something went wrong.

0 comments on commit ea4b4ae

Please sign in to comment.