Permalink
Browse files

munin scripts

  • Loading branch information...
1 parent a42cf46 commit 9f4cc661440864f9b20c899c630eb3231021263c @oliv3 oliv3 committed Jun 12, 2009
Showing with 119 additions and 0 deletions.
  1. +60 −0 munin/yaws_hits_
  2. +59 −0 munin/yaws_sent_
View
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+#
+# YAWS server hits
+#
+# Needs following minimal configuration in plugin-conf.d/munin-node:
+# [yaws*]
+# user root
+#
+# Magick markers
+#%# family=auto
+#%# capabilities=autoconf
+
+
+ID=`basename $0 | sed 's/^yaws_hits_//g'`
+TMPFILE=.yaws_hits_$ID
+STATS=`yaws --stats --id $ID | tail --lines=+2 > $TMPFILE`
+
+if [ "$1" = "autoconf" ]; then
+ if which yaws > /dev/null; then
+ echo yes
+ exit 0
+ else
+ echo no
+ exit 1
+ fi
+fi
+
+if [ "$1" = "config" ]; then
+ echo graph_title Hits for server $ID
+ echo graph_vlabel Hits
+ echo graph_category Yaws
+ echo graph_args --base 1024 -l 0
+
+ while read line; do
+ HOST=`echo $line | awk '{ print $1 }'`
+ FIELD=`echo $HOST | sed 's/[\.:]/_/g'`
+
+ echo $FIELD.label $HOST
+ echo $FIELD.draw LINE2
+ echo $FIELD.type DERIVE
+ echo $FIELD.min 0
+ done < $TMPFILE
+
+ rm -f $TMPFILE
+
+ exit 0
+fi
+
+while read line; do
+ HOST=`echo $line | awk '{ print $1 }'`
+ FIELD=`echo $HOST | sed 's/[\.:]/_/g'`
+ HITS=`echo $line | awk '{ print $4 }'`
+
+ echo $FIELD.value $HITS
+done < $TMPFILE
+
+rm -f $TMPFILE
+
+exit 0
View
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+#
+# YAWS server bytes sent
+#
+# Needs following minimal configuration in plugin-conf.d/munin-node:
+# [yaws*]
+# user root
+#
+# Magick markers
+#%# family=auto
+#%# capabilities=autoconf
+
+ID=`basename $0 | sed 's/^yaws_sent_//g'`
+TMPFILE=.yaws_sent_$ID
+STATS=`yaws --stats --id $ID | tail --lines=+2 > $TMPFILE`
+
+if [ "$1" = "autoconf" ]; then
+ if which yaws > /dev/null; then
+ echo yes
+ exit 0
+ else
+ echo no
+ exit 1
+ fi
+fi
+
+if [ "$1" = "config" ]; then
+ echo graph_title Bytes sent by server $ID
+ echo graph_vlabel Bytes
+ echo graph_category Yaws
+ echo graph_args --base 1024 -l 0
+
+ while read line; do
+ HOST=`echo $line | awk '{ print $1 }'`
+ FIELD=`echo $HOST | sed 's/[\.:]/_/g'`
+
+ echo $FIELD.label $HOST
+ echo $FIELD.draw LINE2
+ echo $FIELD.type DERIVE
+ echo $FIELD.min 0
+ done < $TMPFILE
+
+ rm -f $TMPFILE
+
+ exit 0
+fi
+
+while read line; do
+ HOST=`echo $line | awk '{ print $1 }'`
+ FIELD=`echo $HOST | sed 's/[\.:]/_/g'`
+ SENT=`echo $line | awk '{ print $5 }'`
+
+ echo $FIELD.value $SENT
+done < $TMPFILE
+
+rm -f $TMPFILE
+
+exit 0

0 comments on commit 9f4cc66

Please sign in to comment.