1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

Merge pull request #539 from ssm/fix/syntax-errors

Add syntax checking, and fix all syntax errors
This commit is contained in:
Stig Sandbeck Mathisen 2014-10-05 21:15:30 +02:00
commit 155a8dbd8c
66 changed files with 1895 additions and 1606 deletions

58
.travis.yml Normal file
View file

@ -0,0 +1,58 @@
---
language: perl
install:
- sudo apt-get update
- sudo apt-get --no-install-recommends install devscripts python ruby php5-cli gawk ksh pylint
- sudo apt-get --no-install-recommends install pkg-config libdb-dev libvirt-dev libexpat-dev
# - Munin/Plugin.pm is in "munin-node" on precise
- sudo apt-get --no-install-recommends install munin-node
# Modules used by test script
- cpanm --notest Capture::Tiny
- cpanm --notest File::Find
- cpanm --notest Test::More
#
# Modules used by plugins
- cpanm --notest Asterisk::AMI
- cpanm --notest BerkeleyDB
- cpanm --notest Cache::Memcached
- cpanm --notest DBD::Pg
- cpanm --notest Data::Dump
- cpanm --notest Date::Manip
- cpanm --notest Date::Parse
- cpanm --notest DateTime::Format::ISO8601
- cpanm --notest Device::SerialPort
- cpanm --notest FCGI::Client
- cpanm --notest File::ReadBackwards
- cpanm --notest File::Tail::Multi
- cpanm --notest Graphics::ColorObject
- cpanm --notest IPC::Run3
- cpanm --notest IPC::ShareLite
- cpanm --notest JSON::Any
- cpanm --notest Mail::Sendmail
- cpanm --notest Modern::Perl
- cpanm --notest MooseX::POE
- cpanm --notest Net::DNS
- cpanm --notest Net::OpenSSH
- cpanm --notest Net::SNMP
- cpanm --notest Net::Telnet
- cpanm --notest Net::Telnet::Cisco
- cpanm --notest POE
- cpanm --notest POE::Component::IRC
- cpanm --notest POE::Quickie
- cpanm --notest Proc::ProcessTable
- cpanm --notest Redis
- cpanm --notest WWW::Mechanize::TreeBuilder
- cpanm --notest Text::Iconv
- cpanm --notest XML::LibXML
- cpanm --notest XML::Simple
- cpanm --notest XML::Smart
- cpanm --notest XML::Twig
- cpanm --notest nvidia::ml
# - Sys::Virt version matching the test system's libvirt-dev
- cpanm --notest DANBERR/Sys-Virt-0.9.8.tar.gz
# Modules used by plugins, but missing on cpan
# - Sun::Solaris::Kstat
# - VMware::VIRuntime
# - MythTV
script: "PERL5LIB=$PERL5LIB:/usr/share/perl5 prove"

View file

@ -63,7 +63,7 @@ if(defined($ARGV[0])) {
print "graph_total Total\n"; print "graph_total Total\n";
print "graph_vlabel Bits\n"; print "graph_vlabel Bits\n";
print "graph_category $server\n"; print "graph_category $server\n";
print "graph_info This graph show $server total bandwidth used by various "\ print "graph_info This graph show $server total bandwidth used by various " .
"projects.\n"; "projects.\n";
while ((my $project, my @files) = each(%logs)) { while ((my $project, my @files) = each(%logs)) {
print $project.".label $project\n"; print $project.".label $project\n";

View file

@ -60,7 +60,7 @@ if(defined($ARGV[0])) {
print "graph_args --base 1000\n"; print "graph_args --base 1000\n";
print "graph_vlabel bits per \${graph_period} in (-) / out (+)\n"; print "graph_vlabel bits per \${graph_period} in (-) / out (+)\n";
print "graph_category $server\n"; print "graph_category $server\n";
print "graph_info This graph show $server in/out bandwidth used by various"\ print "graph_info This graph show $server in/out bandwidth used by various" .
" projects.\n"; " projects.\n";
while ((my $project, my @files) = each(%logs)) { while ((my $project, my @files) = each(%logs)) {
print "i".$project.".label $project\n"; print "i".$project.".label $project\n";

View file

@ -19,7 +19,7 @@ room=${0##*tinychat_users_}
## ##
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
# Check that curl is installed # Check that curl is installed
if hash curl &>/dev/null; then if hash curl >/dev/null 2>&1; then
echo "yes" echo "yes"
else else
echo "no (no curl installed)" echo "no (no curl installed)"

View file

@ -69,7 +69,7 @@ GPLv2
CONFIGDIR=$(awk -F : '/^configdirectory:/ { gsub(/ /, "", $2); print $2 }' /etc/imapd.conf 2> /dev/null) CONFIGDIR=$(awk -F : '/^configdirectory:/ { gsub(/ /, "", $2); print $2 }' /etc/imapd.conf 2> /dev/null)
PROCDIR="${CONFIGDIR}/proc" PROCDIR="${CONFIGDIR}/proc"
if [ "$1" == "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ "x${CONFIGDIR}x" != "xx" ] && [ -d ${PROCDIR} ]; then if [ "x${CONFIGDIR}x" != "xx" ] && [ -d ${PROCDIR} ]; then
echo yes echo yes
else else
@ -79,14 +79,14 @@ if [ "$1" == "autoconf" ]; then
fi fi
# Check if we actually got some sensible data # Check if we actually got some sensible data
if [ "x${CONFIGDIR}x" == "xx" ]; then if [ "x${CONFIGDIR}x" = "xx" ]; then
exit 1 exit 1
fi fi
# If run with the "config"-parameter, give out information on how the # If run with the "config"-parameter, give out information on how the
# graphs should look. # graphs should look.
if [ "$1" == "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title Cyrus IMAPd Load' echo 'graph_title Cyrus IMAPd Load'
echo 'graph_args --base 1000 -l 0' echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel connections' echo 'graph_vlabel connections'

View file

@ -1,33 +1,33 @@
#!/bin/sh #!/bin/sh
# #
# (c)2009, Christian Kujau <lists@nerdbynature.de> modified by dano229 # (c)2009, Christian Kujau <lists@nerdbynature.de> modified by dano229
# Based on the 'homedirs' plugin, initially written in Perl by Philipp Gruber <pg@flupps.net> # Based on the 'homedirs' plugin, initially written in Perl by Philipp Gruber <pg@flupps.net>
# #
# We still need a cronjob to update CACHEFILE once in a while, e.g.: # We still need a cronjob to update CACHEFILE once in a while, e.g.:
# 0 * * * * root [ -O /tmp/munin-du_multidirs.cache ] && du -sk /dir /dir2 dir3/* > /tmp/munin-du_multidirs.cache # 0 * * * * root [ -O /tmp/munin-du_multidirs.cache ] && du -sk /dir /dir2 dir3/* > /tmp/munin-du_multidirs.cache
# #
CACHEFILE=/tmp/munin-du_multidirs.cache CACHEFILE=/tmp/munin-du_multidirs.cache
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
echo yes echo yes
exit 0 exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title Directory usage' echo 'graph_title Directory usage'
echo 'graph_args --base 1024 -l 1' echo 'graph_args --base 1024 -l 1'
echo 'graph_vlabel Bytes' echo 'graph_vlabel Bytes'
echo 'graph_category disk' echo 'graph_category disk'
echo 'graph_info This graph shows the size of several directories' echo 'graph_info This graph shows the size of several directories'
awk '!/lost\+found/ {print $2 }' $CACHEFILE | sort | while read label; do awk '!/lost\+found/ {print $2 }' $CACHEFILE | sort | while read label; do
field=`echo "$label" | sed 's/^[^A-Za-z_]/_/' | sed 's/[^A-Za-z0-9_]/_/g'` field=`echo "$label" | sed 's/^[^A-Za-z_]/_/' | sed 's/[^A-Za-z0-9_]/_/g'`
echo "$field".label "$label" echo "$field".label "$label"
echo "$field".draw LINE1 echo "$field".draw LINE1
# echo "$field".warning 0 # echo "$field".warning 0
# echo "$field".critical 0 # echo "$field".critical 0
done done
exit 0 exit 0
fi fi
awk '!/lost\+found/ { sub(/[^a-zA-Z_]/,"_",$2); gsub(/[^a-zA-Z0-9_]/,"_",$2); print $2".value "$1 * 1024 }' $CACHEFILE | sort -r -n -k2 awk '!/lost\+found/ { sub(/[^a-zA-Z_]/,"_",$2); gsub(/[^a-zA-Z0-9_]/,"_",$2); print $2".value "$1 * 1024 }' $CACHEFILE | sort -r -n -k2

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# -*- sh -*- # -*- sh -*-
# vim: ft=sh # vim: ft=sh

View file

@ -1,19 +1,19 @@
#!/bin/sh #!/bin/sh
#Author Juned Memon www.tipsNtrapS.com (juned.memon@tipsntraps.com) #Author Juned Memon www.tipsNtrapS.com (juned.memon@tipsntraps.com)
#To Check how stable the Hadoop filesystem is, we generally check number of under-replicated nodes in hadoop. This plugin graphs the under-replicated nodes in hadoop. #To Check how stable the Hadoop filesystem is, we generally check number of under-replicated nodes in hadoop. This plugin graphs the under-replicated nodes in hadoop.
case $1 in case $1 in
config) config)
cat <<'EOM' cat <<'EOM'
graph_title Under Replicated Blocks Hadoop graph_title Under Replicated Blocks Hadoop
graph_category hadoop graph_category hadoop
graph_vlabel block graph_vlabel block
block.label block block.label block
EOM EOM
exit 0;; exit 0;;
esac esac
echo -n "block.value " echo -n "block.value "
hadoop dfsadmin -report | grep "Under replicated blocks" | awk '{print $4}' hadoop dfsadmin -report | grep "Under replicated blocks" | awk '{print $4}'

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Plugin to monitor hylafax queue # Plugin to monitor hylafax queue
# #

View file

@ -1,25 +1,25 @@
#! /bin/sh #! /bin/sh
# configuration : # configuration :
# #
# env.LOGFILE /var/log/proftpd/proftpd.log # env.LOGFILE /var/log/proftpd/proftpd.log
if [ "$1" = 'config' ]; then if [ "$1" = 'config' ]; then
echo "graph_args --base 1000 -l 0" echo "graph_args --base 1000 -l 0"
echo "graph_title Serveur FTP" echo "graph_title Serveur FTP"
echo "graph_category Ftp" echo "graph_category Ftp"
echo "graph_vlabel Stats Proftpd" echo "graph_vlabel Stats Proftpd"
echo "succes.label Login succes" echo "succes.label Login succes"
echo "succes.draw AREA" echo "succes.draw AREA"
echo "failed.label Login failed" echo "failed.label Login failed"
echo "failed.draw AREA" echo "failed.draw AREA"
fi fi
LOGFILE=${LOGFILE:-"/var/log/proftpd/proftpd.log"} LOGFILE=${LOGFILE:-"/var/log/proftpd/proftpd.log"}
succes=$(grep -c "successful" "$LOGFILE" ) succes=$(grep -c "successful" "$LOGFILE" )
failed=$(grep -c "Login failed" "$LOGFILE" ) failed=$(grep -c "Login failed" "$LOGFILE" )
echo "succes.value $succes" echo "succes.value $succes"
echo "failed.value $failed" echo "failed.value $failed"
exit 0 exit 0

View file

@ -1,47 +1,46 @@
#!/bin/sh #!/bin/bash
# #
# #
# Script to show pureftp counts. # Script to show pureftp counts.
# Logs are searched in /var/log/pure-ftpd/transfer.log by default. # Logs are searched in /var/log/pure-ftpd/transfer.log by default.
# Logs must be in w3c format: # Logs must be in w3c format:
# pure-ftpd --altlog w3c:/var/log/pure-ftpd/transfer.log # pure-ftpd --altlog w3c:/var/log/pure-ftpd/transfer.log
# #
# Parameters understood: # Parameters understood:
# #
# config (required) # config (required)
# autoconf (optional - used by munin-config) # autoconf (optional - used by munin-config)
# #
# #
# Magic markers (optional - used by munin-config and installation # Magic markers (optional - used by munin-config and installation
# scripts): # scripts):
# #
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
MAXLABEL=20 MAXLABEL=20
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
echo yes echo yes
exit 0 exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title FTP Server' echo 'graph_title FTP Server'
echo 'graph_args --base 1000 -l 0' echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel Daily FTP Operations' echo 'graph_vlabel Daily FTP Operations'
echo 'graph_category FTP' echo 'graph_category FTP'
echo 'graph_period second' echo 'graph_period second'
echo 'ftp_put.type GAUGE' echo 'ftp_put.type GAUGE'
echo 'ftp_get.type GAUGE' echo 'ftp_get.type GAUGE'
echo 'ftp_put.label Files PUT' echo 'ftp_put.label Files PUT'
echo 'ftp_get.label Files GET' echo 'ftp_get.label Files GET'
exit 0 exit 0
fi fi
echo -en "ftp_put.value " echo -en "ftp_put.value "
echo $(grep "`date '+%Y-%m-%d'`" /var/log/pure-ftpd/transfer.log | grep [[:space:]]\\[\\]created[[:space:]] | wc -l) echo $(grep "`date '+%Y-%m-%d'`" /var/log/pure-ftpd/transfer.log | grep [[:space:]]\\[\\]created[[:space:]] | wc -l)
echo -n echo -n
echo -en "ftp_get.value " echo -en "ftp_get.value "
echo $(grep "`date '+%Y-%m-%d'`" /var/log/pure-ftpd/transfer.log | grep [[:space:]]\\[\\]sent[[:space:]] | wc -l) echo $(grep "`date '+%Y-%m-%d'`" /var/log/pure-ftpd/transfer.log | grep [[:space:]]\\[\\]sent[[:space:]] | wc -l)

View file

@ -1,96 +1,96 @@
#!/bin/bash #!/bin/bash
# -*- sh -*- # -*- sh -*-
: << =cut : << =cut
=head1 NAME =head1 NAME
glassfish_counters_ - Wildcard-plugin to monitor counters in GlassFish glassfish_counters_ - Wildcard-plugin to monitor counters in GlassFish
=head1 CONFIGURATION =head1 CONFIGURATION
This plugin does need the full path to the asadmin script: This plugin does need the full path to the asadmin script:
[glassfish_counters_*] [glassfish_counters_*]
env.ASADMIN /usr/local/glassfish/bin/asadmin env.ASADMIN /usr/local/glassfish/bin/asadmin
This is a wildcard plugin. To monitor an subtree, link This is a wildcard plugin. To monitor an subtree, link
glassfish_counters_<subtree> to this file. E.g. glassfish_counters_<subtree> to this file. E.g.
ln -s /usr/share/munin/plugins/glassfish_counters_ \ ln -s /usr/share/munin/plugins/glassfish_counters_ \
/etc/munin/plugins/glassfish_counters_server.web.request /etc/munin/plugins/glassfish_counters_server.web.request
...will monitor server.web.request.* ...will monitor server.web.request.*
To ignore certain counters, just add more "IGNORE" lines on top of To ignore certain counters, just add more "IGNORE" lines on top of
the awk script. (XXX: Fixme for env.) the awk script. (XXX: Fixme for env.)
=head1 AUTHOR =head1 AUTHOR
Philipp Buehler Philipp Buehler
=head1 LICENSE =head1 LICENSE
BSD 2-clause BSD 2-clause
=head1 VERSION =head1 VERSION
$Id: glassfish_counters_.in$ $Id: glassfish_counters_.in$
0.0.1 0.0.1
=cut =cut
[ -z $ASADMIN ] && { [ -z $ASADMIN ] && {
echo "ASADMIN not set in node configuration" echo "ASADMIN not set in node configuration"
exit 1 exit 1
} || MUN_AS_ADMIN=${ASADMIN} } || MUN_AS_ADMIN=${ASADMIN}
check_link () { check_link () {
scriptname=${0##*/} scriptname=${0##*/}
myself=${scriptname##*_} myself=${scriptname##*_}
if [ "x$myself" = "x" ] ; then if [ "x$myself" = "x" ] ; then
echo "plugin must be symlinked, e.g. to glassfish_counters_server.web.request" echo "plugin must be symlinked, e.g. to glassfish_counters_server.web.request"
exit 1 exit 1
fi fi
} }
SUBTREE=${0##*glassfish_counters_} SUBTREE=${0##*glassfish_counters_}
case $1 in case $1 in
suggest) suggest)
echo "not implemented" echo "not implemented"
exit 0 exit 0
;; ;;
config) config)
check_link check_link
$MUN_AS_ADMIN get -t --monitor=true "${SUBTREE}.*" | \ $MUN_AS_ADMIN get -t --monitor=true "${SUBTREE}.*" | \
awk 'BEGIN{ FS="[ = ]"} awk 'BEGIN{ FS="[ = ]"}
/requestcount/ { next; } # IGNORE /requestcount/ { next; } # IGNORE
/dotted-name/ { myself = $NF /dotted-name/ { myself = $NF
print "graph_title GlassFish", myself print "graph_title GlassFish", myself
print "graph_vlabel count" print "graph_vlabel count"
print "graph_category glassfish" print "graph_category glassfish"
print "graph_info this shows available counters from", myself print "graph_info this shows available counters from", myself
next next
} }
/-name / { nwhat = split($1, what, ".") /-name / { nwhat = split($1, what, ".")
gsub(/-name/, "", what[nwhat]) gsub(/-name/, "", what[nwhat])
print what[nwhat] ".label " $NF print what[nwhat] ".label " $NF
print what[nwhat] ".type GAUGE" print what[nwhat] ".type GAUGE"
} }
/-description / { nwhat = split($1, what, ".") /-description / { nwhat = split($1, what, ".")
gsub(/-description/, "", what[nwhat]) gsub(/-description/, "", what[nwhat])
$1 = ""; line = $0 $1 = ""; line = $0
gsub(/^ /,"", line) gsub(/^ /,"", line)
print what[nwhat] ".info " line print what[nwhat] ".info " line
} }
' '
exit 0 exit 0
;; ;;
esac esac
check_link check_link
$MUN_AS_ADMIN get -t --monitor=true "${SUBTREE}.*" | \ $MUN_AS_ADMIN get -t --monitor=true "${SUBTREE}.*" | \
awk 'BEGIN{ FS="[ = ]" } awk 'BEGIN{ FS="[ = ]" }
/requestcount/ { next;} # IGNORE /requestcount/ { next;} # IGNORE
/-count / { nwhat = split($1, what, ".") /-count / { nwhat = split($1, what, ".")
gsub(/-count/, "", what[nwhat]) gsub(/-count/, "", what[nwhat])
print what[nwhat] ".value " $NF} print what[nwhat] ".value " $NF}
' '

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
########################## ##########################
# googlecode_ # googlecode_
########################## ##########################

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# -*- sh -*- # -*- sh -*-
: << =cut : << =cut

View file

@ -1,161 +1,161 @@
#!/bin/bash #!/bin/bash
# #
#healthcheck on munin #healthcheck on munin
#egrep system log and alert. #egrep system log and alert.
# #
#programed by rti (hiroyuki fujie) super.rti@gmail.com @super_rti #programed by rti (hiroyuki fujie) super.rti@gmail.com @super_rti
#LICENSE: NYSL (public domain) #LICENSE: NYSL (public domain)
# #
# #
#config file #config file
# /etc/munin/plugin-conf.d/munin-node # /etc/munin/plugin-conf.d/munin-node
# #
#example minimum config #example minimum config
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_log] #[healthcheck_log]
#user root #user root
#env.log_1 /var/log/messages #env.log_1 /var/log/messages
#--------------------------------------------------- #---------------------------------------------------
# #
#check two log #check two log
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_log] #[healthcheck_log]
#user root #user root
#env.log_1 /var/log/messages #env.log_1 /var/log/messages
#env.log_2 /var/log/syslog #env.log_2 /var/log/syslog
#--------------------------------------------------- #---------------------------------------------------
# #
#check two three #check two three
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_log] #[healthcheck_log]
#user root #user root
#env.log_1 /var/log/messages #env.log_1 /var/log/messages
#env.log_2 /var/log/syslog #env.log_2 /var/log/syslog
#env.log_3 /var/log/dmesg #env.log_3 /var/log/dmesg
#--------------------------------------------------- #---------------------------------------------------
# #
#set name #set name
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_log] #[healthcheck_log]
#user root #user root
#env.log_1 /var/log/messages #env.log_1 /var/log/messages
#env.name_1 my_server_messages #env.name_1 my_server_messages
#--------------------------------------------------- #---------------------------------------------------
# #
#set egrep string #set egrep string
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_log] #[healthcheck_log]
#user root #user root
#env.log_1 /var/log/messages #env.log_1 /var/log/messages
#env.grep_1 alert|warning #env.grep_1 alert|warning
#--------------------------------------------------- #---------------------------------------------------
# #
#set egrep string #set egrep string
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_log] #[healthcheck_log]
#user root #user root
#env.log_1 /var/log/messages #env.log_1 /var/log/messages
#env.grep_1 alert|warning #env.grep_1 alert|warning
#--------------------------------------------------- #---------------------------------------------------
# #
#full option #full option
#/etc/munin/plugin-conf.d/munin-node #/etc/munin/plugin-conf.d/munin-node
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_log] #[healthcheck_log]
#user root #log file is read only root user. #user root #log file is read only root user.
#env.log_1 /var/log/messages #target log filename #env.log_1 /var/log/messages #target log filename
#env.grep_1 critical|error #egrep string. #env.grep_1 critical|error #egrep string.
#defualt by critical|error|warning|crash|fatal|kernel #defualt by critical|error|warning|crash|fatal|kernel
#--------------------------------------------------- #---------------------------------------------------
# #
#edakari speed up. #edakari speed up.
CHECKMAX=`env | grep log_ | wc -l` CHECKMAX=`env | grep log_ | wc -l`
let CHECKMAX="$CHECKMAX + 1" let CHECKMAX="$CHECKMAX + 1"
MINUTE_BY_GREP_RANGE=10 MINUTE_BY_GREP_RANGE=10
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ $CHECKMAX -le 1 ]; then if [ $CHECKMAX -le 1 ]; then
echo no echo no
exit 1 exit 1
fi fi
echo yes echo yes
exit 0 exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title log grep (match count)' echo 'graph_title log grep (match count)'
echo "graph_args --base 1000 -l 0 --vertical-label match_count" echo "graph_args --base 1000 -l 0 --vertical-label match_count"
echo 'graph_scale no' echo 'graph_scale no'
echo 'graph_vlabel match_count' echo 'graph_vlabel match_count'
echo 'graph_category healthcheck' echo 'graph_category healthcheck'
echo 'graph_info This graph shows the bad event count on log' echo 'graph_info This graph shows the bad event count on log'
for(( I = 1; I < $CHECKMAX; ++I )) for(( I = 1; I < $CHECKMAX; ++I ))
do do
eval log=\$log_${I} eval log=\$log_${I}
eval name=\$name_${I} eval name=\$name_${I}
eval grep=\$grep_${I} eval grep=\$grep_${I}
if [ "x${log}" = "x" ]; then if [ "x${log}" = "x" ]; then
continue continue
fi fi
if [ "x${name}" = "x" ]; then if [ "x${name}" = "x" ]; then
name=`echo $log | sed 's#[/|\.]#_#g'` name=`echo $log | sed 's#[/|\.]#_#g'`
fi fi
if [ "x${name}" = "x" ]; then if [ "x${name}" = "x" ]; then
grep="critical|error|crash|fatal|kernel" grep="critical|error|crash|fatal|kernel"
fi fi
echo "$name.label $name" echo "$name.label $name"
echo "$name.info egrep $grep $log | wc -l" echo "$name.info egrep $grep $log | wc -l"
echo "$name.draw LINE2" echo "$name.draw LINE2"
echo "$name.min 0" echo "$name.min 0"
echo "$name.max 20" echo "$name.max 20"
echo "$name.critical 0:0" echo "$name.critical 0:0"
done done
exit 0 exit 0
fi fi
NOWTIME=`date --date "$MINUTE_BY_GREP_RANGE minute ago" +%s` NOWTIME=`date --date "$MINUTE_BY_GREP_RANGE minute ago" +%s`
for(( I = 1; I < $CHECKMAX; ++I )) for(( I = 1; I < $CHECKMAX; ++I ))
do do
eval log=\$log_${I} eval log=\$log_${I}
eval name=\$name_${I} eval name=\$name_${I}
eval grep=\$grep_${I} eval grep=\$grep_${I}
if [ "x${log}" = "x" ]; then if [ "x${log}" = "x" ]; then
continue continue
fi fi
if [ "x${name}" = "x" ]; then if [ "x${name}" = "x" ]; then
name=`echo $log | sed 's#[/|\.]#_#g'` name=`echo $log | sed 's#[/|\.]#_#g'`
fi fi
if [ "x${grep}" = "x" ]; then if [ "x${grep}" = "x" ]; then
grep="critical|error|crash|fatal|kernel" grep="critical|error|crash|fatal|kernel"
fi fi
COUNT=0 COUNT=0
MESSAGE= MESSAGE=
IFS=$'\n' IFS=$'\n'
MATCHLINES=(`egrep -i "$grep" "$log"`) MATCHLINES=(`egrep -i "$grep" "$log"`)
for(( N = ${#MATCHLINES[@]} - 1; N >= 0 ; --N )) for(( N = ${#MATCHLINES[@]} - 1; N >= 0 ; --N ))
do do
LINE=${MATCHLINES[$N]} LINE=${MATCHLINES[$N]}
DATESTRING=`echo $LINE | awk '{ printf("%s %s %s",$1,$2,$3)}'` DATESTRING=`echo $LINE | awk '{ printf("%s %s %s",$1,$2,$3)}'`
LOGTIME=`date --date "$DATESTRING" +%s` LOGTIME=`date --date "$DATESTRING" +%s`
if [ $LOGTIME -lt $NOWTIME ]; then if [ $LOGTIME -lt $NOWTIME ]; then
break break
fi fi
let COUNT="$COUNT + 1" let COUNT="$COUNT + 1"
MESSAGE="$MESSAGE$LINE //@LINE@// " MESSAGE="$MESSAGE$LINE //@LINE@// "
done done
if [ $COUNT -eq 0 ]; then if [ $COUNT -eq 0 ]; then
echo "${name}.value 0" echo "${name}.value 0"
else else
echo "${name}.value ${COUNT}" echo "${name}.value ${COUNT}"
echo "${name}.extinfo ${MESSAGE}" echo "${name}.extinfo ${MESSAGE}"
fi fi
done done

View file

@ -1,92 +1,92 @@
#!/bin/bash #!/bin/bash
# #
#healthcheck on munin #healthcheck on munin
#check process and alert. #check process and alert.
# #
#programed by rti (hiroyuki fujie) super.rti@gmail.com @super_rti #programed by rti (hiroyuki fujie) super.rti@gmail.com @super_rti
#LICENSE: NYSL (public domain) #LICENSE: NYSL (public domain)
# #
#config file #config file
# /etc/munin/plugin-conf.d/munin-node # /etc/munin/plugin-conf.d/munin-node
# #
#example minimum config #example minimum config
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_process] #[healthcheck_process]
#env.process_1 httpd #env.process_1 httpd
#--------------------------------------------------- #---------------------------------------------------
# #
#chcek two process #chcek two process
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_process] #[healthcheck_process]
#env.process_1 httpd #env.process_1 httpd
#env.process_2 samba #env.process_2 samba
#--------------------------------------------------- #---------------------------------------------------
# #
#chcek three process #chcek three process
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_process] #[healthcheck_process]
#env.process_1 httpd #env.process_1 httpd
#env.process_2 samba #env.process_2 samba
#env.process_3 mysqld #env.process_3 mysqld
#--------------------------------------------------- #---------------------------------------------------
# #
# #
# #
#edakari speed up. #edakari speed up.
CHECKMAX=`env | grep process_ | wc -l` CHECKMAX=`env | grep process_ | wc -l`
let CHECKMAX="$CHECKMAX + 1" let CHECKMAX="$CHECKMAX + 1"
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ $CHECKMAX -le 1 ]; then if [ $CHECKMAX -le 1 ]; then
echo no echo no
exit 1 exit 1
fi fi
echo yes echo yes
exit 0 exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title process memory Usage(MB)' echo 'graph_title process memory Usage(MB)'
echo "graph_args --base 1000 -l 0 --vertical-label MB" echo "graph_args --base 1000 -l 0 --vertical-label MB"
echo 'graph_scale no' echo 'graph_scale no'
echo 'graph_vlabel process memory' echo 'graph_vlabel process memory'
echo 'graph_category healthcheck' echo 'graph_category healthcheck'
echo 'graph_info This graph shows the Memory used by process' echo 'graph_info This graph shows the Memory used by process'
for(( I = 1; I < $CHECKMAX; ++I )) for(( I = 1; I < $CHECKMAX; ++I ))
do do
eval process=\$process_${I} eval process=\$process_${I}
eval alertmemory=\$alertmemory_${I} eval alertmemory=\$alertmemory_${I}
if [ "x${process}" = "x" ]; then if [ "x${process}" = "x" ]; then
continue continue
fi fi
echo "$process.label $process" echo "$process.label $process"
echo "$process.info Memory used by $process" echo "$process.info Memory used by $process"
echo "$process.draw LINE2" echo "$process.draw LINE2"
echo "$process.min -10" echo "$process.min -10"
echo "$process.critical 0:" echo "$process.critical 0:"
done done
exit 0 exit 0
fi fi
for(( I = 1; I < $CHECKMAX; ++I )) for(( I = 1; I < $CHECKMAX; ++I ))
do do
eval process=\$process_${I} eval process=\$process_${I}
if [ "x${process}" = "x" ]; then if [ "x${process}" = "x" ]; then
continue continue
fi fi
vrets=(`ps u --no-headers -C $process | awk 'BEGIN { count = 0 ; sum = 0; } { count ++ ; sum += $6/1024 ; } END { printf("%d %d\n",count,sum); }'`) vrets=(`ps u --no-headers -C $process | awk 'BEGIN { count = 0 ; sum = 0; } { count ++ ; sum += $6/1024 ; } END { printf("%d %d\n",count,sum); }'`)
count=${vrets[0]} count=${vrets[0]}
value=${vrets[1]} value=${vrets[1]}
if [ $count -le 0 ]; then if [ $count -le 0 ]; then
echo "$process.value -10" echo "$process.value -10"
echo "$process.extinfo process down" echo "$process.extinfo process down"
else else
echo "$process.value $value" echo "$process.value $value"
fi fi
done done

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Plugin to graph response times of the specified websites/URLs. # Plugin to graph response times of the specified websites/URLs.
# #

View file

@ -1,4 +1,4 @@
#! @@PERL@@ -w #!/usr/bin/perl
# -*- perl -*- # -*- perl -*-
=pod =pod

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
do_config() { do_config() {
graph=( 2 # number of graphs. graph=( 2 # number of graphs.

View file

@ -1,53 +1,53 @@
#!/bin/bash #!/bin/bash
# #
# Plugin to monitor incoming mails greylisted by postfix-policyd # Plugin to monitor incoming mails greylisted by postfix-policyd
# #
# Parameters understood: # Parameters understood:
# #
# config (required) # config (required)
# autoconf (optional) # autoconf (optional)
# #
MYSQL_USER="postfix-policyd" MYSQL_USER="postfix-policyd"
MYSQL_PASS="" MYSQL_PASS=""
MYSQL_DB="postfixpolicyd" MYSQL_DB="postfixpolicyd"
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -n "${MYSQL_PASS}" ] ; then if [ -n "${MYSQL_PASS}" ] ; then
echo yes echo yes
exit 0 exit 0
else else
echo "no (set mysql pass)" echo "no (set mysql pass)"
exit 1 exit 1
fi fi
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title Postfix-Policyd daily filtering' echo 'graph_title Postfix-Policyd daily filtering'
echo 'graph_order delayed passed whitelisted' echo 'graph_order delayed passed whitelisted'
echo 'graph_category mail' echo 'graph_category mail'
echo 'graph_vlabel Count' echo 'graph_vlabel Count'
echo 'graph_scale no' echo 'graph_scale no'
## echo 'graph_args --base 1000 -l 0' ## echo 'graph_args --base 1000 -l 0'
echo 'delayed.label delayed' echo 'delayed.label delayed'
echo 'delayed.type GAUGE' echo 'delayed.type GAUGE'
echo 'passed.label passed' echo 'passed.label passed'
echo 'passed.type GAUGE' echo 'passed.type GAUGE'
echo 'whitelisted.label whitelisted' echo 'whitelisted.label whitelisted'
echo 'whitelisted.type GAUGE' echo 'whitelisted.type GAUGE'
echo 'blacklisted.label blacklisted' echo 'blacklisted.label blacklisted'
echo 'blacklisted.type GAUGE' echo 'blacklisted.type GAUGE'
exit 0 exit 0
fi fi
DELAYED="`echo "SELECT COUNT(*) FROM triplet WHERE _count = 0" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | egrep [0-9]`" DELAYED="`echo "SELECT COUNT(*) FROM triplet WHERE _count = 0" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | egrep [0-9]`"
PASSED="`echo "SELECT COUNT(*) FROM triplet WHERE _count != 0" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | egrep [0-9]`" PASSED="`echo "SELECT COUNT(*) FROM triplet WHERE _count != 0" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | egrep [0-9]`"
WHITELISTED="`echo "SELECT COUNT(*) FROM whitelist" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | egrep [0-9]`" WHITELISTED="`echo "SELECT COUNT(*) FROM whitelist" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | egrep [0-9]`"
BLACKLISTED="`echo "SELECT COUNT(*) FROM blacklist" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | egrep [0-9]`" BLACKLISTED="`echo "SELECT COUNT(*) FROM blacklist" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | egrep [0-9]`"
echo "delayed.value ${DELAYED}" echo "delayed.value ${DELAYED}"
echo "passed.value ${PASSED}" echo "passed.value ${PASSED}"
echo "whitelisted.value ${WHITELISTED}" echo "whitelisted.value ${WHITELISTED}"
echo "blacklisted.value ${BLACKLISTED}" echo "blacklisted.value ${BLACKLISTED}"

View file

@ -1,4 +1,4 @@
#! @@PERL@@ -w #!/usr/bin/perl
# -*- perl -*- # -*- perl -*-
=head1 NAME =head1 NAME

View file

@ -92,7 +92,7 @@ graph_vlabel ${vlabel}
graph_category ${category} graph_category ${category}
graph_info ${info} graph_info ${info}
EOH1 EOH1
[[ -n "${period}" ]] && echo "graph_period ${period}" [ -n "${period}" ] && echo "graph_period ${period}"
I=1 I=1
for name in ${names}; do for name in ${names}; do
eval iquery='${query_'${name}'}' eval iquery='${query_'${name}'}'

View file

@ -71,7 +71,8 @@
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
use DBI; use DBI;
use MythTV; eval 'use MythTV; 1;'
or die 'Please install MythTV';
use strict; use strict;
use warnings; use warnings;
use Munin::Plugin; use Munin::Plugin;

View file

@ -1,4 +1,4 @@
#!/usr/bin/ruby -rauto_gem #!/usr/bin/ruby
# #
# Munin plugin for the D-link DIR-655 router # Munin plugin for the D-link DIR-655 router
# #

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# #
# Munin plugin to show changing the ip address by ddclient. # Munin plugin to show changing the ip address by ddclient.

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Wildcard-plugin to monitor IP addresses through iptables. To monitor an # Wildcard-plugin to monitor IP addresses through iptables. To monitor an
# IP, link fwbuilder_<ipaddress> to this file. E.g. # IP, link fwbuilder_<ipaddress> to this file. E.g.

View file

@ -1,154 +1,154 @@
#!/bin/sh #!/bin/bash
# #
# Munin plugin for HFSC Traffic Shaping Statistics # Munin plugin for HFSC Traffic Shaping Statistics
# #
# It shows the general statistic graph of a used net bandwidth per a user. # It shows the general statistic graph of a used net bandwidth per a user.
# #
# This plugin was tailored to the HFSC solution # This plugin was tailored to the HFSC solution
# presented at http://www.elessar.one.pl/article_kernel2.6.php # presented at http://www.elessar.one.pl/article_kernel2.6.php
# #
# You can find the plugin description and the installation notes here: # You can find the plugin description and the installation notes here:
# http://www.elessar.one.pl/article_munin.php # http://www.elessar.one.pl/article_munin.php
# #
### ###
# Written by Rafal Rajs # Written by Rafal Rajs
# Date: 2007/06/19 # Date: 2007/06/19
# Email: elessar1@poczta.wp.pl # Email: elessar1@poczta.wp.pl
# WWW: http://www.elessar.one.pl # WWW: http://www.elessar.one.pl
### ###
#path to the file with global defs #path to the file with global defs
. /etc/scripts/globals . /etc/scripts/globals
# imported from HFSC script # imported from HFSC script
# set class numbers # set class numbers
N_CLASS_D_1=70 N_CLASS_D_1=70
N_CLASS_D_2=100 N_CLASS_D_2=100
N_CLASS_U_1=130 N_CLASS_U_1=130
N_CLASS_U_2=160 N_CLASS_U_2=160
SH_TMP="/etc/scripts/tmp.txt" SH_TMP="/etc/scripts/tmp.txt"
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo "graph_title HFSC Traffic Shaping Stats" echo "graph_title HFSC Traffic Shaping Stats"
echo 'graph_vlabel bytes per ${graph_period}' echo 'graph_vlabel bytes per ${graph_period}'
echo 'graph_category network' echo 'graph_category network'
j=1 j=1
while [ $j -le $L_USERS ] while [ $j -le $L_USERS ]
do do
echo "${USERNAMES[${j}]}.label ${USERNAMES[${j}]}" echo "${USERNAMES[${j}]}.label ${USERNAMES[${j}]}"
echo "${USERNAMES[${j}]}.type COUNTER" echo "${USERNAMES[${j}]}.type COUNTER"
if [ $j == 1 ]; then if [ $j == 1 ]; then
echo "${USERNAMES[${j}]}.draw AREA" echo "${USERNAMES[${j}]}.draw AREA"
else else
echo "${USERNAMES[${j}]}.draw STACK" echo "${USERNAMES[${j}]}.draw STACK"
fi; fi;
echo "${USERNAMES[${j}]}.info Stats for ${USERNAMES[${j}]} - ${USER_IP[${j}]}" echo "${USERNAMES[${j}]}.info Stats for ${USERNAMES[${j}]} - ${USER_IP[${j}]}"
echo "${USERNAMES[${j}]}.min 0" echo "${USERNAMES[${j}]}.min 0"
echo "${USERNAMES[${j}]}.max 130000" echo "${USERNAMES[${j}]}.max 130000"
j=$[$j+1] j=$[$j+1]
done; done;
#customized colours #customized colours
echo 'Serwer.colour 000000' echo 'Serwer.colour 000000'
exit 0 exit 0
fi; fi;
#### DOWNLOAD #### DOWNLOAD
temp1=`/sbin/tc -s class show dev imq0 > $SH_TMP` temp1=`/sbin/tc -s class show dev imq0 > $SH_TMP`
while read line while read line
do do
test_hfsc=`echo $line | grep "hfsc"` test_hfsc=`echo $line | grep "hfsc"`
j=1 j=1
while [ $j -le $L_USERS ] while [ $j -le $L_USERS ]
do do
case $test_hfsc in case $test_hfsc in
*hfsc[\ ]1:$[$N_CLASS_D_1+$j]*) *hfsc[\ ]1:$[$N_CLASS_D_1+$j]*)
# check N_CLASS_D_1 stats for every user # check N_CLASS_D_1 stats for every user
read line read line
temp1=`echo $line | awk '{ print $2; }'` temp1=`echo $line | awk '{ print $2; }'`
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1] STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
# echo "N_CLASS_D_1="$temp1 # echo "N_CLASS_D_1="$temp1
# echo "N_CLASS_D_1_SUM "$j" ="${STAT_USER[$j]} # echo "N_CLASS_D_1_SUM "$j" ="${STAT_USER[$j]}
;; ;;
*hfsc[\ ]1:$[$N_CLASS_D_2+$j]*) *hfsc[\ ]1:$[$N_CLASS_D_2+$j]*)
# check N_CLASS_D_2 stats for every user # check N_CLASS_D_2 stats for every user
read line read line
temp1=`echo $line | awk '{ print $2; }'` temp1=`echo $line | awk '{ print $2; }'`
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1] STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
# echo "N_CLASS_D_2="$temp1 # echo "N_CLASS_D_2="$temp1
# echo "N_CLASS_D_2_SUM "$j" ="${STAT_USER[$j]} # echo "N_CLASS_D_2_SUM "$j" ="${STAT_USER[$j]}
;; ;;
esac esac
j=$[$j+1] j=$[$j+1]
done; done;
done < $SH_TMP done < $SH_TMP
#### UPLOAD #### UPLOAD
temp1=`/sbin/tc -s class show dev imq1 > $SH_TMP` temp1=`/sbin/tc -s class show dev imq1 > $SH_TMP`
while read line while read line
do do
test_hfsc=`echo $line | grep "hfsc"` test_hfsc=`echo $line | grep "hfsc"`
j=1 j=1
while [ $j -le $L_USERS ] while [ $j -le $L_USERS ]
do do
case $test_hfsc in case $test_hfsc in
*hfsc[\ ]1:$[$N_CLASS_U_1+$j]*) *hfsc[\ ]1:$[$N_CLASS_U_1+$j]*)
# check N_CLASS_U_1 stats for every user # check N_CLASS_U_1 stats for every user
read line read line
temp1=`echo $line | awk '{ print $2; }'` temp1=`echo $line | awk '{ print $2; }'`
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1] STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
# echo "N_CLASS_U_1="$temp1 # echo "N_CLASS_U_1="$temp1
# echo "N_CLASS_U_1_SUM "$j" ="${STAT_USER[$j]} # echo "N_CLASS_U_1_SUM "$j" ="${STAT_USER[$j]}
;; ;;
*hfsc[\ ]1:$[$N_CLASS_U_2+$j]*) *hfsc[\ ]1:$[$N_CLASS_U_2+$j]*)
# check N_CLASS_U_2 stats for every user # check N_CLASS_U_2 stats for every user
read line read line
temp1=`echo $line | awk '{ print $2; }'` temp1=`echo $line | awk '{ print $2; }'`
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1] STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
# echo "N_CLASS_U_2="$temp1 # echo "N_CLASS_U_2="$temp1
# echo "N_CLASS_U_2_SUM "$j" ="${STAT_USER[$j]} # echo "N_CLASS_U_2_SUM "$j" ="${STAT_USER[$j]}
;; ;;
esac esac
j=$[$j+1] j=$[$j+1]
done; done;
done < $SH_TMP done < $SH_TMP
j=1 j=1
while [ $j -le $L_USERS ] while [ $j -le $L_USERS ]
do do
echo ${USERNAMES[${j}]}".value "${STAT_USER[$j]} echo ${USERNAMES[${j}]}".value "${STAT_USER[$j]}
j=$[$j+1] j=$[$j+1]
done; done;
## clean temp file ## clean temp file
temp1=`echo "" > $SH_TMP` temp1=`echo "" > $SH_TMP`

View file

@ -1,189 +1,189 @@
#!/bin/sh #!/bin/bash
# #
# Munin plugin for HFSC Traffic Shaping Statistics UP/DOWN # Munin plugin for HFSC Traffic Shaping Statistics UP/DOWN
# #
# It shows the download and upload statistic graph of a used net bandwidth per a user. # It shows the download and upload statistic graph of a used net bandwidth per a user.
# #
# This plugin was tailored to the HFSC solution # This plugin was tailored to the HFSC solution
# presented at http://www.elessar.one.pl/article_kernel2.6.php # presented at http://www.elessar.one.pl/article_kernel2.6.php
# #
# You can find the plugin description and the installation notes here: # You can find the plugin description and the installation notes here:
# http://www.elessar.one.pl/article_munin.php # http://www.elessar.one.pl/article_munin.php
# #
### ###
# Written by Rafal Rajs # Written by Rafal Rajs
# Date: 2007/06/19 # Date: 2007/06/19
# Email: elessar1@poczta.wp.pl # Email: elessar1@poczta.wp.pl
# WWW: http://www.elessar.one.pl # WWW: http://www.elessar.one.pl
### ###
# path to the file with global defs # path to the file with global defs
. /etc/scripts/globals . /etc/scripts/globals
# imported from HFSC script # imported from HFSC script
# set class numbers # set class numbers
N_CLASS_D_1=70 N_CLASS_D_1=70
N_CLASS_D_2=100 N_CLASS_D_2=100
N_CLASS_U_1=130 N_CLASS_U_1=130
N_CLASS_U_2=160 N_CLASS_U_2=160
SH_TMP="/etc/scripts/tmp1.txt" SH_TMP="/etc/scripts/tmp1.txt"
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo "graph_title HFSC Traffic Shaping Stats - UP/DOWN" echo "graph_title HFSC Traffic Shaping Stats - UP/DOWN"
echo 'graph_vlabel bytes DOWN(-)/UP(+) per ${graph_period}' echo 'graph_vlabel bytes DOWN(-)/UP(+) per ${graph_period}'
echo 'graph_width 450' echo 'graph_width 450'
echo 'graph_category network' echo 'graph_category network'
j=1 j=1
while [ $j -le $L_USERS ] while [ $j -le $L_USERS ]
do do
echo "${USERNAMES[${j}]}_down.label ${USERNAMES[${j}]}" echo "${USERNAMES[${j}]}_down.label ${USERNAMES[${j}]}"
echo "${USERNAMES[${j}]}_down.type COUNTER" echo "${USERNAMES[${j}]}_down.type COUNTER"
echo "${USERNAMES[${j}]}_down.graph no" echo "${USERNAMES[${j}]}_down.graph no"
if [ $j == 1 ]; then if [ $j == 1 ]; then
echo "${USERNAMES[${j}]}_down.draw AREA" echo "${USERNAMES[${j}]}_down.draw AREA"
else else
echo "${USERNAMES[${j}]}_down.draw STACK" echo "${USERNAMES[${j}]}_down.draw STACK"
fi; fi;
echo "${USERNAMES[${j}]}_down.info Stats for ${USERNAMES[${j}]} - ${USER_IP[${j}]}" echo "${USERNAMES[${j}]}_down.info Stats for ${USERNAMES[${j}]} - ${USER_IP[${j}]}"
echo "${USERNAMES[${j}]}_down.min 0" echo "${USERNAMES[${j}]}_down.min 0"
echo "${USERNAMES[${j}]}_down.max 130000" echo "${USERNAMES[${j}]}_down.max 130000"
echo "${USERNAMES[${j}]}_up.label ${USERNAMES[${j}]}" echo "${USERNAMES[${j}]}_up.label ${USERNAMES[${j}]}"
echo "${USERNAMES[${j}]}_up.type COUNTER" echo "${USERNAMES[${j}]}_up.type COUNTER"
echo "${USERNAMES[${j}]}_up.negative ${USERNAMES[${j}]}_down" echo "${USERNAMES[${j}]}_up.negative ${USERNAMES[${j}]}_down"
if [ $j == 1 ]; then if [ $j == 1 ]; then
echo "${USERNAMES[${j}]}_up.draw AREA" echo "${USERNAMES[${j}]}_up.draw AREA"
else else
echo "${USERNAMES[${j}]}_up.draw STACK" echo "${USERNAMES[${j}]}_up.draw STACK"
fi; fi;
echo "${USERNAMES[${j}]}_up.info Stats for ${USERNAMES[${j}]} - ${USER_IP[${j}]}" echo "${USERNAMES[${j}]}_up.info Stats for ${USERNAMES[${j}]} - ${USER_IP[${j}]}"
echo "${USERNAMES[${j}]}_up.min 0" echo "${USERNAMES[${j}]}_up.min 0"
echo "${USERNAMES[${j}]}_up.max 30000" echo "${USERNAMES[${j}]}_up.max 30000"
j=$[$j+1] j=$[$j+1]
done; done;
#customized colours #customized colours
echo 'Serwer_down.colour 000000' echo 'Serwer_down.colour 000000'
echo 'Serwer_up.colour 000000' echo 'Serwer_up.colour 000000'
exit 0 exit 0
fi; fi;
#### DOWNLOAD #### DOWNLOAD
temp1=`/sbin/tc -s class show dev imq0 > $SH_TMP` temp1=`/sbin/tc -s class show dev imq0 > $SH_TMP`
while read line while read line
do do
test_hfsc=`echo $line | grep "hfsc"` test_hfsc=`echo $line | grep "hfsc"`
j=1 j=1
while [ $j -le $L_USERS ] while [ $j -le $L_USERS ]
do do
case $test_hfsc in case $test_hfsc in
*hfsc[\ ]1:$[$N_CLASS_D_1+$j]*) *hfsc[\ ]1:$[$N_CLASS_D_1+$j]*)
# check N_CLASS_D_1 stats for every user # check N_CLASS_D_1 stats for every user
read line read line
temp1=`echo $line | awk '{ print $2; }'` temp1=`echo $line | awk '{ print $2; }'`
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1] STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
# echo "N_CLASS_D_1="$temp1 # echo "N_CLASS_D_1="$temp1
# echo "N_CLASS_D_1_SUM "$j" ="${STAT_USER[$j]} # echo "N_CLASS_D_1_SUM "$j" ="${STAT_USER[$j]}
;; ;;
*hfsc[\ ]1:$[$N_CLASS_D_2+$j]*) *hfsc[\ ]1:$[$N_CLASS_D_2+$j]*)
# check N_CLASS_D_2 stats for every user # check N_CLASS_D_2 stats for every user
read line read line
temp1=`echo $line | awk '{ print $2; }'` temp1=`echo $line | awk '{ print $2; }'`
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1] STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
# echo "N_CLASS_D_2="$temp1 # echo "N_CLASS_D_2="$temp1
# echo "N_CLASS_D_2_SUM "$j" ="${STAT_USER[$j]} # echo "N_CLASS_D_2_SUM "$j" ="${STAT_USER[$j]}
;; ;;
esac esac
j=$[$j+1] j=$[$j+1]
done; done;
done < $SH_TMP done < $SH_TMP
#### ####
j=1 j=1
while [ $j -le $L_USERS ] while [ $j -le $L_USERS ]
do do
echo ${USERNAMES[${j}]}"_down.value "${STAT_USER[$j]} echo ${USERNAMES[${j}]}"_down.value "${STAT_USER[$j]}
j=$[$j+1] j=$[$j+1]
done; done;
#reset values #reset values
j=1 j=1
while [ $j -le $L_USERS ] while [ $j -le $L_USERS ]
do do
STAT_USER[$j]=0 STAT_USER[$j]=0
j=$[$j+1] j=$[$j+1]
done; done;
#### UPLOAD #### UPLOAD
temp1=`/sbin/tc -s class show dev imq1 > $SH_TMP` temp1=`/sbin/tc -s class show dev imq1 > $SH_TMP`
while read line while read line
do do
test_hfsc=`echo $line | grep "hfsc"` test_hfsc=`echo $line | grep "hfsc"`
j=1 j=1
while [ $j -le $L_USERS ] while [ $j -le $L_USERS ]
do do
case $test_hfsc in case $test_hfsc in
*hfsc[\ ]1:$[$N_CLASS_U_1+$j]*) *hfsc[\ ]1:$[$N_CLASS_U_1+$j]*)
# check N_CLASS_U_1 stats for every user # check N_CLASS_U_1 stats for every user
read line read line
temp1=`echo $line | awk '{ print $2; }'` temp1=`echo $line | awk '{ print $2; }'`
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1] STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
# echo "N_CLASS_U_1="$temp1 # echo "N_CLASS_U_1="$temp1
# echo "N_CLASS_U_1_SUM "$j" ="${STAT_USER[$j]} # echo "N_CLASS_U_1_SUM "$j" ="${STAT_USER[$j]}
;; ;;
*hfsc[\ ]1:$[$N_CLASS_U_2+$j]*) *hfsc[\ ]1:$[$N_CLASS_U_2+$j]*)
# check N_CLASS_U_2 stats for every user # check N_CLASS_U_2 stats for every user
read line read line
temp1=`echo $line | awk '{ print $2; }'` temp1=`echo $line | awk '{ print $2; }'`
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1] STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
# echo "N_CLASS_U_2="$temp1 # echo "N_CLASS_U_2="$temp1
# echo "N_CLASS_U_2_SUM "$j" ="${STAT_USER[$j]} # echo "N_CLASS_U_2_SUM "$j" ="${STAT_USER[$j]}
;; ;;
esac esac
j=$[$j+1] j=$[$j+1]
done; done;
done < $SH_TMP done < $SH_TMP
j=1 j=1
while [ $j -le $L_USERS ] while [ $j -le $L_USERS ]
do do
echo ${USERNAMES[${j}]}"_up.value "${STAT_USER[$j]} echo ${USERNAMES[${j}]}"_up.value "${STAT_USER[$j]}
j=$[$j+1] j=$[$j+1]
done; done;
## clean temp file ## clean temp file
temp1=`echo "" > $SH_TMP` temp1=`echo "" > $SH_TMP`

View file

@ -84,7 +84,7 @@ IFACES=`$iptables -L munin_node -nvx | awk '$6 ~ /(eth|ppp)[0-9]/ { if (done[$6]
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
# echo "graph_order out in" # echo "graph_order out in"
if [ "$TYPE" == "pkts" ]; then if [ "$TYPE" = "pkts" ]; then
echo "graph_title pkts" echo "graph_title pkts"
echo 'graph_vlabel pkts per ${graph_period}' echo 'graph_vlabel pkts per ${graph_period}'
else else
@ -107,7 +107,7 @@ if [ "$1" = "config" ]; then
exit 0 exit 0
fi; fi;
if [ "$TYPE" == "pkts" ]; then if [ "$TYPE" = "pkts" ]; then
$iptables -L munin_node -nvx | egrep "eth|ppp" | awk "{ print \$6 \".value \" \$1 }" $iptables -L munin_node -nvx | egrep "eth|ppp" | awk "{ print \$6 \".value \" \$1 }"
else else
$iptables -L munin_node -nvx | egrep "eth|ppp" | awk "{ print \$6 \".value \" \$2 }" $iptables -L munin_node -nvx | egrep "eth|ppp" | awk "{ print \$6 \".value \" \$2 }"

View file

@ -55,6 +55,7 @@ NETSTAT=${netstat:-`which netstat`}
NETSTAT=${NETSTAT:-/usr/bin/netstat} NETSTAT=${NETSTAT:-/usr/bin/netstat}
PORTS=${ports:-389 636} PORTS=${ports:-389 636}
TEMP_FILE=$(mktemp /tmp/munin_ldap.XXXXXX) TEMP_FILE=$(mktemp /tmp/munin_ldap.XXXXXX)
trap "rm -f ${TEMP_FILE}" EXIT
PATH=/bin:/usr/bin:/usr/local/bin PATH=/bin:/usr/bin:/usr/local/bin
SOCKET=${socket:-/var/run/openldap/ldapi} SOCKET=${socket:-/var/run/openldap/ldapi}
@ -96,7 +97,7 @@ if [ "$1" = "autoconf" ]; then
for port in $PORTS; do for port in $PORTS; do
ONE_LISTENING=${ONE_LISTENING}$(find_ips_bound $port) ONE_LISTENING=${ONE_LISTENING}$(find_ips_bound $port)
done done
rm -f $TEMP_FILE
if [ -n "$ONE_LISTENING" ]; then if [ -n "$ONE_LISTENING" ]; then
echo yes echo yes
exit 0 exit 0
@ -121,17 +122,26 @@ if [ "$1" = "config" ]; then
echo "socket.label ldapi" echo "socket.label ldapi"
fi fi
fi fi
rm -f $TEMP_FILE
exit 0 exit 0
fi fi
for port in $LISTENING_PORTS; do for port in $LISTENING_PORTS; do
for ip in $(find_ips_bound $port); do for ip in $(find_ips_bound $port); do
echo "$(echo $ip | sed 's/\./_/g')_${port}.value $(grep "^tcp[46]\{0,1\}\([[:space:]]\{1,\}[[:digit:]]\{1,\}\)\{2\}[[:space:]]\{1,\}$ip[\.:]$port[[:space:]].*ESTABLISHED$" $TEMP_FILE | wc -l | sed 's/[[:space:]]*//g')"
label=$(printf "%s_%d" "$(echo $ip | tr ':.' '_')" "$port")
connections=$(
awk -v ip_port="${ip}:${port}" \
'BEGIN { counter=0 }
$1 ~ /tcp[46]?/ && $4 == ip_port && $6 == "ESTABLISHED" { counter++ }
END { print counter }' \
$TEMP_FILE
)
printf "%s.value %d\n" "$label" "$connections"
done done
done done
if [ -e "$SOCKET" ]; then if [ -e "$SOCKET" ]; then
echo "socket.value $($NETSTAT -an ${FAMILYMARK}unix | grep $SOCKET | wc -l | sed 's/[[:space:]]*//g')" echo "socket.value $($NETSTAT -an ${FAMILYMARK}unix | grep $SOCKET | wc -l | sed 's/[[:space:]]*//g')"
fi fi
rm -f $TEMP_FILE

View file

@ -72,7 +72,14 @@ USA.
use strict; use strict;
use warnings; use warnings;
use threads;
# This evil "eval" is to make Travis CI able to test the plugin syntax
# without having a perl built with threads.
#
# Also: The use of interpreter-based threads in perl is officially
# discouraged.
eval 'use threads; 1;' or die 'Could not use threads';
use Net::Ping; use Net::Ping;
my (%defaults, @hosts, $cmd_arg); my (%defaults, @hosts, $cmd_arg);

View file

@ -1,60 +1,60 @@
#!/bin/sh #!/bin/sh
# #
# Copyright (c) 2009 Sven-Hendrik Haase # Copyright (c) 2009 Sven-Hendrik Haase
# Copyright (C) 2004 Jimmy Olsen # Copyright (C) 2004 Jimmy Olsen
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 dated June, # as published by the Free Software Foundation; version 2 dated June,
# 1991. # 1991.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
# #
# Plugin to monitor packet loss # Plugin to monitor packet loss
# #
# Please note that sometimes it can take quite long for the plugin to return # Please note that sometimes it can take quite long for the plugin to return
# a value on a network with lots of packet loss. # a value on a network with lots of packet loss.
# You therefore need to account for it by appending the following to your # You therefore need to account for it by appending the following to your
# plugin-conf.d/munin-node. Remember to restart munin-node afterwards. # plugin-conf.d/munin-node. Remember to restart munin-node afterwards.
# Append the next 3 lines to plugin-conf.d/munin-node: # Append the next 3 lines to plugin-conf.d/munin-node:
# [packetloss_*] # [packetloss_*]
# timeout 60 # timeout 60
# user root # user root
# #
# Parameters: # Parameters:
# #
# ping_args - Arguments to ping (default "-c 2") # ping_args - Arguments to ping (default "-c 2")
# ping_args2 - Arguments after the host name (required for Solaris) # ping_args2 - Arguments after the host name (required for Solaris)
# ping - Ping program to use # ping - Ping program to use
# host - Host to ping # host - Host to ping
# #
# Arguments for Solaris: # Arguments for Solaris:
# ping_args -s # ping_args -s
# ping_args2 56 2 # ping_args2 56 2
# #
#%# family=manual #%# family=manual
file_host=`basename $0 | sed 's/^packetloss_//g'` file_host=`basename $0 | sed 's/^packetloss_//g'`
host=${host:-${file_host:-www.google.com}} host=${host:-${file_host:-www.google.com}}
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo "graph_title Packet loss to $host (in %)" echo "graph_title Packet loss to $host (in %)"
echo 'graph_args --upper-limit 100 -l 0' echo 'graph_args --upper-limit 100 -l 0'
echo 'graph_vlabel %' echo 'graph_vlabel %'
echo 'graph_category network' echo 'graph_category network'
echo 'graph_info This graph shows packet loss statistics.' echo 'graph_info This graph shows packet loss statistics.'
echo "packetloss.label $host" echo "packetloss.label $host"
echo "packetloss.info Packet loss statistics for $host." echo "packetloss.info Packet loss statistics for $host."
echo 'packetloss.draw LINE2' echo 'packetloss.draw LINE2'
exit 0 exit 0
fi fi
${ping:-ping} ${ping_args:-'-c 10'} ${host} ${ping_args2} | perl -n -e 'print "packetloss.value $1\n" if /(\d+)% packet loss/;' ${ping:-ping} ${ping_args:-'-c 10'} ${host} ${ping_args2} | perl -n -e 'print "packetloss.value $1\n" if /(\d+)% packet loss/;'

View file

@ -1,42 +1,42 @@
#!/bin/sh #!/bin/sh
# #
PATH=/bin:/usr/bin PATH=/bin:/usr/bin
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
echo yes echo yes
exit 0 exit 0
fi fi
DAEMONS=`sockstat | awk '{print substr($0, 1, 8)}' | sort | uniq` DAEMONS=`sockstat | awk '{print substr($0, 1, 8)}' | sort | uniq`
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title Connections' echo 'graph_title Connections'
echo 'graph_vlabel Connections' echo 'graph_vlabel Connections'
echo 'graph_noscale true' echo 'graph_noscale true'
echo 'graph_category network' echo 'graph_category network'
echo 'graph_info This graph shows connections load.' echo 'graph_info This graph shows connections load.'
for D in $DAEMONS for D in $DAEMONS
do do
echo "_$D.label $D" echo "_$D.label $D"
done done
echo "_TOTAL.label TOTAL" echo "_TOTAL.label TOTAL"
exit 0 exit 0
fi fi
VALUES=`sockstat | awk '{print substr($0, 1, 8)}' | sort | uniq -c` VALUES=`sockstat | awk '{print substr($0, 1, 8)}' | sort | uniq -c`
NUM=1 NUM=1
for D in $DAEMONS for D in $DAEMONS
do do
echo -n "_$D.value " echo -n "_$D.value "
VAL=`echo $VALUES | cut -d ' ' -f $NUM` VAL=`echo $VALUES | cut -d ' ' -f $NUM`
echo $VAL echo $VAL
NUM=$(($NUM + 2)) NUM=$(($NUM + 2))
done done
echo -n "_TOTAL.value " echo -n "_TOTAL.value "
sockstat | wc -l sockstat | wc -l

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# #
# Munin plugin to show the up- / download stream of the actual # Munin plugin to show the up- / download stream of the actual

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# A Munin Plugin to show umts signal strength using gcom # A Munin Plugin to show umts signal strength using gcom
# Created by Derik Vercueil <jfvercueil@yahoo.co.uk> # Created by Derik Vercueil <jfvercueil@yahoo.co.uk>

View file

@ -64,7 +64,7 @@ if(defined($ARGV[0])) {
print "graph_total Total\n"; print "graph_total Total\n";
print "graph_vlabel Bits\n"; print "graph_vlabel Bits\n";
print "graph_category $server\n"; print "graph_category $server\n";
print "graph_info This graph show $server total bandwidth used by various "\ print "graph_info This graph show $server total bandwidth used by various " .
"projects.\n"; "projects.\n";
while ((my $project, my @files) = each(%logs)) { while ((my $project, my @files) = each(%logs)) {
print $project.".label $project\n"; print $project.".label $project\n";

View file

@ -61,7 +61,7 @@ if(defined($ARGV[0])) {
print "graph_args --base 1000\n"; print "graph_args --base 1000\n";
print "graph_vlabel bits per \${graph_period} in (-) / out (+)\n"; print "graph_vlabel bits per \${graph_period} in (-) / out (+)\n";
print "graph_category $server\n"; print "graph_category $server\n";
print "graph_info This graph show $server in/out bandwidth used by various"\ print "graph_info This graph show $server in/out bandwidth used by various" .
" projects.\n"; " projects.\n";
while ((my $project, my @files) = each(%logs)) { while ((my $project, my @files) = each(%logs)) {
print "i".$project.".label $project\n"; print "i".$project.".label $project\n";

View file

@ -72,7 +72,7 @@ for i in $LIST1; do
done done
# If TOTU is 0, change to 1 for avoid problem in the division # If TOTU is 0, change to 1 for avoid problem in the division
if [[ $TOTU -eq 0 ]]; then if [ "$TOTU" = "0" ]; then
TOTU=1 TOTU=1
fi fi

View file

@ -1,153 +1,153 @@
#!/bin/bash #!/bin/bash
# #
# Munin plugin to monitor oracle connections w/o DBD::Oracle, or perl for that # Munin plugin to monitor oracle connections w/o DBD::Oracle, or perl for that
# matter ;-) # matter ;-)
# #
# Author: Kevin Kunkel (kunkel.kevin@gmail.com) on December 11, 2007 # Author: Kevin Kunkel (kunkel.kevin@gmail.com) on December 11, 2007
# (Based off the perl munin plugin by Joan Carles Soler) # (Based off the perl munin plugin by Joan Carles Soler)
# #
# Licenced under GPL v2. # Licenced under GPL v2.
# #
# Usage: # Usage:
# #
# If required, give username, password and/or oracle server # If required, give username, password and/or oracle server
# host through environment variables. # host through environment variables.
# #
# Parameters: # Parameters:
# autoconf # autoconf
# config (required) # config (required)
# #
# Config variables: # Config variables:
# #
# ORACLE_SID - Which database to use. Defaults to orcl # ORACLE_SID - Which database to use. Defaults to orcl
# oracle_user - A oracle user account with read permission to # oracle_user - A oracle user account with read permission to
# the v$session view. Defaults to # the v$session view. Defaults to
# 'oracle'. Anyway, Munin must be told which user # 'oracle'. Anyway, Munin must be told which user
# this plugin should be run as. # this plugin should be run as.
# oracle_pass - The corresponding password, if # oracle_pass - The corresponding password, if
# applicable. Default to undef. # applicable. Default to undef.
# #
# SHOW_ORACLE_USERS - If set to 1 show usernames and num. of connections. # SHOW_ORACLE_USERS - If set to 1 show usernames and num. of connections.
# Default is not show users (0). # Default is not show users (0).
# Magic markers # Magic markers
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
# Hard-code environment variables here # Hard-code environment variables here
#oracle_user= #oracle_user=
#oracle_pass= #oracle_pass=
#ORACLE_SID= #ORACLE_SID=
#ORACLE_HOME= #ORACLE_HOME=
#SHOW_ORACLE_USERS= #SHOW_ORACLE_USERS=
# End variable hard-code # End variable hard-code
if [ -z "$ORACLE_HOME" ] ; then if [ -z "$ORACLE_HOME" ] ; then
# Adjust to your oratab locations # Adjust to your oratab locations
for oratab in /var/opt/oracle/oratab /etc/oratab for oratab in /var/opt/oracle/oratab /etc/oratab
do do
[ ! -f $oratab ] && continue [ ! -f $oratab ] && continue
IFS=: IFS=:
while read SID HOME STARTUP; while read SID HOME STARTUP;
do do
if [ "$SID" = "*" ] if [ "$SID" = "*" ]
then then
ORACLE_HOME=$HOME ORACLE_HOME=$HOME
break break
fi fi
done < $oratab done < $oratab
[ -n "$ORACLE_HOME" ] && break [ -n "$ORACLE_HOME" ] && break
break break
done done
fi fi
if [ -z "$ORACLE_SID" ] if [ -z "$ORACLE_SID" ]
then then
ORACLE_SID="orcl" ORACLE_SID="orcl"
fi fi
if [ -z "$oracle_user" ] if [ -z "$oracle_user" ]
then then
oracle_user="oracle" oracle_user="oracle"
fi fi
if [ -z "$SHOW_ORACLE_USERS" ] if [ -z "$SHOW_ORACLE_USERS" ]
then then
SHOW_ORACLE_USERS=0 SHOW_ORACLE_USERS=0
else else
if [ $SHOW_ORACLE_USERS -ne 1 ] if [ $SHOW_ORACLE_USERS -ne 1 ]
then then
SHOW_ORACLE_USERS=0 SHOW_ORACLE_USERS=0
fi fi
fi fi
PATH=$PATH:$ORACLE_HOME/bin PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME PATH ORACLE_SID export ORACLE_HOME PATH ORACLE_SID
if [ "$1" = "autoconf" ] if [ "$1" = "autoconf" ]
then then
echo yes echo yes
exit 0 exit 0
fi fi
if [ "$1" = "config" ] if [ "$1" = "config" ]
then then
WARN_CRIT=`sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \ WARN_CRIT=`sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \
grep -v '^$' | awk '{print $1 * 0.7 " " $1 * 0.8 }' grep -v '^$' | awk '{print $1 * 0.7 " " $1 * 0.8 }'
set pagesize 0 set pagesize 0
select value from v\\$parameter where name = 'sessions'; select value from v\\$parameter where name = 'sessions';
EOF` EOF`
echo "graph_title Oracle active connections to $ORACLE_SID" echo "graph_title Oracle active connections to $ORACLE_SID"
echo "graph_args -l 0 --base 1000" echo "graph_args -l 0 --base 1000"
echo "graph_vlabel Connections" echo "graph_vlabel Connections"
echo "graph_category Oracle" echo "graph_category Oracle"
echo "graph_info Shows active oracle connections to $ORACLE_SID" echo "graph_info Shows active oracle connections to $ORACLE_SID"
echo "graph_scale no" echo "graph_scale no"
if [ $SHOW_ORACLE_USERS -eq 1 ] if [ $SHOW_ORACLE_USERS -eq 1 ]
then then
sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \ sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \
grep -v '^$' | awk '{ print $1 ".label " $1 " active connections" grep -v '^$' | awk '{ print $1 ".label " $1 " active connections"
print $1 ".info " $1 " active connections" print $1 ".info " $1 " active connections"
print $1 ".type GAUGE" }; END { print $1 ".type GAUGE" }; END {
print "total.label active connections" print "total.label active connections"
print "total.info active connections" print "total.info active connections"
print "total.type GAUGE" print "total.type GAUGE"
}' }'
set pagesize 0 set pagesize 0
select username, count(username) from v\$session where username is not null group by username; select username, count(username) from v\$session where username is not null group by username;
EOF EOF
echo $WARN_CRIT| awk '{ print "total.warning " $1 "\ntotal.critical " $2 }' echo $WARN_CRIT| awk '{ print "total.warning " $1 "\ntotal.critical " $2 }'
else else
echo "connections.label active connections" echo "connections.label active connections"
echo "connections.info active connections" echo "connections.info active connections"
echo "connections.type GAUGE" echo "connections.type GAUGE"
echo $WARN_CRIT| awk '{ print "connections.warning " $1 "\nconnections.critical " $2 }' echo $WARN_CRIT| awk '{ print "connections.warning " $1 "\nconnections.critical " $2 }'
fi fi
fi fi
if [ $SHOW_ORACLE_USERS -eq 1 ] if [ $SHOW_ORACLE_USERS -eq 1 ]
then then
sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \ sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \
grep -v '^$'|awk 'BEGIN { total=0 } { grep -v '^$'|awk 'BEGIN { total=0 } {
print $1 ".value " $2 print $1 ".value " $2
total=total+$2 } END { print "total.value " total }' total=total+$2 } END { print "total.value " total }'
set pagesize 0 set pagesize 0
select username, count(username) from v\$session where username is not null group by username; select username, count(username) from v\$session where username is not null group by username;
EOF EOF
else else
sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | grep -v '^$'|\ sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | grep -v '^$'|\
awk '{ print "connections.value " $1 }' awk '{ print "connections.value " $1 }'
set pagesize 0 set pagesize 0
select count(username) from v\$session where username is not null; select count(username) from v\$session where username is not null;
EOF EOF
fi fi
echo "max_connections.value" "`sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \ echo "max_connections.value" "`sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \
grep -v '^$' | awk '{print $1 }' grep -v '^$' | awk '{print $1 }'
set pagesize 0 set pagesize 0
select value from v\\$parameter where name = 'sessions'; select value from v\\$parameter where name = 'sessions';
EOF`" EOF`"

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# #
# Script to show adsl router stats for routers with Conexant based chips and the standard Conexant web admin gui like the eTec EpicRouter... # Script to show adsl router stats for routers with Conexant based chips and the standard Conexant web admin gui like the eTec EpicRouter...

View file

@ -29,7 +29,7 @@ usage() {
echo 'For testing the script, run qstatcod4and5_ cods IP PORT' echo 'For testing the script, run qstatcod4and5_ cods IP PORT'
echo ' - GameType : cods ... run qstat for seeing available gametype' echo ' - GameType : cods ... run qstat for seeing available gametype'
echo 'For munin you must ln -s /usr/share/munin/plugins/qstatcod4and5_ /etc/munin/plugins/cod4_cods_IP_PORT' echo 'For munin you must ln -s /usr/share/munin/plugins/qstatcod4and5_ /etc/munin/plugins/cod4_cods_IP_PORT'
echo 'Example you will test this COD4 Server: 123.456.789.123:28960 echo 'Example you will test this COD4 Server: 123.456.789.123:28960'
echo 'your symlink looks like this: ln -s /usr/share/munin/plugins/cod4server /etc/munin/plugins/cod4_cods_123.456.789.123_28960' echo 'your symlink looks like this: ln -s /usr/share/munin/plugins/cod4server /etc/munin/plugins/cod4_cods_123.456.789.123_28960'
echo 'Perhaps you must have to set qstat_exe path, actually on'${qstat_exe}; echo 'Perhaps you must have to set qstat_exe path, actually on'${qstat_exe};
echo 'Have Fun' echo 'Have Fun'

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
####################################################################################################################### #######################################################################################################################
# #
# = PowerMTA Munin multi-monitor = # = PowerMTA Munin multi-monitor =

View file

@ -1,42 +1,42 @@
#!/bin/sh #!/bin/bash
vmta="208-97-205-153" vmta="208-97-205-153"
# Lets run the command to pull the vmta's in # Lets run the command to pull the vmta's in
queues=(`pmta show queue */$vmta | awk -F" " '{print $1}'`) # Pull in top queues queues=(`pmta show queue */$vmta | awk -F" " '{print $1}'`) # Pull in top queues
# Now we need to do some further cleanup for blank or erroneous array items # Now we need to do some further cleanup for blank or erroneous array items
unset queues[0] unset queues[0]
unset queues[${#queues[@]}] unset queues[${#queues[@]}]
case $1 in case $1 in
config) config)
echo "graph_title RGMTA2 PMTA VMTA $vmta Recipents" echo "graph_title RGMTA2 PMTA VMTA $vmta Recipents"
echo "graph_vlabel recipents" echo "graph_vlabel recipents"
echo "graph_scale no" echo "graph_scale no"
echo "graph_category PowerMTA" echo "graph_category PowerMTA"
for i in ${queues[@]};do for i in ${queues[@]};do
queue=(`pmta show queue $i`) queue=(`pmta show queue $i`)
unset queue[0] unset queue[0]
unset queue[${#queue[@]}] unset queue[${#queue[@]}]
domain=`echo "${queue[7]}" | awk -F" " '{print $1}' | cut -d/ -f1 | sed -e 's/[\.]/_/g'` domain=`echo "${queue[7]}" | awk -F" " '{print $1}' | cut -d/ -f1 | sed -e 's/[\.]/_/g'`
domain2=`echo "${queue[7]}" | awk -F" " '{print $1}' | cut -d/ -f1` domain2=`echo "${queue[7]}" | awk -F" " '{print $1}' | cut -d/ -f1`
echo $domain'.label '$domain2 echo $domain'.label '$domain2
echo $domain'.draw STACK' echo $domain'.draw STACK'
done done
exit 0;; exit 0;;
esac esac
for i in ${queues[@]};do for i in ${queues[@]};do
queue=(`pmta show queue $i`) queue=(`pmta show queue $i`)
unset queue[0] unset queue[0]
unset queue[${#queue[@]}] unset queue[${#queue[@]}]
domain=`echo "${queue[7]}" | awk -F" " '{print $1}' | cut -d/ -f1 | sed -e 's/[\.]/_/g'` domain=`echo "${queue[7]}" | awk -F" " '{print $1}' | cut -d/ -f1 | sed -e 's/[\.]/_/g'`
recpts=${queue[8]} recpts=${queue[8]}
conns=${queue[10]} conns=${queue[10]}
echo $domain'.value '$recpts echo $domain'.value '$recpts
done done

View file

@ -1,4 +1,4 @@
#!/sbin/sh #!/bin/sh
# See /usr/include/sys/dk.h ! # See /usr/include/sys/dk.h !
PATH=/usr/bin:/usr/sbin:/sbin PATH=/usr/bin:/usr/sbin:/sbin

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Plugin to monitor CPU share, for a selected set of processes. Tested on Linux. # Plugin to monitor CPU share, for a selected set of processes. Tested on Linux.
# #

View file

@ -1,37 +1,63 @@
#!/bin/sh #!/bin/sh
#
# Plugin to monitor the number of connections to RabbitMQ
#
# Usage: Link or copy into /etc/munin/node.d/
#
# Parameters
# env.conn_warn <warning connections>
# env.conn_crit <critical connections>
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
# If run with the "autoconf"-parameter, give our opinion on wether we : << =cut
# should be run on this system or not. This is optinal, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.
if [ "$1" = "autoconf" ]; then =head1 NAME
echo yes
exit 0
fi
HOME=/tmp/ rabbitmq_connections - monitor the number of connections to RabbitMQ
=head1 CONFIGURATION
You will need to add configuration to
/etc/munin/plugin-conf.d/rabbitmq_connection.conf for this plugin to
work.
=over 2
=item C<user>
Required. Valid choices are C<rabbitmq> and C<root>. This is required
by C<rabbitmqctl>.
=item C<env.conn_warn>
Optional, default value is 500
=item C<env.conn_crit>
Optional, default value is 1000
=back
=head2 EXAMPLE CONFIGURATION
[rabbitmq_connections]
user rabbitmq
env.conn_warn 512
env.conn_crit 1024
=head1 MAGIC MARKERS
#%# family=contrib
=cut
case $(whoami) in
rabbitmq|root)
;;
*)
echo 'Error: Plugin requires "user" to be set in plugin configuration.' >&2
echo 'See "munindoc rabbitmq_connections" for more information' >&2
exit 1
;;
esac
# If run with the "config"-parameter, give out information on how the # If run with the "config"-parameter, give out information on how the
# graphs should look. # graphs should look.
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
CONN_WARN=${queue_warn:-500} CONN_WARN=${conn_warn:-500}
CONN_CRIT=${queue_crit:-1000} CONN_CRIT=${conn_crit:-1000}
# The host name this plugin is for. (Can be overridden to have # The host name this plugin is for. (Can be overridden to have
# one machine answer for several) # one machine answer for several)
@ -63,4 +89,11 @@ fi
# real work - i.e. display the data. Almost always this will be # real work - i.e. display the data. Almost always this will be
# "value" subfield for every data field. # "value" subfield for every data field.
echo "connections.value $(HOME=$HOME rabbitmqctl list_connections | grep -v "^Listing" | grep -v "done.$" | wc -l)" if hash rabbitmqctl >/dev/null 2>&1; then
connections=$(HOME=/tmp rabbitmqctl list_connections state | grep -c running)
else
echo "$0: Could not run rabbitmqctl" >&2
connections=U
fi
printf "connections.value %s\n" "$connections"

View file

@ -32,7 +32,7 @@ reddit_user=${0##*reddit_karma_}
## ##
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
# Check that curl is installed # Check that curl is installed
if hash curl &>/dev/null; then if hash curl >/dev/null 2>&1; then
echo "yes" echo "yes"
else else
echo "no (no curl installed)" echo "no (no curl installed)"

View file

@ -1,40 +1,40 @@
#!/bin/sh #!/bin/sh
# #
# Plugin to monitor the number of Samba locked files on the machine. # Plugin to monitor the number of Samba locked files on the machine.
# #
# Parameters: # Parameters:
# #
# config (required) # config (required)
# autoconf (optional - used by munin-config) # autoconf (optional - used by munin-config)
# #
# $Log$ # $Log$
# Revision 1.0 2007/04/16 Jon Higgs # Revision 1.0 2007/04/16 Jon Higgs
# Initial Release - Adapated from jimmyo's processses plugin. # Initial Release - Adapated from jimmyo's processses plugin.
# #
# Magick markers (optional - used by munin-config and som installation # Magick markers (optional - used by munin-config and som installation
# scripts): # scripts):
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
echo yes echo yes
exit 0 exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title Samba Locked Files' echo 'graph_title Samba Locked Files'
echo 'graph_args --base 1000 -l 0 ' echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel number of locked files' echo 'graph_vlabel number of locked files'
echo 'graph_category Samba' echo 'graph_category Samba'
echo 'graph_info This graph shows the number locked Samba Files.' echo 'graph_info This graph shows the number locked Samba Files.'
echo 'samba_locked.label Locked Files' echo 'samba_locked.label Locked Files'
echo 'samba_locked.draw LINE2' echo 'samba_locked.draw LINE2'
echo 'samba_locked.info The current number of locked files.' echo 'samba_locked.info The current number of locked files.'
exit 0 exit 0
fi fi
echo "samba_locked.value $(smbstatus -L 2> /dev/null | grep -c DENY_)" echo "samba_locked.value $(smbstatus -L 2> /dev/null | grep -c DENY_)"
# If here, always return OK # If here, always return OK
exit 0 exit 0

View file

@ -269,7 +269,7 @@ if 'MUNIN_CAP_MULTIGRAPH' not in os.environ:
# Parse host_name and counter type from arg0 # Parse host_name and counter type from arg0
called_as = os.path.basename(sys.argv[0]) called_as = os.path.basename(sys.argv[0])
regex_str = '^snmp_'(.+)'_brocade_ifs' regex_str = r'^snmp_(.+)_brocade_ifs'
match = re.match(regex_str, called_as) match = re.match(regex_str, called_as)
if match: if match:
host_name = match.group(1) host_name = match.group(1)

View file

@ -133,12 +133,6 @@ if (!defined ($session))
die "Croaking: could not establish SNMP object"; die "Croaking: could not establish SNMP object";
} }
if (!defined ($session))
{
die "Croaking: $error";
}
if ($ARGV[0] and $ARGV[0] eq "config") if ($ARGV[0] and $ARGV[0] eq "config")
{ {
print "host_name $host\n"; print "host_name $host\n";

View file

@ -40,11 +40,11 @@ if [ "$1" = "suggest" ]; then
if [ ! "$RC" != "0" ] ; then if [ ! "$RC" != "0" ] ; then
FILE=`basename $0` FILE=`basename $0`
DIR=`dirname $0` DIR=`dirname $0`
HOSTNAME=`host $IP | sed s/.*pointer//\ ` HOST_NAME=`host $IP | sed s/.*pointer//\ `
HOSTNAME=`echo $HOSTNAME | sed -e 's/\.$//'` HOST_NAME=`echo $HOST_NAME | sed -e 's/\.$//'`
LINKDIR="/etc/munin/plugins/" LINKDIR="/etc/munin/plugins/"
LINKFILE=`echo $FILE | sed s/__/_$HOSTNAME_/` LINKFILE=`echo $FILE | sed s/__/_$HOST_NAME_/`
echo file $FILE dir $DIR hostname $HOSTNAME linkdir $LINKDIR linkfile $LINKFILE echo file $FILE dir $DIR hostname $HOST_NAME linkdir $LINKDIR linkfile $LINKFILE
#echo "ln -s $DIR/$FILE $LINKNAME" #echo "ln -s $DIR/$FILE $LINKNAME"
fi fi

View file

@ -1,4 +1,5 @@
#!/usr/bin/ruby #!/usr/bin/ruby
# encoding: utf-8
# Plugin to monitor Room Alert 11E environmental units. # Plugin to monitor Room Alert 11E environmental units.
# Requires ruby and the ruby SNMP library. # Requires ruby and the ruby SNMP library.

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# A Munin Plugin to show auth stuff # A Munin Plugin to show auth stuff
# Created by Dominik Schulz <lkml@ds.gauner.org> # Created by Dominik Schulz <lkml@ds.gauner.org>

View file

@ -1,79 +1,79 @@
#!/bin/sh #!/bin/bash
# #
# Script to monitor iostat cpu|tps. # Script to monitor iostat cpu|tps.
# #
# Parameters understood: # Parameters understood:
# #
# config (required) # config (required)
# autoconf (optional - used by munin-config) # autoconf (optional - used by munin-config)
judge=`basename $0 | sed 's/^iostat_//g'` judge=`basename $0 | sed 's/^iostat_//g'`
current=`date +%H":"%M":"%S`; current=`date +%H":"%M":"%S`;
tenMago=`date --date "10 minutes ago" +%H":"%M":"%S` tenMago=`date --date "10 minutes ago" +%H":"%M":"%S`
export LANG=en_US.UTF-8 export LANG=en_US.UTF-8
# autoconf # autoconf
if [ "$1" == "autoconf" ]; then if [ "$1" == "autoconf" ]; then
if ( sar 1 1 >/dev/null 2>&1 ); then if ( sar 1 1 >/dev/null 2>&1 ); then
echo yes echo yes
exit 0 exit 0
else else
if [ $? -eq 127 ]; then if [ $? -eq 127 ]; then
echo "no (could not run \"sar\")" echo "no (could not run \"sar\")"
exit 1 exit 1
else else
echo no echo no
exit 1 exit 1
fi fi
fi fi
fi fi
ARRAY=( `sar -p -d -s ${tenMago} -e ${current} | grep -v nodev | grep "Average" | awk '{ print $2 , $3 , $10 }'` ) ARRAY=( `sar -p -d -s ${tenMago} -e ${current} | grep -v nodev | grep "Average" | awk '{ print $2 , $3 , $10 }'` )
# config # config
if [ "$1" == "config" ]; then if [ "$1" == "config" ]; then
if [ "$judge" == cpu_average ]; then if [ "$judge" == cpu_average ]; then
echo 'graph_title iostat util' echo 'graph_title iostat util'
echo 'graph_args --upper-limit 100 -l 0' echo 'graph_args --upper-limit 100 -l 0'
echo 'graph_vlabel %' echo 'graph_vlabel %'
echo 'graph_category System' echo 'graph_category System'
for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do
echo "_dev_${ARRAY[i]}.label ${ARRAY[i]}" echo "_dev_${ARRAY[i]}.label ${ARRAY[i]}"
i=`expr $i + 2` i=`expr $i + 2`
done done
exit 0 exit 0
fi fi
if [ "$judge" == tps_average ]; then if [ "$judge" == tps_average ]; then
echo 'graph_title iostat tps' echo 'graph_title iostat tps'
echo 'graph_args -l 0' echo 'graph_args -l 0'
echo 'graph_vlabel tps' echo 'graph_vlabel tps'
echo 'graph_category System' echo 'graph_category System'
for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do
echo "_dev_${ARRAY[i]}.label ${ARRAY[i]}" echo "_dev_${ARRAY[i]}.label ${ARRAY[i]}"
i=`expr $i + 2` i=`expr $i + 2`
done done
exit 0 exit 0
fi fi
fi fi
# other # other
if [ "$judge" == cpu_average ]; then if [ "$judge" == cpu_average ]; then
for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do
echo -n "_dev_${ARRAY[i]}.value " echo -n "_dev_${ARRAY[i]}.value "
i=`expr $i + 2` i=`expr $i + 2`
echo "${ARRAY[i]}" echo "${ARRAY[i]}"
done done
fi fi
if [ "$judge" == tps_average ]; then if [ "$judge" == tps_average ]; then
for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do
echo -n "_dev_${ARRAY[i]}.value " echo -n "_dev_${ARRAY[i]}.value "
i=`expr $i + 1` i=`expr $i + 1`
echo "${ARRAY[i]}" echo "${ARRAY[i]}"
i=`expr $i + 1` i=`expr $i + 1`
done done
fi fi

View file

@ -73,7 +73,8 @@ else
sub value # get value for variables sub value # get value for variables
{ {
my %h_ramvalues; my %h_ramvalues;
use Sun::Solaris::Kstat; eval 'use Sun::Solaris::Kstat; 1;'
or die 'Please install Sun::Solaros::Kstat';
my $Kstat = Sun::Solaris::Kstat->new(); my $Kstat = Sun::Solaris::Kstat->new();
# --- Fetch Hardware info --- # --- Fetch Hardware info ---

View file

@ -1,118 +1,118 @@
#! /bin/ksh #! /bin/ksh
# Copyright (c) 2010, Wikimedia Deutschland # Copyright (c) 2010, Wikimedia Deutschland
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright # * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright # * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the # notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution. # documentation and/or other materials provided with the distribution.
# * Neither the name of Wikimedia Deutschland nor the # * Neither the name of Wikimedia Deutschland nor the
# names of its contributors may be used to endorse or promote products # names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission. # derived from this software without specific prior written permission.
# #
# THIS SOFTWARE IS PROVIDED BY WIKIMEDIA DEUTSCHLAND ''AS IS'' AND ANY # THIS SOFTWARE IS PROVIDED BY WIKIMEDIA DEUTSCHLAND ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL WIKIMEDIA DEUTSCHLAND BE LIABLE FOR ANY # DISCLAIMED. IN NO EVENT SHALL WIKIMEDIA DEUTSCHLAND BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
# NOTE: This software is not released as a product. It was written primarily for # NOTE: This software is not released as a product. It was written primarily for
# Wikimedia Deutschland's own use, and is made public as is, in the hope it may # Wikimedia Deutschland's own use, and is made public as is, in the hope it may
# be useful. Wikimedia Deutschland may at any time discontinue developing or # be useful. Wikimedia Deutschland may at any time discontinue developing or
# supporting this software. There is no guarantee any new versions or even fixes # supporting this software. There is no guarantee any new versions or even fixes
# for security issues will be released. # for security issues will be released.
### ###
# Munin plugin to report Solaris memory usage via mdb's memstat. # Munin plugin to report Solaris memory usage via mdb's memstat.
# Must be run as root. # Must be run as root.
# #
# river@tamara.tcx.org.uk 2010-08-28 # river@tamara.tcx.org.uk 2010-08-28
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -e /usr/bin/mdb ]; then if [ -e /usr/bin/mdb ]; then
echo yes echo yes
exit 0 exit 0
else else
echo /usr/bin/mdb not found echo /usr/bin/mdb not found
exit 1 exit 1
fi fi
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo ' echo '
graph_args --base 1024 -l 0 --vertical-label Bytes graph_args --base 1024 -l 0 --vertical-label Bytes
graph_title Memory usage graph_title Memory usage
graph_category system graph_category system
graph_info This graph shows system memory use. graph_info This graph shows system memory use.
graph_order kernel anon exec cacheused zfs cachefree free graph_order kernel anon exec cacheused zfs cachefree free
kernel.label kernel kernel.label kernel
kernel.draw AREA kernel.draw AREA
kernel.info Memory used by kernel kernel.info Memory used by kernel
anon.label anon anon.label anon
anon.draw STACK anon.draw STACK
anon.info Memory used by programs anon.info Memory used by programs
exec.label exec_and_libs exec.label exec_and_libs
exec.draw STACK exec.draw STACK
exec.info Memory used by executable files and libraries exec.info Memory used by executable files and libraries
cacheused.label cacheused cacheused.label cacheused
cacheused.draw STACK cacheused.draw STACK
cacheused.info Memory used by page cache cacheused.info Memory used by page cache
zfs.label zfs zfs.label zfs
zfs.draw STACK zfs.draw STACK
zfs.info Memory used for ZFS file cache zfs.info Memory used for ZFS file cache
cachefree.label cachefree cachefree.label cachefree
cachefree.draw STACK cachefree.draw STACK
cachefree.info Free memory in cache list cachefree.info Free memory in cache list
free.label free free.label free
free.draw STACK free.draw STACK
free.info Free memory free.info Free memory
' '
exit 0 exit 0
fi fi
echo "::memstat" | mdb -k | nawk ' echo "::memstat" | mdb -k | nawk '
BEGIN { BEGIN {
pagesize='$(getconf PAGESIZE)' pagesize='$(getconf PAGESIZE)'
kernel=0 kernel=0
zfs=0 zfs=0
anon=0 anon=0
exec=0 exec=0
cache=0 cache=0
phys=0 phys=0
} }
/^Kernel/ { kernel=$2 } /^Kernel/ { kernel=$2 }
/^ZFS File Data/ { zfs=$4 } /^ZFS File Data/ { zfs=$4 }
/^Anon/ { anon=$2 } /^Anon/ { anon=$2 }
/^Exec and libs/ { exec=$4 } /^Exec and libs/ { exec=$4 }
/^Page cache/ { cacheused=$3 } /^Page cache/ { cacheused=$3 }
/^Free \(cachelist\)/ { cachefree=$3 } /^Free \(cachelist\)/ { cachefree=$3 }
/^Free \(freelist\)/ { free=$3 } /^Free \(freelist\)/ { free=$3 }
END { END {
print "kernel.value " (kernel * pagesize) print "kernel.value " (kernel * pagesize)
print "zfs.value " (zfs * pagesize) print "zfs.value " (zfs * pagesize)
print "anon.value " (anon * pagesize) print "anon.value " (anon * pagesize)
print "exec.value " (exec * pagesize) print "exec.value " (exec * pagesize)
print "cacheused.value " (cacheused * pagesize) print "cacheused.value " (cacheused * pagesize)
print "cachefree.value " (cachefree * pagesize) print "cachefree.value " (cachefree * pagesize)
print "free.value " (free * pagesize) print "free.value " (free * pagesize)
} }
' '

View file

@ -71,7 +71,8 @@ else
sub value sub value
{ {
my %h_swapvalue; my %h_swapvalue;
use Sun::Solaris::Kstat; eval 'use Sun::Solaris::Kstat; 1;'
or die 'Please install Sun::Solaris::Kstat';
my $Kstat = Sun::Solaris::Kstat->new(); my $Kstat = Sun::Solaris::Kstat->new();
# --- Fetch Hardware info --- # --- Fetch Hardware info ---

View file

@ -1,17 +1,17 @@
#!/bin/sh #!/bin/sh
RID=${0##*trafic_ro_} RID=${0##*trafic_ro_}
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo graph_title $V 24h visitors for $RID echo graph_title $V 24h visitors for $RID
echo 'graph_args --base 1000' echo 'graph_args --base 1000'
echo 'graph_vlabel vizitatori_ultimele_24_ore' echo 'graph_vlabel vizitatori_ultimele_24_ore'
echo 'graph_category Trafic_ro' echo 'graph_category Trafic_ro'
echo 'graph_info 24h visitors.' echo 'graph_info 24h visitors.'
echo "24h_visitors.label $RID" echo "24h_visitors.label $RID"
echo "24h_visitors.info 24H visitors for $RID" echo "24h_visitors.info 24H visitors for $RID"
echo '24h_visitors.draw LINE2' echo '24h_visitors.draw LINE2'
exit 0 exit 0
fi fi
VISITORS="$(echo '<doc><item>munin</item></doc>' | curl curl --silent -X POST -H 'Content-type: text/xml' -d @- http://api.trafic.ro/rest/0.01/sumar-site/$RID | xmlstarlet sel -t -m "/sumar-site/vizitatori_ultimele_24_ore" -v ".")" VISITORS="$(echo '<doc><item>munin</item></doc>' | curl curl --silent -X POST -H 'Content-type: text/xml' -d @- http://api.trafic.ro/rest/0.01/sumar-site/$RID | xmlstarlet sel -t -m "/sumar-site/vizitatori_ultimele_24_ore" -v ".")"
echo "24h_visitors.value" $VISITORS; echo "24h_visitors.value" $VISITORS;

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/php
<?php <?php
# plugin made by Dju # plugin made by Dju

View file

@ -1,69 +1,69 @@
#!/bin/bash #!/bin/bash
# Copyright (c) 2013 Gareth Davies (shaolintiger@gmail.com www.shaolintiger.com) # Copyright (c) 2013 Gareth Davies (shaolintiger@gmail.com www.shaolintiger.com)
# License GPLv2 # License GPLv2
# This plugin monitors number of workers, total memory used and average memory per process for Unicorn. # This plugin monitors number of workers, total memory used and average memory per process for Unicorn.
# Here are the symlinks to enable it # Here are the symlinks to enable it
# #
# ln -s /usr/share/munin/plugins/unicorn_ /etc/munin/plugins/unicorn_average # ln -s /usr/share/munin/plugins/unicorn_ /etc/munin/plugins/unicorn_average
# ln -s /usr/share/munin/plugins/unicorn_ /etc/munin/plugins/unicorn_memory # ln -s /usr/share/munin/plugins/unicorn_ /etc/munin/plugins/unicorn_memory
# ln -s /usr/share/munin/plugins/unicorn_ /etc/munin/plugins/unicorn_processes # ln -s /usr/share/munin/plugins/unicorn_ /etc/munin/plugins/unicorn_processes
mode=`echo $0 | cut -d _ -f 2` mode=`echo $0 | cut -d _ -f 2`
if [ "$1" = "suggest" ]; then if [ "$1" = "suggest" ]; then
echo "memory" echo "memory"
echo "processes" echo "processes"
echo "average" echo "average"
exit 0 exit 0
fi fi
if [ "$mode" = "memory" ]; then if [ "$mode" = "memory" ]; then
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo "graph_title Total Unicorn Memory" echo "graph_title Total Unicorn Memory"
echo "graph_vlabel Total RAM" echo "graph_vlabel Total RAM"
echo "graph_category Unicorn" echo "graph_category Unicorn"
echo "graph_args --base 1024" echo "graph_args --base 1024"
echo "ram.label Total RAM" echo "ram.label Total RAM"
exit 0 exit 0
else else
memory_array=(`ps auwx | grep "unicorn worker" | grep -v grep | awk '{print $6 }'`) memory_array=(`ps auwx | grep "unicorn worker" | grep -v grep | awk '{print $6 }'`)
for i in "${memory_array[@]}" for i in "${memory_array[@]}"
do do
sum=$(( $sum + ( $i * 1024) )) sum=$(( $sum + ( $i * 1024) ))
done done
echo -n "ram.value " echo -n "ram.value "
echo $sum echo $sum
fi fi
elif [ "$mode" = "processes" ]; then elif [ "$mode" = "processes" ]; then
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo "graph_title Unicorn Processes" echo "graph_title Unicorn Processes"
echo "graph_vlabel Processes" echo "graph_vlabel Processes"
echo "graph_category Unicorn" echo "graph_category Unicorn"
echo "processes.label active processes" echo "processes.label active processes"
else else
echo -n "processes.value " echo -n "processes.value "
ps awwwux | grep 'unicorn worker' | grep -v grep | wc -l ps awwwux | grep 'unicorn worker' | grep -v grep | wc -l
exit 0 exit 0
fi fi
elif [ "$mode" = "average" ]; then elif [ "$mode" = "average" ]; then
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title Unicorn Average Process Size' echo 'graph_title Unicorn Average Process Size'
echo 'graph_args --base 1024 -l 0 ' echo 'graph_args --base 1024 -l 0 '
echo 'graph_vlabel Average Process Size' echo 'graph_vlabel Average Process Size'
echo 'graph_category Unicorn' echo 'graph_category Unicorn'
echo 'unicorn_average.label Average Process Size' echo 'unicorn_average.label Average Process Size'
echo 'unicorn_average.draw LINE2' echo 'unicorn_average.draw LINE2'
echo 'unicorn_average.info The average process size for Unicorn' echo 'unicorn_average.info The average process size for Unicorn'
else else
echo -n "unicorn_average.value " echo -n "unicorn_average.value "
ps awwwux | grep 'unicorn worker' | grep -v grep | grep -v master | awk '{total_mem = $6 * 1024 + total_mem; total_proc++} END{printf("%d\n", total_mem / total_proc)}' ps awwwux | grep 'unicorn worker' | grep -v grep | grep -v master | awk '{total_mem = $6 * 1024 + total_mem; total_proc++} END{printf("%d\n", total_mem / total_proc)}'
exit 0 exit 0
fi fi
fi fi
exit 0 exit 0

View file

@ -1,33 +1,33 @@
#!/bin/sh #!/bin/sh
# #
# (c) Andreas Kreisl # (c) Andreas Kreisl
# #
# Link name will be used as title: apc_{$title} # Link name will be used as title: apc_{$title}
# #
# env.keys LOADPCT BCHARGE LINEV BATTV TIMELEFT # env.keys LOADPCT BCHARGE LINEV BATTV TIMELEFT
# env.unit % or Volt or Minutes # env.unit % or Volt or Minutes
# #
if [ -z "$keys" ]; then if [ -z "$keys" ]; then
keys="TIMELEFT" keys="TIMELEFT"
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
title=`basename $0 | sed 's/^apc_//g' | awk '{ sub(/^./,toupper(substr($0,1,1))); print; }'` title=`basename $0 | sed 's/^apc_//g' | awk '{ sub(/^./,toupper(substr($0,1,1))); print; }'`
echo "graph_title APC Status - $title" echo "graph_title APC Status - $title"
echo 'graph_args --base 1000 -l 0 ' echo 'graph_args --base 1000 -l 0 '
echo "graph_vlabel $unit" echo "graph_vlabel $unit"
echo 'graph_category sensors' echo 'graph_category sensors'
title=`/sbin/apcaccess | egrep "^MODEL" | awk '{print $3" "$4" "$5" "$6" "$7" "$8" "$9;}'` title=`/sbin/apcaccess | egrep "^MODEL" | awk '{print $3" "$4" "$5" "$6" "$7" "$8" "$9;}'`
echo "graph_info $title" echo "graph_info $title"
for key in $keys; do for key in $keys; do
echo "$key.label $key" echo "$key.label $key"
echo "$key.info Value of $key." echo "$key.info Value of $key."
echo "$key.draw LINE2" echo "$key.draw LINE2"
done done
exit 0 exit 0
fi fi
searchkey=`echo "$keys" | tr " " "\|"` searchkey=`echo "$keys" | tr " " "\|"`
/sbin/apcaccess | egrep "$searchkey" | awk '{print $1".value "$3;}' /sbin/apcaccess | egrep "$searchkey" | awk '{print $1".value "$3;}'

View file

@ -1,4 +1,4 @@
#!@@PERL@@ #!/usr/bin/perl
# -*- perl -*- # -*- perl -*-
# #
# varnish4_ - Munin plugin to for Varnish 4.x # varnish4_ - Munin plugin to for Varnish 4.x

View file

@ -115,9 +115,14 @@ use strict;
use sort 'stable'; # guarantee stability use sort 'stable'; # guarantee stability
no warnings; # don't want warnings in output no warnings; # don't want warnings in output
use VMware::VIRuntime; # need to install VIM SDK (vSphere CLI/SDK 4.1 or newer) # need to install VIM SDK (vSphere CLI/SDK 4.1 or newer)
use VMware::VILib; eval 'use VMware::VIRuntime; 1;'
use VMware::VIExt; or die 'Please install vSphere SDK for VMware::* modules';
eval 'use VMware::VILib; 1;'
or die 'Please install vSphere SDK for VMware::* modules';
eval 'use VMware::VIExt; 1;'
or die 'Please install vsphere SDK for VMware::* modules';
use Data::Dumper; use Data::Dumper;
use DateTime::Format::ISO8601; # may need to install "libdatetime-format-iso8601-perl" on Debian-based systems use DateTime::Format::ISO8601; # may need to install "libdatetime-format-iso8601-perl" on Debian-based systems
use List::Util qw(sum max); use List::Util qw(sum max);

View file

@ -51,7 +51,7 @@ fi
DOMAINS=$(xm list | awk '{print $1}' | egrep -v "^(Name|Domain-0)") DOMAINS=$(xm list | awk '{print $1}' | egrep -v "^(Name|Domain-0)")
for dom in $DOMAINS; do for dom in $DOMAINS; do
dev=$( xm list $dom --long | awk '/vifname / { print $2 }' | sed 's/)//' ) dev=$( xm list $dom --long | awk '/vifname / { print $2 }' | sed 's/)//' )
if [ "$dev" == "" ]; then if [ "$dev" = "" ]; then
dev=$( xm network-list $dom |\ dev=$( xm network-list $dom |\
egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@') egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@')
fi fi

View file

@ -64,7 +64,11 @@
#%# capabilities=autoconf suggest #%# capabilities=autoconf suggest
use strict; use strict;
use Munin::Plugin;
# Need to use eval EXPR here. "-T" is used on the command line, and
# munin is not installable in a reasonable way for automated testing.
eval 'use Munin::Plugin; 1;' or die 'Please install Munin::Plugin';
use File::Basename; use File::Basename;
use IO::Socket::UNIX qw(SOCK_STREAM); use IO::Socket::UNIX qw(SOCK_STREAM);

175
t/test.t Normal file
View file

@ -0,0 +1,175 @@
# -*- perl -*-
use strict;
use warnings;
use Test::More;
use File::Find ();
use Capture::Tiny ':all';
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find::prune;
my $num_plugins = 0;
sub wanted {
my ( $dev, $ino, $mode, $nlink, $uid, $gid, $interpreter, $arguments );
( ( $dev, $ino, $mode, $nlink, $uid, $gid ) = lstat($_) )
&& -f _
&& ( ( $interpreter, $arguments ) = hashbang("$_") )
&& ($interpreter)
&& ++$num_plugins
&& process_file( $_, $name, $interpreter, $arguments );
}
File::Find::find( { wanted => \&wanted }, 'plugins' );
sub hashbang {
my ($filename) = @_;
open my $file, '<', $filename;
my $firstline = <$file>;
close $file;
$firstline =~ m{ ^\#! # hashbang
\s* # optional space
(?:/usr/bin/env\s+)? # optional /usr/bin/env
(?<interpreter>\S+) # interpreter
(?:\s+
(?<arguments>[^\n]*) # optional interpreter arguments
)?
}xms;
return ( $+{interpreter}, $+{arguments} );
}
sub process_file {
my ( $file, $filename, $interpreter, $arguments ) = @_;
use v5.10.1;
if ( $interpreter =~ m{/bin/sh} ) {
subtest $filename => sub {
plan tests => 2;
run_check(
{ command => [ 'sh', '-n', $file ],
description => 'sh syntax check'
}
);
run_check(
{ command => [ 'checkbashisms', $file ],
description => 'checkbashisms'
}
);
};
}
elsif ( $interpreter =~ m{/bin/ksh} ) {
run_check(
{ command => [ 'ksh', '-n', $file ],
description => 'ksh syntax check',
filename => $filename
}
);
}
elsif ( $interpreter =~ m{bash} ) {
run_check(
{ command => [ 'bash', '-n', $file ],
description => 'bash syntax check',
filename => $filename
}
);
}
elsif ( $interpreter =~ m{perl} ) {
my $command;
if ( $arguments =~ m{-.*T}mx ) {
$command = [ 'perl', '-cwT', $file ];
}
else {
$command = [ 'perl', '-cw', $file ];
}
run_check(
{ command => $command,
description => 'perl syntax check',
filename => $filename
}
);
}
elsif ( $interpreter =~ m{python} ) {
run_check(
{ command => [ 'python', '-m', 'py_compile', $file ],
description => 'python compile',
filename => $filename
}
);
}
elsif ( $interpreter =~ m{php} ) {
run_check(
{ command => [ 'php', '-l', $file ],
description => 'php syntax check',
filename => $filename
}
);
}
elsif ( $interpreter =~ m{j?ruby} ) {
run_check(
{ command => [ 'ruby', '-cw', $file ],
description => 'ruby syntax check',
filename => $filename
}
);
}
elsif ( $interpreter =~ m{gawk} ) {
run_check(
{ command => [
'gawk', '--source', 'BEGIN { exit(0) } END { exit(0) }',
'--file', $file
],
description => 'gawk syntax check',
filename => $filename
}
);
}
elsif ( $interpreter =~ m{expect} ) {
SKIP: {
skip 'no idea how to check expect scripts', 1;
pass("No pretending everything is ok");
}
}
else {
fail( $filename . " unknown interpreter " . $interpreter );
}
}
sub run_check {
my ($args) = @_;
my $check_command = $args->{command};
my $description = $args->{description};
my $filename = $args->{filename};
my $message;
if ($filename) {
$message = sprintf( '%s: %s', $filename, $description );
}
else {
$message = $description;
}
my ( $stdout, $stderr, $exit ) = capture {
system( @{$check_command} );
};
ok( ( $exit == 0 ), $message );
if ($exit) {
diag(
sprintf(
"\nCommand: %s\n\nSTDOUT:\n\n%s\n\nSTDERR:\n\n%s\n\n",
join( " ", @{$check_command} ),
$stdout, $stderr
)
);
}
}
done_testing($num_plugins);