diff --git a/plugins/beboxsync/beboxstats b/plugins/beboxsync/beboxstats new file mode 100755 index 00000000..184b8315 --- /dev/null +++ b/plugins/beboxsync/beboxstats @@ -0,0 +1,62 @@ +#!/usr/bin/perl -w + +use strict; + +my ($Args) = @ARGV; + +my $expecter = "/home/alex/bin/beboxstats.expect"; + +if ($Args) { + + # work out line to grab + if ($Args eq 'autoconf') { + # Check the expect script that polls the router exists + unless ( -e $expecter ) { + print "no (Can't find expect script. Check value of \$expecter: $expecter)\n"; + } else { + print "yes\n"; + } + + } elsif ($Args eq 'config') { # print out plugin parameters + printf(" +graph_title bebox line stats +graph_vlabel deciBels +graph_category other +graph_info This graph shows the various line parameters +attenuationdownstream.label Downstream Attenuation +attenuationupstream.label Upstream Attenuation +margindownstream.label Downstream Noise Margin +marginupstream.label Upstream Noise Margin +outputpowerdownstream.label Downstream Output Power +outputpowerupstream.label Upstream Output Power +margindownstream.type GAUGE +outputpowerupstream.type GAUGE +attenuationdownstream.type GAUGE +marginupstream.type GAUGE +outputpowerdownstream.type GAUGE +attenuationupstream.type GAUGE + "); + # .label is the Key on the graph + } else { + printf("Usage: $0 + No arguments: print line stats + autoconf: print 'yes' + config: print config info for Munin\n"); + } + +} else { + # if no arguments, just fetch the data and print it out + +my @insplitted = split(' ', `$expecter | grep dB`); + +print "margindownstream.value $insplitted[3]\n"; +print "marginupstream.value $insplitted[4]\n"; + +print "attenuationdownstream.value $insplitted[8]\n"; +print "attenuationupstream.value $insplitted[9]\n"; + +print "outputpowerdownstream.value $insplitted[13]\n"; +print "outputpowerupstream.value $insplitted[14]\n"; +} + + diff --git a/plugins/beboxsync/beboxstats.expect b/plugins/beboxsync/beboxstats.expect new file mode 100755 index 00000000..aedd3d89 --- /dev/null +++ b/plugins/beboxsync/beboxstats.expect @@ -0,0 +1,25 @@ +#!/usr/bin/expect -f + +# script to log on to a BeBox router [ST Speedtouch 780] and gather line stats + +# set timeout for response from router to 30 seconds +set timeout 30 +set router "host.or.ip.of.router" +set port "23" +set username "Administrator" +set password "routerpassword" + +# telnet to $router on $port +spawn telnet $router $port + +expect "Username :" +send "$username\r" + +expect "Password :" +send "$password\r" + +expect "}=>" +send "adsl info\r" + +expect "}=>" +send "exit\r" diff --git a/plugins/beboxsync/beboxsync b/plugins/beboxsync/beboxsync new file mode 100755 index 00000000..be992845 --- /dev/null +++ b/plugins/beboxsync/beboxsync @@ -0,0 +1,50 @@ +#!/usr/bin/perl -w + +# (C) Alex Dekker +# License is GPL + +use strict; + +my ($Args) = @ARGV; + +my $expecter = "/home/alex/bin/beboxstats.expect"; + +if ($Args) { + + # work out line to grab + if ($Args eq 'autoconf') { + # Check the expect script that polls the router exists + unless ( -e $expecter ) { + print "no (Can't find expect script. Check value of \$expecter: $expecter)\n"; + } else { + print "yes\n"; + } + } elsif ($Args eq 'config') { # print out plugin parameters + printf(" +graph_title bebox sync stats +graph_vlabel ATM kbps +graph_category other +graph_info This graph shows line sync speed +syncdownstream.label Downstream Sync Speed +syncupstream.label Upstream Sync Speed +syncdownstream.type GAUGE +syncupstream.type GAUGE + "); + # .label is the Key on the graph + } else { + printf("Usage: $0 + No arguments: print line stats + autoconf: print 'yes' + config: print config info for Munin\n"); + } + +} else { + # if no arguments, just fetch the data and print it out + +my @insplitted = split(' ', `$expecter | grep stream`); + +print "syncdownstream.value $insplitted[11]\n"; +print "syncupstream.value $insplitted[15]\n"; +} + + diff --git a/plugins/other/beboxsync b/plugins/other/beboxsync deleted file mode 100755 index aa34bfba..00000000 Binary files a/plugins/other/beboxsync and /dev/null differ diff --git a/plugins/other/tr_ratios b/plugins/other/tr_ratios deleted file mode 100755 index f341fdf0..00000000 Binary files a/plugins/other/tr_ratios and /dev/null differ diff --git a/plugins/other/transmission/tr_ratios b/plugins/other/transmission/tr_ratios new file mode 100755 index 00000000..495ea16b --- /dev/null +++ b/plugins/other/transmission/tr_ratios @@ -0,0 +1,16 @@ +#!/bin/bash + +user='' +pass='' + +if [ "$1" = "config" ]; then + echo "graph_title Transmission seed ratios" + echo "graph_vlabel Seed ratio %" + echo "graph_category Transmission" + echo "graph_info This plugin shows your transmission ratios per torrent" + transmission-remote -n $user:$pass -l | gawk -f /usr/share/munin/plugins/tr_ratios_labels + exit 0 +fi + +transmission-remote -n $user:$pass -l | gawk -f /usr/share/munin/plugins/tr_ratios_data + diff --git a/plugins/other/transmission/tr_ratios_data b/plugins/other/transmission/tr_ratios_data new file mode 100644 index 00000000..fd9dd551 --- /dev/null +++ b/plugins/other/transmission/tr_ratios_data @@ -0,0 +1,10 @@ +BEGIN { FIELDWIDTHS = "7 4 13 10 7 9 7 13 40" } +NR > 1 { + split($1,torrentid," ") + if(torrentid[1] != "Sum:") { + split($7,ratio," ") + ratio[1] = ratio[1] * 100 + print "ID" torrentid[1] ".value " ratio[1] + } +} + diff --git a/plugins/other/transmission/tr_ratios_labels b/plugins/other/transmission/tr_ratios_labels new file mode 100644 index 00000000..273ab3d3 --- /dev/null +++ b/plugins/other/transmission/tr_ratios_labels @@ -0,0 +1,8 @@ +BEGIN { FIELDWIDTHS = "7 4 13 10 7 9 7 13 40" } +NR > 1 { + split($1,torrentid," ") + if(torrentid[1] != "Sum:") { + print "ID" torrentid[1] ".label " $9 + } +} + diff --git a/plugins/zfs/zfs-statistics-for-freebsd b/plugins/zfs/zfs-statistics-for-freebsd deleted file mode 100755 index 8bb49759..00000000 Binary files a/plugins/zfs/zfs-statistics-for-freebsd and /dev/null differ diff --git a/plugins/zope/zodb/README b/plugins/zope/zodb/README new file mode 100644 index 00000000..549d7f22 --- /dev/null +++ b/plugins/zope/zodb/README @@ -0,0 +1,36 @@ +These are 2 rather crude munin plugins to get at data about zopes ZODB. +They have proved very usefull, together with the process_memory +plugin, in tweaking the zodb cache-size for performance. + +There is no config, auto or otherwise, you have to edit the scripts to change anything. +Should not be to hard however :) + + +To install you have to copy the two scripts in the "scripts_python" +folder into zope. Probably easiest just to paste them into an +appropriately named new script in the ZMI. + +Click on the proxy tab, and give them the "Manager" role. + +You can test them like this: +wget --delete-after -q -O - localhost:8080//munin_db_activity.py +wget --delete-after -q -O - localhost:8080//munin_cache_parameters.py + +Edit zope_db_activity and zope_cache_parameters scripts to reflect + and your instance(s) ports. + +Then move them into your munin plugins lib, and create a symlink under etc according to the +usual munin custom: + +mv zope_* /opt/munin/lib/plugins/ + +ln -s /opt/munin/lib/plugins/zope_* /etc/opt/munin/plugins/ + +Test them with: +/opt/munin/sbin/munin-run zope_db_activity +/opt/munin/sbin/munin-run zope_cache_parameters + +Restart your munin-node and the graphs should appear shortly. + +If you make any improvements (which should be easy), please update +the munin exhange entry, or mail me at gaute(at)pht(dot)no \ No newline at end of file diff --git a/plugins/zope/zodb/scripts_python/munin_cache_parameters.py b/plugins/zope/zodb/scripts_python/munin_cache_parameters.py new file mode 100644 index 00000000..70dff165 --- /dev/null +++ b/plugins/zope/zodb/scripts_python/munin_cache_parameters.py @@ -0,0 +1,27 @@ +## Script (Python) "munin_cache_parameters.py" +##bind container=container +##bind context=context +##bind namespace= +##bind script=script +##bind subpath=traverse_subpath +##parameters= +##title= +## +""" +Fetches data about the ZODB for the munin plugin "zope_cache_parameters". +Needs the Manager proxy role to work. +Only answers requests from localhost directly to zopes port. +""" + +req = context.REQUEST + +if req['HTTP_X_FORWARDED_FOR'] or req['REMOTE_ADDR'] != '127.0.0.1': + return "This script can only be called frm localhost" + +maindb = context.restrictedTraverse('/Control_Panel/Database/main') + +print maindb.database_size(), # Total number of objects in the database +print maindb.cache_length(), # Total number of objects in memory from all caches +print len(maindb.cache_detail_length()) * maindb.cache_size() # Target number of objects in memory sum total + +return printed diff --git a/plugins/zope/zodb/scripts_python/munin_db_activity.py b/plugins/zope/zodb/scripts_python/munin_db_activity.py new file mode 100644 index 00000000..824fce48 --- /dev/null +++ b/plugins/zope/zodb/scripts_python/munin_db_activity.py @@ -0,0 +1,34 @@ +## Script (Python) "munin_db_activity.py" +##bind container=container +##bind context=context +##bind namespace= +##bind script=script +##bind subpath=traverse_subpath +##parameters= +##title= +## +""" +Fetches data about the ZODB for the munin plugin "zope_db_activity". +Needs the Manager proxy role to work. +Only answers requests from localhost directly to zopes port. +""" + +req = context.REQUEST + +if req['HTTP_X_FORWARDED_FOR'] or req['REMOTE_ADDR'] != '127.0.0.1': + return "This script can only be called frm localhost" + +sec = 60*5 # 5 min is munins update frequency + +now = float(DateTime()) +then = now-sec + +request = dict(chart_start=then, + chart_end=now) + +maindb = context.restrictedTraverse('/Control_Panel/Database/main') +cd = maindb.getActivityChartData(200, request) + +print cd['total_load_count'],cd['total_store_count'],cd['total_connections'] + +return printed diff --git a/plugins/zope/zodb/zope_cache_parameters b/plugins/zope/zodb/zope_cache_parameters new file mode 100755 index 00000000..cfdf3813 --- /dev/null +++ b/plugins/zope/zodb/zope_cache_parameters @@ -0,0 +1,43 @@ +#!/usr/bin/python + +from sys import argv +import httplib +conns = [] + +# this should really go in plugins.conf +conns.append(httplib.HTTPConnection("localhost",8080)) +conns.append(httplib.HTTPConnection("localhost",8070)) + + +url = "/munin_cache_parameters.py" + +if len(argv) > 1 and argv[1] == 'config': + + # there is probably a better way to display this cached vs targed graph + # as a percentage of target possibly.. + + print """graph_title Zope cache parameters + graph_category Zope + graph_info A grap of the main data on the "Cache Parameters" tab of the main DB in the zope control panel.""".replace("\n ","\n") + for i in range(0,len(conns)): + print """obs_in_db%(i)s.label Z%(i)s Obs in DB + obs_cached%(i)s.label Z%(i)s obs in all caches + obs_target%(i)s.label Z%(i)s cached obs target""".replace("\n ","\n") % dict(i=i) +else: + for i in range(0,len(conns)): + conns[i].request("GET", url) + + r1 = conns[i].getresponse() + #print r1.status, r1.reason + #200 OK + data = r1.read().strip() + conns[i].close() + (obs_in_db, obs_cached, obs_target) = data.split() + id = dict(i=i) + print 'obs_in_db%(i)s.value' % id, obs_in_db + print 'obs_cached%(i)s.value'% id, obs_cached + print 'obs_target%(i)s.value'% id, obs_target + + + + diff --git a/plugins/zope/zodb/zope_db_activity b/plugins/zope/zodb/zope_db_activity new file mode 100755 index 00000000..64175fb9 --- /dev/null +++ b/plugins/zope/zodb/zope_db_activity @@ -0,0 +1,41 @@ +#!/usr/bin/python + +from sys import argv +import httplib +conns = [] + +# this should really go in plugins.conf +conns.append(httplib.HTTPConnection("localhost",8080)) +conns.append(httplib.HTTPConnection("localhost",8070)) + + +url = "/munin_db_activity.py" + +if len(argv) > 1 and argv[1] == 'config': + + print """graph_title Zope Database Activity + graph_vlabel Count / 5 min. + graph_category Zope + graph_info The number of Reads, Stores, and Connections that happens in the ZODB backend. The data comes from the same source as that in the "Recent Database Activity" tab in the zope control panel.""".replace("\n ","\n") + for i in range(0,len(conns)): + print """load_count%(i)s.label Z%(i)s Loads + store_count%(i)s.label Z%(i)s Stores + connections%(i)s.label Z%(i)s Connections""".replace("\n ","\n") % dict(i=i) +else: + for i in range(0,len(conns)): + conns[i].request("GET", url) + + r1 = conns[i].getresponse() + #print r1.status, r1.reason + #200 OK + data = r1.read().strip() + conns[i].close() + (total_load_count, total_store_count, total_connections) = data.split() + id = dict(i=i) + print 'load_count%(i)s.value' % id, total_load_count + print 'store_count%(i)s.value'% id, total_store_count + print 'connections%(i)s.value'% id, total_connections + + + + diff --git a/plugins/zope/zope_zodb b/plugins/zope/zope_zodb deleted file mode 100755 index f2e1a0d9..00000000 Binary files a/plugins/zope/zope_zodb and /dev/null differ