mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Merge pull request #539 from ssm/fix/syntax-errors
Add syntax checking, and fix all syntax errors
This commit is contained in:
commit
155a8dbd8c
58
.travis.yml
Normal file
58
.travis.yml
Normal 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"
|
@ -63,7 +63,7 @@ if(defined($ARGV[0])) {
|
||||
print "graph_total Total\n";
|
||||
print "graph_vlabel Bits\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";
|
||||
while ((my $project, my @files) = each(%logs)) {
|
||||
print $project.".label $project\n";
|
||||
|
@ -60,7 +60,7 @@ if(defined($ARGV[0])) {
|
||||
print "graph_args --base 1000\n";
|
||||
print "graph_vlabel bits per \${graph_period} in (-) / out (+)\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";
|
||||
while ((my $project, my @files) = each(%logs)) {
|
||||
print "i".$project.".label $project\n";
|
||||
|
@ -19,7 +19,7 @@ room=${0##*tinychat_users_}
|
||||
##
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
# Check that curl is installed
|
||||
if hash curl &>/dev/null; then
|
||||
if hash curl >/dev/null 2>&1; then
|
||||
echo "yes"
|
||||
else
|
||||
echo "no (no curl installed)"
|
||||
|
@ -69,7 +69,7 @@ GPLv2
|
||||
CONFIGDIR=$(awk -F : '/^configdirectory:/ { gsub(/ /, "", $2); print $2 }' /etc/imapd.conf 2> /dev/null)
|
||||
PROCDIR="${CONFIGDIR}/proc"
|
||||
|
||||
if [ "$1" == "autoconf" ]; then
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ "x${CONFIGDIR}x" != "xx" ] && [ -d ${PROCDIR} ]; then
|
||||
echo yes
|
||||
else
|
||||
@ -79,14 +79,14 @@ if [ "$1" == "autoconf" ]; then
|
||||
fi
|
||||
|
||||
# Check if we actually got some sensible data
|
||||
if [ "x${CONFIGDIR}x" == "xx" ]; then
|
||||
if [ "x${CONFIGDIR}x" = "xx" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If run with the "config"-parameter, give out information on how the
|
||||
# graphs should look.
|
||||
|
||||
if [ "$1" == "config" ]; then
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Cyrus IMAPd Load'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel connections'
|
||||
|
@ -1,33 +1,33 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# (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>
|
||||
#
|
||||
# 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
|
||||
#
|
||||
CACHEFILE=/tmp/munin-du_multidirs.cache
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Directory usage'
|
||||
echo 'graph_args --base 1024 -l 1'
|
||||
echo 'graph_vlabel Bytes'
|
||||
echo 'graph_category disk'
|
||||
echo 'graph_info This graph shows the size of several directories'
|
||||
|
||||
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'`
|
||||
echo "$field".label "$label"
|
||||
echo "$field".draw LINE1
|
||||
# echo "$field".warning 0
|
||||
# echo "$field".critical 0
|
||||
done
|
||||
exit 0
|
||||
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
|
||||
#!/bin/sh
|
||||
#
|
||||
# (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>
|
||||
#
|
||||
# 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
|
||||
#
|
||||
CACHEFILE=/tmp/munin-du_multidirs.cache
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Directory usage'
|
||||
echo 'graph_args --base 1024 -l 1'
|
||||
echo 'graph_vlabel Bytes'
|
||||
echo 'graph_category disk'
|
||||
echo 'graph_info This graph shows the size of several directories'
|
||||
|
||||
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'`
|
||||
echo "$field".label "$label"
|
||||
echo "$field".draw LINE1
|
||||
# echo "$field".warning 0
|
||||
# echo "$field".critical 0
|
||||
done
|
||||
exit 0
|
||||
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
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# -*- sh -*-
|
||||
# vim: ft=sh
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
#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.
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
cat <<'EOM'
|
||||
graph_title Under Replicated Blocks Hadoop
|
||||
graph_category hadoop
|
||||
graph_vlabel block
|
||||
block.label block
|
||||
EOM
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
echo -n "block.value "
|
||||
hadoop dfsadmin -report | grep "Under replicated blocks" | awk '{print $4}'
|
||||
#!/bin/sh
|
||||
|
||||
#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.
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
cat <<'EOM'
|
||||
graph_title Under Replicated Blocks Hadoop
|
||||
graph_category hadoop
|
||||
graph_vlabel block
|
||||
block.label block
|
||||
EOM
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
echo -n "block.value "
|
||||
hadoop dfsadmin -report | grep "Under replicated blocks" | awk '{print $4}'
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# Plugin to monitor hylafax queue
|
||||
#
|
||||
|
@ -1,25 +1,25 @@
|
||||
#! /bin/sh
|
||||
# configuration :
|
||||
#
|
||||
# env.LOGFILE /var/log/proftpd/proftpd.log
|
||||
|
||||
if [ "$1" = 'config' ]; then
|
||||
echo "graph_args --base 1000 -l 0"
|
||||
echo "graph_title Serveur FTP"
|
||||
echo "graph_category Ftp"
|
||||
echo "graph_vlabel Stats Proftpd"
|
||||
echo "succes.label Login succes"
|
||||
echo "succes.draw AREA"
|
||||
echo "failed.label Login failed"
|
||||
echo "failed.draw AREA"
|
||||
fi
|
||||
|
||||
LOGFILE=${LOGFILE:-"/var/log/proftpd/proftpd.log"}
|
||||
|
||||
succes=$(grep -c "successful" "$LOGFILE" )
|
||||
failed=$(grep -c "Login failed" "$LOGFILE" )
|
||||
|
||||
echo "succes.value $succes"
|
||||
echo "failed.value $failed"
|
||||
|
||||
exit 0
|
||||
#! /bin/sh
|
||||
# configuration :
|
||||
#
|
||||
# env.LOGFILE /var/log/proftpd/proftpd.log
|
||||
|
||||
if [ "$1" = 'config' ]; then
|
||||
echo "graph_args --base 1000 -l 0"
|
||||
echo "graph_title Serveur FTP"
|
||||
echo "graph_category Ftp"
|
||||
echo "graph_vlabel Stats Proftpd"
|
||||
echo "succes.label Login succes"
|
||||
echo "succes.draw AREA"
|
||||
echo "failed.label Login failed"
|
||||
echo "failed.draw AREA"
|
||||
fi
|
||||
|
||||
LOGFILE=${LOGFILE:-"/var/log/proftpd/proftpd.log"}
|
||||
|
||||
succes=$(grep -c "successful" "$LOGFILE" )
|
||||
failed=$(grep -c "Login failed" "$LOGFILE" )
|
||||
|
||||
echo "succes.value $succes"
|
||||
echo "failed.value $failed"
|
||||
|
||||
exit 0
|
||||
|
@ -1,47 +1,46 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
# Script to show pureftp counts.
|
||||
# Logs are searched in /var/log/pure-ftpd/transfer.log by default.
|
||||
# Logs must be in w3c format:
|
||||
# pure-ftpd --altlog w3c:/var/log/pure-ftpd/transfer.log
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
#
|
||||
# Magic markers (optional - used by munin-config and installation
|
||||
# scripts):
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
MAXLABEL=20
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title FTP Server'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel Daily FTP Operations'
|
||||
echo 'graph_category FTP'
|
||||
echo 'graph_period second'
|
||||
echo 'ftp_put.type GAUGE'
|
||||
echo 'ftp_get.type GAUGE'
|
||||
echo 'ftp_put.label Files PUT'
|
||||
echo 'ftp_get.label Files GET'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -en "ftp_put.value "
|
||||
echo $(grep "`date '+%Y-%m-%d'`" /var/log/pure-ftpd/transfer.log | grep [[:space:]]\\[\\]created[[:space:]] | wc -l)
|
||||
echo -n
|
||||
echo -en "ftp_get.value "
|
||||
echo $(grep "`date '+%Y-%m-%d'`" /var/log/pure-ftpd/transfer.log | grep [[:space:]]\\[\\]sent[[:space:]] | wc -l)
|
||||
|
||||
#!/bin/bash
|
||||
#
|
||||
#
|
||||
# Script to show pureftp counts.
|
||||
# Logs are searched in /var/log/pure-ftpd/transfer.log by default.
|
||||
# Logs must be in w3c format:
|
||||
# pure-ftpd --altlog w3c:/var/log/pure-ftpd/transfer.log
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
#
|
||||
# Magic markers (optional - used by munin-config and installation
|
||||
# scripts):
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
MAXLABEL=20
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title FTP Server'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel Daily FTP Operations'
|
||||
echo 'graph_category FTP'
|
||||
echo 'graph_period second'
|
||||
echo 'ftp_put.type GAUGE'
|
||||
echo 'ftp_get.type GAUGE'
|
||||
echo 'ftp_put.label Files PUT'
|
||||
echo 'ftp_get.label Files GET'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -en "ftp_put.value "
|
||||
echo $(grep "`date '+%Y-%m-%d'`" /var/log/pure-ftpd/transfer.log | grep [[:space:]]\\[\\]created[[:space:]] | wc -l)
|
||||
echo -n
|
||||
echo -en "ftp_get.value "
|
||||
echo $(grep "`date '+%Y-%m-%d'`" /var/log/pure-ftpd/transfer.log | grep [[:space:]]\\[\\]sent[[:space:]] | wc -l)
|
||||
|
@ -1,96 +1,96 @@
|
||||
#!/bin/bash
|
||||
# -*- sh -*-
|
||||
|
||||
: << =cut
|
||||
|
||||
=head1 NAME
|
||||
|
||||
glassfish_counters_ - Wildcard-plugin to monitor counters in GlassFish
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
This plugin does need the full path to the asadmin script:
|
||||
[glassfish_counters_*]
|
||||
env.ASADMIN /usr/local/glassfish/bin/asadmin
|
||||
|
||||
This is a wildcard plugin. To monitor an subtree, link
|
||||
glassfish_counters_<subtree> to this file. E.g.
|
||||
|
||||
ln -s /usr/share/munin/plugins/glassfish_counters_ \
|
||||
/etc/munin/plugins/glassfish_counters_server.web.request
|
||||
|
||||
...will monitor server.web.request.*
|
||||
|
||||
To ignore certain counters, just add more "IGNORE" lines on top of
|
||||
the awk script. (XXX: Fixme for env.)
|
||||
|
||||
=head1 AUTHOR
|
||||
Philipp Buehler
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
BSD 2-clause
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
$Id: glassfish_counters_.in$
|
||||
0.0.1
|
||||
|
||||
=cut
|
||||
[ -z $ASADMIN ] && {
|
||||
echo "ASADMIN not set in node configuration"
|
||||
exit 1
|
||||
} || MUN_AS_ADMIN=${ASADMIN}
|
||||
|
||||
check_link () {
|
||||
scriptname=${0##*/}
|
||||
myself=${scriptname##*_}
|
||||
if [ "x$myself" = "x" ] ; then
|
||||
echo "plugin must be symlinked, e.g. to glassfish_counters_server.web.request"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
SUBTREE=${0##*glassfish_counters_}
|
||||
|
||||
case $1 in
|
||||
suggest)
|
||||
echo "not implemented"
|
||||
exit 0
|
||||
;;
|
||||
config)
|
||||
check_link
|
||||
$MUN_AS_ADMIN get -t --monitor=true "${SUBTREE}.*" | \
|
||||
awk 'BEGIN{ FS="[ = ]"}
|
||||
/requestcount/ { next; } # IGNORE
|
||||
/dotted-name/ { myself = $NF
|
||||
print "graph_title GlassFish", myself
|
||||
print "graph_vlabel count"
|
||||
print "graph_category glassfish"
|
||||
print "graph_info this shows available counters from", myself
|
||||
next
|
||||
}
|
||||
/-name / { nwhat = split($1, what, ".")
|
||||
gsub(/-name/, "", what[nwhat])
|
||||
print what[nwhat] ".label " $NF
|
||||
print what[nwhat] ".type GAUGE"
|
||||
}
|
||||
/-description / { nwhat = split($1, what, ".")
|
||||
gsub(/-description/, "", what[nwhat])
|
||||
$1 = ""; line = $0
|
||||
gsub(/^ /,"", line)
|
||||
print what[nwhat] ".info " line
|
||||
}
|
||||
'
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
check_link
|
||||
$MUN_AS_ADMIN get -t --monitor=true "${SUBTREE}.*" | \
|
||||
awk 'BEGIN{ FS="[ = ]" }
|
||||
/requestcount/ { next;} # IGNORE
|
||||
/-count / { nwhat = split($1, what, ".")
|
||||
gsub(/-count/, "", what[nwhat])
|
||||
print what[nwhat] ".value " $NF}
|
||||
'
|
||||
#!/bin/bash
|
||||
# -*- sh -*-
|
||||
|
||||
: << =cut
|
||||
|
||||
=head1 NAME
|
||||
|
||||
glassfish_counters_ - Wildcard-plugin to monitor counters in GlassFish
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
This plugin does need the full path to the asadmin script:
|
||||
[glassfish_counters_*]
|
||||
env.ASADMIN /usr/local/glassfish/bin/asadmin
|
||||
|
||||
This is a wildcard plugin. To monitor an subtree, link
|
||||
glassfish_counters_<subtree> to this file. E.g.
|
||||
|
||||
ln -s /usr/share/munin/plugins/glassfish_counters_ \
|
||||
/etc/munin/plugins/glassfish_counters_server.web.request
|
||||
|
||||
...will monitor server.web.request.*
|
||||
|
||||
To ignore certain counters, just add more "IGNORE" lines on top of
|
||||
the awk script. (XXX: Fixme for env.)
|
||||
|
||||
=head1 AUTHOR
|
||||
Philipp Buehler
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
BSD 2-clause
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
$Id: glassfish_counters_.in$
|
||||
0.0.1
|
||||
|
||||
=cut
|
||||
[ -z $ASADMIN ] && {
|
||||
echo "ASADMIN not set in node configuration"
|
||||
exit 1
|
||||
} || MUN_AS_ADMIN=${ASADMIN}
|
||||
|
||||
check_link () {
|
||||
scriptname=${0##*/}
|
||||
myself=${scriptname##*_}
|
||||
if [ "x$myself" = "x" ] ; then
|
||||
echo "plugin must be symlinked, e.g. to glassfish_counters_server.web.request"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
SUBTREE=${0##*glassfish_counters_}
|
||||
|
||||
case $1 in
|
||||
suggest)
|
||||
echo "not implemented"
|
||||
exit 0
|
||||
;;
|
||||
config)
|
||||
check_link
|
||||
$MUN_AS_ADMIN get -t --monitor=true "${SUBTREE}.*" | \
|
||||
awk 'BEGIN{ FS="[ = ]"}
|
||||
/requestcount/ { next; } # IGNORE
|
||||
/dotted-name/ { myself = $NF
|
||||
print "graph_title GlassFish", myself
|
||||
print "graph_vlabel count"
|
||||
print "graph_category glassfish"
|
||||
print "graph_info this shows available counters from", myself
|
||||
next
|
||||
}
|
||||
/-name / { nwhat = split($1, what, ".")
|
||||
gsub(/-name/, "", what[nwhat])
|
||||
print what[nwhat] ".label " $NF
|
||||
print what[nwhat] ".type GAUGE"
|
||||
}
|
||||
/-description / { nwhat = split($1, what, ".")
|
||||
gsub(/-description/, "", what[nwhat])
|
||||
$1 = ""; line = $0
|
||||
gsub(/^ /,"", line)
|
||||
print what[nwhat] ".info " line
|
||||
}
|
||||
'
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
check_link
|
||||
$MUN_AS_ADMIN get -t --monitor=true "${SUBTREE}.*" | \
|
||||
awk 'BEGIN{ FS="[ = ]" }
|
||||
/requestcount/ { next;} # IGNORE
|
||||
/-count / { nwhat = split($1, what, ".")
|
||||
gsub(/-count/, "", what[nwhat])
|
||||
print what[nwhat] ".value " $NF}
|
||||
'
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
##########################
|
||||
# googlecode_
|
||||
##########################
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# -*- sh -*-
|
||||
|
||||
: << =cut
|
||||
|
@ -1,161 +1,161 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#healthcheck on munin
|
||||
#egrep system log and alert.
|
||||
#
|
||||
#programed by rti (hiroyuki fujie) super.rti@gmail.com @super_rti
|
||||
#LICENSE: NYSL (public domain)
|
||||
#
|
||||
#
|
||||
#config file
|
||||
# /etc/munin/plugin-conf.d/munin-node
|
||||
#
|
||||
#example minimum config
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root
|
||||
#env.log_1 /var/log/messages
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#check two log
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root
|
||||
#env.log_1 /var/log/messages
|
||||
#env.log_2 /var/log/syslog
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#check two three
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root
|
||||
#env.log_1 /var/log/messages
|
||||
#env.log_2 /var/log/syslog
|
||||
#env.log_3 /var/log/dmesg
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#set name
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root
|
||||
#env.log_1 /var/log/messages
|
||||
#env.name_1 my_server_messages
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#set egrep string
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root
|
||||
#env.log_1 /var/log/messages
|
||||
#env.grep_1 alert|warning
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#set egrep string
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root
|
||||
#env.log_1 /var/log/messages
|
||||
#env.grep_1 alert|warning
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#full option
|
||||
#/etc/munin/plugin-conf.d/munin-node
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root #log file is read only root user.
|
||||
#env.log_1 /var/log/messages #target log filename
|
||||
#env.grep_1 critical|error #egrep string.
|
||||
#defualt by critical|error|warning|crash|fatal|kernel
|
||||
#---------------------------------------------------
|
||||
#
|
||||
|
||||
|
||||
#edakari speed up.
|
||||
CHECKMAX=`env | grep log_ | wc -l`
|
||||
let CHECKMAX="$CHECKMAX + 1"
|
||||
MINUTE_BY_GREP_RANGE=10
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ $CHECKMAX -le 1 ]; then
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title log grep (match count)'
|
||||
echo "graph_args --base 1000 -l 0 --vertical-label match_count"
|
||||
echo 'graph_scale no'
|
||||
echo 'graph_vlabel match_count'
|
||||
echo 'graph_category healthcheck'
|
||||
echo 'graph_info This graph shows the bad event count on log'
|
||||
|
||||
for(( I = 1; I < $CHECKMAX; ++I ))
|
||||
do
|
||||
eval log=\$log_${I}
|
||||
eval name=\$name_${I}
|
||||
eval grep=\$grep_${I}
|
||||
if [ "x${log}" = "x" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ "x${name}" = "x" ]; then
|
||||
name=`echo $log | sed 's#[/|\.]#_#g'`
|
||||
fi
|
||||
if [ "x${name}" = "x" ]; then
|
||||
grep="critical|error|crash|fatal|kernel"
|
||||
fi
|
||||
|
||||
echo "$name.label $name"
|
||||
echo "$name.info egrep $grep $log | wc -l"
|
||||
echo "$name.draw LINE2"
|
||||
echo "$name.min 0"
|
||||
echo "$name.max 20"
|
||||
echo "$name.critical 0:0"
|
||||
done
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NOWTIME=`date --date "$MINUTE_BY_GREP_RANGE minute ago" +%s`
|
||||
|
||||
for(( I = 1; I < $CHECKMAX; ++I ))
|
||||
do
|
||||
eval log=\$log_${I}
|
||||
eval name=\$name_${I}
|
||||
eval grep=\$grep_${I}
|
||||
if [ "x${log}" = "x" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ "x${name}" = "x" ]; then
|
||||
name=`echo $log | sed 's#[/|\.]#_#g'`
|
||||
fi
|
||||
if [ "x${grep}" = "x" ]; then
|
||||
grep="critical|error|crash|fatal|kernel"
|
||||
fi
|
||||
|
||||
COUNT=0
|
||||
MESSAGE=
|
||||
IFS=$'\n'
|
||||
MATCHLINES=(`egrep -i "$grep" "$log"`)
|
||||
for(( N = ${#MATCHLINES[@]} - 1; N >= 0 ; --N ))
|
||||
do
|
||||
LINE=${MATCHLINES[$N]}
|
||||
DATESTRING=`echo $LINE | awk '{ printf("%s %s %s",$1,$2,$3)}'`
|
||||
LOGTIME=`date --date "$DATESTRING" +%s`
|
||||
if [ $LOGTIME -lt $NOWTIME ]; then
|
||||
break
|
||||
fi
|
||||
let COUNT="$COUNT + 1"
|
||||
MESSAGE="$MESSAGE$LINE //@LINE@// "
|
||||
done
|
||||
|
||||
|
||||
if [ $COUNT -eq 0 ]; then
|
||||
echo "${name}.value 0"
|
||||
else
|
||||
echo "${name}.value ${COUNT}"
|
||||
echo "${name}.extinfo ${MESSAGE}"
|
||||
fi
|
||||
done
|
||||
#!/bin/bash
|
||||
#
|
||||
#healthcheck on munin
|
||||
#egrep system log and alert.
|
||||
#
|
||||
#programed by rti (hiroyuki fujie) super.rti@gmail.com @super_rti
|
||||
#LICENSE: NYSL (public domain)
|
||||
#
|
||||
#
|
||||
#config file
|
||||
# /etc/munin/plugin-conf.d/munin-node
|
||||
#
|
||||
#example minimum config
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root
|
||||
#env.log_1 /var/log/messages
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#check two log
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root
|
||||
#env.log_1 /var/log/messages
|
||||
#env.log_2 /var/log/syslog
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#check two three
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root
|
||||
#env.log_1 /var/log/messages
|
||||
#env.log_2 /var/log/syslog
|
||||
#env.log_3 /var/log/dmesg
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#set name
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root
|
||||
#env.log_1 /var/log/messages
|
||||
#env.name_1 my_server_messages
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#set egrep string
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root
|
||||
#env.log_1 /var/log/messages
|
||||
#env.grep_1 alert|warning
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#set egrep string
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root
|
||||
#env.log_1 /var/log/messages
|
||||
#env.grep_1 alert|warning
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#full option
|
||||
#/etc/munin/plugin-conf.d/munin-node
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_log]
|
||||
#user root #log file is read only root user.
|
||||
#env.log_1 /var/log/messages #target log filename
|
||||
#env.grep_1 critical|error #egrep string.
|
||||
#defualt by critical|error|warning|crash|fatal|kernel
|
||||
#---------------------------------------------------
|
||||
#
|
||||
|
||||
|
||||
#edakari speed up.
|
||||
CHECKMAX=`env | grep log_ | wc -l`
|
||||
let CHECKMAX="$CHECKMAX + 1"
|
||||
MINUTE_BY_GREP_RANGE=10
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ $CHECKMAX -le 1 ]; then
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title log grep (match count)'
|
||||
echo "graph_args --base 1000 -l 0 --vertical-label match_count"
|
||||
echo 'graph_scale no'
|
||||
echo 'graph_vlabel match_count'
|
||||
echo 'graph_category healthcheck'
|
||||
echo 'graph_info This graph shows the bad event count on log'
|
||||
|
||||
for(( I = 1; I < $CHECKMAX; ++I ))
|
||||
do
|
||||
eval log=\$log_${I}
|
||||
eval name=\$name_${I}
|
||||
eval grep=\$grep_${I}
|
||||
if [ "x${log}" = "x" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ "x${name}" = "x" ]; then
|
||||
name=`echo $log | sed 's#[/|\.]#_#g'`
|
||||
fi
|
||||
if [ "x${name}" = "x" ]; then
|
||||
grep="critical|error|crash|fatal|kernel"
|
||||
fi
|
||||
|
||||
echo "$name.label $name"
|
||||
echo "$name.info egrep $grep $log | wc -l"
|
||||
echo "$name.draw LINE2"
|
||||
echo "$name.min 0"
|
||||
echo "$name.max 20"
|
||||
echo "$name.critical 0:0"
|
||||
done
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NOWTIME=`date --date "$MINUTE_BY_GREP_RANGE minute ago" +%s`
|
||||
|
||||
for(( I = 1; I < $CHECKMAX; ++I ))
|
||||
do
|
||||
eval log=\$log_${I}
|
||||
eval name=\$name_${I}
|
||||
eval grep=\$grep_${I}
|
||||
if [ "x${log}" = "x" ]; then
|
||||
continue
|
||||
fi
|
||||
if [ "x${name}" = "x" ]; then
|
||||
name=`echo $log | sed 's#[/|\.]#_#g'`
|
||||
fi
|
||||
if [ "x${grep}" = "x" ]; then
|
||||
grep="critical|error|crash|fatal|kernel"
|
||||
fi
|
||||
|
||||
COUNT=0
|
||||
MESSAGE=
|
||||
IFS=$'\n'
|
||||
MATCHLINES=(`egrep -i "$grep" "$log"`)
|
||||
for(( N = ${#MATCHLINES[@]} - 1; N >= 0 ; --N ))
|
||||
do
|
||||
LINE=${MATCHLINES[$N]}
|
||||
DATESTRING=`echo $LINE | awk '{ printf("%s %s %s",$1,$2,$3)}'`
|
||||
LOGTIME=`date --date "$DATESTRING" +%s`
|
||||
if [ $LOGTIME -lt $NOWTIME ]; then
|
||||
break
|
||||
fi
|
||||
let COUNT="$COUNT + 1"
|
||||
MESSAGE="$MESSAGE$LINE //@LINE@// "
|
||||
done
|
||||
|
||||
|
||||
if [ $COUNT -eq 0 ]; then
|
||||
echo "${name}.value 0"
|
||||
else
|
||||
echo "${name}.value ${COUNT}"
|
||||
echo "${name}.extinfo ${MESSAGE}"
|
||||
fi
|
||||
done
|
||||
|
@ -1,92 +1,92 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#healthcheck on munin
|
||||
#check process and alert.
|
||||
#
|
||||
#programed by rti (hiroyuki fujie) super.rti@gmail.com @super_rti
|
||||
#LICENSE: NYSL (public domain)
|
||||
#
|
||||
#config file
|
||||
# /etc/munin/plugin-conf.d/munin-node
|
||||
#
|
||||
#example minimum config
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_process]
|
||||
#env.process_1 httpd
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#chcek two process
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_process]
|
||||
#env.process_1 httpd
|
||||
#env.process_2 samba
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#chcek three process
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_process]
|
||||
#env.process_1 httpd
|
||||
#env.process_2 samba
|
||||
#env.process_3 mysqld
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
#edakari speed up.
|
||||
CHECKMAX=`env | grep process_ | wc -l`
|
||||
let CHECKMAX="$CHECKMAX + 1"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ $CHECKMAX -le 1 ]; then
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title process memory Usage(MB)'
|
||||
echo "graph_args --base 1000 -l 0 --vertical-label MB"
|
||||
echo 'graph_scale no'
|
||||
echo 'graph_vlabel process memory'
|
||||
echo 'graph_category healthcheck'
|
||||
echo 'graph_info This graph shows the Memory used by process'
|
||||
|
||||
for(( I = 1; I < $CHECKMAX; ++I ))
|
||||
do
|
||||
eval process=\$process_${I}
|
||||
eval alertmemory=\$alertmemory_${I}
|
||||
if [ "x${process}" = "x" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "$process.label $process"
|
||||
echo "$process.info Memory used by $process"
|
||||
echo "$process.draw LINE2"
|
||||
echo "$process.min -10"
|
||||
echo "$process.critical 0:"
|
||||
done
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for(( I = 1; I < $CHECKMAX; ++I ))
|
||||
do
|
||||
eval process=\$process_${I}
|
||||
if [ "x${process}" = "x" ]; then
|
||||
continue
|
||||
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); }'`)
|
||||
count=${vrets[0]}
|
||||
value=${vrets[1]}
|
||||
if [ $count -le 0 ]; then
|
||||
echo "$process.value -10"
|
||||
echo "$process.extinfo process down"
|
||||
else
|
||||
echo "$process.value $value"
|
||||
fi
|
||||
done
|
||||
#!/bin/bash
|
||||
#
|
||||
#healthcheck on munin
|
||||
#check process and alert.
|
||||
#
|
||||
#programed by rti (hiroyuki fujie) super.rti@gmail.com @super_rti
|
||||
#LICENSE: NYSL (public domain)
|
||||
#
|
||||
#config file
|
||||
# /etc/munin/plugin-conf.d/munin-node
|
||||
#
|
||||
#example minimum config
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_process]
|
||||
#env.process_1 httpd
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#chcek two process
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_process]
|
||||
#env.process_1 httpd
|
||||
#env.process_2 samba
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#chcek three process
|
||||
#---------------------------------------------------
|
||||
#[healthcheck_process]
|
||||
#env.process_1 httpd
|
||||
#env.process_2 samba
|
||||
#env.process_3 mysqld
|
||||
#---------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
#edakari speed up.
|
||||
CHECKMAX=`env | grep process_ | wc -l`
|
||||
let CHECKMAX="$CHECKMAX + 1"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ $CHECKMAX -le 1 ]; then
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title process memory Usage(MB)'
|
||||
echo "graph_args --base 1000 -l 0 --vertical-label MB"
|
||||
echo 'graph_scale no'
|
||||
echo 'graph_vlabel process memory'
|
||||
echo 'graph_category healthcheck'
|
||||
echo 'graph_info This graph shows the Memory used by process'
|
||||
|
||||
for(( I = 1; I < $CHECKMAX; ++I ))
|
||||
do
|
||||
eval process=\$process_${I}
|
||||
eval alertmemory=\$alertmemory_${I}
|
||||
if [ "x${process}" = "x" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "$process.label $process"
|
||||
echo "$process.info Memory used by $process"
|
||||
echo "$process.draw LINE2"
|
||||
echo "$process.min -10"
|
||||
echo "$process.critical 0:"
|
||||
done
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for(( I = 1; I < $CHECKMAX; ++I ))
|
||||
do
|
||||
eval process=\$process_${I}
|
||||
if [ "x${process}" = "x" ]; then
|
||||
continue
|
||||
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); }'`)
|
||||
count=${vrets[0]}
|
||||
value=${vrets[1]}
|
||||
if [ $count -le 0 ]; then
|
||||
echo "$process.value -10"
|
||||
echo "$process.extinfo process down"
|
||||
else
|
||||
echo "$process.value $value"
|
||||
fi
|
||||
done
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# Plugin to graph response times of the specified websites/URLs.
|
||||
#
|
||||
|
@ -1,4 +1,4 @@
|
||||
#! @@PERL@@ -w
|
||||
#!/usr/bin/perl
|
||||
# -*- perl -*-
|
||||
|
||||
=pod
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
do_config() {
|
||||
graph=( 2 # number of graphs.
|
||||
|
@ -1,53 +1,53 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Plugin to monitor incoming mails greylisted by postfix-policyd
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional)
|
||||
#
|
||||
|
||||
MYSQL_USER="postfix-policyd"
|
||||
MYSQL_PASS=""
|
||||
MYSQL_DB="postfixpolicyd"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -n "${MYSQL_PASS}" ] ; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo "no (set mysql pass)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Postfix-Policyd daily filtering'
|
||||
echo 'graph_order delayed passed whitelisted'
|
||||
echo 'graph_category mail'
|
||||
echo 'graph_vlabel Count'
|
||||
echo 'graph_scale no'
|
||||
|
||||
## echo 'graph_args --base 1000 -l 0'
|
||||
echo 'delayed.label delayed'
|
||||
echo 'delayed.type GAUGE'
|
||||
echo 'passed.label passed'
|
||||
echo 'passed.type GAUGE'
|
||||
echo 'whitelisted.label whitelisted'
|
||||
echo 'whitelisted.type GAUGE'
|
||||
echo 'blacklisted.label blacklisted'
|
||||
echo 'blacklisted.type GAUGE'
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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]`"
|
||||
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]`"
|
||||
|
||||
echo "delayed.value ${DELAYED}"
|
||||
echo "passed.value ${PASSED}"
|
||||
echo "whitelisted.value ${WHITELISTED}"
|
||||
echo "blacklisted.value ${BLACKLISTED}"
|
||||
#!/bin/bash
|
||||
#
|
||||
# Plugin to monitor incoming mails greylisted by postfix-policyd
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional)
|
||||
#
|
||||
|
||||
MYSQL_USER="postfix-policyd"
|
||||
MYSQL_PASS=""
|
||||
MYSQL_DB="postfixpolicyd"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -n "${MYSQL_PASS}" ] ; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo "no (set mysql pass)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Postfix-Policyd daily filtering'
|
||||
echo 'graph_order delayed passed whitelisted'
|
||||
echo 'graph_category mail'
|
||||
echo 'graph_vlabel Count'
|
||||
echo 'graph_scale no'
|
||||
|
||||
## echo 'graph_args --base 1000 -l 0'
|
||||
echo 'delayed.label delayed'
|
||||
echo 'delayed.type GAUGE'
|
||||
echo 'passed.label passed'
|
||||
echo 'passed.type GAUGE'
|
||||
echo 'whitelisted.label whitelisted'
|
||||
echo 'whitelisted.type GAUGE'
|
||||
echo 'blacklisted.label blacklisted'
|
||||
echo 'blacklisted.type GAUGE'
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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]`"
|
||||
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]`"
|
||||
|
||||
echo "delayed.value ${DELAYED}"
|
||||
echo "passed.value ${PASSED}"
|
||||
echo "whitelisted.value ${WHITELISTED}"
|
||||
echo "blacklisted.value ${BLACKLISTED}"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#! @@PERL@@ -w
|
||||
#!/usr/bin/perl
|
||||
# -*- perl -*-
|
||||
|
||||
=head1 NAME
|
||||
|
@ -92,7 +92,7 @@ graph_vlabel ${vlabel}
|
||||
graph_category ${category}
|
||||
graph_info ${info}
|
||||
EOH1
|
||||
[[ -n "${period}" ]] && echo "graph_period ${period}"
|
||||
[ -n "${period}" ] && echo "graph_period ${period}"
|
||||
I=1
|
||||
for name in ${names}; do
|
||||
eval iquery='${query_'${name}'}'
|
||||
|
@ -71,7 +71,8 @@
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
use DBI;
|
||||
use MythTV;
|
||||
eval 'use MythTV; 1;'
|
||||
or die 'Please install MythTV';
|
||||
use strict;
|
||||
use warnings;
|
||||
use Munin::Plugin;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/ruby -rauto_gem
|
||||
#!/usr/bin/ruby
|
||||
#
|
||||
# Munin plugin for the D-link DIR-655 router
|
||||
#
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
#
|
||||
# Munin plugin to show changing the ip address by ddclient.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# Wildcard-plugin to monitor IP addresses through iptables. To monitor an
|
||||
# IP, link fwbuilder_<ipaddress> to this file. E.g.
|
||||
|
@ -1,154 +1,154 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Munin plugin for HFSC Traffic Shaping Statistics
|
||||
#
|
||||
# It shows the general statistic graph of a used net bandwidth per a user.
|
||||
#
|
||||
# This plugin was tailored to the HFSC solution
|
||||
# presented at http://www.elessar.one.pl/article_kernel2.6.php
|
||||
#
|
||||
# You can find the plugin description and the installation notes here:
|
||||
# http://www.elessar.one.pl/article_munin.php
|
||||
#
|
||||
###
|
||||
# Written by Rafal Rajs
|
||||
# Date: 2007/06/19
|
||||
# Email: elessar1@poczta.wp.pl
|
||||
# WWW: http://www.elessar.one.pl
|
||||
###
|
||||
|
||||
#path to the file with global defs
|
||||
. /etc/scripts/globals
|
||||
|
||||
|
||||
# imported from HFSC script
|
||||
# set class numbers
|
||||
|
||||
N_CLASS_D_1=70
|
||||
N_CLASS_D_2=100
|
||||
N_CLASS_U_1=130
|
||||
N_CLASS_U_2=160
|
||||
SH_TMP="/etc/scripts/tmp.txt"
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo "graph_title HFSC Traffic Shaping Stats"
|
||||
echo 'graph_vlabel bytes per ${graph_period}'
|
||||
echo 'graph_category network'
|
||||
|
||||
j=1
|
||||
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
echo "${USERNAMES[${j}]}.label ${USERNAMES[${j}]}"
|
||||
echo "${USERNAMES[${j}]}.type COUNTER"
|
||||
|
||||
if [ $j == 1 ]; then
|
||||
echo "${USERNAMES[${j}]}.draw AREA"
|
||||
else
|
||||
echo "${USERNAMES[${j}]}.draw STACK"
|
||||
fi;
|
||||
|
||||
echo "${USERNAMES[${j}]}.info Stats for ${USERNAMES[${j}]} - ${USER_IP[${j}]}"
|
||||
echo "${USERNAMES[${j}]}.min 0"
|
||||
echo "${USERNAMES[${j}]}.max 130000"
|
||||
|
||||
j=$[$j+1]
|
||||
|
||||
done;
|
||||
|
||||
#customized colours
|
||||
echo 'Serwer.colour 000000'
|
||||
|
||||
exit 0
|
||||
|
||||
fi;
|
||||
|
||||
#### DOWNLOAD
|
||||
|
||||
temp1=`/sbin/tc -s class show dev imq0 > $SH_TMP`
|
||||
|
||||
|
||||
while read line
|
||||
do
|
||||
test_hfsc=`echo $line | grep "hfsc"`
|
||||
|
||||
j=1
|
||||
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
case $test_hfsc in
|
||||
|
||||
*hfsc[\ ]1:$[$N_CLASS_D_1+$j]*)
|
||||
# check N_CLASS_D_1 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_D_1="$temp1
|
||||
# echo "N_CLASS_D_1_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
*hfsc[\ ]1:$[$N_CLASS_D_2+$j]*)
|
||||
# check N_CLASS_D_2 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_D_2="$temp1
|
||||
# echo "N_CLASS_D_2_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
esac
|
||||
|
||||
j=$[$j+1]
|
||||
|
||||
done;
|
||||
|
||||
done < $SH_TMP
|
||||
|
||||
#### UPLOAD
|
||||
|
||||
temp1=`/sbin/tc -s class show dev imq1 > $SH_TMP`
|
||||
|
||||
|
||||
while read line
|
||||
do
|
||||
test_hfsc=`echo $line | grep "hfsc"`
|
||||
|
||||
j=1
|
||||
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
case $test_hfsc in
|
||||
|
||||
*hfsc[\ ]1:$[$N_CLASS_U_1+$j]*)
|
||||
# check N_CLASS_U_1 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_U_1="$temp1
|
||||
# echo "N_CLASS_U_1_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
*hfsc[\ ]1:$[$N_CLASS_U_2+$j]*)
|
||||
# check N_CLASS_U_2 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_U_2="$temp1
|
||||
# echo "N_CLASS_U_2_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
esac
|
||||
|
||||
j=$[$j+1]
|
||||
|
||||
done;
|
||||
|
||||
done < $SH_TMP
|
||||
|
||||
j=1
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
echo ${USERNAMES[${j}]}".value "${STAT_USER[$j]}
|
||||
j=$[$j+1]
|
||||
done;
|
||||
|
||||
|
||||
## clean temp file
|
||||
temp1=`echo "" > $SH_TMP`
|
||||
#!/bin/bash
|
||||
#
|
||||
# Munin plugin for HFSC Traffic Shaping Statistics
|
||||
#
|
||||
# It shows the general statistic graph of a used net bandwidth per a user.
|
||||
#
|
||||
# This plugin was tailored to the HFSC solution
|
||||
# presented at http://www.elessar.one.pl/article_kernel2.6.php
|
||||
#
|
||||
# You can find the plugin description and the installation notes here:
|
||||
# http://www.elessar.one.pl/article_munin.php
|
||||
#
|
||||
###
|
||||
# Written by Rafal Rajs
|
||||
# Date: 2007/06/19
|
||||
# Email: elessar1@poczta.wp.pl
|
||||
# WWW: http://www.elessar.one.pl
|
||||
###
|
||||
|
||||
#path to the file with global defs
|
||||
. /etc/scripts/globals
|
||||
|
||||
|
||||
# imported from HFSC script
|
||||
# set class numbers
|
||||
|
||||
N_CLASS_D_1=70
|
||||
N_CLASS_D_2=100
|
||||
N_CLASS_U_1=130
|
||||
N_CLASS_U_2=160
|
||||
SH_TMP="/etc/scripts/tmp.txt"
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo "graph_title HFSC Traffic Shaping Stats"
|
||||
echo 'graph_vlabel bytes per ${graph_period}'
|
||||
echo 'graph_category network'
|
||||
|
||||
j=1
|
||||
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
echo "${USERNAMES[${j}]}.label ${USERNAMES[${j}]}"
|
||||
echo "${USERNAMES[${j}]}.type COUNTER"
|
||||
|
||||
if [ $j == 1 ]; then
|
||||
echo "${USERNAMES[${j}]}.draw AREA"
|
||||
else
|
||||
echo "${USERNAMES[${j}]}.draw STACK"
|
||||
fi;
|
||||
|
||||
echo "${USERNAMES[${j}]}.info Stats for ${USERNAMES[${j}]} - ${USER_IP[${j}]}"
|
||||
echo "${USERNAMES[${j}]}.min 0"
|
||||
echo "${USERNAMES[${j}]}.max 130000"
|
||||
|
||||
j=$[$j+1]
|
||||
|
||||
done;
|
||||
|
||||
#customized colours
|
||||
echo 'Serwer.colour 000000'
|
||||
|
||||
exit 0
|
||||
|
||||
fi;
|
||||
|
||||
#### DOWNLOAD
|
||||
|
||||
temp1=`/sbin/tc -s class show dev imq0 > $SH_TMP`
|
||||
|
||||
|
||||
while read line
|
||||
do
|
||||
test_hfsc=`echo $line | grep "hfsc"`
|
||||
|
||||
j=1
|
||||
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
case $test_hfsc in
|
||||
|
||||
*hfsc[\ ]1:$[$N_CLASS_D_1+$j]*)
|
||||
# check N_CLASS_D_1 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_D_1="$temp1
|
||||
# echo "N_CLASS_D_1_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
*hfsc[\ ]1:$[$N_CLASS_D_2+$j]*)
|
||||
# check N_CLASS_D_2 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_D_2="$temp1
|
||||
# echo "N_CLASS_D_2_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
esac
|
||||
|
||||
j=$[$j+1]
|
||||
|
||||
done;
|
||||
|
||||
done < $SH_TMP
|
||||
|
||||
#### UPLOAD
|
||||
|
||||
temp1=`/sbin/tc -s class show dev imq1 > $SH_TMP`
|
||||
|
||||
|
||||
while read line
|
||||
do
|
||||
test_hfsc=`echo $line | grep "hfsc"`
|
||||
|
||||
j=1
|
||||
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
case $test_hfsc in
|
||||
|
||||
*hfsc[\ ]1:$[$N_CLASS_U_1+$j]*)
|
||||
# check N_CLASS_U_1 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_U_1="$temp1
|
||||
# echo "N_CLASS_U_1_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
*hfsc[\ ]1:$[$N_CLASS_U_2+$j]*)
|
||||
# check N_CLASS_U_2 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_U_2="$temp1
|
||||
# echo "N_CLASS_U_2_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
esac
|
||||
|
||||
j=$[$j+1]
|
||||
|
||||
done;
|
||||
|
||||
done < $SH_TMP
|
||||
|
||||
j=1
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
echo ${USERNAMES[${j}]}".value "${STAT_USER[$j]}
|
||||
j=$[$j+1]
|
||||
done;
|
||||
|
||||
|
||||
## clean temp file
|
||||
temp1=`echo "" > $SH_TMP`
|
||||
|
@ -1,189 +1,189 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# This plugin was tailored to the HFSC solution
|
||||
# presented at http://www.elessar.one.pl/article_kernel2.6.php
|
||||
#
|
||||
# You can find the plugin description and the installation notes here:
|
||||
# http://www.elessar.one.pl/article_munin.php
|
||||
#
|
||||
###
|
||||
# Written by Rafal Rajs
|
||||
# Date: 2007/06/19
|
||||
# Email: elessar1@poczta.wp.pl
|
||||
# WWW: http://www.elessar.one.pl
|
||||
###
|
||||
|
||||
# path to the file with global defs
|
||||
. /etc/scripts/globals
|
||||
|
||||
# imported from HFSC script
|
||||
# set class numbers
|
||||
|
||||
N_CLASS_D_1=70
|
||||
N_CLASS_D_2=100
|
||||
N_CLASS_U_1=130
|
||||
N_CLASS_U_2=160
|
||||
SH_TMP="/etc/scripts/tmp1.txt"
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo "graph_title HFSC Traffic Shaping Stats - UP/DOWN"
|
||||
echo 'graph_vlabel bytes DOWN(-)/UP(+) per ${graph_period}'
|
||||
echo 'graph_width 450'
|
||||
echo 'graph_category network'
|
||||
|
||||
j=1
|
||||
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
echo "${USERNAMES[${j}]}_down.label ${USERNAMES[${j}]}"
|
||||
echo "${USERNAMES[${j}]}_down.type COUNTER"
|
||||
echo "${USERNAMES[${j}]}_down.graph no"
|
||||
|
||||
if [ $j == 1 ]; then
|
||||
echo "${USERNAMES[${j}]}_down.draw AREA"
|
||||
else
|
||||
echo "${USERNAMES[${j}]}_down.draw STACK"
|
||||
fi;
|
||||
|
||||
echo "${USERNAMES[${j}]}_down.info Stats for ${USERNAMES[${j}]} - ${USER_IP[${j}]}"
|
||||
echo "${USERNAMES[${j}]}_down.min 0"
|
||||
echo "${USERNAMES[${j}]}_down.max 130000"
|
||||
|
||||
echo "${USERNAMES[${j}]}_up.label ${USERNAMES[${j}]}"
|
||||
echo "${USERNAMES[${j}]}_up.type COUNTER"
|
||||
echo "${USERNAMES[${j}]}_up.negative ${USERNAMES[${j}]}_down"
|
||||
|
||||
if [ $j == 1 ]; then
|
||||
echo "${USERNAMES[${j}]}_up.draw AREA"
|
||||
else
|
||||
echo "${USERNAMES[${j}]}_up.draw STACK"
|
||||
fi;
|
||||
|
||||
echo "${USERNAMES[${j}]}_up.info Stats for ${USERNAMES[${j}]} - ${USER_IP[${j}]}"
|
||||
echo "${USERNAMES[${j}]}_up.min 0"
|
||||
echo "${USERNAMES[${j}]}_up.max 30000"
|
||||
|
||||
|
||||
j=$[$j+1]
|
||||
|
||||
done;
|
||||
|
||||
#customized colours
|
||||
echo 'Serwer_down.colour 000000'
|
||||
echo 'Serwer_up.colour 000000'
|
||||
|
||||
exit 0
|
||||
|
||||
fi;
|
||||
|
||||
#### DOWNLOAD
|
||||
|
||||
temp1=`/sbin/tc -s class show dev imq0 > $SH_TMP`
|
||||
|
||||
while read line
|
||||
do
|
||||
test_hfsc=`echo $line | grep "hfsc"`
|
||||
|
||||
j=1
|
||||
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
case $test_hfsc in
|
||||
|
||||
*hfsc[\ ]1:$[$N_CLASS_D_1+$j]*)
|
||||
# check N_CLASS_D_1 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_D_1="$temp1
|
||||
# echo "N_CLASS_D_1_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
*hfsc[\ ]1:$[$N_CLASS_D_2+$j]*)
|
||||
# check N_CLASS_D_2 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_D_2="$temp1
|
||||
# echo "N_CLASS_D_2_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
esac
|
||||
|
||||
j=$[$j+1]
|
||||
|
||||
done;
|
||||
|
||||
done < $SH_TMP
|
||||
|
||||
|
||||
####
|
||||
|
||||
j=1
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
echo ${USERNAMES[${j}]}"_down.value "${STAT_USER[$j]}
|
||||
j=$[$j+1]
|
||||
done;
|
||||
|
||||
#reset values
|
||||
|
||||
j=1
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
STAT_USER[$j]=0
|
||||
j=$[$j+1]
|
||||
done;
|
||||
|
||||
#### UPLOAD
|
||||
|
||||
temp1=`/sbin/tc -s class show dev imq1 > $SH_TMP`
|
||||
|
||||
while read line
|
||||
do
|
||||
test_hfsc=`echo $line | grep "hfsc"`
|
||||
|
||||
j=1
|
||||
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
case $test_hfsc in
|
||||
|
||||
*hfsc[\ ]1:$[$N_CLASS_U_1+$j]*)
|
||||
# check N_CLASS_U_1 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_U_1="$temp1
|
||||
# echo "N_CLASS_U_1_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
*hfsc[\ ]1:$[$N_CLASS_U_2+$j]*)
|
||||
# check N_CLASS_U_2 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_U_2="$temp1
|
||||
# echo "N_CLASS_U_2_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
esac
|
||||
|
||||
j=$[$j+1]
|
||||
|
||||
done;
|
||||
|
||||
done < $SH_TMP
|
||||
|
||||
j=1
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
echo ${USERNAMES[${j}]}"_up.value "${STAT_USER[$j]}
|
||||
j=$[$j+1]
|
||||
done;
|
||||
|
||||
|
||||
## clean temp file
|
||||
temp1=`echo "" > $SH_TMP`
|
||||
|
||||
#!/bin/bash
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# This plugin was tailored to the HFSC solution
|
||||
# presented at http://www.elessar.one.pl/article_kernel2.6.php
|
||||
#
|
||||
# You can find the plugin description and the installation notes here:
|
||||
# http://www.elessar.one.pl/article_munin.php
|
||||
#
|
||||
###
|
||||
# Written by Rafal Rajs
|
||||
# Date: 2007/06/19
|
||||
# Email: elessar1@poczta.wp.pl
|
||||
# WWW: http://www.elessar.one.pl
|
||||
###
|
||||
|
||||
# path to the file with global defs
|
||||
. /etc/scripts/globals
|
||||
|
||||
# imported from HFSC script
|
||||
# set class numbers
|
||||
|
||||
N_CLASS_D_1=70
|
||||
N_CLASS_D_2=100
|
||||
N_CLASS_U_1=130
|
||||
N_CLASS_U_2=160
|
||||
SH_TMP="/etc/scripts/tmp1.txt"
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo "graph_title HFSC Traffic Shaping Stats - UP/DOWN"
|
||||
echo 'graph_vlabel bytes DOWN(-)/UP(+) per ${graph_period}'
|
||||
echo 'graph_width 450'
|
||||
echo 'graph_category network'
|
||||
|
||||
j=1
|
||||
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
echo "${USERNAMES[${j}]}_down.label ${USERNAMES[${j}]}"
|
||||
echo "${USERNAMES[${j}]}_down.type COUNTER"
|
||||
echo "${USERNAMES[${j}]}_down.graph no"
|
||||
|
||||
if [ $j == 1 ]; then
|
||||
echo "${USERNAMES[${j}]}_down.draw AREA"
|
||||
else
|
||||
echo "${USERNAMES[${j}]}_down.draw STACK"
|
||||
fi;
|
||||
|
||||
echo "${USERNAMES[${j}]}_down.info Stats for ${USERNAMES[${j}]} - ${USER_IP[${j}]}"
|
||||
echo "${USERNAMES[${j}]}_down.min 0"
|
||||
echo "${USERNAMES[${j}]}_down.max 130000"
|
||||
|
||||
echo "${USERNAMES[${j}]}_up.label ${USERNAMES[${j}]}"
|
||||
echo "${USERNAMES[${j}]}_up.type COUNTER"
|
||||
echo "${USERNAMES[${j}]}_up.negative ${USERNAMES[${j}]}_down"
|
||||
|
||||
if [ $j == 1 ]; then
|
||||
echo "${USERNAMES[${j}]}_up.draw AREA"
|
||||
else
|
||||
echo "${USERNAMES[${j}]}_up.draw STACK"
|
||||
fi;
|
||||
|
||||
echo "${USERNAMES[${j}]}_up.info Stats for ${USERNAMES[${j}]} - ${USER_IP[${j}]}"
|
||||
echo "${USERNAMES[${j}]}_up.min 0"
|
||||
echo "${USERNAMES[${j}]}_up.max 30000"
|
||||
|
||||
|
||||
j=$[$j+1]
|
||||
|
||||
done;
|
||||
|
||||
#customized colours
|
||||
echo 'Serwer_down.colour 000000'
|
||||
echo 'Serwer_up.colour 000000'
|
||||
|
||||
exit 0
|
||||
|
||||
fi;
|
||||
|
||||
#### DOWNLOAD
|
||||
|
||||
temp1=`/sbin/tc -s class show dev imq0 > $SH_TMP`
|
||||
|
||||
while read line
|
||||
do
|
||||
test_hfsc=`echo $line | grep "hfsc"`
|
||||
|
||||
j=1
|
||||
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
case $test_hfsc in
|
||||
|
||||
*hfsc[\ ]1:$[$N_CLASS_D_1+$j]*)
|
||||
# check N_CLASS_D_1 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_D_1="$temp1
|
||||
# echo "N_CLASS_D_1_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
*hfsc[\ ]1:$[$N_CLASS_D_2+$j]*)
|
||||
# check N_CLASS_D_2 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_D_2="$temp1
|
||||
# echo "N_CLASS_D_2_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
esac
|
||||
|
||||
j=$[$j+1]
|
||||
|
||||
done;
|
||||
|
||||
done < $SH_TMP
|
||||
|
||||
|
||||
####
|
||||
|
||||
j=1
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
echo ${USERNAMES[${j}]}"_down.value "${STAT_USER[$j]}
|
||||
j=$[$j+1]
|
||||
done;
|
||||
|
||||
#reset values
|
||||
|
||||
j=1
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
STAT_USER[$j]=0
|
||||
j=$[$j+1]
|
||||
done;
|
||||
|
||||
#### UPLOAD
|
||||
|
||||
temp1=`/sbin/tc -s class show dev imq1 > $SH_TMP`
|
||||
|
||||
while read line
|
||||
do
|
||||
test_hfsc=`echo $line | grep "hfsc"`
|
||||
|
||||
j=1
|
||||
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
case $test_hfsc in
|
||||
|
||||
*hfsc[\ ]1:$[$N_CLASS_U_1+$j]*)
|
||||
# check N_CLASS_U_1 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_U_1="$temp1
|
||||
# echo "N_CLASS_U_1_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
*hfsc[\ ]1:$[$N_CLASS_U_2+$j]*)
|
||||
# check N_CLASS_U_2 stats for every user
|
||||
read line
|
||||
temp1=`echo $line | awk '{ print $2; }'`
|
||||
STAT_USER[$j]=$[${STAT_USER[$j]}+$temp1]
|
||||
# echo "N_CLASS_U_2="$temp1
|
||||
# echo "N_CLASS_U_2_SUM "$j" ="${STAT_USER[$j]}
|
||||
;;
|
||||
esac
|
||||
|
||||
j=$[$j+1]
|
||||
|
||||
done;
|
||||
|
||||
done < $SH_TMP
|
||||
|
||||
j=1
|
||||
while [ $j -le $L_USERS ]
|
||||
do
|
||||
echo ${USERNAMES[${j}]}"_up.value "${STAT_USER[$j]}
|
||||
j=$[$j+1]
|
||||
done;
|
||||
|
||||
|
||||
## clean temp file
|
||||
temp1=`echo "" > $SH_TMP`
|
||||
|
||||
|
@ -84,7 +84,7 @@ IFACES=`$iptables -L munin_node -nvx | awk '$6 ~ /(eth|ppp)[0-9]/ { if (done[$6]
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
# echo "graph_order out in"
|
||||
if [ "$TYPE" == "pkts" ]; then
|
||||
if [ "$TYPE" = "pkts" ]; then
|
||||
echo "graph_title pkts"
|
||||
echo 'graph_vlabel pkts per ${graph_period}'
|
||||
else
|
||||
@ -107,7 +107,7 @@ if [ "$1" = "config" ]; then
|
||||
exit 0
|
||||
fi;
|
||||
|
||||
if [ "$TYPE" == "pkts" ]; then
|
||||
if [ "$TYPE" = "pkts" ]; then
|
||||
$iptables -L munin_node -nvx | egrep "eth|ppp" | awk "{ print \$6 \".value \" \$1 }"
|
||||
else
|
||||
$iptables -L munin_node -nvx | egrep "eth|ppp" | awk "{ print \$6 \".value \" \$2 }"
|
||||
|
@ -55,6 +55,7 @@ NETSTAT=${netstat:-`which netstat`}
|
||||
NETSTAT=${NETSTAT:-/usr/bin/netstat}
|
||||
PORTS=${ports:-389 636}
|
||||
TEMP_FILE=$(mktemp /tmp/munin_ldap.XXXXXX)
|
||||
trap "rm -f ${TEMP_FILE}" EXIT
|
||||
PATH=/bin:/usr/bin:/usr/local/bin
|
||||
SOCKET=${socket:-/var/run/openldap/ldapi}
|
||||
|
||||
@ -96,7 +97,7 @@ if [ "$1" = "autoconf" ]; then
|
||||
for port in $PORTS; do
|
||||
ONE_LISTENING=${ONE_LISTENING}$(find_ips_bound $port)
|
||||
done
|
||||
rm -f $TEMP_FILE
|
||||
|
||||
if [ -n "$ONE_LISTENING" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
@ -121,17 +122,26 @@ if [ "$1" = "config" ]; then
|
||||
echo "socket.label ldapi"
|
||||
fi
|
||||
fi
|
||||
rm -f $TEMP_FILE
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for port in $LISTENING_PORTS; 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
|
||||
if [ -e "$SOCKET" ]; then
|
||||
echo "socket.value $($NETSTAT -an ${FAMILYMARK}unix | grep $SOCKET | wc -l | sed 's/[[:space:]]*//g')"
|
||||
fi
|
||||
|
||||
rm -f $TEMP_FILE
|
||||
|
@ -72,7 +72,14 @@ USA.
|
||||
|
||||
use strict;
|
||||
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;
|
||||
my (%defaults, @hosts, $cmd_arg);
|
||||
|
||||
|
@ -1,60 +1,60 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2009 Sven-Hendrik Haase
|
||||
# Copyright (C) 2004 Jimmy Olsen
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
# Plugin to monitor packet loss
|
||||
#
|
||||
# Please note that sometimes it can take quite long for the plugin to return
|
||||
# a value on a network with lots of packet loss.
|
||||
# You therefore need to account for it by appending the following to your
|
||||
# plugin-conf.d/munin-node. Remember to restart munin-node afterwards.
|
||||
# Append the next 3 lines to plugin-conf.d/munin-node:
|
||||
# [packetloss_*]
|
||||
# timeout 60
|
||||
# user root
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# ping_args - Arguments to ping (default "-c 2")
|
||||
# ping_args2 - Arguments after the host name (required for Solaris)
|
||||
# ping - Ping program to use
|
||||
# host - Host to ping
|
||||
#
|
||||
# Arguments for Solaris:
|
||||
# ping_args -s
|
||||
# ping_args2 56 2
|
||||
#
|
||||
#%# family=manual
|
||||
|
||||
file_host=`basename $0 | sed 's/^packetloss_//g'`
|
||||
host=${host:-${file_host:-www.google.com}}
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo "graph_title Packet loss to $host (in %)"
|
||||
echo 'graph_args --upper-limit 100 -l 0'
|
||||
echo 'graph_vlabel %'
|
||||
echo 'graph_category network'
|
||||
echo 'graph_info This graph shows packet loss statistics.'
|
||||
echo "packetloss.label $host"
|
||||
echo "packetloss.info Packet loss statistics for $host."
|
||||
echo 'packetloss.draw LINE2'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
${ping:-ping} ${ping_args:-'-c 10'} ${host} ${ping_args2} | perl -n -e 'print "packetloss.value $1\n" if /(\d+)% packet loss/;'
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2009 Sven-Hendrik Haase
|
||||
# Copyright (C) 2004 Jimmy Olsen
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
# Plugin to monitor packet loss
|
||||
#
|
||||
# Please note that sometimes it can take quite long for the plugin to return
|
||||
# a value on a network with lots of packet loss.
|
||||
# You therefore need to account for it by appending the following to your
|
||||
# plugin-conf.d/munin-node. Remember to restart munin-node afterwards.
|
||||
# Append the next 3 lines to plugin-conf.d/munin-node:
|
||||
# [packetloss_*]
|
||||
# timeout 60
|
||||
# user root
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# ping_args - Arguments to ping (default "-c 2")
|
||||
# ping_args2 - Arguments after the host name (required for Solaris)
|
||||
# ping - Ping program to use
|
||||
# host - Host to ping
|
||||
#
|
||||
# Arguments for Solaris:
|
||||
# ping_args -s
|
||||
# ping_args2 56 2
|
||||
#
|
||||
#%# family=manual
|
||||
|
||||
file_host=`basename $0 | sed 's/^packetloss_//g'`
|
||||
host=${host:-${file_host:-www.google.com}}
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo "graph_title Packet loss to $host (in %)"
|
||||
echo 'graph_args --upper-limit 100 -l 0'
|
||||
echo 'graph_vlabel %'
|
||||
echo 'graph_category network'
|
||||
echo 'graph_info This graph shows packet loss statistics.'
|
||||
echo "packetloss.label $host"
|
||||
echo "packetloss.info Packet loss statistics for $host."
|
||||
echo 'packetloss.draw LINE2'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
${ping:-ping} ${ping_args:-'-c 10'} ${host} ${ping_args2} | perl -n -e 'print "packetloss.value $1\n" if /(\d+)% packet loss/;'
|
||||
|
@ -1,42 +1,42 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
PATH=/bin:/usr/bin
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
DAEMONS=`sockstat | awk '{print substr($0, 1, 8)}' | sort | uniq`
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Connections'
|
||||
echo 'graph_vlabel Connections'
|
||||
echo 'graph_noscale true'
|
||||
echo 'graph_category network'
|
||||
echo 'graph_info This graph shows connections load.'
|
||||
|
||||
for D in $DAEMONS
|
||||
do
|
||||
echo "_$D.label $D"
|
||||
done
|
||||
|
||||
echo "_TOTAL.label TOTAL"
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
VALUES=`sockstat | awk '{print substr($0, 1, 8)}' | sort | uniq -c`
|
||||
NUM=1
|
||||
|
||||
for D in $DAEMONS
|
||||
do
|
||||
echo -n "_$D.value "
|
||||
VAL=`echo $VALUES | cut -d ' ' -f $NUM`
|
||||
echo $VAL
|
||||
NUM=$(($NUM + 2))
|
||||
done
|
||||
|
||||
echo -n "_TOTAL.value "
|
||||
sockstat | wc -l
|
||||
#!/bin/sh
|
||||
#
|
||||
|
||||
PATH=/bin:/usr/bin
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
DAEMONS=`sockstat | awk '{print substr($0, 1, 8)}' | sort | uniq`
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Connections'
|
||||
echo 'graph_vlabel Connections'
|
||||
echo 'graph_noscale true'
|
||||
echo 'graph_category network'
|
||||
echo 'graph_info This graph shows connections load.'
|
||||
|
||||
for D in $DAEMONS
|
||||
do
|
||||
echo "_$D.label $D"
|
||||
done
|
||||
|
||||
echo "_TOTAL.label TOTAL"
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
VALUES=`sockstat | awk '{print substr($0, 1, 8)}' | sort | uniq -c`
|
||||
NUM=1
|
||||
|
||||
for D in $DAEMONS
|
||||
do
|
||||
echo -n "_$D.value "
|
||||
VAL=`echo $VALUES | cut -d ' ' -f $NUM`
|
||||
echo $VAL
|
||||
NUM=$(($NUM + 2))
|
||||
done
|
||||
|
||||
echo -n "_TOTAL.value "
|
||||
sockstat | wc -l
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
#
|
||||
# Munin plugin to show the up- / download stream of the actual
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# A Munin Plugin to show umts signal strength using gcom
|
||||
# Created by Derik Vercueil <jfvercueil@yahoo.co.uk>
|
||||
|
@ -64,7 +64,7 @@ if(defined($ARGV[0])) {
|
||||
print "graph_total Total\n";
|
||||
print "graph_vlabel Bits\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";
|
||||
while ((my $project, my @files) = each(%logs)) {
|
||||
print $project.".label $project\n";
|
||||
|
@ -61,7 +61,7 @@ if(defined($ARGV[0])) {
|
||||
print "graph_args --base 1000\n";
|
||||
print "graph_vlabel bits per \${graph_period} in (-) / out (+)\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";
|
||||
while ((my $project, my @files) = each(%logs)) {
|
||||
print "i".$project.".label $project\n";
|
||||
|
@ -72,7 +72,7 @@ for i in $LIST1; do
|
||||
done
|
||||
|
||||
# If TOTU is 0, change to 1 for avoid problem in the division
|
||||
if [[ $TOTU -eq 0 ]]; then
|
||||
if [ "$TOTU" = "0" ]; then
|
||||
TOTU=1
|
||||
fi
|
||||
|
||||
|
@ -1,153 +1,153 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Munin plugin to monitor oracle connections w/o DBD::Oracle, or perl for that
|
||||
# matter ;-)
|
||||
#
|
||||
# Author: Kevin Kunkel (kunkel.kevin@gmail.com) on December 11, 2007
|
||||
# (Based off the perl munin plugin by Joan Carles Soler)
|
||||
#
|
||||
# Licenced under GPL v2.
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# If required, give username, password and/or oracle server
|
||||
# host through environment variables.
|
||||
#
|
||||
# Parameters:
|
||||
# autoconf
|
||||
# config (required)
|
||||
#
|
||||
# Config variables:
|
||||
#
|
||||
# ORACLE_SID - Which database to use. Defaults to orcl
|
||||
# oracle_user - A oracle user account with read permission to
|
||||
# the v$session view. Defaults to
|
||||
# 'oracle'. Anyway, Munin must be told which user
|
||||
# this plugin should be run as.
|
||||
# oracle_pass - The corresponding password, if
|
||||
# applicable. Default to undef.
|
||||
#
|
||||
# SHOW_ORACLE_USERS - If set to 1 show usernames and num. of connections.
|
||||
# Default is not show users (0).
|
||||
# Magic markers
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
|
||||
# Hard-code environment variables here
|
||||
|
||||
#oracle_user=
|
||||
#oracle_pass=
|
||||
#ORACLE_SID=
|
||||
#ORACLE_HOME=
|
||||
#SHOW_ORACLE_USERS=
|
||||
|
||||
# End variable hard-code
|
||||
|
||||
|
||||
|
||||
if [ -z "$ORACLE_HOME" ] ; then
|
||||
# Adjust to your oratab locations
|
||||
for oratab in /var/opt/oracle/oratab /etc/oratab
|
||||
do
|
||||
[ ! -f $oratab ] && continue
|
||||
IFS=:
|
||||
while read SID HOME STARTUP;
|
||||
do
|
||||
if [ "$SID" = "*" ]
|
||||
then
|
||||
ORACLE_HOME=$HOME
|
||||
break
|
||||
fi
|
||||
done < $oratab
|
||||
[ -n "$ORACLE_HOME" ] && break
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$ORACLE_SID" ]
|
||||
then
|
||||
ORACLE_SID="orcl"
|
||||
fi
|
||||
|
||||
if [ -z "$oracle_user" ]
|
||||
then
|
||||
oracle_user="oracle"
|
||||
fi
|
||||
|
||||
if [ -z "$SHOW_ORACLE_USERS" ]
|
||||
then
|
||||
SHOW_ORACLE_USERS=0
|
||||
else
|
||||
if [ $SHOW_ORACLE_USERS -ne 1 ]
|
||||
then
|
||||
SHOW_ORACLE_USERS=0
|
||||
fi
|
||||
fi
|
||||
|
||||
PATH=$PATH:$ORACLE_HOME/bin
|
||||
export ORACLE_HOME PATH ORACLE_SID
|
||||
|
||||
if [ "$1" = "autoconf" ]
|
||||
then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
if [ "$1" = "config" ]
|
||||
then
|
||||
WARN_CRIT=`sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \
|
||||
grep -v '^$' | awk '{print $1 * 0.7 " " $1 * 0.8 }'
|
||||
set pagesize 0
|
||||
select value from v\\$parameter where name = 'sessions';
|
||||
EOF`
|
||||
echo "graph_title Oracle active connections to $ORACLE_SID"
|
||||
echo "graph_args -l 0 --base 1000"
|
||||
echo "graph_vlabel Connections"
|
||||
echo "graph_category Oracle"
|
||||
echo "graph_info Shows active oracle connections to $ORACLE_SID"
|
||||
echo "graph_scale no"
|
||||
if [ $SHOW_ORACLE_USERS -eq 1 ]
|
||||
then
|
||||
sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \
|
||||
grep -v '^$' | awk '{ print $1 ".label " $1 " active connections"
|
||||
print $1 ".info " $1 " active connections"
|
||||
print $1 ".type GAUGE" }; END {
|
||||
print "total.label active connections"
|
||||
print "total.info active connections"
|
||||
print "total.type GAUGE"
|
||||
}'
|
||||
set pagesize 0
|
||||
select username, count(username) from v\$session where username is not null group by username;
|
||||
EOF
|
||||
echo $WARN_CRIT| awk '{ print "total.warning " $1 "\ntotal.critical " $2 }'
|
||||
else
|
||||
echo "connections.label active connections"
|
||||
echo "connections.info active connections"
|
||||
echo "connections.type GAUGE"
|
||||
echo $WARN_CRIT| awk '{ print "connections.warning " $1 "\nconnections.critical " $2 }'
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ $SHOW_ORACLE_USERS -eq 1 ]
|
||||
then
|
||||
sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \
|
||||
grep -v '^$'|awk 'BEGIN { total=0 } {
|
||||
print $1 ".value " $2
|
||||
total=total+$2 } END { print "total.value " total }'
|
||||
set pagesize 0
|
||||
select username, count(username) from v\$session where username is not null group by username;
|
||||
EOF
|
||||
else
|
||||
sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | grep -v '^$'|\
|
||||
awk '{ print "connections.value " $1 }'
|
||||
set pagesize 0
|
||||
select count(username) from v\$session where username is not null;
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo "max_connections.value" "`sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \
|
||||
grep -v '^$' | awk '{print $1 }'
|
||||
set pagesize 0
|
||||
select value from v\\$parameter where name = 'sessions';
|
||||
EOF`"
|
||||
#!/bin/bash
|
||||
#
|
||||
# Munin plugin to monitor oracle connections w/o DBD::Oracle, or perl for that
|
||||
# matter ;-)
|
||||
#
|
||||
# Author: Kevin Kunkel (kunkel.kevin@gmail.com) on December 11, 2007
|
||||
# (Based off the perl munin plugin by Joan Carles Soler)
|
||||
#
|
||||
# Licenced under GPL v2.
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# If required, give username, password and/or oracle server
|
||||
# host through environment variables.
|
||||
#
|
||||
# Parameters:
|
||||
# autoconf
|
||||
# config (required)
|
||||
#
|
||||
# Config variables:
|
||||
#
|
||||
# ORACLE_SID - Which database to use. Defaults to orcl
|
||||
# oracle_user - A oracle user account with read permission to
|
||||
# the v$session view. Defaults to
|
||||
# 'oracle'. Anyway, Munin must be told which user
|
||||
# this plugin should be run as.
|
||||
# oracle_pass - The corresponding password, if
|
||||
# applicable. Default to undef.
|
||||
#
|
||||
# SHOW_ORACLE_USERS - If set to 1 show usernames and num. of connections.
|
||||
# Default is not show users (0).
|
||||
# Magic markers
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
|
||||
# Hard-code environment variables here
|
||||
|
||||
#oracle_user=
|
||||
#oracle_pass=
|
||||
#ORACLE_SID=
|
||||
#ORACLE_HOME=
|
||||
#SHOW_ORACLE_USERS=
|
||||
|
||||
# End variable hard-code
|
||||
|
||||
|
||||
|
||||
if [ -z "$ORACLE_HOME" ] ; then
|
||||
# Adjust to your oratab locations
|
||||
for oratab in /var/opt/oracle/oratab /etc/oratab
|
||||
do
|
||||
[ ! -f $oratab ] && continue
|
||||
IFS=:
|
||||
while read SID HOME STARTUP;
|
||||
do
|
||||
if [ "$SID" = "*" ]
|
||||
then
|
||||
ORACLE_HOME=$HOME
|
||||
break
|
||||
fi
|
||||
done < $oratab
|
||||
[ -n "$ORACLE_HOME" ] && break
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$ORACLE_SID" ]
|
||||
then
|
||||
ORACLE_SID="orcl"
|
||||
fi
|
||||
|
||||
if [ -z "$oracle_user" ]
|
||||
then
|
||||
oracle_user="oracle"
|
||||
fi
|
||||
|
||||
if [ -z "$SHOW_ORACLE_USERS" ]
|
||||
then
|
||||
SHOW_ORACLE_USERS=0
|
||||
else
|
||||
if [ $SHOW_ORACLE_USERS -ne 1 ]
|
||||
then
|
||||
SHOW_ORACLE_USERS=0
|
||||
fi
|
||||
fi
|
||||
|
||||
PATH=$PATH:$ORACLE_HOME/bin
|
||||
export ORACLE_HOME PATH ORACLE_SID
|
||||
|
||||
if [ "$1" = "autoconf" ]
|
||||
then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
if [ "$1" = "config" ]
|
||||
then
|
||||
WARN_CRIT=`sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \
|
||||
grep -v '^$' | awk '{print $1 * 0.7 " " $1 * 0.8 }'
|
||||
set pagesize 0
|
||||
select value from v\\$parameter where name = 'sessions';
|
||||
EOF`
|
||||
echo "graph_title Oracle active connections to $ORACLE_SID"
|
||||
echo "graph_args -l 0 --base 1000"
|
||||
echo "graph_vlabel Connections"
|
||||
echo "graph_category Oracle"
|
||||
echo "graph_info Shows active oracle connections to $ORACLE_SID"
|
||||
echo "graph_scale no"
|
||||
if [ $SHOW_ORACLE_USERS -eq 1 ]
|
||||
then
|
||||
sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \
|
||||
grep -v '^$' | awk '{ print $1 ".label " $1 " active connections"
|
||||
print $1 ".info " $1 " active connections"
|
||||
print $1 ".type GAUGE" }; END {
|
||||
print "total.label active connections"
|
||||
print "total.info active connections"
|
||||
print "total.type GAUGE"
|
||||
}'
|
||||
set pagesize 0
|
||||
select username, count(username) from v\$session where username is not null group by username;
|
||||
EOF
|
||||
echo $WARN_CRIT| awk '{ print "total.warning " $1 "\ntotal.critical " $2 }'
|
||||
else
|
||||
echo "connections.label active connections"
|
||||
echo "connections.info active connections"
|
||||
echo "connections.type GAUGE"
|
||||
echo $WARN_CRIT| awk '{ print "connections.warning " $1 "\nconnections.critical " $2 }'
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ $SHOW_ORACLE_USERS -eq 1 ]
|
||||
then
|
||||
sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \
|
||||
grep -v '^$'|awk 'BEGIN { total=0 } {
|
||||
print $1 ".value " $2
|
||||
total=total+$2 } END { print "total.value " total }'
|
||||
set pagesize 0
|
||||
select username, count(username) from v\$session where username is not null group by username;
|
||||
EOF
|
||||
else
|
||||
sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | grep -v '^$'|\
|
||||
awk '{ print "connections.value " $1 }'
|
||||
set pagesize 0
|
||||
select count(username) from v\$session where username is not null;
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo "max_connections.value" "`sqlplus -s ${oracle_user}/${oracle_pass}@$ORACLE_SID << EOF | \
|
||||
grep -v '^$' | awk '{print $1 }'
|
||||
set pagesize 0
|
||||
select value from v\\$parameter where name = 'sessions';
|
||||
EOF`"
|
||||
|
@ -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...
|
||||
|
@ -29,7 +29,7 @@ usage() {
|
||||
echo 'For testing the script, run qstatcod4and5_ cods IP PORT'
|
||||
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 '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 'Perhaps you must have to set qstat_exe path, actually on'${qstat_exe};
|
||||
echo 'Have Fun'
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#######################################################################################################################
|
||||
#
|
||||
# = PowerMTA Munin multi-monitor =
|
||||
|
@ -1,42 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
vmta="208-97-205-153"
|
||||
# Lets run the command to pull the vmta's in
|
||||
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
|
||||
unset queues[0]
|
||||
unset queues[${#queues[@]}]
|
||||
|
||||
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
|
||||
echo "graph_title RGMTA2 PMTA VMTA $vmta Recipents"
|
||||
echo "graph_vlabel recipents"
|
||||
echo "graph_scale no"
|
||||
echo "graph_category PowerMTA"
|
||||
for i in ${queues[@]};do
|
||||
queue=(`pmta show queue $i`)
|
||||
unset queue[0]
|
||||
unset queue[${#queue[@]}]
|
||||
|
||||
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`
|
||||
echo $domain'.label '$domain2
|
||||
echo $domain'.draw STACK'
|
||||
done
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
for i in ${queues[@]};do
|
||||
queue=(`pmta show queue $i`)
|
||||
unset queue[0]
|
||||
unset queue[${#queue[@]}]
|
||||
|
||||
domain=`echo "${queue[7]}" | awk -F" " '{print $1}' | cut -d/ -f1 | sed -e 's/[\.]/_/g'`
|
||||
recpts=${queue[8]}
|
||||
conns=${queue[10]}
|
||||
echo $domain'.value '$recpts
|
||||
done
|
||||
#!/bin/bash
|
||||
|
||||
vmta="208-97-205-153"
|
||||
# Lets run the command to pull the vmta's in
|
||||
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
|
||||
unset queues[0]
|
||||
unset queues[${#queues[@]}]
|
||||
|
||||
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
|
||||
echo "graph_title RGMTA2 PMTA VMTA $vmta Recipents"
|
||||
echo "graph_vlabel recipents"
|
||||
echo "graph_scale no"
|
||||
echo "graph_category PowerMTA"
|
||||
for i in ${queues[@]};do
|
||||
queue=(`pmta show queue $i`)
|
||||
unset queue[0]
|
||||
unset queue[${#queue[@]}]
|
||||
|
||||
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`
|
||||
echo $domain'.label '$domain2
|
||||
echo $domain'.draw STACK'
|
||||
done
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
for i in ${queues[@]};do
|
||||
queue=(`pmta show queue $i`)
|
||||
unset queue[0]
|
||||
unset queue[${#queue[@]}]
|
||||
|
||||
domain=`echo "${queue[7]}" | awk -F" " '{print $1}' | cut -d/ -f1 | sed -e 's/[\.]/_/g'`
|
||||
recpts=${queue[8]}
|
||||
conns=${queue[10]}
|
||||
echo $domain'.value '$recpts
|
||||
done
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/sbin/sh
|
||||
#!/bin/sh
|
||||
|
||||
# See /usr/include/sys/dk.h !
|
||||
PATH=/usr/bin:/usr/sbin:/sbin
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# Plugin to monitor CPU share, for a selected set of processes. Tested on Linux.
|
||||
#
|
||||
|
@ -1,37 +1,63 @@
|
||||
#!/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
|
||||
# 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.
|
||||
: << =cut
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
=head1 NAME
|
||||
|
||||
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
|
||||
# graphs should look.
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
CONN_WARN=${queue_warn:-500}
|
||||
CONN_CRIT=${queue_crit:-1000}
|
||||
CONN_WARN=${conn_warn:-500}
|
||||
CONN_CRIT=${conn_crit:-1000}
|
||||
|
||||
# The host name this plugin is for. (Can be overridden to have
|
||||
# one machine answer for several)
|
||||
@ -63,4 +89,11 @@ fi
|
||||
# real work - i.e. display the data. Almost always this will be
|
||||
# "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"
|
||||
|
@ -32,7 +32,7 @@ reddit_user=${0##*reddit_karma_}
|
||||
##
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
# Check that curl is installed
|
||||
if hash curl &>/dev/null; then
|
||||
if hash curl >/dev/null 2>&1; then
|
||||
echo "yes"
|
||||
else
|
||||
echo "no (no curl installed)"
|
||||
|
@ -1,40 +1,40 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor the number of Samba locked files on the machine.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.0 2007/04/16 Jon Higgs
|
||||
# Initial Release - Adapated from jimmyo's processses plugin.
|
||||
#
|
||||
# Magick markers (optional - used by munin-config and som installation
|
||||
# scripts):
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title Samba Locked Files'
|
||||
echo 'graph_args --base 1000 -l 0 '
|
||||
echo 'graph_vlabel number of locked files'
|
||||
echo 'graph_category Samba'
|
||||
echo 'graph_info This graph shows the number locked Samba Files.'
|
||||
echo 'samba_locked.label Locked Files'
|
||||
echo 'samba_locked.draw LINE2'
|
||||
echo 'samba_locked.info The current number of locked files.'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "samba_locked.value $(smbstatus -L 2> /dev/null | grep -c DENY_)"
|
||||
|
||||
# If here, always return OK
|
||||
exit 0
|
||||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor the number of Samba locked files on the machine.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.0 2007/04/16 Jon Higgs
|
||||
# Initial Release - Adapated from jimmyo's processses plugin.
|
||||
#
|
||||
# Magick markers (optional - used by munin-config and som installation
|
||||
# scripts):
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title Samba Locked Files'
|
||||
echo 'graph_args --base 1000 -l 0 '
|
||||
echo 'graph_vlabel number of locked files'
|
||||
echo 'graph_category Samba'
|
||||
echo 'graph_info This graph shows the number locked Samba Files.'
|
||||
echo 'samba_locked.label Locked Files'
|
||||
echo 'samba_locked.draw LINE2'
|
||||
echo 'samba_locked.info The current number of locked files.'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "samba_locked.value $(smbstatus -L 2> /dev/null | grep -c DENY_)"
|
||||
|
||||
# If here, always return OK
|
||||
exit 0
|
||||
|
@ -269,7 +269,7 @@ if 'MUNIN_CAP_MULTIGRAPH' not in os.environ:
|
||||
|
||||
# Parse host_name and counter type from arg0
|
||||
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)
|
||||
if match:
|
||||
host_name = match.group(1)
|
||||
|
@ -133,12 +133,6 @@ if (!defined ($session))
|
||||
die "Croaking: could not establish SNMP object";
|
||||
}
|
||||
|
||||
|
||||
if (!defined ($session))
|
||||
{
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "host_name $host\n";
|
||||
|
@ -40,11 +40,11 @@ if [ "$1" = "suggest" ]; then
|
||||
if [ ! "$RC" != "0" ] ; then
|
||||
FILE=`basename $0`
|
||||
DIR=`dirname $0`
|
||||
HOSTNAME=`host $IP | sed s/.*pointer//\ `
|
||||
HOSTNAME=`echo $HOSTNAME | sed -e 's/\.$//'`
|
||||
HOST_NAME=`host $IP | sed s/.*pointer//\ `
|
||||
HOST_NAME=`echo $HOST_NAME | sed -e 's/\.$//'`
|
||||
LINKDIR="/etc/munin/plugins/"
|
||||
LINKFILE=`echo $FILE | sed s/__/_$HOSTNAME_/`
|
||||
echo file $FILE dir $DIR hostname $HOSTNAME linkdir $LINKDIR linkfile $LINKFILE
|
||||
LINKFILE=`echo $FILE | sed s/__/_$HOST_NAME_/`
|
||||
echo file $FILE dir $DIR hostname $HOST_NAME linkdir $LINKDIR linkfile $LINKFILE
|
||||
#echo "ln -s $DIR/$FILE $LINKNAME"
|
||||
fi
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/ruby
|
||||
# encoding: utf-8
|
||||
|
||||
# Plugin to monitor Room Alert 11E environmental units.
|
||||
# Requires ruby and the ruby SNMP library.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# A Munin Plugin to show auth stuff
|
||||
# Created by Dominik Schulz <lkml@ds.gauner.org>
|
||||
|
@ -1,79 +1,79 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Script to monitor iostat cpu|tps.
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
|
||||
judge=`basename $0 | sed 's/^iostat_//g'`
|
||||
current=`date +%H":"%M":"%S`;
|
||||
tenMago=`date --date "10 minutes ago" +%H":"%M":"%S`
|
||||
export LANG=en_US.UTF-8
|
||||
|
||||
# autoconf
|
||||
|
||||
if [ "$1" == "autoconf" ]; then
|
||||
if ( sar 1 1 >/dev/null 2>&1 ); then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
if [ $? -eq 127 ]; then
|
||||
echo "no (could not run \"sar\")"
|
||||
exit 1
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
ARRAY=( `sar -p -d -s ${tenMago} -e ${current} | grep -v nodev | grep "Average" | awk '{ print $2 , $3 , $10 }'` )
|
||||
|
||||
# config
|
||||
|
||||
if [ "$1" == "config" ]; then
|
||||
if [ "$judge" == cpu_average ]; then
|
||||
echo 'graph_title iostat util'
|
||||
echo 'graph_args --upper-limit 100 -l 0'
|
||||
echo 'graph_vlabel %'
|
||||
echo 'graph_category System'
|
||||
for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do
|
||||
echo "_dev_${ARRAY[i]}.label ${ARRAY[i]}"
|
||||
i=`expr $i + 2`
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$judge" == tps_average ]; then
|
||||
echo 'graph_title iostat tps'
|
||||
echo 'graph_args -l 0'
|
||||
echo 'graph_vlabel tps'
|
||||
echo 'graph_category System'
|
||||
for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do
|
||||
echo "_dev_${ARRAY[i]}.label ${ARRAY[i]}"
|
||||
i=`expr $i + 2`
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# other
|
||||
|
||||
if [ "$judge" == cpu_average ]; then
|
||||
for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do
|
||||
echo -n "_dev_${ARRAY[i]}.value "
|
||||
i=`expr $i + 2`
|
||||
echo "${ARRAY[i]}"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$judge" == tps_average ]; then
|
||||
for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do
|
||||
echo -n "_dev_${ARRAY[i]}.value "
|
||||
i=`expr $i + 1`
|
||||
echo "${ARRAY[i]}"
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
fi
|
||||
#!/bin/bash
|
||||
#
|
||||
# Script to monitor iostat cpu|tps.
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
|
||||
judge=`basename $0 | sed 's/^iostat_//g'`
|
||||
current=`date +%H":"%M":"%S`;
|
||||
tenMago=`date --date "10 minutes ago" +%H":"%M":"%S`
|
||||
export LANG=en_US.UTF-8
|
||||
|
||||
# autoconf
|
||||
|
||||
if [ "$1" == "autoconf" ]; then
|
||||
if ( sar 1 1 >/dev/null 2>&1 ); then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
if [ $? -eq 127 ]; then
|
||||
echo "no (could not run \"sar\")"
|
||||
exit 1
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
ARRAY=( `sar -p -d -s ${tenMago} -e ${current} | grep -v nodev | grep "Average" | awk '{ print $2 , $3 , $10 }'` )
|
||||
|
||||
# config
|
||||
|
||||
if [ "$1" == "config" ]; then
|
||||
if [ "$judge" == cpu_average ]; then
|
||||
echo 'graph_title iostat util'
|
||||
echo 'graph_args --upper-limit 100 -l 0'
|
||||
echo 'graph_vlabel %'
|
||||
echo 'graph_category System'
|
||||
for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do
|
||||
echo "_dev_${ARRAY[i]}.label ${ARRAY[i]}"
|
||||
i=`expr $i + 2`
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$judge" == tps_average ]; then
|
||||
echo 'graph_title iostat tps'
|
||||
echo 'graph_args -l 0'
|
||||
echo 'graph_vlabel tps'
|
||||
echo 'graph_category System'
|
||||
for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do
|
||||
echo "_dev_${ARRAY[i]}.label ${ARRAY[i]}"
|
||||
i=`expr $i + 2`
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# other
|
||||
|
||||
if [ "$judge" == cpu_average ]; then
|
||||
for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do
|
||||
echo -n "_dev_${ARRAY[i]}.value "
|
||||
i=`expr $i + 2`
|
||||
echo "${ARRAY[i]}"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$judge" == tps_average ]; then
|
||||
for (( i=0 ; i<${#ARRAY[*]} ; i++ )) ; do
|
||||
echo -n "_dev_${ARRAY[i]}.value "
|
||||
i=`expr $i + 1`
|
||||
echo "${ARRAY[i]}"
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
fi
|
||||
|
@ -73,7 +73,8 @@ else
|
||||
sub value # get value for variables
|
||||
{
|
||||
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();
|
||||
|
||||
# --- Fetch Hardware info ---
|
||||
|
@ -1,118 +1,118 @@
|
||||
#! /bin/ksh
|
||||
# Copyright (c) 2010, Wikimedia Deutschland
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of Wikimedia Deutschland nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY WIKIMEDIA DEUTSCHLAND ''AS IS'' AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL WIKIMEDIA DEUTSCHLAND BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# 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
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# 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
|
||||
# be useful. Wikimedia Deutschland may at any time discontinue developing or
|
||||
# supporting this software. There is no guarantee any new versions or even fixes
|
||||
# for security issues will be released.
|
||||
###
|
||||
# Munin plugin to report Solaris memory usage via mdb's memstat.
|
||||
# Must be run as root.
|
||||
#
|
||||
# river@tamara.tcx.org.uk 2010-08-28
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -e /usr/bin/mdb ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo /usr/bin/mdb not found
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo '
|
||||
graph_args --base 1024 -l 0 --vertical-label Bytes
|
||||
graph_title Memory usage
|
||||
graph_category system
|
||||
graph_info This graph shows system memory use.
|
||||
graph_order kernel anon exec cacheused zfs cachefree free
|
||||
|
||||
kernel.label kernel
|
||||
kernel.draw AREA
|
||||
kernel.info Memory used by kernel
|
||||
|
||||
anon.label anon
|
||||
anon.draw STACK
|
||||
anon.info Memory used by programs
|
||||
|
||||
exec.label exec_and_libs
|
||||
exec.draw STACK
|
||||
exec.info Memory used by executable files and libraries
|
||||
|
||||
cacheused.label cacheused
|
||||
cacheused.draw STACK
|
||||
cacheused.info Memory used by page cache
|
||||
|
||||
zfs.label zfs
|
||||
zfs.draw STACK
|
||||
zfs.info Memory used for ZFS file cache
|
||||
|
||||
cachefree.label cachefree
|
||||
cachefree.draw STACK
|
||||
cachefree.info Free memory in cache list
|
||||
|
||||
free.label free
|
||||
free.draw STACK
|
||||
free.info Free memory
|
||||
'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "::memstat" | mdb -k | nawk '
|
||||
BEGIN {
|
||||
pagesize='$(getconf PAGESIZE)'
|
||||
kernel=0
|
||||
zfs=0
|
||||
anon=0
|
||||
exec=0
|
||||
cache=0
|
||||
phys=0
|
||||
}
|
||||
|
||||
/^Kernel/ { kernel=$2 }
|
||||
/^ZFS File Data/ { zfs=$4 }
|
||||
/^Anon/ { anon=$2 }
|
||||
/^Exec and libs/ { exec=$4 }
|
||||
/^Page cache/ { cacheused=$3 }
|
||||
/^Free \(cachelist\)/ { cachefree=$3 }
|
||||
/^Free \(freelist\)/ { free=$3 }
|
||||
|
||||
END {
|
||||
print "kernel.value " (kernel * pagesize)
|
||||
print "zfs.value " (zfs * pagesize)
|
||||
print "anon.value " (anon * pagesize)
|
||||
print "exec.value " (exec * pagesize)
|
||||
print "cacheused.value " (cacheused * pagesize)
|
||||
print "cachefree.value " (cachefree * pagesize)
|
||||
print "free.value " (free * pagesize)
|
||||
}
|
||||
'
|
||||
#! /bin/ksh
|
||||
# Copyright (c) 2010, Wikimedia Deutschland
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of Wikimedia Deutschland nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY WIKIMEDIA DEUTSCHLAND ''AS IS'' AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL WIKIMEDIA DEUTSCHLAND BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# 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
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# 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
|
||||
# be useful. Wikimedia Deutschland may at any time discontinue developing or
|
||||
# supporting this software. There is no guarantee any new versions or even fixes
|
||||
# for security issues will be released.
|
||||
###
|
||||
# Munin plugin to report Solaris memory usage via mdb's memstat.
|
||||
# Must be run as root.
|
||||
#
|
||||
# river@tamara.tcx.org.uk 2010-08-28
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -e /usr/bin/mdb ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo /usr/bin/mdb not found
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo '
|
||||
graph_args --base 1024 -l 0 --vertical-label Bytes
|
||||
graph_title Memory usage
|
||||
graph_category system
|
||||
graph_info This graph shows system memory use.
|
||||
graph_order kernel anon exec cacheused zfs cachefree free
|
||||
|
||||
kernel.label kernel
|
||||
kernel.draw AREA
|
||||
kernel.info Memory used by kernel
|
||||
|
||||
anon.label anon
|
||||
anon.draw STACK
|
||||
anon.info Memory used by programs
|
||||
|
||||
exec.label exec_and_libs
|
||||
exec.draw STACK
|
||||
exec.info Memory used by executable files and libraries
|
||||
|
||||
cacheused.label cacheused
|
||||
cacheused.draw STACK
|
||||
cacheused.info Memory used by page cache
|
||||
|
||||
zfs.label zfs
|
||||
zfs.draw STACK
|
||||
zfs.info Memory used for ZFS file cache
|
||||
|
||||
cachefree.label cachefree
|
||||
cachefree.draw STACK
|
||||
cachefree.info Free memory in cache list
|
||||
|
||||
free.label free
|
||||
free.draw STACK
|
||||
free.info Free memory
|
||||
'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "::memstat" | mdb -k | nawk '
|
||||
BEGIN {
|
||||
pagesize='$(getconf PAGESIZE)'
|
||||
kernel=0
|
||||
zfs=0
|
||||
anon=0
|
||||
exec=0
|
||||
cache=0
|
||||
phys=0
|
||||
}
|
||||
|
||||
/^Kernel/ { kernel=$2 }
|
||||
/^ZFS File Data/ { zfs=$4 }
|
||||
/^Anon/ { anon=$2 }
|
||||
/^Exec and libs/ { exec=$4 }
|
||||
/^Page cache/ { cacheused=$3 }
|
||||
/^Free \(cachelist\)/ { cachefree=$3 }
|
||||
/^Free \(freelist\)/ { free=$3 }
|
||||
|
||||
END {
|
||||
print "kernel.value " (kernel * pagesize)
|
||||
print "zfs.value " (zfs * pagesize)
|
||||
print "anon.value " (anon * pagesize)
|
||||
print "exec.value " (exec * pagesize)
|
||||
print "cacheused.value " (cacheused * pagesize)
|
||||
print "cachefree.value " (cachefree * pagesize)
|
||||
print "free.value " (free * pagesize)
|
||||
}
|
||||
'
|
||||
|
@ -71,7 +71,8 @@ else
|
||||
sub value
|
||||
{
|
||||
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();
|
||||
|
||||
# --- Fetch Hardware info ---
|
||||
|
@ -1,17 +1,17 @@
|
||||
#!/bin/sh
|
||||
RID=${0##*trafic_ro_}
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo graph_title $V 24h visitors for $RID
|
||||
echo 'graph_args --base 1000'
|
||||
echo 'graph_vlabel vizitatori_ultimele_24_ore'
|
||||
echo 'graph_category Trafic_ro'
|
||||
echo 'graph_info 24h visitors.'
|
||||
echo "24h_visitors.label $RID"
|
||||
echo "24h_visitors.info 24H visitors for $RID"
|
||||
echo '24h_visitors.draw LINE2'
|
||||
exit 0
|
||||
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 ".")"
|
||||
echo "24h_visitors.value" $VISITORS;
|
||||
#!/bin/sh
|
||||
RID=${0##*trafic_ro_}
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo graph_title $V 24h visitors for $RID
|
||||
echo 'graph_args --base 1000'
|
||||
echo 'graph_vlabel vizitatori_ultimele_24_ore'
|
||||
echo 'graph_category Trafic_ro'
|
||||
echo 'graph_info 24h visitors.'
|
||||
echo "24h_visitors.label $RID"
|
||||
echo "24h_visitors.info 24H visitors for $RID"
|
||||
echo '24h_visitors.draw LINE2'
|
||||
exit 0
|
||||
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 ".")"
|
||||
echo "24h_visitors.value" $VISITORS;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
|
||||
# plugin made by Dju
|
||||
|
@ -1,69 +1,69 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2013 Gareth Davies (shaolintiger@gmail.com www.shaolintiger.com)
|
||||
# License GPLv2
|
||||
# This plugin monitors number of workers, total memory used and average memory per process for Unicorn.
|
||||
# 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_memory
|
||||
# ln -s /usr/share/munin/plugins/unicorn_ /etc/munin/plugins/unicorn_processes
|
||||
|
||||
mode=`echo $0 | cut -d _ -f 2`
|
||||
|
||||
if [ "$1" = "suggest" ]; then
|
||||
echo "memory"
|
||||
echo "processes"
|
||||
echo "average"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$mode" = "memory" ]; then
|
||||
if [ "$1" = "config" ]; then
|
||||
echo "graph_title Total Unicorn Memory"
|
||||
echo "graph_vlabel Total RAM"
|
||||
echo "graph_category Unicorn"
|
||||
echo "graph_args --base 1024"
|
||||
echo "ram.label Total RAM"
|
||||
exit 0
|
||||
else
|
||||
|
||||
memory_array=(`ps auwx | grep "unicorn worker" | grep -v grep | awk '{print $6 }'`)
|
||||
|
||||
for i in "${memory_array[@]}"
|
||||
do
|
||||
sum=$(( $sum + ( $i * 1024) ))
|
||||
done
|
||||
echo -n "ram.value "
|
||||
echo $sum
|
||||
|
||||
fi
|
||||
|
||||
elif [ "$mode" = "processes" ]; then
|
||||
if [ "$1" = "config" ]; then
|
||||
echo "graph_title Unicorn Processes"
|
||||
echo "graph_vlabel Processes"
|
||||
echo "graph_category Unicorn"
|
||||
echo "processes.label active processes"
|
||||
else
|
||||
echo -n "processes.value "
|
||||
ps awwwux | grep 'unicorn worker' | grep -v grep | wc -l
|
||||
exit 0
|
||||
fi
|
||||
|
||||
elif [ "$mode" = "average" ]; then
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Unicorn Average Process Size'
|
||||
echo 'graph_args --base 1024 -l 0 '
|
||||
echo 'graph_vlabel Average Process Size'
|
||||
echo 'graph_category Unicorn'
|
||||
echo 'unicorn_average.label Average Process Size'
|
||||
echo 'unicorn_average.draw LINE2'
|
||||
echo 'unicorn_average.info The average process size for Unicorn'
|
||||
else
|
||||
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)}'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
fi
|
||||
exit 0
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2013 Gareth Davies (shaolintiger@gmail.com www.shaolintiger.com)
|
||||
# License GPLv2
|
||||
# This plugin monitors number of workers, total memory used and average memory per process for Unicorn.
|
||||
# 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_memory
|
||||
# ln -s /usr/share/munin/plugins/unicorn_ /etc/munin/plugins/unicorn_processes
|
||||
|
||||
mode=`echo $0 | cut -d _ -f 2`
|
||||
|
||||
if [ "$1" = "suggest" ]; then
|
||||
echo "memory"
|
||||
echo "processes"
|
||||
echo "average"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$mode" = "memory" ]; then
|
||||
if [ "$1" = "config" ]; then
|
||||
echo "graph_title Total Unicorn Memory"
|
||||
echo "graph_vlabel Total RAM"
|
||||
echo "graph_category Unicorn"
|
||||
echo "graph_args --base 1024"
|
||||
echo "ram.label Total RAM"
|
||||
exit 0
|
||||
else
|
||||
|
||||
memory_array=(`ps auwx | grep "unicorn worker" | grep -v grep | awk '{print $6 }'`)
|
||||
|
||||
for i in "${memory_array[@]}"
|
||||
do
|
||||
sum=$(( $sum + ( $i * 1024) ))
|
||||
done
|
||||
echo -n "ram.value "
|
||||
echo $sum
|
||||
|
||||
fi
|
||||
|
||||
elif [ "$mode" = "processes" ]; then
|
||||
if [ "$1" = "config" ]; then
|
||||
echo "graph_title Unicorn Processes"
|
||||
echo "graph_vlabel Processes"
|
||||
echo "graph_category Unicorn"
|
||||
echo "processes.label active processes"
|
||||
else
|
||||
echo -n "processes.value "
|
||||
ps awwwux | grep 'unicorn worker' | grep -v grep | wc -l
|
||||
exit 0
|
||||
fi
|
||||
|
||||
elif [ "$mode" = "average" ]; then
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Unicorn Average Process Size'
|
||||
echo 'graph_args --base 1024 -l 0 '
|
||||
echo 'graph_vlabel Average Process Size'
|
||||
echo 'graph_category Unicorn'
|
||||
echo 'unicorn_average.label Average Process Size'
|
||||
echo 'unicorn_average.draw LINE2'
|
||||
echo 'unicorn_average.info The average process size for Unicorn'
|
||||
else
|
||||
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)}'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
fi
|
||||
exit 0
|
||||
|
@ -1,33 +1,33 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# (c) Andreas Kreisl
|
||||
#
|
||||
# Link name will be used as title: apc_{$title}
|
||||
#
|
||||
# env.keys LOADPCT BCHARGE LINEV BATTV TIMELEFT
|
||||
# env.unit % or Volt or Minutes
|
||||
#
|
||||
|
||||
|
||||
if [ -z "$keys" ]; then
|
||||
keys="TIMELEFT"
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
title=`basename $0 | sed 's/^apc_//g' | awk '{ sub(/^./,toupper(substr($0,1,1))); print; }'`
|
||||
echo "graph_title APC Status - $title"
|
||||
echo 'graph_args --base 1000 -l 0 '
|
||||
echo "graph_vlabel $unit"
|
||||
echo 'graph_category sensors'
|
||||
title=`/sbin/apcaccess | egrep "^MODEL" | awk '{print $3" "$4" "$5" "$6" "$7" "$8" "$9;}'`
|
||||
echo "graph_info $title"
|
||||
for key in $keys; do
|
||||
echo "$key.label $key"
|
||||
echo "$key.info Value of $key."
|
||||
echo "$key.draw LINE2"
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
searchkey=`echo "$keys" | tr " " "\|"`
|
||||
/sbin/apcaccess | egrep "$searchkey" | awk '{print $1".value "$3;}'
|
||||
#!/bin/sh
|
||||
#
|
||||
# (c) Andreas Kreisl
|
||||
#
|
||||
# Link name will be used as title: apc_{$title}
|
||||
#
|
||||
# env.keys LOADPCT BCHARGE LINEV BATTV TIMELEFT
|
||||
# env.unit % or Volt or Minutes
|
||||
#
|
||||
|
||||
|
||||
if [ -z "$keys" ]; then
|
||||
keys="TIMELEFT"
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
title=`basename $0 | sed 's/^apc_//g' | awk '{ sub(/^./,toupper(substr($0,1,1))); print; }'`
|
||||
echo "graph_title APC Status - $title"
|
||||
echo 'graph_args --base 1000 -l 0 '
|
||||
echo "graph_vlabel $unit"
|
||||
echo 'graph_category sensors'
|
||||
title=`/sbin/apcaccess | egrep "^MODEL" | awk '{print $3" "$4" "$5" "$6" "$7" "$8" "$9;}'`
|
||||
echo "graph_info $title"
|
||||
for key in $keys; do
|
||||
echo "$key.label $key"
|
||||
echo "$key.info Value of $key."
|
||||
echo "$key.draw LINE2"
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
searchkey=`echo "$keys" | tr " " "\|"`
|
||||
/sbin/apcaccess | egrep "$searchkey" | awk '{print $1".value "$3;}'
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!@@PERL@@
|
||||
#!/usr/bin/perl
|
||||
# -*- perl -*-
|
||||
#
|
||||
# varnish4_ - Munin plugin to for Varnish 4.x
|
||||
|
@ -115,9 +115,14 @@ use strict;
|
||||
use sort 'stable'; # guarantee stability
|
||||
no warnings; # don't want warnings in output
|
||||
|
||||
use VMware::VIRuntime; # need to install VIM SDK (vSphere CLI/SDK 4.1 or newer)
|
||||
use VMware::VILib;
|
||||
use VMware::VIExt;
|
||||
# need to install VIM SDK (vSphere CLI/SDK 4.1 or newer)
|
||||
eval 'use VMware::VIRuntime; 1;'
|
||||
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 DateTime::Format::ISO8601; # may need to install "libdatetime-format-iso8601-perl" on Debian-based systems
|
||||
use List::Util qw(sum max);
|
||||
|
@ -51,7 +51,7 @@ fi
|
||||
DOMAINS=$(xm list | awk '{print $1}' | egrep -v "^(Name|Domain-0)")
|
||||
for dom in $DOMAINS; do
|
||||
dev=$( xm list $dom --long | awk '/vifname / { print $2 }' | sed 's/)//' )
|
||||
if [ "$dev" == "" ]; then
|
||||
if [ "$dev" = "" ]; then
|
||||
dev=$( xm network-list $dom |\
|
||||
egrep "^[0-9]+" | sed 's@^.*vif/\([0-9]*\)/\([0-9]*\).*$@vif\1.\2@')
|
||||
fi
|
||||
|
@ -64,7 +64,11 @@
|
||||
#%# capabilities=autoconf suggest
|
||||
|
||||
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 IO::Socket::UNIX qw(SOCK_STREAM);
|
||||
|
||||
|
175
t/test.t
Normal file
175
t/test.t
Normal 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);
|
Loading…
Reference in New Issue
Block a user