1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-08-11 08:24:51 +00:00

Merge pull request #1 from munin-monitoring/master

Udpate Fork
This commit is contained in:
Kai 2020-09-10 13:49:08 -04:00 committed by GitHub
commit 2c98aeb063
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1122 changed files with 23836 additions and 11689 deletions

45
.codespell.exclude Normal file
View file

@ -0,0 +1,45 @@
echo "succes.label Login success"
echo "succes.draw AREA"
echo "succes.value $success"
Tim Small <tim@seoss.co.uk>
accesss => 'NFSPROC3_ACCESS (Check Access Permission)',
# Beginn des modifizierten Skriptes - Beginning of the modified script #
[ /(\d+) packets with ECN ECT\(0\) bit set$/, [ [ :packets, 'ECT(0) bit' ] ] ],
[ /(\d+) packets with ECN ECT\(1\) bit set$/, [ [ :packets, 'ECT(1) bit' ] ] ],
[ /(\d+) ARP entrys? timed out$/, [ [ :entries, 'timed out' ] ] ],
echo -en "recieved.value "
print "require dont.graph.anything [0-9]+\n"
# Informations générales :
# Marge de bruit 5.10 dB 5.60 dB
# Adresse MAC Freebox XX:XX:XX:XX:XX:XX
# Adresse IP 203.0.113.60
# Adresse IP privée 192.0.2.1
# Adresse IP DMZ 192.0.2.2
# Adresse IP Freeplayer 192.0.2.0
# Adresse MAC Adresse IP
# Linjen som grep'es ut kan se ut som dette:
# Linjen som grep'es ut kan se ut som dette:
VISITORS="$(echo '<doc><item>munin</item></doc>' | 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 ".")"
# - Serien Timer werden nun separat gezaehlt (anzahl pro Woche)
# - Timer werden nur ignoriert wenn sie 0(inaktiv) als Status haben
primary muss ein iterable oder StringType sein
secondary muss iterable oder StringType sein
print ("d.label Design voltage\nd.type GAUGE\nd.draw AREA\n");
if ($str =~ /^(no?|0|f(alse)?)$/i) {
# (Based off the perl munin plugin by Joan Carles Soler)
<hist>
</hist>
Christian Loos <cloos@netsandbox.de>
# - kein div 0 Fehler mehr wenn der Host nicht zu erreichen ist
# - im Namen kann Munin-konform der Hostname mit angegeben werden: vdr_localhost vdr_192.168.0.2, ... (localhost ist default)
print "platte.info Angabe, wieviel der von VDR beschreibbaren Festplatten belegt ist.\n";
echo 'graph_title Samba Locked Files'
echo 'graph_vlabel number of locked files'
echo 'samba_locked.label Locked Files'
echo 'lock.label Locked files'
echo 'graph_info This graph shows the Memory used by process'
echo 'shares.label shared files'
# Based on Tim Wulkau's script. Thank you!
echo 'graph_title Memory usage by process'
echo 'VmSize.info The size of the virtual memory allocated to the process'
grep -v 'Preparing to download files' | \

5
.codespell.ignore-words Normal file
View file

@ -0,0 +1,5 @@
cas
conexant
ende
referer
wan

3
.flake8 Normal file
View file

@ -0,0 +1,3 @@
[flake8]
ignore = W503, E203
max-line-length = 99

2
.gitignore vendored
View file

@ -1,2 +1,4 @@
.*.swp .*.swp
*~ *~
__pycache__/

7
.rubocop.yml Normal file
View file

@ -0,0 +1,7 @@
# Allow "=begin"/"=end" multiline comments in order to protect munin's
# magic markers ("#%#").
Style/BlockComments:
Enabled: false
AllCops:
NewCops: enable

View file

@ -1,61 +1,90 @@
--- ---
language: perl dist: bionic
install: addons:
- sudo apt-get update apt:
- sudo apt-get --no-install-recommends install devscripts python python3 ruby php5-cli gawk ksh zsh pylint packages:
- sudo apt-get --no-install-recommends install pkg-config libdb-dev libvirt-dev libexpat-dev - codespell
# - Munin/Plugin.pm is in "munin-node" on precise - devscripts
- sudo apt-get --no-install-recommends install munin-node - python
- python-flake8
- python3
- python3-flake8
- ruby
- php-cli
- gawk
- ksh
- zsh
- pylint
- shellcheck
- rubocop
- pkg-config
- libdb-dev
- libvirt-dev
- libexpat-dev
# Modules used by test script # Munin/Plugin.pm is in "munin-node" on precise
- cpanm --notest Capture::Tiny - munin-node
# Modules used by test script
- libsys-virt-perl
- libcapture-tiny-perl
# Modules used by plugins
- libberkeleydb-perl
- libcache-memcached-perl
- libgraphics-colornames-www-perl
- libdbd-pg-perl
- libdata-dump-perl
- libdate-manip-perl
- libdatetime-format-iso8601-perl
- libdevice-serialport-perl
- libfile-readbackwards-perl
- libgraphics-colorobject-perl
- libipc-run3-perl
- libipc-sharelite-perl
- libjson-perl
- libjson-any-perl
- libmail-sendmail-perl
- libmodern-perl-perl
- libmoosex-poe-perl
- libnet-dns-perl
- libnet-openssh-perl
- libnet-snmp-perl
- libnet-telnet-perl
- libnet-telnet-cisco-perl
- libpoe-perl
- libpoe-component-irc-perl
- libproc-processtable-perl
- libredis-perl
- libswitch-perl
- libtext-iconv-perl
- libwww-mechanize-perl
- libwww-mechanize-treebuilder-perl
- libyaml-perl
- libxml-libxml-perl
- libxml-simple-perl
- libxml-smart-perl
- libxml-twig-perl
- libexperimental-perl
before_install:
- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
- cpanm --notest File::Find - cpanm --notest File::Find
- cpanm --notest Test::More - cpanm --notest Test::More
# # more Modules used by plugins
# Modules used by plugins
- cpanm --notest Asterisk::AMI - 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 Date::Parse
- cpanm --notest DateTime::Format::ISO8601
- cpanm --notest Device::SerialPort
- cpanm --notest FCGI::Client - cpanm --notest FCGI::Client
- cpanm --notest File::ReadBackwards
- cpanm --notest Graphics::ColorObject
- cpanm --notest IPC::Run3
- cpanm --notest IPC::ShareLite
- cpanm --notest JSON
- 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::Component::IRC
- cpanm --notest POE::Quickie - cpanm --notest POE::Quickie
- cpanm --notest Proc::ProcessTable # Modules used bu plugins, but not compiling from CPAN
- cpanm --notest Redis # - cpanm --notest nvidia::ml
- cpanm --notest WWW::Mechanize::TreeBuilder
- cpanm --notest Text::Iconv
- cpanm --notest YAML
- cpanm --notest XML::LibXML
- cpanm --notest XML::Simple
- cpanm --notest XML::Smart
- cpanm --notest XML::Twig
- cpanm --notest nvidia::ml
- cpanm --notest experimental
# - 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 # Modules used by plugins, but missing on cpan
# - File::Tail::Multi # - File::Tail::Multi
# - Sun::Solaris::Kstat # - Sun::Solaris::Kstat
# - VMware::VIRuntime # - VMware::VIRuntime
# - MythTV # - MythTV
script: "PERL5LIB=$PERL5LIB:/usr/share/perl5 prove"
script:
- make lint
- prove

7
Makefile Normal file
View file

@ -0,0 +1,7 @@
.PHONY: lint
lint:
# TODO: add "--ignore-words .codespell.ignore-words" as soon as travis supports a newer
# testing environment (containing codespell 0.11 or later).
find plugins/ -type f -not -name "*.png" -not -name "*.conf" -not -name "*.jar" -not -name "*.pyc" -print0 \
| xargs -0 codespell \
--exclude-file .codespell.exclude

View file

@ -1,13 +1,18 @@
This is the repository for all user contributed stuff This is the repository for all user contributed stuff related to
[munin](http://munin-monitoring.org).
# contrib/plugins/ - 3rd-party plugins # contrib/plugins/ - 3rd-party plugins
**This is usually where you want to begin your journey.** **This is usually where you want to begin your journey.**
Here you'll find all the plugins coming from http://exchange.munin-monitoring.org/. Here you find a plethora of plugins for the most diverse topics. Please take a look and
That web site is for the time being disabled, new updates are done here. improve existing or propose new plugins.
Please read the [hints for plugin contributions](./plugins#contributed-munin-plugins).
See the [gallery](http://gallery.munin-monitoring.org/) for a browsable overview of these plugins.
If a dedicated website comes back alive, its plugin backend will be this git repo.
# contrib/templates/ - 3rd-party templates # contrib/templates/ - 3rd-party templates
@ -15,50 +20,53 @@ Feel free to update templates here, or even to create new ones.
Bonus points for mobile-friendly ones :) Bonus points for mobile-friendly ones :)
Note that the one named `official` is a loose-synced copy of the one in SVN trunk. Note that the one named `official` is a loose-synced copy of the one distributed with munin.
It should serves as a base for small editions that can be resynced in SVN trunk, so for that : It should serves as a base for small editions that can be merged into munin, so for that:
* don't copy the whole template * don't copy the whole template
* directly edit files in this directory * directly edit files in this directory
# contrib/tools/ - 3rd-party tools # contrib/tools/ - 3rd-party tools
Here, you can put just any kind of tool. Please use this directory instead of a random place on the internet. Here, you can put just any kind of tool. Please use this directory instead of a random place on the internet.
It makes things way more easy to search for others. It makes things way more easy to search for others.
And, it serves as an incubator of SVN `trunk/contrib` :-)
# contrib/samples/ - 3rd-party examples of configs # contrib/samples/ - 3rd-party examples of configs
This serves as a repository for examples of various configs. You know, the ''learn by example'' way of doing things. This serves as a repository for examples of various configs. You know, the ''learn by example'' way of doing things.
## Notes to contributors ## Notes to contributors
### Commits, Comments & Pull requests ### Commits, Comments & Pull requests
We like to have _elementary_ commits as it is much easier to manage for reviewing and debugging. We like to have _elementary_ commits as it is much easier to manage for reviewing and debugging.
So please **don't** be afraid to make **as many** commits as needed. Merging many commits is as easy So please **don't** be afraid to make **as many** commits as needed. Merging many commits is as easy
as merging one, if not easier. as merging one, if not easier.
A good rationale is that each commit shall have a one-liner commit comment as its first line. A good rationale is that each commit shall have a one-liner commit comment as its first line.
Ideally that first line has a prefix that shows the part the commit is about. It makes it very Ideally that first line has a prefix that shows the part the commit is about. It makes it very
easy to see grouped changes, and it enable avoiding to look at the `--stat`. To know the prefix you should easy to see grouped changes, and it enable avoiding to look at the `--stat`. To know the prefix you should
use, you can have a look at already existing commits. Next lines are optional and should only use, you can have a look at already existing commits. Next lines are optional and should only
explain the _why_ it is done this particular way. explain the _why_ it is done this particular way.
On the other side, pull requests can regroup many commits at once. On the other side, pull requests can regroup many commits at once.
Just try to explain in the pull comment the ''why'' we should merge it (if it's not obvious). Just try to explain in the pull comment the ''why'' we should merge it (if it's not obvious).
Tim Pope wrote a [very nice tuto](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) on making good commit comments. Tim Pope wrote a [very nice tuto](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) on making good commit comments.
### Licenses ### Licenses
All the code here is licensed with the same terms as munin itself (GPLv2), unless specified otherwise inside a file. All the code here is licensed with the same terms as munin itself (GPLv2), unless specified otherwise inside a file.
In all cases the code shall have an OSI-compatible license. Asking for a pull implies that you agree with that fact. In all cases the code shall have an OSI-compatible license. Asking for a pull implies that you agree with that fact.
This change was made on Jun 1st 2012. If you wrote some code earlier and you do not agree to the new licensing default, you can : This change was made on Jun 1st 2012. If you wrote some code earlier and you do not agree to the new licensing default, you can:
- submit a licensing change pull - submit a licensing change pull
- submit a removal pull - submit a removal pull
# Building status # Building status

54
plugins/README.md Normal file
View file

@ -0,0 +1,54 @@
# Contributed Munin Plugins
This plethora of plugins covering various topics was contributed by many different users of [munin](http://munin-monitoring.org).
See the [gallery](http://gallery.munin-monitoring.org/) for a browsable overview of these plugins.
## Purpose of this repository
This repository of contributed plugin strives to achieve the following goals:
* allow users to find interesting plugins
* allow contributors to publish their plugins
* simplify cooperative maintenance of plugins
Contributed plugins are maintained primarily by their authors.
You may file bug reports for plugin issue here in this repository (`munin-contrib`), but please do not forget to notify the author of the plugin (see the plugin's documentation), too.
Please note, that this repository is not supposed to be a dumping site for random plugins of low quality. The related infrastructure (e.g the [gallery](http://gallery.munin-monitoring.org/) or automated tests) require a certain level of quality. Please see below for details.
## Submit a new plugin
1. check if a similar plugin exists and if it can be extended/changed instead of adding a new plugin
* please avoid code copies - they are a maintenance burden
2. add [documentation](http://guide.munin-monitoring.org/en/latest/develop/documenting.html#plugin-documentation) including configuration, author, license and [magic markers](http://guide.munin-monitoring.org/en/latest/architecture/syntax.html#magic-markers)
3. pick a suitable [category](http://guide.munin-monitoring.org/en/latest/reference/graph-category.html)
5. use style check tools for the language of the plugin (e.g. perl: `perlcritic`, shell: `shellcheck`, python: `flake8`, ruby: `rubocop`)
6. pick a suitable [name and location](#Plugin_name_and_location)
7. bonus:
* use the [multigraph approach](http://guide.munin-monitoring.org/en/latest/plugin/multigraphing.html#plugin-multigraphing) for non-trivial plugins
* add [example graphs](http://guide.munin-monitoring.org/en/latest/develop/plugins/plugin-gallery.html#rules-for-plugin-contributors) for the [gallery](http://gallery.munin-monitoring.org/)
* support [dirtyconfig](http://guide.munin-monitoring.org/en/latest/plugin/protocol-dirtyconfig.html#plugin-protocol-dirtyconfig) if it is suitable
8. open a [pull request](https://github.com/munin-monitoring/contrib/pull/) with your new plugin or send it attached to an email to the [mailing list](https://lists.sourceforge.net/lists/listinfo/munin-users)
See the [plugin development documentation](http://guide.munin-monitoring.org/en/latest/develop/plugins/index.html) for more details.
## Modify an existing plugin
* *try* to keep the plugin backwards compatible (e.g. keep data fieldnames unchanged)
* improvements of code quality and features can justify incompatible changes of existing plugins
* bonus:
* improve the existing plugins according to the [wishlist for new plugins](#Submit_a_new_plugin)
* upgrades from simple plugins to a [multigraph plugin](http://guide.munin-monitoring.org/en/latest/plugin/multigraphing.html#plugin-multigraphing) are welcome
## Plugin name and location
The following descriptions are *intentions* - they do not necessarily describe the current state for all plugins. Please open a [pull request](https://github.com/munin-monitoring/contrib/pull/) if you want to align the current structure along the goals outlined below:
* the top level directory should describe a related *software* or *vendor*
* use *concepts* or *platforms* only if it is really necessary (e.g. *cpu*, *bsd*, *memory*)
* subdirectories are usually not required

34
plugins/accounting/accounting_ Normal file → Executable file
View file

@ -115,28 +115,26 @@ fi
if [ "$1" == "autoconf" ]; then if [ "$1" == "autoconf" ]; then
if [ -r /proc/net/dev ]; then if [ -r /proc/net/dev ]; then
$IPTABLES -L INPUT -v -n -x >/dev/null 2>/dev/null $IPTABLES -L INPUT -v -n -x -w >/dev/null 2>/dev/null
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
echo "no (could not run iptables as user `whoami`)" echo "no (could not run iptables as user `whoami`)"
exit 1 else
else echo yes
echo yes
exit 0
fi fi
else else
echo "no (/proc/net/dev not found)" echo "no (/proc/net/dev not found)"
exit 1
fi fi
exit 0
fi fi
if [ "$1" = "suggest" ]; then if [ "$1" = "suggest" ]; then
if [ $PROTO = "ipv4" ]; then if [ $PROTO = "ipv4" ]; then
$IPTABLES -L INPUT -v -x -n 2>/dev/null | sed -n 's/^.*\/\* ACCT\-\([a-zA-Z\-]*\) \*\/.*$/\ipv4_\1/p' $IPTABLES -L INPUT -v -x -n -w 2>/dev/null | sed -n 's/^.*\/\* ACCT\-\([a-zA-Z\-]*\) \*\/.*$/\ipv4_\1/p'
$IPTABLES -L OUTPUT -v -x -n 2>/dev/null | sed -n 's/^.*\/\* ACCT\-\([a-zA-Z\-]*\) \*\/.*$/\ipv4_\1/p' $IPTABLES -L OUTPUT -v -x -n -w 2>/dev/null | sed -n 's/^.*\/\* ACCT\-\([a-zA-Z\-]*\) \*\/.*$/\ipv4_\1/p'
elif [ $PROTO == "ipv6" ]; then elif [ $PROTO == "ipv6" ]; then
$IPTABLES -L INPUT -v -x -n 2>/dev/null | sed -n 's/^.*\/\* ACCT\-\([a-zA-Z\-]*\) \*\/.*$/\ipv6_\1/p' $IPTABLES -L INPUT -v -x -n -w 2>/dev/null | sed -n 's/^.*\/\* ACCT\-\([a-zA-Z\-]*\) \*\/.*$/\ipv6_\1/p'
$IPTABLES -L OUTPUT -v -x -n 2>/dev/null | sed -n 's/^.*\/\* ACCT\-\([a-zA-Z\-]*\) \*\/.*$/\ipv6_\1/p' $IPTABLES -L OUTPUT -v -x -n -w 2>/dev/null | sed -n 's/^.*\/\* ACCT\-\([a-zA-Z\-]*\) \*\/.*$/\ipv6_\1/p'
fi fi
exit 0 exit 0
@ -192,12 +190,12 @@ if [ "$1" = "config" ]; then
fi; fi;
echo 'multigraph '${0##*/}'_in' echo 'multigraph '${0##*/}'_in'
$IPTABLES -L INPUT -v -n -x | grep "\/\* ACCT\-"$SUBCHAIN"\-tcp\-in \*\/" | tr -s '*' '-' | awk "{ print \"tcpIN.value \" \$2 }" $IPTABLES -L INPUT -v -n -x -w | grep "\/\* ACCT\-"$SUBCHAIN"\-tcp\-in \*\/" | tr -s '*' '-' | awk "{ print \"tcpIN.value \" \$2 }"
$IPTABLES -L INPUT -v -n -x | grep "\/\* ACCT\-"$SUBCHAIN"\-udp\-in \*\/" | tr -s '*' '-' | awk "{ print \"udpIN.value \" \$2 }" $IPTABLES -L INPUT -v -n -x -w | grep "\/\* ACCT\-"$SUBCHAIN"\-udp\-in \*\/" | tr -s '*' '-' | awk "{ print \"udpIN.value \" \$2 }"
$IPTABLES -L INPUT -v -n -x | grep "\/\* ACCT\-"$SUBCHAIN"\-icmp\-in \*\/" | tr -s '*' '-' | awk "{ print \"icmpIN.value \" \$2 }" $IPTABLES -L INPUT -v -n -x -w | grep "\/\* ACCT\-"$SUBCHAIN"\-icmp\-in \*\/" | tr -s '*' '-' | awk "{ print \"icmpIN.value \" \$2 }"
echo echo
echo 'multigraph '${0##*/}'_out' echo 'multigraph '${0##*/}'_out'
$IPTABLES -L OUTPUT -v -n -x | grep "\/\* ACCT\-"$SUBCHAIN"\-tcp\-out \*\/" | tr -s '*' '-' | awk "{ print \"tcpOUT.value \" \$2 }" $IPTABLES -L OUTPUT -v -n -x -w | grep "\/\* ACCT\-"$SUBCHAIN"\-tcp\-out \*\/" | tr -s '*' '-' | awk "{ print \"tcpOUT.value \" \$2 }"
$IPTABLES -L OUTPUT -v -n -x | grep "\/\* ACCT\-"$SUBCHAIN"\-udp\-out \*\/" | tr -s '*' '-' | awk "{ print \"udpOUT.value \" \$2 }" $IPTABLES -L OUTPUT -v -n -x -w | grep "\/\* ACCT\-"$SUBCHAIN"\-udp\-out \*\/" | tr -s '*' '-' | awk "{ print \"udpOUT.value \" \$2 }"
$IPTABLES -L OUTPUT -v -n -x | grep "\/\* ACCT\-"$SUBCHAIN"\-icmp\-out \*\/" | tr -s '*' '-' | awk "{ print \"icmpOUT.value \" \$2 }" $IPTABLES -L OUTPUT -v -n -x -w | grep "\/\* ACCT\-"$SUBCHAIN"\-icmp\-out \*\/" | tr -s '*' '-' | awk "{ print \"icmpOUT.value \" \$2 }"

View file

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# #
# Plugin to monitor the amavis mail filter for Debian # Plugin to monitor the amavis mail filter for Debian
# (based upon a plugin authored by Geoffroy Desvernay) # (based upon a plugin authored by Geoffroy Desvernay)
# #
@ -32,16 +32,15 @@ BC=${bc:-`which bc`}
mktempfile () { mktempfile () {
mktemp mktemp
} }
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -f "${AMAVIS_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" -a -n "${BC}" -a -x "${BC}" ] ; then if [ -f "${AMAVIS_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" -a -n "${BC}" -a -x "${BC}" ] ; then
echo yes echo yes
exit 0
else else
echo no echo no
exit 1
fi fi
exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
@ -96,7 +95,7 @@ then
virus=`grep 'INFECTED' ${TEMP_FILE} | wc -l` virus=`grep 'INFECTED' ${TEMP_FILE} | wc -l`
spam=`grep 'Blocked SPAM' ${TEMP_FILE} | wc -l` spam=`grep 'Blocked SPAM' ${TEMP_FILE} | wc -l`
other=`echo ${total}-${clean}-${virus}-${other}-${spam} | ${BC}` other=`echo ${total}-${clean}-${virus}-${other}-${spam} | ${BC}`
/bin/rm -f $TEMP_FILE /bin/rm -f $TEMP_FILE
fi fi

View file

@ -45,11 +45,10 @@ my($db_home) = # DB databases directory
if ($ARGV[0] and $ARGV[0] eq "autoconf") { if ($ARGV[0] and $ARGV[0] eq "autoconf") {
if (-x "/usr/sbin/amavisd-agent") { if (-x "/usr/sbin/amavisd-agent") {
print "yes\n"; print "yes\n";
exit 0;
} else { } else {
print "no (/usr/sbin/amavisd-agent not found or not executable)\n"; print "no (/usr/sbin/amavisd-agent not found or not executable)\n";
exit 1;
} }
exit 0;
} elsif ($ARGV[0] and $ARGV[0] eq "suggest") { } elsif ($ARGV[0] and $ARGV[0] eq "suggest") {
print "time\n"; print "time\n";
print "cache\n"; print "cache\n";

View file

@ -2,7 +2,7 @@
# #
# Plugin to monitor Amavis virus and spam statistics. # Plugin to monitor Amavis virus and spam statistics.
# #
# #
# Based on a routine by William Towle # Based on a routine by William Towle
# Uncomment the cdef lines to convert the graph to mails/minute # Uncomment the cdef lines to convert the graph to mails/minute
# Comment out the line "total.graph no" to show the total on the graph. This may not be aesthetically pleasing. # Comment out the line "total.graph no" to show the total on the graph. This may not be aesthetically pleasing.
@ -23,11 +23,10 @@ STATEFILE=$MUNIN_PLUGSTATE/amavis.offset
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then if [ -f "${MAIL_LOG}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
echo yes echo yes
exit 0
else else
echo no echo no
exit 1
fi fi
exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
@ -38,7 +37,7 @@ if [ "$1" = "config" ]; then
echo 'graph_args --base 1000 -l 0' echo 'graph_args --base 1000 -l 0'
echo 'graph_order clean p_spam b_spam virus total' echo 'graph_order clean p_spam b_spam virus total'
echo 'clean.min 0' echo 'clean.min 0'
echo 'clean.type ABSOLUTE' echo 'clean.type ABSOLUTE'
#echo 'clean.cdef clean,60,*' #echo 'clean.cdef clean,60,*'
@ -70,15 +69,13 @@ fi
$LOGTAIL ${MAIL_LOG} $STATEFILE | \ $LOGTAIL ${MAIL_LOG} $STATEFILE | \
awk 'BEGIN { na= 0; nb= 0; nc= 0; nd= 0; total= 0 } awk 'BEGIN { clean_count=0; passed_spam_count=0; blocked_spam_count=0; infected_count=0; total=0 }
{ {
if (index($0, "Passed CLEAN")) { na++ ; total++ } if (index($0, "Passed CLEAN")) { clean_count++ ; total++ }
else if (index($0, "Passed SPAMMY")) { nb++ ; total++ } else if (index($0, "Passed SPAMMY")) { passed_spam_count++ ; total++ }
else if (index($0, "Blocked SPAMMY")) { nc++ ; total++ } else if (index($0, "Blocked SPAMMY")) { blocked_spam_count++ ; total++ }
else if (index($0, "INFECTED")) { nd++ ; total++ } else if (index($0, "INFECTED")) { infected_count++ ; total++ }
} }
END { print "clean.value " na"\np_spam.value " nb"\nb_spam.value " nc"\nvirus.value " nd"\ntotal.value " total }' END { print "clean.value " clean_count"\np_spam.value " passed_spam_count"\nb_spam.value " blocked_spam_count"\nvirus.value " infected_count"\ntotal.value " total }'

View file

@ -54,14 +54,13 @@ sub autoconf
if (-d $LOGDIR) { if (-d $LOGDIR) {
if (-f $logfile) { if (-f $logfile) {
print "yes\n"; print "yes\n";
exit 0;
} else { } else {
print "no (logfile not found)\n"; print "no (logfile not found)\n";
} }
} else { } else {
print "no (could not find logdir)\n"; print "no (could not find logdir)\n";
} }
exit 1; exit 0;
} }
sub config sub config
@ -134,7 +133,7 @@ sub parse
while (<$log>) { while (<$log>) {
# \d protects us against HTML injection here, be careful when changing # \d protects us against HTML injection here, be careful when changing
if (m,SCM:{ID:(\d+) +.* +Consumption: +(\d+) +,) { if (m,SCM:\{ID:(\d+) +.* +Consumption: +(\d+) +,) {
$stations{$1} = $2; $stations{$1} = $2;
$signals{$1}++; $signals{$1}++;
} }

View file

@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
# #
# Plugin to monitor the number of clients in the the aMule queue. # Plugin to monitor the number of clients in the the aMule queue.
# #
# In order to use this plugin, you need to enable the "Online Signature" feature # In order to use this plugin, you need to enable the "Online Signature" feature
# available in aMule's configuration options. You will also need to tell aMule to save # available in aMule's configuration options. You will also need to tell aMule to save
# the signature file in '/tmp' . # the signature file in '/tmp' .
# For detailed instructions with screenshots, see http://linux.andreagozzi.com/content/munin_stuff.php # For detailed instructions with screenshots, see http://linux.andreagozzi.com/content/munin_stuff.php
# #
# #
# Parameters understood: # Parameters understood:
# #
# config (required) # config (required)
@ -28,16 +28,15 @@
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -z "$(which amule)" ]; then if [ -z "$(which amule)" ]; then
echo "$0: error: amule not installed" echo "no (amule not installed)"
exit 1
else else
if [ ! -e /tmp/amulesig.dat ]; then if [ ! -e /tmp/amulesig.dat ]; then
echo "$0: error: amulesig.dat not found" echo "no (amulesig.dat not found)"
else else
echo yes echo yes
exit 0
fi fi
fi fi
exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then

View file

@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
# #
# Plugin to monitor the number of shared files with the aMule ed2k/KAD client. # Plugin to monitor the number of shared files with the aMule ed2k/KAD client.
# #
# In order to use this plugin, you need to enable the "Online Signature" feature # In order to use this plugin, you need to enable the "Online Signature" feature
# available in aMule's configuration options. You will also need to tell aMule to save # available in aMule's configuration options. You will also need to tell aMule to save
# the signature file in '/tmp' . # the signature file in '/tmp' .
# For detailed instructions with screenshots, see http://linux.andreagozzi.com/content/munin_stuff.php # For detailed instructions with screenshots, see http://linux.andreagozzi.com/content/munin_stuff.php
# #
# #
# Parameters understood: # Parameters understood:
# #
# config (required) # config (required)
@ -28,16 +28,15 @@
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -z "$(which amule)" ]; then if [ -z "$(which amule)" ]; then
echo "$0: error: amule not installed" echo "no (amule not installed)"
exit 1
else else
if [ ! -e /tmp/amulesig.dat ]; then if [ ! -e /tmp/amulesig.dat ]; then
echo "$0: error: amulesig.dat not found" echo "no (amulesig.dat not found)"
else else
echo yes echo yes
exit 0
fi fi
fi fi
exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then

View file

@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
# #
# Plugin to monitor the UL/DL speed of the aMule ed2k/KAD client. # Plugin to monitor the UL/DL speed of the aMule ed2k/KAD client.
# #
# In order to use this plugin, you need to enable the "Online Signature" feature # In order to use this plugin, you need to enable the "Online Signature" feature
# available in aMule's configuration options. You will also need to tell aMule to save # available in aMule's configuration options. You will also need to tell aMule to save
# the signature file in '/tmp' . # the signature file in '/tmp' .
# For detailed instructions with screenshots, see http://linux.andreagozzi.com/content/munin_stuff.php # For detailed instructions with screenshots, see http://linux.andreagozzi.com/content/munin_stuff.php
# #
# #
# Parameters understood: # Parameters understood:
# #
# config (required) # config (required)
@ -28,16 +28,15 @@
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -z "$(which amule)" ]; then if [ -z "$(which amule)" ]; then
echo "$0: error: amule not installed" echo "no (amule not installed)"
exit 1
else else
if [ ! -e /tmp/amulesig.dat ]; then if [ ! -e /tmp/amulesig.dat ]; then
echo "$0: error: amulesig.dat not found" echo "no (amulesig.dat not found)"
else else
echo yes echo yes
exit 0
fi fi
fi fi
exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then

View file

@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
# #
# Plugin to monitor the current aMule ed2k/KAD client uptime. # Plugin to monitor the current aMule ed2k/KAD client uptime.
# #
# In order to use this plugin, you need to enable the "Online Signature" feature # In order to use this plugin, you need to enable the "Online Signature" feature
# available in aMule's configuration options. You will also need to tell aMule to save # available in aMule's configuration options. You will also need to tell aMule to save
# the signature file in '/tmp' . # the signature file in '/tmp' .
# For detailed instructions with screenshots, see http://linux.andreagozzi.com/content/munin_stuff.php # For detailed instructions with screenshots, see http://linux.andreagozzi.com/content/munin_stuff.php
# #
# #
# Parameters understood: # Parameters understood:
# #
# config (required) # config (required)
@ -28,16 +28,15 @@
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -z "$(which amule)" ]; then if [ -z "$(which amule)" ]; then
echo "$0: error: amule not installed" echo "no (amule not installed)"
exit 1
else else
if [ ! -e /tmp/amulesig.dat ]; then if [ ! -e /tmp/amulesig.dat ]; then
echo "$0: error: amulesig.dat not found" echo "no (amulesig.dat not found)"
else else
echo yes echo yes
exit 0
fi fi
fi fi
exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then

View file

@ -42,20 +42,20 @@ my %chars = (
if (exists $ARGV[0] and $ARGV[0] eq "autoconf") { if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
if ($ret) { if ($ret) {
print "no ($ret)\n"; print "no ($ret)\n";
exit 1; exit 0;
} }
my $ua = LWP::UserAgent->new(timeout => 30); my $ua = LWP::UserAgent->new(timeout => 30);
my @badports; my @badports;
foreach my $port (@PORTS) { foreach my $port (@PORTS) {
my $url = sprintf $URL, $port; my $url = sprintf $URL, $port;
my $response = $ua->request(HTTP::Request->new('GET',$url)); my $response = $ua->request(HTTP::Request->new('GET',$url));
push @badports, $port unless $response->is_success and $response->content =~ /Scoreboard/im; push @badports, $port unless $response->is_success and $response->content =~ /Scoreboard/im;
} }
if (@badports) { if (@badports) {
print "no (no apache server-status on ports @badports)\n"; print "no (no apache server-status on ports @badports)\n";
exit 1; exit 0;
} else { } else {
print "yes\n"; print "yes\n";
exit 0; exit 0;
@ -75,7 +75,7 @@ if (exists $ARGV[0] and $ARGV[0] eq "config") {
print $val, "\n"; print $val, "\n";
print "activity_${port}_${char}.type GAUGE\n"; print "activity_${port}_${char}.type GAUGE\n";
} }
} }
exit 0; exit 0;
} }

26
plugins/apache/apache_average_time_last_n_requests Normal file → Executable file
View file

@ -3,7 +3,7 @@
# Raphaël Droz <raphael.droz@gmail.com> - 2016-01-08 # Raphaël Droz <raphael.droz@gmail.com> - 2016-01-08
# #
# Monitors the average time requests matching a custom regexp takes # Monitors the average time requests matching a custom regexp takes
# For instance monitor time execution of files in http://example.com/foo/bar, # For instance monitor time execution of files in http://example.com/foo/bar,
# requests from google, images etc. # requests from google, images etc.
# #
# Simply add an entry in the 'type' hashref and modify the description fields # Simply add an entry in the 'type' hashref and modify the description fields
@ -13,7 +13,7 @@
# #
# NOTE: You need to add a field in your Apache logs showing time executed. # NOTE: You need to add a field in your Apache logs showing time executed.
# This is normally done using the %T (seconds) or %D (microseconds) # This is normally done using the %T (seconds) or %D (microseconds)
# For instance: # For instance:
# LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" %T %v" # LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" %T %v"
# Check http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats for more info # Check http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats for more info
# #
@ -62,14 +62,14 @@ my $types = {
# any kind of request # any kind of request
total => { total => {
munin_fields => { munin_fields => {
label => 'All requests', label => 'All requests',
draw => 'LINE2', draw => 'LINE2',
info => 'Average seconds per any request', info => 'Average seconds per any request',
}, },
sum => 0, sum => 0,
lines => 0, lines => 0,
matches => sub { matches => sub {
return 1; return 1;
}, },
}, },
@ -82,11 +82,11 @@ my $types = {
}, },
sum => 0, sum => 0,
lines => 0, lines => 0,
matches => sub { matches => sub {
my ($fields) = @_; my ($fields) = @_;
my $script; my $script;
($script = $fields->[6]) =~ s/\?.*\z //mx; ($script = $fields->[6]) =~ s/\?.*\z //mx;
return $script =~ m{ \.(png|jpe?g|gif|tiff|ilbm|tga) \z }mx; return $script =~ m{ \.(png|jpe?g|gif|tiff|ilbm|tga) \z }mx;
}, },
}, },
}; };
@ -101,7 +101,7 @@ if (@ARGV && $ARGV[0] eq 'config') {
} }
} }
exit(0); exit(0);
} }
my $config_file = `ls -1 $ACCESS_LOG_PATTERN | tail -n 1`; my $config_file = `ls -1 $ACCESS_LOG_PATTERN | tail -n 1`;
@ -121,13 +121,13 @@ foreach my $line (@lines) {
$types->{$type}->{'lines'}++; $types->{$type}->{'lines'}++;
} }
} }
} }
} }
foreach my $type (keys %{$types}) { foreach my $type (keys %{$types}) {
my $value = $types->{$type}->{'lines'} ? $types->{$type}->{'sum'} / $types->{$type}->{'lines'} : 'U'; my $value = $types->{$type}->{'lines'} ? $types->{$type}->{'sum'} / $types->{$type}->{'lines'} : 'U';
printf "%s.value %s\n", ($type, $value); printf "%s.value %s\n", ($type, $value);
} }

View file

@ -5,10 +5,10 @@
# luis peralta - luis@11870.com # luis peralta - luis@11870.com
# http://www.ziritione.org # http://www.ziritione.org
# #
# Installing: configure apache blackbox and set the logfile to /var/log/blackbox.log # Installing: configure apache blackbox and set the logfile to /var/log/blackbox.log
# or change the BLACKBOXLOG setting below. # or change the BLACKBOXLOG setting below.
# #
# Dependencies: apache mod_logio, apache blackbox # Dependencies: apache mod_logio, apache blackbox
# http://www.devco.net/archives/2008/03/05/detailed_apache_stats.php # http://www.devco.net/archives/2008/03/05/detailed_apache_stats.php
# #
# Last version available at: http://www.ziritione.org/http_status # Last version available at: http://www.ziritione.org/http_status
@ -23,13 +23,13 @@
use strict; use strict;
my $BLACKBOXLOG = "/var/log/blackbox.log"; my $BLACKBOXLOG = "/var/log/blackbox.log";
my %WANTED = ( "apache.status.200" => "_200", my %WANTED = ( "apache.status.200" => "_200",
"apache.status.301" => "_301", "apache.status.301" => "_301",
"apache.status.302" => "_302", "apache.status.302" => "_302",
"apache.status.404" => "_404", "apache.status.404" => "_404",
"apache.status.5xx" => "_5xx", "apache.status.5xx" => "_5xx",
); );
my $arg = shift(); my $arg = shift();
@ -78,7 +78,7 @@ graph_total total\n");
); );
$num++; $num++;
} }
} }

View file

@ -2,15 +2,15 @@
Those plugins are used to monitor different projects or vhost (i.e. either different log files or using regular expression as filters) on the same web server. Those plugins are used to monitor different projects or vhost (i.e. either different log files or using regular expression as filters) on the same web server.
## munin_byprojects_access ## munin_byprojects_access
Count the number of hits per projects/vhost. Count the number of hits per projects/vhost.
![byproject_access](https://www.mantor.org/~northox/misc/munin-plugins/nginx_byprojects_access1-month.png "byproject_access") ![byproject_access](https://www.mantor.org/~northox/misc/munin-plugins/nginx_byprojects_access1-month.png "byproject_access")
## munin_byprojects_bandwidth ## munin_byprojects_bandwidth
Count the total bandwidth used by each projects/vhost. [Logtail] (https://www.fourmilab.ch/webtools/logtail/) is required. Count the total bandwidth used by each projects/vhost. [Logtail] (https://www.fourmilab.ch/webtools/logtail/) is required.
![byproject_bandwidth](https://www.mantor.org/~northox/misc/munin-plugins/apache_byprojects_bandwidth-month.png "byproject_bandwidth") ![byproject_bandwidth](https://www.mantor.org/~northox/misc/munin-plugins/apache_byprojects_bandwidth-month.png "byproject_bandwidth")
## munin_byprojects_inout_bandwidth ## munin_byprojects_inout_bandwidth
Counts the in/out bandwidth used by each projects/vhost. [Logtail] (https://www.fourmilab.ch/webtools/logtail/) is required. Counts the in/out bandwidth used by each projects/vhost. [Logtail] (https://www.fourmilab.ch/webtools/logtail/) is required.
![byproject_inout_bandwidth](https://www.mantor.org/~northox/misc/munin-plugins/apache_byprojects_inout_bandwidth-month.png "byproject_inout_bandwidth") ![byproject_inout_bandwidth](https://www.mantor.org/~northox/misc/munin-plugins/apache_byprojects_inout_bandwidth-month.png "byproject_inout_bandwidth")
## Installation ## Installation

8
plugins/apache/apache_byprojects/byprojects_access Normal file → Executable file
View file

@ -3,16 +3,16 @@ use strict;
# #
# byprojects_access # byprojects_access
# #
# Perl script to monitor access *byprojects* (e.g. vhost) from multiple files # Perl script to monitor access *byprojects* (e.g. vhost) from multiple files
# and/or regex. # and/or regex.
# #
# Danny Fullerton <northox@mantor.org> # Danny Fullerton <northox@mantor.org>
# Mantor Organization <www.mantor.org> # Mantor Organization <www.mantor.org>
# This work is licensed under a MIT license. # This work is licensed under a MIT license.
# #
# You need logtail (https://www.fourmilab.ch/webtools/logtail/) # You need logtail (https://www.fourmilab.ch/webtools/logtail/)
# #
# Log can be gathered from multiple sources by simply specifying multiple log # Log can be gathered from multiple sources by simply specifying multiple log
# filename or using wildcards (glob). File content can be selected using regex. # filename or using wildcards (glob). File content can be selected using regex.
# #
# - 'prod' => [ {'path' => '/home/prod/log/access.log'} ], # - 'prod' => [ {'path' => '/home/prod/log/access.log'} ],
@ -74,7 +74,7 @@ foreach my $project ( keys %logs ) {
my @paths = glob $log->{'path'}; my @paths = glob $log->{'path'};
foreach my $path (@paths) { foreach my $path (@paths) {
my $state = $statepath.'/'.$project.$x.'_access.state'; my $state = $statepath.'/'.$project.$x.'_access.state';
open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or
die "Can't open $logtail : $!"; die "Can't open $logtail : $!";
while (<LT>) { while (<LT>) {
my $buf = $_; my $buf = $_;

8
plugins/apache/apache_byprojects/byprojects_bandwidth Normal file → Executable file
View file

@ -3,10 +3,10 @@ use strict;
# #
# byprojects_bandwidth # byprojects_bandwidth
# #
# Perl script to monitor total bandwidth *byprojects* (e.g. vhost) from multiple # Perl script to monitor total bandwidth *byprojects* (e.g. vhost) from multiple
# files and/or regex. # files and/or regex.
# #
# Danny Fullerton <northox@mantor.org> # Danny Fullerton <northox@mantor.org>
# Mantor Organization <www.mantor.org> # Mantor Organization <www.mantor.org>
# This work is licensed under a MIT license. # This work is licensed under a MIT license.
# #
@ -17,7 +17,7 @@ use strict;
# "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" # "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O"
# where %I is input and %O is output. # where %I is input and %O is output.
# #
# Log can be gathered from multiple sources by simply specifying multiple log # Log can be gathered from multiple sources by simply specifying multiple log
# filename or using wildcards (glob). File content can be selected using regex. # filename or using wildcards (glob). File content can be selected using regex.
# #
# - 'prod' => [ {'path' => '/home/prod/log/access.log'} ], # - 'prod' => [ {'path' => '/home/prod/log/access.log'} ],
@ -81,7 +81,7 @@ foreach my $project ( keys %logs ) {
my @paths = glob $log->{'path'}; my @paths = glob $log->{'path'};
foreach my $path (@paths) { foreach my $path (@paths) {
my $state = $statepath.'/'.$project.$x.'_totalbandwidth.state'; my $state = $statepath.'/'.$project.$x.'_totalbandwidth.state';
open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or
die "Can't open $logtail : $!"; die "Can't open $logtail : $!";
while (<LT>) { while (<LT>) {
my $buf = $_; my $buf = $_;

View file

@ -3,10 +3,10 @@ use strict;
# #
# byprojects_inout_bandwidth # byprojects_inout_bandwidth
# #
# Perl script to monitor in/out bandwidth *byprojects* (e.g. vhost) from # Perl script to monitor in/out bandwidth *byprojects* (e.g. vhost) from
# multiple files and/or regex. # multiple files and/or regex.
# #
# Danny Fullerton <northox@mantor.org> # Danny Fullerton <northox@mantor.org>
# Mantor Organization <www.mantor.org> # Mantor Organization <www.mantor.org>
# This work is licensed under a MIT license. # This work is licensed under a MIT license.
# #
@ -17,7 +17,7 @@ use strict;
# "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" # "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O"
# where %I is input and %O is output. # where %I is input and %O is output.
# #
# Log can be gathered from multiple sources by simply specifying multiple log # Log can be gathered from multiple sources by simply specifying multiple log
# filename or using wildcards (glob). File content can be selected using regex. # filename or using wildcards (glob). File content can be selected using regex.
# #
# - 'prod' => [ {'path' => '/home/prod/log/access.log'} ], # - 'prod' => [ {'path' => '/home/prod/log/access.log'} ],
@ -84,7 +84,7 @@ foreach my $project ( keys %logs ) {
my @paths = glob $log->{'path'}; my @paths = glob $log->{'path'};
foreach my $path (@paths) { foreach my $path (@paths) {
my $state = $statepath.'/'.$project.$x.'_inoutbandwidth.state'; my $state = $statepath.'/'.$project.$x.'_inoutbandwidth.state';
open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or open(LT, "$logtail -f ".$log->{'path'}." -o $state |") or
die "Can't open $logtail : $!"; die "Can't open $logtail : $!";
while (<LT>) { while (<LT>) {
my $buf = $_; my $buf = $_;

View file

@ -1,69 +0,0 @@
#!/bin/sh
# -*- sh -*-
: << =cut
=head1 NAME
apache_memmory -Indicate the medium size of all the apache child process
=head1 CONFIGURATION
[apache_*]
env.apuser user_running_apache
env.binname apache_binary_name
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. $MUNIN_LIBDIR/plugins/plugin.sh
USR=$apuser
PROCS=$binname
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Medium size of apache child process.'
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel Kb'
echo 'graph_scale no'
echo 'graph_category webserver'
echo 'graph_info Indicate the memdium size of all the apache child process.'
echo "servers.label servers"
echo "servers.type GAUGE"
echo "servers.min 0"
exit 0
fi
VAL1=`ps auxf | grep ${PROCS} | grep ^${USR} | grep -v grep | wc -l`
VAL2=`ps auxf | grep ${PROCS} | grep ^${USR} | grep -v grep | awk '{s+=$6} END {print s}'`
VAL3=`expr $VAL2 / $VAL1`
echo "servers.value $VAL3"

66
plugins/apache/apache_memory Executable file
View file

@ -0,0 +1,66 @@
#!/bin/sh
# -*- sh -*-
: << =cut
=head1 NAME
apache_memory - Indicate the medium size of all the apache child process
=head1 CONFIGURATION
[apache_*]
env.apuser user_running_apache (default: "www-data")
env.binname apache_binary_name (default: "apache2")
=head1 AUTHOR
Ricardo Fraile <rfrail3@yahoo.es>
=head1 LICENSE
GPLv2
=head1 MAGICK MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. "$MUNIN_LIBDIR/plugins/plugin.sh"
USR=${apuser:-www-data}
PROCS=${binname:-apache2}
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Average size of apache child processes'
echo 'graph_args --base 1024 -l 0 '
echo 'graph_vlabel Bytes'
echo 'graph_scale no'
echo 'graph_category webserver'
echo 'graph_info Indicate the memdium size of all the apache child process.'
echo "servers.label servers"
echo "servers.type GAUGE"
echo "servers.min 0"
exit 0
fi
matched_processes=$(ps auxf | grep -- "$PROCS" | grep "^$USR" | grep -v grep)
if [ -n "$matched_processes" ]; then
average_memory=$(printf '%s' "$matched_processes" | awk '{count+=1; sum+=$6} END {print sum / count * 1024}')
else
average_memory="U"
fi
echo "servers.value $average_memory"

View file

@ -5,13 +5,13 @@
=head1 NAME =head1 NAME
apache_servers -Indicate the number of apache servers running (child process) apache_servers - Indicate the number of apache servers running (child process)
=head1 CONFIGURATION =head1 CONFIGURATION
[apache_*] [apache_*]
env.apuser user_runnin_apache env.apuser user_running_apache (default: "www-data")
env.binname apache_binary_name env.binname apache_binary_name (default: "apache2")
=head1 AUTHOR =head1 AUTHOR
@ -28,37 +28,32 @@ GPLv2
=cut =cut
. $MUNIN_LIBDIR/plugins/plugin.sh . "$MUNIN_LIBDIR/plugins/plugin.sh"
USR=$apuser USR=${apuser:-www-data}
PROCS=$binname PROCS=${binname:-apache2}
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
echo yes echo yes
exit 0 exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title Number of apache servers running.' echo 'graph_title Number of apache servers running'
echo 'graph_args --base 1000 -l 0 ' echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel servers' echo 'graph_vlabel servers'
echo 'graph_scale no' echo 'graph_scale no'
echo 'graph_category webserver' echo 'graph_category webserver'
echo 'graph_info Indicate the number of apache servers running (child process).' echo 'graph_info Indicate the number of apache servers running (child process).'
echo "servers.label servers"
echo "servers.type GAUGE"
echo "servers.min 0"
echo "servers.info Number of apache processes"
exit 0
echo "servers.label servers"
echo "servers.type GAUGE"
echo "servers.min 0"
echo "servers.info I/O on nfs"
exit 0
fi fi
VAL1=`ps auxf | grep ${PROCS} | grep ^${USR} | grep -v grep | wc -l` process_count=$(ps auxf | grep -- "$PROCS" | grep "^$USR" | grep -v grep | wc -l)
echo "servers.value $process_count"
echo "servers.value $VAL1"

View file

@ -8,7 +8,7 @@
# to Apache2::SizeLimit. # to Apache2::SizeLimit.
# Author: Kjetil Kjernsmo <kjetilk@opera.com>, based on work by William Viker # Author: Kjetil Kjernsmo <kjetilk@opera.com>, based on work by William Viker
# Copyright (C) 2007 Opera Software ASA # Copyright (C) 2007 Opera Software ASA
# #
# Contibutors: Earle Nietzel <earle.nietzel@gmail.com> # Contibutors: Earle Nietzel <earle.nietzel@gmail.com>
# #
@ -37,7 +37,7 @@ if (!eval "require Linux::Smaps;") {
my $PNAME = exists $ENV{'pname'} ? $ENV{'pname'} : "httpd"; my $PNAME = exists $ENV{'pname'} ? $ENV{'pname'} : "httpd";
my $PUSER = exists $ENV{'puser'} ? $ENV{'puser'} : "apache"; my $PUSER = exists $ENV{'puser'} ? $ENV{'puser'} : "apache";
if (defined(@ARGV) && ($ARGV[0] eq 'config')) { if (@ARGV && ($ARGV[0] eq 'config')) {
print "graph_title Apache Smaps\n"; print "graph_title Apache Smaps\n";
print "graph_args --base 1024 -l 0\n"; print "graph_args --base 1024 -l 0\n";
print "graph_vlabel Bytes\n"; print "graph_vlabel Bytes\n";

View file

@ -144,7 +144,7 @@ if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" ) {
if ($response->content =~ /^Total Accesses:/im ) { if ($response->content =~ /^Total Accesses:/im ) {
next; next;
} else { } else {
print "no (ExtendedStatus option for apache" print "no (ExtendedStatus option for apache"
. " mod_status is missing on port $port)\n"; . " mod_status is missing on port $port)\n";
exit 0; exit 0;
} }

View file

@ -32,7 +32,7 @@ GPLv2
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
echo yes echo yes
exit 0 exit 0
fi fi
@ -81,8 +81,3 @@ done
echo "threads.value `echo $((SUM / $COUNT))`" echo "threads.value `echo $((SUM / $COUNT))`"

View file

@ -5,12 +5,13 @@
=head1 NAME =head1 NAME
apache_tmemmory -Indicate the total memory used by apache apache_tmemmory - Indicate the total memory used by apache
=head1 CONFIGURATION =head1 CONFIGURATION
[apache_*] [apache_*]
env.binname apache_binary_name env.apuser user_running_apache (default: "www-data")
env.binname apache_binary_name (default: "apache2")
=head1 AUTHOR =head1 AUTHOR
@ -27,38 +28,32 @@ GPLv2
=cut =cut
. $MUNIN_LIBDIR/plugins/plugin.sh . "$MUNIN_LIBDIR/plugins/plugin.sh"
USR=${apuser:-www-data}
USR=$apuser PROCS=${binname:-apache2}
PROCS=$binname
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
echo yes echo yes
exit 0 exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title Total memory used by apache' echo 'graph_title Total memory used by apache'
echo 'graph_args --base 1000 -l 0 ' echo 'graph_args --base 1024 -l 0 '
echo 'graph_vlabel Mb' echo 'graph_vlabel bytes'
echo 'graph_scale no' echo 'graph_scale no'
echo 'graph_category webserver' echo 'graph_category webserver'
echo 'graph_info Indicate the total memory used by apache.' echo 'graph_info Indicate the total memory used by apache.'
echo "servers.label servers" echo "servers.label servers"
echo "servers.type GAUGE" echo "servers.type GAUGE"
echo "servers.min 0" echo "servers.min 0"
exit 0 exit 0
fi fi
VAL1=`ps auxf | grep ${PROCS} | grep -v grep | awk '{s+=$6} END {print s}'` total_memory=$(ps auxf | grep -- "$PROCS" | grep "^$USR" | grep -v grep | awk '{s+=$6} END {print s * 1024}')
echo "servers.value $total_memory"
VAL2=`expr $VAL1 / 1024`
echo "servers.value $VAL2"

View file

@ -23,16 +23,13 @@ then
if ! ls $ACCESSLOG > /dev/null if ! ls $ACCESSLOG > /dev/null
then then
echo "no (could not find apache access log \"$ACCESSLOG\")" echo "no (could not find apache access log \"$ACCESSLOG\")"
exit 1
elif ! ls $DIRECTORY > /dev/null elif ! ls $DIRECTORY > /dev/null
then then
echo "no (could not find munin plugins directory \"$DIRECTORY\")" echo "no (could not find munin plugins directory \"$DIRECTORY\")"
exit 2
else else
echo "yes" echo "yes"
exit 0
fi fi
exit 0
fi fi
# ######################################################################################### INIT # ######################################################################################### INIT
@ -100,7 +97,7 @@ do
else else
USERNAME[$I]="anonymous" USERNAME[$I]="anonymous"
fi fi
NAME[$I]="_${USERNAME[I]}" # Output sort order NAME[$I]="_${USERNAME[I]}" # Output sort order
else else
NAME[$I]="${USERNAME[I]}" NAME[$I]="${USERNAME[I]}"
fi fi
@ -140,7 +137,7 @@ then
FILENAMES=$( find $DIRECTORY -type f -not -wholename $TIMESTAMP | sort) FILENAMES=$( find $DIRECTORY -type f -not -wholename $TIMESTAMP | sort)
awk '{ printf "%s.label %s\n%s.draw AREA\n", $1, $3, $1 }' $( echo "$FILENAMES" | head -n1 ) awk '{ printf "%s.label %s\n%s.draw AREA\n", $1, $3, $1 }' $( echo "$FILENAMES" | head -n1 )
for FILENAME in $( echo "$FILENAMES" | tail -n+2) for FILENAME in $( echo "$FILENAMES" | tail -n+2)
do do
awk '{ printf "%s.label %s\n%s.draw STACK\n", $1, $3, $1 }' $FILENAME awk '{ printf "%s.label %s\n%s.draw STACK\n", $1, $3, $1 }' $FILENAME

14
plugins/apache/apache_vhosts/apache_logparser Normal file → Executable file
View file

@ -95,7 +95,7 @@ sub count {
#find sitename #find sitename
$file=~s/$site/$1/; $file=~s/$site/$1/;
$file=$vhost if $vhost; $file=$vhost if $vhost;
# skip broken lines # skip broken lines
next unless $file; next unless $file;
@ -103,7 +103,7 @@ sub count {
my $vpm=clean_fieldname("$file"); my $vpm=clean_fieldname("$file");
$temp{$vpm}{'label'}="$file"; $temp{$vpm}{'label'}="$file";
$temp{$vpm}{'label'}=~s/www\.//; $temp{$vpm}{'label'}=~s/www\.//;
# count all requests # count all requests
$temp{$vpm}{'requests'}++; $temp{$vpm}{'requests'}++;
@ -118,13 +118,13 @@ sub count {
# average bytes # average bytes
$temp{$vpm}{'avg_bytes'}=$temp{$vpm}{'bytes'}/$temp{$vpm}{'requests'} || 0; $temp{$vpm}{'avg_bytes'}=$temp{$vpm}{'bytes'}/$temp{$vpm}{'requests'} || 0;
} }
# count by status / error code # count by status / error code
$temp{$vpm}{"status"}{$status}++ if $status; $temp{$vpm}{"status"}{$status}++ if $status;
if ($time) { if ($time) {
# microsec to millisec # microsec to millisec
$time=sprintf("%d",$time/1000); $time=sprintf("%d",$time/1000);
# min/max execution time # min/max execution time
$temp{$vpm}{'max_time'}=max($temp{$vpm}{'max_time'},$time) || 0; $temp{$vpm}{'max_time'}=max($temp{$vpm}{'max_time'},$time) || 0;
@ -144,9 +144,9 @@ while (1) {
# tail files, calls &count with linearray # tail files, calls &count with linearray
$tail->read; $tail->read;
# begin transaction # begin transaction
$share->lock(LOCK_EX); $share->lock(LOCK_EX);
# get data (may be updated by other loggers too) # get data (may be updated by other loggers too)
my %old=eval{%{thaw($share->fetch)}}; # using eval to suppress thaw error on empty string at the first run my %old=eval{%{thaw($share->fetch)}}; # using eval to suppress thaw error on empty string at the first run
@ -182,7 +182,7 @@ while (1) {
$share->store( freeze \%old ); $share->store( freeze \%old );
# end transaction # end transaction
$share->unlock; $share->unlock;
# parse/write every n seconds (plus processing time) # parse/write every n seconds (plus processing time)
sleep $nsec; sleep $nsec;
} }

12
plugins/apache/apache_vhosts/apache_pipelogger Normal file → Executable file
View file

@ -40,12 +40,12 @@ while (<STDIN>) {
# sanity check # sanity check
next unless m/^([\d\w\.\-_]+\s){5}([\d\w\.\-_]+$)/; # escaped "." and "-" next unless m/^([\d\w\.\-_]+\s){5}([\d\w\.\-_]+$)/; # escaped "." and "-"
# sitename to munin fieldname # sitename to munin fieldname
my $vpm=clean_fieldname($vhost); my $vpm=clean_fieldname($vhost);
$temp{$vpm}{'label'}=$vhost; $temp{$vpm}{'label'}=$vhost;
$temp{$vpm}{'label'}=~s/www\.//; $temp{$vpm}{'label'}=~s/www\.//;
# count all requests # count all requests
$temp{$vpm}{'requests'}++; $temp{$vpm}{'requests'}++;
@ -60,7 +60,7 @@ while (<STDIN>) {
# average bytes # average bytes
$temp{$vpm}{'avg_bytes'}=$temp{$vpm}{'bytes'}/$temp{$vpm}{'requests'} || 0 if ($bytes); $temp{$vpm}{'avg_bytes'}=$temp{$vpm}{'bytes'}/$temp{$vpm}{'requests'} || 0 if ($bytes);
} }
# count by status / error code # count by status / error code
$temp{$vpm}{"status"}{$status}++ if $status; $temp{$vpm}{"status"}{$status}++ if $status;
@ -77,9 +77,9 @@ while (<STDIN>) {
}; };
sub periodic_write { sub periodic_write {
# begin transaction # begin transaction
$share->lock(LOCK_EX); $share->lock(LOCK_EX);
# get data (may be updated by other loggers too) # get data (may be updated by other loggers too)
my %old=eval{%{thaw($share->fetch)}}; # using eval to suppress thaw error on empty string at the first run my %old=eval{%{thaw($share->fetch)}}; # using eval to suppress thaw error on empty string at the first run
@ -95,7 +95,7 @@ sub periodic_write {
$old{$vpm}{'avg_bytes'}=sprintf("%d",($old{$vpm}{'avg_bytes'}+$temp{$vpm}{'avg_bytes'})/2); $old{$vpm}{'avg_bytes'}=sprintf("%d",($old{$vpm}{'avg_bytes'}+$temp{$vpm}{'avg_bytes'})/2);
# reset local counters # reset local counters
foreach my $check qw(requests bytes time cml_time max_bytes avg_bytes max_time avg_time) { foreach my $check (qw(requests bytes time cml_time max_bytes avg_bytes max_time avg_time)) {
$temp{$vpm}{$check}=0; $temp{$vpm}{$check}=0;
} }

24
plugins/apache/apache_vhosts/apache_vhosts Normal file → Executable file
View file

@ -18,13 +18,13 @@ This plugin requires data from apache. You can get at the data in two ways:
- slightly less performant, but easier to apply to existing installations - slightly less performant, but easier to apply to existing installations
- If you want response time stats, you have to log them in apache: - If you want response time stats, you have to log them in apache:
<IfModule mod_log_config.c> <IfModule mod_log_config.c>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined-time LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" combined-time
</IfModule> </IfModule>
- Configure the log parser to match your installation regarding naming and log folders - Configure the log parser to match your installation regarding naming and log folders
You can use both solutions simultaneously, the data will be merged. You can use both solutions simultaneously, the data will be merged.
Be aware that a apache log CustomLog directive in the master config will only log those vhosts that have no directive of their own. Be aware that a apache log CustomLog directive in the master config will only log those vhosts that have no directive of their own.
Install plugin conf (after [apache_*]) Install plugin conf (after [apache_*])
[apache_vhosts] [apache_vhosts]
@ -36,14 +36,14 @@ env.checks requests bytes time
# subgraphs - create multigraph subgraphs (watch your graphing performance...), default 0 # subgraphs - create multigraph subgraphs (watch your graphing performance...), default 0
# checks - enable stats on bytes and response times per request, you have to log these in apache # checks - enable stats on bytes and response times per request, you have to log these in apache
A word on performance: A word on performance:
Requests/sec should not be much of a problem. Pipelogger and Logparser should not have man performance problems, as the apply one regex per line and add some stats. Requests/sec should not be much of a problem. Pipelogger and Logparser should not have man performance problems, as the apply one regex per line and add some stats.
Stats are saved every n seconds (default: 7) to shared mem in serialized format. That should be ok on the most loaded servers (unless you watch cache logs). Stats are saved every n seconds (default: 7) to shared mem in serialized format. That should be ok on the most loaded servers (unless you watch cache logs).
I would estimate that > 10k log lines/sec could start becoming a problem, you might have to start tuning there or use a dedicated system. I would estimate that > 10k log lines/sec could start becoming a problem, you might have to start tuning there or use a dedicated system.
You might think about splitting the logs over multiple Logparser scripts to parallelize and merge in larger intervals. You might think about splitting the logs over multiple Logparser scripts to parallelize and merge in larger intervals.
Graphing is another matter, the more vhosts you have. Graphing is another matter, the more vhosts you have.
With subgraphs off, you do 3 main graphs * 4 timescales (day, week, month, year). With subgraphs off, you do 3 main graphs * 4 timescales (day, week, month, year).
With subgraphs on, you get 2 checks * (1 + 6 * #vhosts) + 1 check * (1 + #vhosts * #statuscodes * 4) With subgraphs on, you get 2 checks * (1 + 6 * #vhosts) + 1 check * (1 + #vhosts * #statuscodes * 4)
With hundreds of vhosts that becomes a problem, as munin-update and munin-html do not scale well. With hundreds of vhosts that becomes a problem, as munin-update and munin-html do not scale well.
@ -152,7 +152,7 @@ ${site}_${graph}_$check.type GAUGE
END END
} # end graph } # end graph
} # end sites } # end sites
} # end subgraph } # end subgraph
} # end checks } # end checks
@ -173,7 +173,7 @@ graph_period minute
graph_order $order graph_order $order
END END
foreach my $site (keys %data) { foreach my $site (keys %data) {
print <<END; print <<END;
${site}_requests.label $data{$site}{'label'} ${site}_requests.label $data{$site}{'label'}
${site}_requests.info $site ${site}_requests.info $site
@ -230,7 +230,7 @@ foreach my $check (keys %checks) {
} # end sites } # end sites
if ($subgraphs{$check}) { if ($subgraphs{$check}) {
# subgraph values # subgraph values
foreach my $site (keys %data) { foreach my $site (keys %data) {
print "\nmultigraph apache_vhosts_$check.$site\n"; print "\nmultigraph apache_vhosts_$check.$site\n";
foreach my $graph ("avg","max") { foreach my $graph ("avg","max") {

View file

@ -12,7 +12,7 @@
# Must be symlinked to what the graph should monitor. Run with --suggest # Must be symlinked to what the graph should monitor. Run with --suggest
# to see valid targets - or just run munin-node-configure --shell # to see valid targets - or just run munin-node-configure --shell
# #
# Written by Bjørn Ruberg 2006-2007 # Written by Bjørn Ruberg 2006-2007
# #
# Magic markers: # Magic markers:
#%# family=auto #%# family=auto
@ -39,20 +39,20 @@ my $type = "throughput";
if (exists $ARGV[0] and $ARGV[0] eq "autoconf") { if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
if ($ret) { if ($ret) {
print "no ($ret)\n"; print "no ($ret)\n";
exit 1; exit 0;
} }
my $ua = LWP::UserAgent->new (timeout => 30); my $ua = LWP::UserAgent->new (timeout => 30);
my @badports; my @badports;
foreach my $port (@PORTS) { foreach my $port (@PORTS) {
my $url = sprintf $URL, $port; my $url = sprintf $URL, $port;
my $response = $ua->request (HTTP::Request->new('GET', $url)); my $response = $ua->request (HTTP::Request->new('GET', $url));
push @badports, $port unless $response->is_success; push @badports, $port unless $response->is_success;
} }
if (@badports) { if (@badports) {
print "no (no mod_watch exists on ports @badports)\n"; print "no (no mod_watch exists on ports @badports)\n";
exit 1; exit 0;
} else { } else {
print "yes\n"; print "yes\n";
exit 0; exit 0;
@ -76,7 +76,7 @@ foreach my $port (@PORTS) {
my ($server, undef, $ifInOctets, $ifOutOctets, $ifRequests, my ($server, undef, $ifInOctets, $ifOutOctets, $ifRequests,
$ifDocuments) = split (/\s/, $string, 6); $ifDocuments) = split (/\s/, $string, 6);
push @servers, $server unless $server eq "SERVER"; push @servers, $server unless $server eq "SERVER";
push @data, "$server $ifInOctets $ifOutOctets $ifRequests $ifDocuments" push @data, "$server $ifInOctets $ifOutOctets $ifRequests $ifDocuments"
unless $server eq "SERVER"; unless $server eq "SERVER";
} }
} }

14
plugins/apache/page_load Normal file → Executable file
View file

@ -22,38 +22,38 @@
# #
# apache2.conf # apache2.conf
# LogFormat "%h %l %u %t \"%r\" %>s %O %b %D \"%{Referer}i\" \"%{User-Agent}i\"" custom # LogFormat "%h %l %u %t \"%r\" %>s %O %b %D \"%{Referer}i\" \"%{User-Agent}i\"" custom
# #
# According to : http://httpd.apache.org/docs/2.2/mod/mod_log_config.html # According to : http://httpd.apache.org/docs/2.2/mod/mod_log_config.html
# %D The time taken to serve the request, in microseconds. # %D The time taken to serve the request, in microseconds.
# In our case %D -> 9 # In our case %D -> 9
###################################################################################################### ######################################################################################################
# GLOBALS # GLOBALS
LOGFILE="/var/log/apache2/access.log" LOGFILE="/var/log/apache2/access.log"
BUFFER_SIZE=500 BUFFER_SIZE=500
###################################################################################################### ######################################################################################################
do_ () { do_ () {
command="tail -n $BUFFER_SIZE $LOGFILE | awk '{sum=sum+\$9} END {print \"exec_time.value \"(sum/$BUFFER_SIZE)/1000000}'" command="tail -n $BUFFER_SIZE $LOGFILE | awk '{sum=sum+\$9} END {print \"exec_time.value \"(sum/$BUFFER_SIZE)/1000000}'"
eval $command eval $command
exit 0 exit 0
} }
do_config () { do_config () {
echo "graph_title Average page execution time" echo "graph_title Average page execution time"
echo "graph_vlabel Seconds" echo "graph_vlabel Seconds"
echo "graph_category webserver" echo "graph_category webserver"
echo "graph_args --base 1000 -l 0" echo "graph_args --base 1000 -l 0"
echo "graph_info Average page execution time" echo "graph_info Average page execution time"
echo "exec_time.label Execution time" echo "exec_time.label Execution time"
echo "exec_time.type GAUGE" echo "exec_time.type GAUGE"
} }
case $1 in case $1 in
config|'') config|'')
eval do_$1 eval do_$1
esac esac
exit $? exit $?

View file

@ -1,71 +0,0 @@
#!/usr/bin/env python
#
# vim:syntax=python
#
# Plugin to monitor the amount of packages in an approx cache.
#
# Usage: place in /etc/munin/plugins/ (or link it there using ln -s)
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=manual
#%# capabilities=autoconf
#
# Now for the real work...
from sys import argv, exit
from os.path import walk, exists, isfile, join
def get_file_types():
"""Returns an array of filetype => count."""
out = {}
def visitor(arg, dirname, names):
for file in names:
if not isfile(join(dirname, file)):
continue
ext = file.split(".")[-1]
out[ext] = out.get(ext, 0) + 1
walk('/var/cache/approx/', visitor, None)
return out
# Autoconfiguration
if len(argv) > 1:
if argv[1] == "autoconf":
# Test if we can find a approx cache
if exists('/var/cache/approx'):
print "yes"
else:
print "no ('/var/cacne/approx' not found)"
exit(1)
exit()
elif argv[1] == "config":
print "graph_title Approx cache";
print "graph yes";
#print "graph_category Other";
#print "graph_total Total";
print "graph_info Statistics from the Approx cache.";
#print "debs.label DEBs";
#print "pending.warning 0:0";
#print "hold.label hold";
for type in get_file_types().keys():
print "%s.label %s" % (type.lower(), type)
exit()
for type, count in get_file_types().iteritems():
print "%s.value %d" % (type.lower(), count)
exit()

64
plugins/apt/approx Executable file
View file

@ -0,0 +1,64 @@
#!/usr/bin/env python
#
# vim:syntax=python
#
# Plugin to monitor the amount of packages in an approx cache.
#
# Usage: place in /etc/munin/plugins/ (or link it there using ln -s)
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
# #%# family=manual
# #%# capabilities=autoconf
#
# Now for the real work...
from os.path import walk, exists, isfile, join
from sys import argv, exit
def get_file_types():
"""Returns an array of filetype => count."""
out = {}
def visitor(arg, dirname, names):
for filename in names:
if not isfile(join(dirname, filename)):
continue
ext = filename.split(".")[-1].lower()
out[ext] = out.get(ext, 0) + 1
walk('/var/cache/approx/', visitor, None)
return out
if len(argv) > 1:
# Autoconfiguration
if argv[1] == "autoconf":
# Test if we can find a approx cache
if exists('/var/cache/approx'):
print("yes")
else:
print("no ('/var/cache/approx' not found)")
exit()
elif argv[1] == "config":
print("graph_title Approx cache")
print("graph yes")
print("graph_category loadbalancer")
print("graph_info Statistics from the Approx cache.")
for filetype in get_file_types().keys():
print("%s.label %s" % (filetype.lower(), filetype))
exit()
for filetype, count in get_file_types().iteritems():
print("%s.value %d" % (filetype.lower(), count))
exit()

View file

@ -24,20 +24,20 @@ This plugin has checked on Debian - Wheezy and squeeze. If you want to use it
on older installations, tell me whether it works or which errors you had. It on older installations, tell me whether it works or which errors you had. It
should run past python-apt 0.7 and python 2.5. should run past python-apt 0.7 and python 2.5.
check out this git repository from check out this git repository from
aptitude install python-apt aptitude install python-apt
git clone git://github.com/munin-monitoring/contrib.git git clone git://github.com/munin-monitoring/contrib.git
cd contrib/plugins/apt/deb_packages cd contrib/plugins/apt/deb_packages
sudo cp deb_packages.py /etc/munin/plugins/deb_packages sudo cp deb_packages.py /etc/munin/plugins/deb_packages
sudo cp deb_packages.munin-conf /etc/munin/plugin-conf.d/deb_packages sudo cp deb_packages.munin.conf /etc/munin/plugin-conf.d/deb_packages
Verify the installation by Verify the installation by
sudo munin-run deb_packages sudo munin-run deb_packages
### Configuration ### Configuration
If you copied deb_packages.munin-conf to plugin-conf.d you have a starting point. If you copied deb_packages.munin.conf to plugin-conf.d you have a starting point.
A typical configuration looks like this A typical configuration looks like this
[deb_packages] [deb_packages]
@ -51,7 +51,7 @@ A typical configuration looks like this
# Age in seconds an $CACHE_FILE can be. If it is older, the script updates # Age in seconds an $CACHE_FILE can be. If it is older, the script updates
# default if not set is 3540 (one hour) # default if not set is 3540 (one hour)
# at the moment this is not used, the plugin always runs (if munin calls it) # at the moment this is not used, the plugin always runs (if munin calls it)
# #
env.CACHE_FILE_MAX_AGE 3540 env.CACHE_FILE_MAX_AGE 3540
# All these numbers are only for sorting, so you can use env.graph01_sort_by_0 # All these numbers are only for sorting, so you can use env.graph01_sort_by_0

View file

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
A munin plugin that prints archive and their upgradable packets A munin plugin that prints archive and their upgradable packets
TODO: make it usable and readable as commandline tool TODO: make it usable and readable as commandline tool
@ -13,18 +13,18 @@ TODO: separate into 2 graphs
sorting a packet to the newest archive sorting a packet to the newest archive
(WONTFIX unless someone asks for) (WONTFIX unless someone asks for)
TODO: TODO:
addinge alternative names for archives "stable -> squeeze" addinge alternative names for archives "stable -> squeeze"
TODO: add gray as TODO: add gray as
foo.colour 000000 foo.colour 000000
to 'now', '', '', '', '', 'Debian dpkg status file' to 'now', '', '', '', '', 'Debian dpkg status file'
TODO: update only if system was updated (aptitutde update has been run) TODO: update only if system was updated (aptitutde update has been run)
check modification date of /var/cache/apt/pkgcache.bin check modification date of /var/cache/apt/pkgcache.bin
cache file must not be older than mod_date of pkgcache.bin + X cache file must not be older than mod_date of pkgcache.bin + X
TODO: shorten ext_info with getShortestConfigOfOptions TODO: shorten ext_info with getShortestConfigOfOptions
TODO: check whether cachefile matches the config TODO: check whether cachefile matches the config
i have no clever idea to do this without 100 lines of code i have no clever idea to do this without 100 lines of code
BUG: If a package will be upgraded, and brings in new dependencies, BUG: If a package will be upgraded, and brings in new dependencies,
these new deps will not be counted. WONTFIX these new deps will not be counted. WONTFIX
""" """
import sys import sys
@ -32,7 +32,7 @@ import argparse
import apt_pkg import apt_pkg
from apt.progress.base import OpProgress from apt.progress.base import OpProgress
from time import time, strftime from time import time, strftime
import os import os
import StringIO import StringIO
import string import string
import re import re
@ -41,7 +41,7 @@ from types import StringTypes, TupleType, DictType, ListType, BooleanType
class EnvironmentConfigBroken(Exception): pass class EnvironmentConfigBroken(Exception): pass
# print environmental things # print environmental things
# for k,v in os.environ.iteritems(): print >> sys.stderr, "%r : %r" % (k,v) # for k,v in os.environ.iteritems(): print >> sys.stderr, "%r : %r" % (k,v)
def getEnv(name, default=None, cast=None): def getEnv(name, default=None, cast=None):
@ -68,14 +68,14 @@ MAX_LIST_SIZE_EXT_INFO = getEnv('MAX_LIST_SIZE_EXT_INFO', default=50, cast=int)
STATE_DIR = getEnv('MUNIN_PLUGSTATE', default='.') STATE_DIR = getEnv('MUNIN_PLUGSTATE', default='.')
CACHE_FILE = os.path.join(STATE_DIR, "deb_packages.state") CACHE_FILE = os.path.join(STATE_DIR, "deb_packages.state")
""" """
There is no need to execute this script every 5 minutes. There is no need to execute this script every 5 minutes.
The Results are put to this file, next munin-run can read from it The Results are put to this file, next munin-run can read from it
CACHE_FILE is usually /var/lib/munin/plugin-state/debian_packages.state CACHE_FILE is usually /var/lib/munin/plugin-state/debian_packages.state
""" """
CACHE_FILE_MAX_AGE = getEnv('CACHE_FILE_MAX_AGE', default=3540, cast=int) CACHE_FILE_MAX_AGE = getEnv('CACHE_FILE_MAX_AGE', default=3540, cast=int)
""" """
Age in seconds an $CACHE_FILE can be. If it is older, the script updates Age in seconds an $CACHE_FILE can be. If it is older, the script updates
""" """
@ -84,7 +84,7 @@ def Property(func):
class Apt(object): class Apt(object):
""" """
lazy helperclass i need in this statisticprogram, which have alle the apt_pkg stuff lazy helperclass i need in this statisticprogram, which has all the apt_pkg stuff
""" """
def __init__(self): def __init__(self):
@ -103,9 +103,9 @@ class Apt(object):
doc = "apt_pkg.Cache instance, lazy instantiated" doc = "apt_pkg.Cache instance, lazy instantiated"
def fget(self): def fget(self):
class NullProgress(OpProgress): class NullProgress(OpProgress):
""" used for do not giving any progress info, """ used for do not giving any progress info,
while doing apt things used, cause documented while doing apt things used, cause documented
use of None as OpProgress did not worked in use of None as OpProgress did not worked in
python-apt 0.7 python-apt 0.7
""" """
def __init__(self): def __init__(self):
@ -119,8 +119,8 @@ class Apt(object):
def update(*args,**kwords): def update(*args,**kwords):
pass pass
if self._cache is None: if self._cache is None:
self._cache = apt_pkg.Cache(NullProgress()) self._cache = apt_pkg.Cache(NullProgress())
return self._cache return self._cache
return locals() return locals()
@ -129,7 +129,7 @@ class Apt(object):
doc = "apt_pkg.DepCache object" doc = "apt_pkg.DepCache object"
def fget(self): def fget(self):
if self._depcache is None: if self._depcache is None:
self._depcache = apt_pkg.DepCache(self.cache) self._depcache = apt_pkg.DepCache(self.cache)
return self._depcache return self._depcache
@ -180,7 +180,7 @@ apt = Apt()
apt.installedPackages apt.installedPackages
apt.upgradablePackages apt.upgradablePackages
initialisation is lazy initialisation is lazy
""" """
def weightOfPackageFile(detail_tuple, option_tuple): def weightOfPackageFile(detail_tuple, option_tuple):
@ -214,7 +214,7 @@ def Tree():
class TreeTwig(defaultdict): class TreeTwig(defaultdict):
def __init__(self, defaultFactory): def __init__(self, defaultFactory):
super(TreeTwig, self).__init__(defaultFactory) super(TreeTwig, self).__init__(defaultFactory)
def printAsTree(self, indent=0): def printAsTree(self, indent=0):
for k, tree in self.iteritems(): for k, tree in self.iteritems():
@ -245,16 +245,16 @@ class TreeTwig(defaultdict):
def getShortestConfigOfOptions(optionList = ['label', 'archive', 'site']): def getShortestConfigOfOptions(optionList = ['label', 'archive', 'site']):
""" """
tries to find the order to print a tree of the optionList tries to find the order to print a tree of the optionList
with the local repositories with the shortest line with the local repositories with the shortest line
possible options are: possible options are:
'component' 'component'
'label' 'label'
'site' 'site'
'archive' 'archive'
'origin' 'origin'
'architecture' 'architecture'
Architecture values are usually the same and can be ignored. Architecture values are usually the same and can be ignored.
tells you which representation of a tree as line is shortest. tells you which representation of a tree as line is shortest.
@ -262,19 +262,19 @@ def getShortestConfigOfOptions(optionList = ['label', 'archive', 'site']):
to write the shortest readable output. to write the shortest readable output.
""" """
l = optionList # just because l is much shorter l = optionList # just because l is much shorter
# creating possible iterations # creating possible iterations
fieldCount = len(optionList) fieldCount = len(optionList)
if fieldCount == 1: if fieldCount == 1:
selection = l selection = l
elif fieldCount == 2: elif fieldCount == 2:
selection = [(x,y) selection = [(x,y)
for x in l for x in l
for y in l if x!=y ] for y in l if x!=y ]
elif fieldCount == 3: elif fieldCount == 3:
selection = [(x,y,z) selection = [(x,y,z)
for x in l for x in l
for y in l if x!=y for y in l if x!=y
for z in l if z!=y and z!=x] for z in l if z!=y and z!=x]
else: else:
raise Exception("NotImplemented for size %s" % fieldCount) raise Exception("NotImplemented for size %s" % fieldCount)
@ -289,7 +289,7 @@ def getShortestConfigOfOptions(optionList = ['label', 'archive', 'site']):
r = min( d.items(), key=lambda x: x[1] ) r = min( d.items(), key=lambda x: x[1] )
return list(r[0]), r[1] return list(r[0]), r[1]
def getOptionsTree(cache, keys=None): def getOptionsTree(cache, keys=None):
""" """
t = getOptionsTree(cache, ['archive', 'site', 'label']) t = getOptionsTree(cache, ['archive', 'site', 'label'])
@ -322,16 +322,16 @@ def createKey(key, file):
""" """
if type(key) in StringTypes: if type(key) in StringTypes:
return file.__getattribute__(key) return file.__getattribute__(key)
elif type(key) in (TupleType, ListType): elif type(key) in (TupleType, ListType):
nKey = tuple() nKey = tuple()
for pKey in key: for pKey in key:
nKey = nKey.__add__((file.__getattribute__(pKey),)) nKey = nKey.__add__((file.__getattribute__(pKey),))
return nKey return nKey
else: else:
raise Exception("Not implemented for keytype %s" % type(key)) raise Exception("Not implemented for keytype %s" % type(key))
def getOptionsTree2(cache, primary=None, secondary=None): def getOptionsTree2(cache, primary=None, secondary=None):
""" """
primary muss ein iterable oder StringType sein primary muss ein iterable oder StringType sein
secondary muss iterable oder StringType sein secondary muss iterable oder StringType sein
t1 = getOptionsTree2(apt.cache, 'origin', ['site', 'archive']) t1 = getOptionsTree2(apt.cache, 'origin', ['site', 'archive'])
@ -369,24 +369,24 @@ def getOptionsTree2(cache, primary=None, secondary=None):
dKey = file.__getattribute__(sKey) dKey = file.__getattribute__(sKey)
d = d[dKey] d = d[dKey]
return t return t
#def getAttributeSet(iterable, attribute): #def getAttributeSet(iterable, attribute):
# return set(f.__getattribute__(attribute) for f in iterable) # return set(f.__getattribute__(attribute) for f in iterable)
# #
#def getOrigins(cache): #def getOrigins(cache):
# return getAttributeSet(cache.file_list, 'origin') # return getAttributeSet(cache.file_list, 'origin')
# #
#def getArchives(cache): #def getArchives(cache):
# return getAttributeSet(cache.file_list, 'archive') # return getAttributeSet(cache.file_list, 'archive')
# #
#def getComponents(cache): #def getComponents(cache):
# return getAttributeSet(cache.file_list, 'component') # return getAttributeSet(cache.file_list, 'component')
# #
#def getLabels(cache): #def getLabels(cache):
# return getAttributeSet(cache.file_list, 'label') # return getAttributeSet(cache.file_list, 'label')
# #
#def getSites(cache): #def getSites(cache):
# return getAttributeSet(cache.file_list, 'site') # return getAttributeSet(cache.file_list, 'site')
# #
class PackageStat(defaultdict): class PackageStat(defaultdict):
@ -397,16 +397,16 @@ class PackageStat(defaultdict):
with some abilities to print output munin likes with some abilities to print output munin likes
""" """
sortDict = { 'label': defaultdict( lambda : 20, sortDict = { 'label': defaultdict( lambda : 20,
{'Debian': 90, {'Debian': 90,
'' : 1, '' : 1,
'Debian Security' : 90, 'Debian Security' : 90,
'Debian Backports': 90}), 'Debian Backports': 90}),
'archive': defaultdict( lambda : 5, 'archive': defaultdict( lambda : 5,
{ 'now': 0, { 'now': 0,
'experimental': 10, 'experimental': 10,
'unstable': 50, 'unstable': 50,
'sid': 50, 'sid': 50,
'testing': 70, 'testing': 70,
'wheezy': 70, 'wheezy': 70,
'squeeze-backports': 80, 'squeeze-backports': 80,
@ -426,9 +426,9 @@ class PackageStat(defaultdict):
} }
""" """
Values to sort options (label, archive, origin ...) Values to sort options (label, archive, origin ...)
(0..99) is allowed. (0..99) is allowed.
(this is needed for other graphs to calc aggregated weights) (this is needed for other graphs to calc aggregated weights)
higher is more older and more official or better higher is more older and more official or better
""" """
dpkgStatusValue = { 'site': '', 'origin': '', 'label': '', 'component': '', 'archive': 'now' } dpkgStatusValue = { 'site': '', 'origin': '', 'label': '', 'component': '', 'archive': 'now' }
@ -443,7 +443,7 @@ class PackageStat(defaultdict):
'component' : 10**2, 'component' : 10**2,
} }
""" """
Dict that stores multipliers Dict that stores multipliers
to compile a sorting value for each archivefile to compile a sorting value for each archivefile
""" """
@ -483,7 +483,7 @@ class PackageStat(defaultdict):
def addPackage(self, sourceFile, package): def addPackage(self, sourceFile, package):
if self.packetHandler.decider(package): if self.packetHandler.decider(package):
self.packetHandler.adder(package, self) self.packetHandler.adder(package, self)
@classmethod @classmethod
def configD(cls, key, value): def configD(cls, key, value):
i = { 'rrdName': cls.generate_rrd_name_from(key), i = { 'rrdName': cls.generate_rrd_name_from(key),
@ -514,8 +514,8 @@ class PackageStat(defaultdict):
print "{rrdName}.draw AREASTACK".format(**i) print "{rrdName}.draw AREASTACK".format(**i)
def optionIsDpkgStatus(self, details, options=None): def optionIsDpkgStatus(self, details, options=None):
""" """
give it details and options and it tells you whether the datails looks like they come from give it details and options and it tells you whether the datails looks like they come from
a 'Debian dpkg status file'. a 'Debian dpkg status file'.
""" """
# setting defaults # setting defaults
@ -530,7 +530,7 @@ class PackageStat(defaultdict):
return isNow return isNow
def printValues(self): def printValues(self):
print "\nmultigraph packages_{option}_{type}".format(option=self.generate_rrd_name_from(self.option), print "\nmultigraph packages_{option}_{type}".format(option=self.generate_rrd_name_from(self.option),
type=self.packetHandler.type) type=self.packetHandler.type)
for options, item in self.options_sorted: for options, item in self.options_sorted:
if not self.packetHandler.includeNow and self.optionIsDpkgStatus(details=options): if not self.packetHandler.includeNow and self.optionIsDpkgStatus(details=options):
@ -555,7 +555,7 @@ packetHandlerD = {}
class PacketHandler(object): class PacketHandler(object):
""" """
Baseclass, that represents the Interface which is used Baseclass, that represents the Interface which is used
""" """
type = None type = None
@ -575,7 +575,7 @@ class PacketHandler(object):
def adder(self, package, packageStat, *args, **kwords): def adder(self, package, packageStat, *args, **kwords):
""" """
take the package and add it tho the packageStat dictionary in defined way take the package and add it to the packageStat dictionary in defined way
""" """
pass pass
@ -591,7 +591,7 @@ class PacketHandler(object):
return weightOfPackageFile(details, options) return weightOfPackageFile(details, options)
class PacketHandlerUpgradable(PacketHandler): class PacketHandlerUpgradable(PacketHandler):
type='upgradable' type='upgradable'
includeNow = False includeNow = False
extInfoItemString = " {i[0].name} <{i[1]} -> {i[2]}>" extInfoItemString = " {i[0].name} <{i[1]} -> {i[2]}>"
@ -628,7 +628,7 @@ class PacketHandlerInstalled(PacketHandler):
# this item (as i) is used for input in extInfoItemString # this item (as i) is used for input in extInfoItemString
item = package item = package
packageStat[keys].append(item) packageStat[keys].append(item)
# registering PackageHandler for Usage # registering PackageHandler for Usage
packetHandlerD[PacketHandlerInstalled.type] = PacketHandlerInstalled packetHandlerD[PacketHandlerInstalled.type] = PacketHandlerInstalled
@ -637,7 +637,7 @@ class Munin(object):
def __init__(self, commandLineArgs=None): def __init__(self, commandLineArgs=None):
self.commandLineArgs = commandLineArgs self.commandLineArgs = commandLineArgs
self.argParser = self._argParser() self.argParser = self._argParser()
self.executionMatrix = { self.executionMatrix = {
'config': self.config, 'config': self.config,
'run' : self.run, 'run' : self.run,
'autoconf' : self.autoconf, 'autoconf' : self.autoconf,
@ -685,7 +685,7 @@ class Munin(object):
else: else:
raise Exception('DPKG-statusfile %r not found, really strange!!!'%dpkgStatusFile) raise Exception('DPKG-statusfile %r not found, really strange!!!'%dpkgStatusFile)
newestFileTimestamp = max(timeL) newestFileTimestamp = max(timeL)
age = newestFileTimestamp - cacheMTime age = newestFileTimestamp - cacheMTime
if age > 0: if age > 0:
return True return True
else: else:
@ -709,7 +709,7 @@ class Munin(object):
# cacheNeedUpdate = True # cacheNeedUpdate = True
if self._cacheIsOutdated() or self.args.nocache: if self._cacheIsOutdated() or self.args.nocache:
# save stdout # save stdout
stdoutDef = sys.stdout stdoutDef = sys.stdout
try: try:
out = StringIO.StringIO() out = StringIO.StringIO()
@ -765,7 +765,7 @@ class Munin(object):
def _argParser(self): def _argParser(self):
parser = argparse.ArgumentParser(description="Show some statistics "\ parser = argparse.ArgumentParser(description="Show some statistics "\
"about debian packages installed on system by archive", "about debian packages installed on system by archive",
) )
parser.set_defaults(command='run', debug=True, nocache=True) parser.set_defaults(command='run', debug=True, nocache=True)
parser.add_argument('--nocache', '-n', default=False, action='store_true', parser.add_argument('--nocache', '-n', default=False, action='store_true',
@ -775,7 +775,7 @@ class Munin(object):
run ........ munin run (writes values) run ........ munin run (writes values)
autoconf ... writes 'yes' autoconf ... writes 'yes'
""" """
parser.add_argument('command', nargs='?', parser.add_argument('command', nargs='?',
choices=['config', 'run', 'autoconf', 'drun'], choices=['config', 'run', 'autoconf', 'drun'],
help='mode munin wants to use. "run" is default' + helpCommand) help='mode munin wants to use. "run" is default' + helpCommand)
return parser return parser
@ -783,10 +783,10 @@ class Munin(object):
def _envParser(self): def _envParser(self):
""" """
reads environVars from [deb_packages] and generate reads environVars from [deb_packages] and generate
a list of dicts, each dict holds a set of settings made in a list of dicts, each dict holds a set of settings made in
munin config. munin config.
[ [
{ 'type' = 'installed', { 'type' = 'installed',
'sort_by' = ['label', 'archive'], 'sort_by' = ['label', 'archive'],
'show_ext' = ['origin', 'site'], 'show_ext' = ['origin', 'site'],
}, },
@ -816,7 +816,7 @@ class Munin(object):
configPart['show_ext'][m.group('optNumber')] = os.getenv(var) configPart['show_ext'][m.group('optNumber')] = os.getenv(var)
else: else:
print >> sys.stderr, "configuration option %r was ignored" % (var) print >> sys.stderr, "configuration option %r was ignored" % (var)
# we have now dicts for 'sort_by' and 'show_ext' keys # we have now dicts for 'sort_by' and 'show_ext' keys
# changing them to lists # changing them to lists
for graphConfig in config.itervalues(): for graphConfig in config.itervalues():
graphConfig['sort_by'] = [val for key, val in sorted(graphConfig['sort_by'].items())] graphConfig['sort_by'] = [val for key, val in sorted(graphConfig['sort_by'].items())]
@ -839,13 +839,13 @@ class Munin(object):
"Graph must be sorted by anything" "Graph must be sorted by anything"
raise EnvironmentConfigBroken("Environment Config broken") raise EnvironmentConfigBroken("Environment Config broken")
# check for valid options for sort_by # check for valid options for sort_by
unusableOptions = set(graph['sort_by']) - PackageStat.viewSet unusableOptions = set(graph['sort_by']) - PackageStat.viewSet
if unusableOptions: if unusableOptions:
print >> sys.stderr, \ print >> sys.stderr, \
"%r are not valid options for 'sort_by'" % (unusableOptions) "%r are not valid options for 'sort_by'" % (unusableOptions)
raise EnvironmentConfigBroken("Environment Config broken") raise EnvironmentConfigBroken("Environment Config broken")
# check for valid options for sort_by # check for valid options for sort_by
unusableOptions = set(graph['show_ext']) - PackageStat.viewSet unusableOptions = set(graph['show_ext']) - PackageStat.viewSet
if unusableOptions: if unusableOptions:
print >> sys.stderr, \ print >> sys.stderr, \
"%r are not valid options for 'show_ext'" % (x) "%r are not valid options for 'show_ext'" % (x)
@ -868,7 +868,7 @@ deb_packages - plugin to monitor update resources and pending packages on Debian
This plugin has checked on Debian - Wheezy and squeeze. If you want to use it This plugin has checked on Debian - Wheezy and squeeze. If you want to use it
on older installations, tell me whether it works or which errors you had. It on older installations, tell me whether it works or which errors you had. It
shoud run past python-apt 0.7 and python 2.5. should run past python-apt 0.7 and python 2.5.
=head1 DESCRIPTION =head1 DESCRIPTION
@ -895,7 +895,7 @@ check out this git repository from
git clone git://github.com/munin-monitoring/contrib.git git clone git://github.com/munin-monitoring/contrib.git
cd contrib/plugins/apt/deb_packages cd contrib/plugins/apt/deb_packages
sudo cp deb_packages.py /etc/munin/plugins/deb_packages sudo cp deb_packages.py /etc/munin/plugins/deb_packages
sudo cp deb_packages.munin-conf /etc/munin/plugin-conf.d/deb_packages sudo cp deb_packages.munin.conf /etc/munin/plugin-conf.d/deb_packages
=back =back
@ -910,7 +910,7 @@ Verify the installation by
=head1 CONFIGURATION =head1 CONFIGURATION
If you copied deb_packages.munin-conf to plugin-conf.d you have a starting point. If you copied deb_packages.munin.conf to plugin-conf.d you have a starting point.
A typical configuration looks like this A typical configuration looks like this

View file

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before After
Before After

View file

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Plugin to monitor ArangoDB servers. It works with the new server statistics Plugin to monitor ArangoDB servers. It works with the new server statistics
interface of ArangoDB 1.3. Not every value seems senseful, but there are interface of ArangoDB 1.3. Not every value seems senseful, but there are
nice graphs generated... nice graphs generated...
@ -30,19 +30,19 @@ Usage:
Links possible: Links possible:
arangodb_conn HTTP client connections arangodb_conn HTTP client connections
arangodb_time_total Total request/queue/connection time arangodb_time_total Total request/queue/connection time
arangodb_bytes_total Total sent/received bytes arangodb_bytes_total Total sent/received bytes
Configuration: Configuration:
- No configuration required. Just enable the admin interface of ArangoDB. - No configuration required. Just enable the admin interface of ArangoDB.
Thanks to the authors of other Python munin plugins. I've used some of Thanks to the authors of other Python munin plugins. I've used some of
them as inspiring example. them as inspiring example.
Possible todos: Possible todos:
- support of munin-like configuration parameters - support of munin-like configuration parameters
- add more statistics - add more statistics
""" """
from os.path import basename from os.path import basename
@ -57,7 +57,7 @@ except ImportError:
def getServerStatus(group): def getServerStatus(group):
raw = urllib2.urlopen( "http://127.0.0.1:8529/_admin/statistics" ).read() raw = urllib2.urlopen( "http://127.0.0.1:8529/_admin/statistics" ).read()
return json.loads( raw )[group] return json.loads( raw )[group]
def doData(plugin_name): def doData(plugin_name):
@ -66,26 +66,26 @@ def doData(plugin_name):
elif plugin_name== 'arangodb_time_total': elif plugin_name== 'arangodb_time_total':
data = getServerStatus('client') data = getServerStatus('client')
timeTotal = data['totalTime']['sum'] timeTotal = data['totalTime']['sum']
timeConnection = data['connectionTime']['sum'] timeConnection = data['connectionTime']['sum']
timeRequest = data['requestTime']['sum'] timeRequest = data['requestTime']['sum']
timeQueue = data['queueTime']['sum'] timeQueue = data['queueTime']['sum']
print "total.value " + str(int(round(timeTotal))) print "total.value " + str(int(round(timeTotal)))
print "connection.value " + str(int(round(timeConnection))) print "connection.value " + str(int(round(timeConnection)))
print "request.value " + str(int(round(timeRequest))) print "request.value " + str(int(round(timeRequest)))
print "queue.value " + str(int(round(timeQueue))) print "queue.value " + str(int(round(timeQueue)))
elif plugin_name== 'arangodb_bytes_total': elif plugin_name== 'arangodb_bytes_total':
data = getServerStatus('client') data = getServerStatus('client')
bytesReceived = data['bytesReceived']['sum'] bytesReceived = data['bytesReceived']['sum']
bytesSent = data['bytesSent']['sum'] bytesSent = data['bytesSent']['sum']
print "received.value " + str(int(round(bytesReceived))) print "received.value " + str(int(round(bytesReceived)))
print "sent.value " + str(int(round(bytesSent))) print "sent.value " + str(int(round(bytesSent)))
else: else:
pass pass
def doConfig(plugin_name): def doConfig(plugin_name):
if plugin_name == 'arangodb_conn': if plugin_name == 'arangodb_conn':
print "graph_title ArangoDB current connections" print "graph_title ArangoDB current connections"
@ -103,7 +103,7 @@ def doConfig(plugin_name):
print "connection.label connection" print "connection.label connection"
print "request.label request" print "request.label request"
print "queue.label queue" print "queue.label queue"
elif plugin_name == 'arangodb_bytes_total': elif plugin_name == 'arangodb_bytes_total':
print "graph_title ArangoDB total bytes" print "graph_title ArangoDB total bytes"
print "graph_args --base 1024" print "graph_args --base 1024"
@ -125,7 +125,7 @@ def doConfig(plugin_name):
else: else:
pass pass
plugin_name = basename(sys.argv[0]) plugin_name = basename(sys.argv[0])

View file

@ -18,7 +18,7 @@
# Parameters: # Parameters:
# #
# config (required) # config (required)
# #
# #
#%# family=manual #%# family=manual

View file

@ -1,41 +0,0 @@
#!/bin/sh
#
# Plugin to monitor total ARP entries
#
# Parameters understood:
#
# config (required)
# autoconf (optional)
#
# Made by Sven Hartge (sven AT svenhartge DOT de)
#
#%# family=contrib
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
# Search for arp
which arp >/dev/null 2>/dev/null || (echo "no (can't find arp binary)" && exit 1)
# ...or success
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title ARP entries'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel Entries'
echo 'graph_category network'
echo 'graph_scale no'
echo 'graph_info This graph shows the number of ARP entries registered by the system.'
echo 'entries.label ARP entries'
echo 'entries.draw LINE2'
echo 'entries.type GAUGE'
echo 'entries.info Number of ARP entries'
exit 0
fi
arp -an | awk 'BEGIN { regex="<incomplete>";} { if (!match($4,regex)) { a[$4] }} END{for(i in a){n++};print "entries.value " n}'

View file

@ -19,13 +19,11 @@
case "$1" in case "$1" in
autoconf) autoconf)
# Search for ip # Search for ip
which ip >/dev/null 2>&1 if which ip >/dev/null; then
if [ $? -ne 0 ]; then echo 'yes'
echo "no (can't find ip binary)" else
exit 1 echo "no (missing 'ip' executable)"
fi fi
# ...or success
echo 'yes'
exit 0 exit 0
;; ;;
suggest) suggest)

0
plugins/arp/arp_bsd_ Normal file → Executable file
View file

View file

@ -30,7 +30,7 @@ my $version = "1.0"; # UA Version
my $agentname = "$pluginname Munin Plugin V$version"; # UA String my $agentname = "$pluginname Munin Plugin V$version"; # UA String
my $url = "http://localhost:55553/"; # (defaults to localhost) my $url = "http://localhost:55553/"; # (defaults to localhost)
my $response = 0; # the server output my $response = 0; # the server output
my @content = (); # the content we're retrive from $response my @content = (); # the content we retrieve from $response
my %index = ( # for Version 2 my %index = ( # for Version 2
'from' => 40, # <-- index frame from ( a tweak for other ASSP Versions ) 'from' => 40, # <-- index frame from ( a tweak for other ASSP Versions )
'to' => 63 # <-- index frame to ( "" ) 'to' => 63 # <-- index frame to ( "" )
@ -66,20 +66,20 @@ my @muninlabel = (
); );
# ============= SANITY CHECKS ================ # ============= SANITY CHECKS ================
unless( defined(@ARGV) ){ unless( @ARGV ){
$ARGV[0] = ""; $ARGV[0] = "";
} }
# =============== THE GET ==================== # =============== THE GET ====================
if( $ARGV[0] eq "" ){ if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new(); my $agent = LWP::UserAgent->new();
$agent->agent("$agentname"); $agent->agent("$agentname");
$response = $agent->get( $url ); $response = $agent->get( $url );
&response_error() unless $response->is_success; &response_error() unless $response->is_success;
@content = split( /\n/, $response->content ); @content = split( /\n/, $response->content );
my $line = ""; my $line = "";
my $count = $index{from}; my $count = $index{from};
my $label; my $label;
my( $key, $value, $last ); my( $key, $value, $last );
while( 1 ){ while( 1 ){

View file

@ -12,7 +12,7 @@
use strict; use strict;
use warnings; use warnings;
use File::Basename; use File::Basename;
use LWP; use LWP;
use Mail::Sendmail; use Mail::Sendmail;
@ -30,7 +30,7 @@ my $version = "1.0"; # UA Version
my $agentname = "$pluginname Munin Plugin V$version"; # UA String my $agentname = "$pluginname Munin Plugin V$version"; # UA String
my $url = "http://localhost:55553/"; # (defaults to localhost) my $url = "http://localhost:55553/"; # (defaults to localhost)
my $response = 0; # the server output my $response = 0; # the server output
my @content = (); # the content we're retrive from $response my @content = (); # the content we retrieve from $response
my %index = ( # for Version 2 my %index = ( # for Version 2
'from' => 2, # <-- index frame from ( a tweak for other ASSP Versions ) 'from' => 2, # <-- index frame from ( a tweak for other ASSP Versions )
'to' => 4 # <-- index frame to ( "" ) 'to' => 4 # <-- index frame to ( "" )
@ -46,18 +46,18 @@ my @muninlabel = ( # General Runtime Information
); );
# ============= SANITY CHECKS ================ # ============= SANITY CHECKS ================
unless( defined(@ARGV) ){ unless( @ARGV ){
$ARGV[0] = ""; $ARGV[0] = "";
} }
# =============== THE GET ==================== # =============== THE GET ====================
if( $ARGV[0] eq "" ){ if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new(); my $agent = LWP::UserAgent->new();
$agent->agent("$agentname"); $agent->agent("$agentname");
$response = $agent->get( $url ); $response = $agent->get( $url );
&response_error() unless $response->is_success; &response_error() unless $response->is_success;
@content = split( /\n/, $response->content ); @content = split( /\n/, $response->content );
my $line = ""; my $line = "";
my $count = $index{from}; my $count = $index{from};
my $label; my $label;

View file

@ -17,23 +17,23 @@ use LWP;
use Mail::Sendmail; use Mail::Sendmail;
# -------------------------- DEBUG VARS --------------------------------- # -------------------------- DEBUG VARS ---------------------------------
my $DEBUG = 0; # for debugging purpose my $DEBUG = 0; # for debugging purpose
my $EMAILDEBUG = 0; # for email debugging my $EMAILDEBUG = 0; # for email debugging
my $pluginname = &basename( "$0" ); # get the basename of the plugin my $pluginname = &basename( "$0" ); # get the basename of the plugin
my @to = qw( webmaster@bguel.info ); # the list of admins receivced messages on an my @to = qw( webmaster@bguel.info ); # the list of admins receivced messages on an
my $from = "$pluginname-at-host\@guel.info"; # the host from where it comes my $from = "$pluginname-at-host\@guel.info"; # the host from where it comes
my $muninnodename = "mail.guel.info"; # the Node from where it comes my $muninnodename = "mail.guel.info"; # the Node from where it comes
my $smtp = "mail.guel.info"; # the smtp relay to send the mail my $smtp = "mail.guel.info"; # the smtp relay to send the mail
# ------------------------- GLOBAL VARS --------------------------------- # ------------------------- GLOBAL VARS ---------------------------------
my $version = "1.0"; # UA Version my $version = "1.0"; # UA Version
my $agentname = "$pluginname Munin Plugin V$version"; # UA String my $agentname = "$pluginname Munin Plugin V$version"; # UA String
my $url = "http://localhost:55553/"; # (defaults to localhost) my $url = "http://localhost:55553/"; # (defaults to localhost)
my $response = 0; # the server output my $response = 0; # the server output
my @content = (); # the content we're retrive from $response my @content = (); # the content we retrieve from $response
my %index = ( # for Version 2 my %index = ( # for Version 2
'from' => 66, # <-- index frame from ( a tweak for other ASSP Versions ) 'from' => 66, # <-- index frame from ( a tweak for other ASSP Versions )
'to' => 100 # <-- index frame to ( "" ) 'to' => 100 # <-- index frame to ( "" )
); );
@ -78,20 +78,20 @@ my @muninlabel = (
); );
# ============= SANITY CHECKS ================ # ============= SANITY CHECKS ================
unless( defined(@ARGV) ){ unless( @ARGV ){
$ARGV[0] = ""; $ARGV[0] = "";
} }
# =============== THE GET ==================== # =============== THE GET ====================
if( $ARGV[0] eq "" ){ if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new(); my $agent = LWP::UserAgent->new();
$agent->agent("$agentname"); $agent->agent("$agentname");
$response = $agent->get( $url ); $response = $agent->get( $url );
&response_error() unless $response->is_success; &response_error() unless $response->is_success;
@content = split( /\n/, $response->content ); @content = split( /\n/, $response->content );
my $line = ""; my $line = "";
my $count = $index{from}; my $count = $index{from};
my $label; my $label;
my( $key, $value, $last ); my( $key, $value, $last );
while( 1 ){ while( 1 ){

View file

@ -30,7 +30,7 @@ my $version = "1.0"; # UA Version
my $agentname = "$pluginname Munin Plugin V$version"; # UA String my $agentname = "$pluginname Munin Plugin V$version"; # UA String
my $url = "http://localhost:55553/"; # (defaults to localhost) my $url = "http://localhost:55553/"; # (defaults to localhost)
my $response = 0; # the server output my $response = 0; # the server output
my @content = (); # the content we're retrive from $response my @content = (); # the content we retrieve from $response
my %index = ( # for Version 2 my %index = ( # for Version 2
'from' => 25, # <-- index frame from ( a tweak for other ASSP Versions ) 'from' => 25, # <-- index frame from ( a tweak for other ASSP Versions )
'to' => 38 # <-- index frame to ( "" ) 'to' => 38 # <-- index frame to ( "" )
@ -56,20 +56,20 @@ my @muninlabel = (
); );
# ============= SANITY CHECKS ================ # ============= SANITY CHECKS ================
unless( defined(@ARGV) ){ unless( @ARGV ){
$ARGV[0] = ""; $ARGV[0] = "";
} }
# =============== THE GET ==================== # =============== THE GET ====================
if( $ARGV[0] eq "" ){ if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new(); my $agent = LWP::UserAgent->new();
$agent->agent("$agentname"); $agent->agent("$agentname");
$response = $agent->get( $url ); $response = $agent->get( $url );
&response_error() unless $response->is_success; &response_error() unless $response->is_success;
@content = split( /\n/, $response->content ); @content = split( /\n/, $response->content );
my $line = ""; my $line = "";
my $count = $index{from}; my $count = $index{from};
my $label; my $label;
my( $key, $value, $last ); my( $key, $value, $last );
while( 1 ){ while( 1 ){

View file

@ -12,7 +12,7 @@
use strict; use strict;
use warnings; use warnings;
use File::Basename; use File::Basename;
use LWP; use LWP;
use Mail::Sendmail; use Mail::Sendmail;
@ -30,7 +30,7 @@ my $version = "1.0"; # UA Version
my $agentname = "$pluginname Munin Plugin V$version"; # UA String my $agentname = "$pluginname Munin Plugin V$version"; # UA String
my $url = "http://localhost:55553/"; # (defaults to localhost) my $url = "http://localhost:55553/"; # (defaults to localhost)
my $response = 0; # the server output my $response = 0; # the server output
my @content = (); # the content we're retrive from $response my @content = (); # the content we retrieve from $response
my %index = ( # for Version 2 my %index = ( # for Version 2
'from' => 4, # <-- index frame from ( a tweak for other ASSP Versions ) 'from' => 4, # <-- index frame from ( a tweak for other ASSP Versions )
'to' => 5 # <-- index frame to ( "" ) 'to' => 5 # <-- index frame to ( "" )
@ -46,18 +46,18 @@ my @muninlabel = ( # General Runtime Information
); );
# ============= SANITY CHECKS ================ # ============= SANITY CHECKS ================
unless( defined(@ARGV) ){ unless( @ARGV ){
$ARGV[0] = ""; $ARGV[0] = "";
} }
# =============== THE GET ==================== # =============== THE GET ====================
if( $ARGV[0] eq "" ){ if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new(); my $agent = LWP::UserAgent->new();
$agent->agent("$agentname"); $agent->agent("$agentname");
$response = $agent->get( $url ); $response = $agent->get( $url );
&response_error() unless $response->is_success; &response_error() unless $response->is_success;
@content = split( /\n/, $response->content ); @content = split( /\n/, $response->content );
my $line = ""; my $line = "";
my $count = $index{from}; my $count = $index{from};
my $label; my $label;

View file

@ -16,8 +16,11 @@ This plugin will produce multiple graphs showing:
- the number of messages in all voicemail boxes (replaces - the number of messages in all voicemail boxes (replaces
asterisk_voicemail); asterisk_voicemail);
- the number of active MeetMe conferences and users connected to them - DEPRECATED: the number of active MeetMe conferences and users connected to
(replace asterisk_meetme and asterisk_meetmeusers, respectively); them (replace asterisk_meetme and asterisk_meetmeusers, respectively);
- the number of active ConfBridge conferences (e.g. non-empty ones) and users
connected to them
- the number of active channels for a given codec, for both SIP and - the number of active channels for a given codec, for both SIP and
IAX2 channels (replaces asterisk_sipchannels and asterisk_codecs). IAX2 channels (replaces asterisk_sipchannels and asterisk_codecs).
@ -27,13 +30,15 @@ This plugin will produce multiple graphs showing:
The following configuration parameters are used by this plugin The following configuration parameters are used by this plugin
[asterisk] [asterisk]
env.host - hostname to connect to env.host - hostname to connect to
env.port - port number to connect to env.port - port number to connect to
env.username - username used for authentication env.username - username used for authentication
env.secret - secret used for authentication env.secret - secret used for authentication
env.channels - The channel types to look for env.channels - The channel types to look for
env.codecsx - List of codec IDs (hexadecimal values) env.codecsx - List of codec IDs (hexadecimal values)
env.codecs - List of codecs names, matching codecsx order env.codecs - List of codecs names, matching codecsx order
env.enable_meetme - Set to 1 to enable graphs for the MeetMe application
env.enable_confbridge - Set to 1 to enable graphs for the ConfBridge application
The "username" and "secret" parameters are mandatory, and have no The "username" and "secret" parameters are mandatory, and have no
defaults. defaults.
@ -46,6 +51,8 @@ defaults.
env.channels Zap IAX2 SIP env.channels Zap IAX2 SIP
env.codecsx 0x2 0x4 0x8 env.codecsx 0x2 0x4 0x8
env.codecs gsm ulaw alaw env.codecs gsm ulaw alaw
env.enable_meetme 0
env.enable_confbridge 1
=head2 WILDCARD CONFIGURATION =head2 WILDCARD CONFIGURATION
@ -77,30 +84,34 @@ use strict;
use Munin::Plugin; use Munin::Plugin;
use IO::Socket; use IO::Socket;
# See the following and its subpages for change history in the AMI protocol:
# https://wiki.asterisk.org/wiki/display/AST/Asterisk+Manager+Interface+%28AMI%29+Changes
sub asterisk_command { sub asterisk_command {
my ($socket, $command) = @_; my ($socket, $command) = @_;
my $line, my $reply; my $line, my $reply;
$socket->print("Action: command\nCommand: $command\n\n"); $socket->print("Action: command\nCommand: $command\n\n");
# Response: (Error|Follows|???) # Response: (Error|Follows|Success)
$line = $socket->getline; $line = $socket->getline;
if ($line !~ /^Response: Follows\r?\n$/) { if ($line !~ /^Response: Success\r?\n$/) {
while ( $line = $socket->getline and $line !~ /^\r?\n$/ ) {} while ( $line = $socket->getline and $line !~ /^\r?\n$/ ) {
print STDERR "COMMAND: Ignoring unwanted line: $line" if $Munin::Plugin::DEBUG;
}
return undef; return undef;
} }
# Privilege: Command # Message: Command output follows
$line = $socket->getline; $line = $socket->getline;
print STDERR "COMMAND got response: $line" if $Munin::Plugin::DEBUG;
# Until we get the --END COMMAND-- marker, it's the command's output. # Until we get the --END COMMAND-- marker, it's the command's output.
while ( $line = $socket->getline and $line !~ /^--END COMMAND--\r?\n$/ ) { while ( $line = $socket->getline and $line =~ /^Output:/ ) {
print STDERR "COMMAND: got response: $line" if $Munin::Plugin::DEBUG;
# Don't keep the "Output: " part of the response
substr($line, 0, 8, '');
$reply .= $line; $reply .= $line;
} }
# And then wait for the empty line that says we're done
while ( $line = $socket->getline and $line !~ /^\r?\n$/ ) {}
return $reply; return $reply;
} }
@ -117,10 +128,13 @@ my @CHANNELS = exists $ENV{'channels'} ? split ' ',$ENV{'channels'} : qw(Zap IAX
my @CODECS = exists $ENV{'codecs'} ? split ' ',$ENV{'codecs'} : qw(gsm ulaw alaw); my @CODECS = exists $ENV{'codecs'} ? split ' ',$ENV{'codecs'} : qw(gsm ulaw alaw);
my @CODECSX = exists $ENV{'codecsx'} ? split ' ',$ENV{'codecsx'} : qw(0x2 0x4 0x8); my @CODECSX = exists $ENV{'codecsx'} ? split ' ',$ENV{'codecsx'} : qw(0x2 0x4 0x8);
my $meetme_enabled = $ENV{'enable_meetme'} || '0';
my $confbridge_enabled = $ENV{'enable_confbridge'} || '1';
my $line, my $error; my $line, my $error;
my $socket = new IO::Socket::INET(PeerAddr => $peeraddr, my $socket = new IO::Socket::INET(PeerAddr => $peeraddr,
PeerPort => $peerport, PeerPort => $peerport,
Proto => 'tcp') Proto => 'tcp')
or $error = "Could not create socket: $!"; or $error = "Could not create socket: $!";
if ( $socket ) { if ( $socket ) {
@ -177,7 +191,8 @@ graph_category voip
total.label Total messages total.label Total messages
END END
print <<END; if ($meetme_enabled == '1') {
print <<END;
multigraph asterisk_meetme multigraph asterisk_meetme
graph_title Asterisk meetme statistics graph_title Asterisk meetme statistics
@ -186,14 +201,27 @@ graph_category voip
users.label Connected users users.label Connected users
conferences.label Active conferences conferences.label Active conferences
END END
}
if ($confbridge_enabled == '1') {
print <<END;
multigraph asterisk_confbridge
graph_title Asterisk ConfBridge statistics
graph_args --base 1000 -l 0
graph_category voip
users.label Connected users
conferences.label Active conferences
END
}
print <<END; print <<END;
multigraph asterisk_codecs multigraph asterisk_codecs
graphs_title Asterisk channels per codec graph_title Asterisk channels per codec
graph_args --base 1000 -l 0 graph_args --base 1000 -l 0
graph_vlabel channels graph_vlabel channels
graph_category voip graph_category voip
END END
foreach my $codec (@CODECS) { foreach my $codec (@CODECS) {
@ -206,7 +234,7 @@ END
print <<END; print <<END;
other.draw AREASTACK other.draw AREASTACK
other.label Other known codecs other.label Other known codecs
unknwon.draw AREASTACK unknown.draw AREASTACK
unknown.label Unknown codec unknown.label Unknown codec
END END
@ -221,7 +249,7 @@ die $error if $error;
my $channels_response = asterisk_command($socket, "core show channels"); my $channels_response = asterisk_command($socket, "core show channels");
#Channel Location State Application(Data) #Channel Location State Application(Data)
#Zap/pseudo-198641660 s@frompstn:1 Rsrvd (None) #Zap/pseudo-198641660 s@frompstn:1 Rsrvd (None)
#Zap/1-1 4@frompstn:1 Up MeetMe(5500) #Zap/1-1 4@frompstn:1 Up ConfBridge(5500)
#2 active channels #2 active channels
#1 active call #1 active call
@ -231,19 +259,30 @@ my $voicemail_response = asterisk_command($socket, "voicemail show users");
#other 1234 Company2 User 0 #other 1234 Company2 User 0
#2 voicemail users configured. #2 voicemail users configured.
my $meetme_response = asterisk_command($socket, "meetme list"); my $meetme_response;
#Conf Num Parties Marked Activity Creation if ($meetme_enabled eq '1') {
#5500 0001 N/A 00:00:03 Static $meetme_response = asterisk_command($socket, "meetme list");
#* Total number of MeetMe users: 1 #Conf Num Parties Marked Activity Creation
#5500 0001 N/A 00:00:03 Static
#* Total number of MeetMe users: 1
}
my $confbridge_response;
if ($confbridge_enabled eq '1') {
$confbridge_response = asterisk_command($socket, "confbridge list");
#Conference Bridge Name Users Marked Locked Muted
#================================ ====== ====== ====== =====
#3 1 0 No No
}
my $sipchannels_response = asterisk_command($socket, "sip show channels"); my $sipchannels_response = asterisk_command($socket, "sip show channels");
#Peer User/ANR Call ID Seq (Tx/Rx) Format #Peer User/ANR Call ID Format Hold Last Message Expiry Peer
#192.168.1.135 yann 6902112b3e0 00101/00002 g729 #192.168.1.135 yann 1341929961-161 00101/00002 No Rx: INVITE g729
#1 active SIP channel(s) #1 active SIP channel(s)
my $iaxchannels_response = asterisk_command($socket, "iax2 show channels"); my $iaxchannels_response = asterisk_command($socket, "iax2 show channels");
#Channel Peer Username ID (Lo/Rem) Seq (Tx/Rx) Lag Jitter JitBuf Format #Channel Peer Username ID (Lo/Rem) Seq (Tx/Rx) Lag Jitter JitBuf Format FirstMsg LastMsg
#IAX2/rodolphe@rodolp 10.8.53.6 rodolphe 00003/01287 00006/00004 00000ms 0148ms 0000ms gsm #IAX2/rodolphe@rodolp 10.8.53.6 rodolphe 00003/01287 00006/00004 00000ms 0148ms 0000ms gsm Rx:NEW Tx:ACK
#1 active IAX channel(s) #1 active IAX channel(s)
# After all the data is fetched we can proceed to process it, the # After all the data is fetched we can proceed to process it, the
@ -279,26 +318,57 @@ if ( !$voicemail_response or $voicemail_response =~ /no voicemail users/ ) {
print "total.value $messages\n"; print "total.value $messages\n";
} }
print "\nmultigraph asterisk_meetme\n"; if ($meetme_enabled == '1') {
if ( !$meetme_response ) { print "\nmultigraph asterisk_meetme\n";
print <<END; if ( !$meetme_response ) {
print <<END;
users.value U users.value U
conferences.value U conferences.value U
END END
} else { } else {
if ( $meetme_response =~ /No active/ ) { if ( $meetme_response =~ /No active/ ) {
print <<END; print <<END;
users.value 0 users.value 0
conferences.value 0 conferences.value 0
END END
} else { } else {
my @meetme_list = split(/\r?\n/, $meetme_response); my @meetme_list = split(/\r?\n/, $meetme_response);
my $users = pop(@meetme_list); my $users = pop(@meetme_list);
$users =~ s/^Total number of MeetMe users: ([0-9]+)$/$1/; $users =~ s/^Total number of MeetMe users: ([0-9]+)$/$1/;
print "users.value $users\n";
print "conferences.value " . (scalar(@meetme_list)-1) . "\n";
}
}
}
if ($confbridge_enabled == '1') {
print "\nmultigraph asterisk_confbridge\n";
if ( !$confbridge_response ) {
print <<END;
users.value U
conferences.value U
END
} else {
my @confbridge_list = split(/\r?\n/, $confbridge_response);
# Remove column headers, then line of =
shift(@confbridge_list);
shift(@confbridge_list);
my $users = 0;
foreach my $bridge (@confbridge_list) {
my @fields = split ' ', $bridge;
# yes we ARE parsing a command's output. if we end up getting some
# unexpected things, just break out to and avoid computing nonsense.
if (scalar(@fields) < 5 or $fields[1] !~ /^[0-9]+$/) {
last;
}
$users += $fields[1];
}
print "users.value $users\n"; print "users.value $users\n";
print "conferences.value " . (scalar(@meetme_list)-1) . "\n"; print "conferences.value " . (scalar(@confbridge_list)) . "\n";
} }
} }
@ -309,7 +379,7 @@ if ( !$sipchannels_response and !$iaxchannels_response ) {
} }
print <<END; print <<END;
other.value U other.value U
unknown.valeu U unknown.value U
END END
} else { } else {
my @results; my @results;
@ -335,9 +405,9 @@ END
} }
foreach my $codec (@CODECSX) { foreach my $codec (@CODECSX) {
if ($fields[4] eq "$codec") { if ($fields[4] eq "$codec") {
$results[$i] = $results[$i] + 1; $results[$i] = $results[$i] + 1;
$found = 1; $found = 1;
last; last;
} }
$i++; $i++;
} }
@ -358,9 +428,9 @@ END
} }
foreach my $codec (@CODECS) { foreach my $codec (@CODECS) {
if ($fields[8] eq "$codec") { if ($fields[8] eq "$codec") {
$results[$i] = $results[$i] + 1; $results[$i] = $results[$i] + 1;
$found = 1; $found = 1;
last; last;
} }
$i++; $i++;
} }

View file

@ -13,7 +13,7 @@
print "graph_title Asterisk Fax - Cancelled Faxes (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Cancelled Faxes (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Cancelled Faxes\n"; print "graph_vlabel Number of Cancelled Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_cancelled.draw AREA\n"; print "t38_cancelled.draw AREA\n";
print "t38_cancelled.label Cancelled T.38 Faxes\n"; print "t38_cancelled.label Cancelled T.38 Faxes\n";
print "g711_cancelled.draw AREA\n"; print "g711_cancelled.draw AREA\n";
@ -60,6 +60,3 @@
print "g711_cancelled.value $faxstats{'Digium G.711'}{'Canceled'}\n"; print "g711_cancelled.value $faxstats{'Digium G.711'}{'Canceled'}\n";
exit( 0 ); exit( 0 );

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Cancelled Faxes\n"; print "graph_title Asterisk Fax - Cancelled Faxes\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Cancelled Faxes\n"; print "graph_vlabel Number of Cancelled Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "cancelled.draw AREA\n"; print "cancelled.draw AREA\n";
print "cancelled.label Cancelled Faxes\n"; print "cancelled.label Cancelled Faxes\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Current Sessions\n"; print "graph_title Asterisk Fax - Current Sessions\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Current Sessions\n"; print "graph_vlabel Current Sessions\n";
print "graph_category other\n"; print "graph_category voip\n";
print "sessions.draw AREA\n"; print "sessions.draw AREA\n";
print "sessions.label Current Sessions\n"; print "sessions.label Current Sessions\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Failed and Completed Faxes\n"; print "graph_title Asterisk Fax - Failed and Completed Faxes\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Failed and Completed Faxes\n"; print "graph_vlabel Failed and Completed Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "failed.draw AREA\n"; print "failed.draw AREA\n";
print "failed.label Failed faxes\n"; print "failed.label Failed faxes\n";
print "completed.draw AREA\n"; print "completed.draw AREA\n";

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - IO Fail\n"; print "graph_title Asterisk Fax - IO Fail\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of IO Failures\n"; print "graph_vlabel Number of IO Failures\n";
print "graph_category other\n"; print "graph_category voip\n";
print "iofail.draw AREA\n"; print "iofail.draw AREA\n";
print "iofail.label IO Failures\n"; print "iofail.label IO Failures\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - IO Partial\n"; print "graph_title Asterisk Fax - IO Partial\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of IO Partials\n"; print "graph_vlabel Number of IO Partials\n";
print "graph_category other\n"; print "graph_category voip\n";
print "iopartial.draw AREA\n"; print "iopartial.draw AREA\n";
print "iopartial.label IO Partial\n"; print "iopartial.label IO Partial\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Licensed Channels\n"; print "graph_title Asterisk Fax - Licensed Channels\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Licensed Channels\n"; print "graph_vlabel Licensed Channels\n";
print "graph_category other\n"; print "graph_category voip\n";
print "channels.draw AREA\n"; print "channels.draw AREA\n";
print "channels.label Licensed Channels\n"; print "channels.label Licensed Channels\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Max Concurrent Sessions\n"; print "graph_title Asterisk Fax - Max Concurrent Sessions\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Max Concurrent Sessions\n"; print "graph_vlabel Max Concurrent Sessions\n";
print "graph_category other\n"; print "graph_category voip\n";
print "maxsessions.draw AREA\n"; print "maxsessions.draw AREA\n";
print "maxsessions.label Sessions\n"; print "maxsessions.label Sessions\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Negotiations Failed\n"; print "graph_title Asterisk Fax - Negotiations Failed\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Negotiations Failed\n"; print "graph_vlabel Number of Negotiations Failed\n";
print "graph_category other\n"; print "graph_category voip\n";
print "failed.draw AREA\n"; print "failed.draw AREA\n";
print "failed.label Negotiations Failed\n"; print "failed.label Negotiations Failed\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - No Fax\n"; print "graph_title Asterisk Fax - No Fax\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of No Faxes\n"; print "graph_vlabel Number of No Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "nofax.draw AREA\n"; print "nofax.draw AREA\n";
print "nofax.label Number of No Faxes\n"; print "nofax.label Number of No Faxes\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -86,7 +86,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Partial Faxes\n"; print "graph_title Asterisk Fax - Partial Faxes\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Partial Faxes\n"; print "graph_vlabel Number of Partial Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "partial.draw AREA\n"; print "partial.draw AREA\n";
print "partial.label Partial Faxes\n"; print "partial.label Partial Faxes\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -86,7 +86,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Protocol Error\n"; print "graph_title Asterisk Fax - Protocol Error\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Protocol Errors\n"; print "graph_vlabel Number of Protocol Errors\n";
print "graph_category other\n"; print "graph_category voip\n";
print "proterror.draw AREA\n"; print "proterror.draw AREA\n";
print "proterror.label Protocol Errors\n"; print "proterror.label Protocol Errors\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Successful Tx\n"; print "graph_title Asterisk Fax - Successful Tx\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Successful Tx's\n"; print "graph_vlabel Successful Tx's\n";
print "graph_category other\n"; print "graph_category voip\n";
print "success.draw AREA\n"; print "success.draw AREA\n";
print "success.label successful tx\n"; print "success.label successful tx\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Switched to T.38\n"; print "graph_title Asterisk Fax - Switched to T.38\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Switches to T.38\n"; print "graph_vlabel Number of Switches to T.38\n";
print "graph_category other\n"; print "graph_category voip\n";
print "switched.draw AREA\n"; print "switched.draw AREA\n";
print "switched.label Switches to T.38\n"; print "switched.label Switches to T.38\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Train Failure\n"; print "graph_title Asterisk Fax - Train Failure\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Train Failures\n"; print "graph_vlabel Number of Train Failures\n";
print "graph_category other\n"; print "graph_category voip\n";
print "failure.draw AREA\n"; print "failure.draw AREA\n";
print "failure.label Train Failures\n"; print "failure.label Train Failures\n";
exit 0; exit 0;

View file

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict; use strict;
use Asterisk::AMI; use Asterisk::AMI;
eval "use Asterisk::AMI"; eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@; print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@; exit( 0 ) if $@;
@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Tx/Rx Attempts\n"; print "graph_title Asterisk Fax - Tx/Rx Attempts\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Tx and Rx Attempts\n"; print "graph_vlabel Number of Tx and Rx Attempts\n";
print "graph_category other\n"; print "graph_category voip\n";
print "transmit.draw AREA\n"; print "transmit.draw AREA\n";
print "transmit.label Tx Attempts\n"; print "transmit.label Tx Attempts\n";
print "receive.draw AREA\n"; print "receive.draw AREA\n";

View file

@ -31,7 +31,7 @@ Receive Attempts : 0
Completed FAXes : 0 Completed FAXes : 0
Failed FAXes : 0 Failed FAXes : 0
Digium G.711 Digium G.711
Licensed Channels : 1 Licensed Channels : 1
Max Concurrent : 0 Max Concurrent : 0
Success : 0 Success : 0

View file

@ -14,7 +14,7 @@
print "graph_title Asterisk active fax channels\n"; print "graph_title Asterisk active fax channels\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel channels\n"; print "graph_vlabel channels\n";
print "graph_category other\n"; print "graph_category voip\n";
print "channels.draw AREA\n"; print "channels.draw AREA\n";
print "channels.label channels\n"; print "channels.label channels\n";
exit 0; exit 0;
@ -37,6 +37,3 @@
print "channels.value $channels\n"; print "channels.value $channels\n";
exit( 0 ); exit( 0 );

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Cancelled Faxes (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Cancelled Faxes (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Cancelled Faxes\n"; print "graph_vlabel Number of Cancelled Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_cancelled.draw AREA\n"; print "t38_cancelled.draw AREA\n";
print "t38_cancelled.label Cancelled T.38 Faxes\n"; print "t38_cancelled.label Cancelled T.38 Faxes\n";
print "g711_cancelled.draw AREA\n"; print "g711_cancelled.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Licensed Channels\n"; print "graph_title Asterisk Fax - Licensed Channels\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel channels\n"; print "graph_vlabel channels\n";
print "graph_category other\n"; print "graph_category voip\n";
print "channels.draw AREA\n"; print "channels.draw AREA\n";
print "channels.label channels\n"; print "channels.label channels\n";
exit 0; exit 0;

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Current Sessions\n"; print "graph_title Asterisk Fax - Current Sessions\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Current Sessions\n"; print "graph_vlabel Current Sessions\n";
print "graph_category other\n"; print "graph_category voip\n";
print "sessions.draw AREA\n"; print "sessions.draw AREA\n";
print "sessions.label Current Sessions\n"; print "sessions.label Current Sessions\n";
exit 0; exit 0;

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Failed and Completed Faxes\n"; print "graph_title Asterisk Fax - Failed and Completed Faxes\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Failed and Completed Faxes\n"; print "graph_vlabel Failed and Completed Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "failed.draw AREA\n"; print "failed.draw AREA\n";
print "failed.label Failed faxes\n"; print "failed.label Failed faxes\n";
print "completed.draw AREA\n"; print "completed.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - IO Failures (T.38 and G.711)\n"; print "graph_title Asterisk Fax - IO Failures (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of IO Failures\n"; print "graph_vlabel Number of IO Failures\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_iofail.draw AREA\n"; print "t38_iofail.draw AREA\n";
print "t38_iofail.label T.38 IO Failures\n"; print "t38_iofail.label T.38 IO Failures\n";
print "g711_iofail.draw AREA\n"; print "g711_iofail.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - IO Partial (T.38 and G.711)\n"; print "graph_title Asterisk Fax - IO Partial (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Number of IO Partials\n"; print "graph_vlabel Number of Number of IO Partials\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_iopartial.draw AREA\n"; print "t38_iopartial.draw AREA\n";
print "t38_iopartial.label Partial T.38 Faxes\n"; print "t38_iopartial.label Partial T.38 Faxes\n";
print "g711_iopartial.draw AREA\n"; print "g711_iopartial.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Licensed Channels (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Licensed Channels (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Licensed Channels\n"; print "graph_vlabel Number of Licensed Channels\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_channels.draw AREA\n"; print "t38_channels.draw AREA\n";
print "t38_channels.label T.38 Licensed Channels\n"; print "t38_channels.label T.38 Licensed Channels\n";
print "g711_channels.draw AREA\n"; print "g711_channels.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Max Concurrent Sessions (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Max Concurrent Sessions (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Max Concurrent Sessions\n"; print "graph_vlabel Number of Max Concurrent Sessions\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_maxsessions.draw AREA\n"; print "t38_maxsessions.draw AREA\n";
print "t38_maxsessions.label Max Concurrent T.38 Sessions\n"; print "t38_maxsessions.label Max Concurrent T.38 Sessions\n";
print "g711_maxsessions.draw AREA\n"; print "g711_maxsessions.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Negotiations Failed (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Negotiations Failed (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Negotiations Failed\n"; print "graph_vlabel Number of Negotiations Failed\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_failed.draw AREA\n"; print "t38_failed.draw AREA\n";
print "t38_failed.label T.38 Negotiations Failed\n"; print "t38_failed.label T.38 Negotiations Failed\n";
print "g711_failed.draw AREA\n"; print "g711_failed.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - No Faxes (T.38 and G.711)\n"; print "graph_title Asterisk Fax - No Faxes (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of No Faxes\n"; print "graph_vlabel Number of No Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_nofax.draw AREA\n"; print "t38_nofax.draw AREA\n";
print "t38_nofax.label No T.38 Faxes\n"; print "t38_nofax.label No T.38 Faxes\n";
print "g711_nofax.draw AREA\n"; print "g711_nofax.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Partial Faxes (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Partial Faxes (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Partial Faxes\n"; print "graph_vlabel Number of Partial Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_partial.draw AREA\n"; print "t38_partial.draw AREA\n";
print "t38_partial.label Partial T.38 Faxes\n"; print "t38_partial.label Partial T.38 Faxes\n";
print "g711_partial.draw AREA\n"; print "g711_partial.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Protocol Errors (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Protocol Errors (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Protocol Errors\n"; print "graph_vlabel Number of Protocol Errors\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_proterror.draw AREA\n"; print "t38_proterror.draw AREA\n";
print "t38_proterror.label T.38 Protocol Errors\n"; print "t38_proterror.label T.38 Protocol Errors\n";
print "g711_proterror.draw AREA\n"; print "g711_proterror.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Successful Faxes (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Successful Faxes (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Successful Faxes\n"; print "graph_vlabel Number of Successful Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_success.draw AREA\n"; print "t38_success.draw AREA\n";
print "t38_success.label Successful T.38 Faxes\n"; print "t38_success.label Successful T.38 Faxes\n";
print "g711_success.draw AREA\n"; print "g711_success.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Switched to T.38\n"; print "graph_title Asterisk Fax - Switched to T.38\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Switches to T.38\n"; print "graph_vlabel Number of Switches to T.38\n";
print "graph_category other\n"; print "graph_category voip\n";
print "switched.draw AREA\n"; print "switched.draw AREA\n";
print "switched.label Switched to T.38\n"; print "switched.label Switched to T.38\n";
exit 0; exit 0;

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Train Failures (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Train Failures (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Train Failures\n"; print "graph_vlabel Number of Train Failures\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_failure.draw AREA\n"; print "t38_failure.draw AREA\n";
print "t38_failure.label T.38 Train Failures\n"; print "t38_failure.label T.38 Train Failures\n";
print "g711_failure.draw AREA\n"; print "g711_failure.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Tx/Rx Attempts\n"; print "graph_title Asterisk Fax - Tx/Rx Attempts\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Tx and Rx Attempts\n"; print "graph_vlabel Number of Tx and Rx Attempts\n";
print "graph_category other\n"; print "graph_category voip\n";
print "transmit.draw AREA\n"; print "transmit.draw AREA\n";
print "transmit.label Tx Attempts\n"; print "transmit.label Tx Attempts\n";
print "receive.draw AREA\n"; print "receive.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Dropped Calls (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Dropped Calls (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Dropped Calls\n"; print "graph_vlabel Number of Dropped Calls\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_dropped.draw AREA\n"; print "t38_dropped.draw AREA\n";
print "t38_dropped.label T.38 Dropped Calls\n"; print "t38_dropped.label T.38 Dropped Calls\n";
print "g711_dropped.draw AREA\n"; print "g711_dropped.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Current Sessions\n"; print "graph_title Asterisk Fax - Current Sessions\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Current Sessions\n"; print "graph_vlabel Current Sessions\n";
print "graph_category other\n"; print "graph_category voip\n";
print "sessions.draw AREA\n"; print "sessions.draw AREA\n";
print "sessions.label Current Sessions\n"; print "sessions.label Current Sessions\n";
exit 0; exit 0;

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Failed and Completed Faxes\n"; print "graph_title Asterisk Fax - Failed and Completed Faxes\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Failed and Completed Faxes\n"; print "graph_vlabel Failed and Completed Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "failed.draw AREA\n"; print "failed.draw AREA\n";
print "failed.label Failed faxes\n"; print "failed.label Failed faxes\n";
print "completed.draw AREA\n"; print "completed.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - File Errors (T.38 and G.711)\n"; print "graph_title Asterisk Fax - File Errors (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of File Errors\n"; print "graph_vlabel Number of File Errors\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_file_error.draw AREA\n"; print "t38_file_error.draw AREA\n";
print "t38_file_error.label T.38 File Errors\n"; print "t38_file_error.label T.38 File Errors\n";
print "g711_file_error.draw AREA\n"; print "g711_file_error.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Memory Errors (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Memory Errors (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Memory Errors\n"; print "graph_vlabel Number of Memory Errors\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_errors.draw AREA\n"; print "t38_errors.draw AREA\n";
print "t38_errors.label T.38 Memory Errors\n"; print "t38_errors.label T.38 Memory Errors\n";
print "g711_errors.draw AREA\n"; print "g711_errors.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Negotiations Failed (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Negotiations Failed (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Negotiations Failed\n"; print "graph_vlabel Number of Negotiations Failed\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_failed.draw AREA\n"; print "t38_failed.draw AREA\n";
print "t38_failed.label T.38 Negotiations Failed\n"; print "t38_failed.label T.38 Negotiations Failed\n";
print "g711_failed.draw AREA\n"; print "g711_failed.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - No Faxes (T.38 and G.711)\n"; print "graph_title Asterisk Fax - No Faxes (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of No Faxes\n"; print "graph_vlabel Number of No Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_nofax.draw AREA\n"; print "t38_nofax.draw AREA\n";
print "t38_nofax.label No T.38 Faxes\n"; print "t38_nofax.label No T.38 Faxes\n";
print "g711_nofax.draw AREA\n"; print "g711_nofax.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Protocol Errors (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Protocol Errors (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Protocol Errors\n"; print "graph_vlabel Number of Protocol Errors\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_proterror.draw AREA\n"; print "t38_proterror.draw AREA\n";
print "t38_proterror.label T.38 Protocol Errors\n"; print "t38_proterror.label T.38 Protocol Errors\n";
print "g711_proterror.draw AREA\n"; print "g711_proterror.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Retries Exceeded (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Retries Exceeded (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Retries Exceeded\n"; print "graph_vlabel Retries Exceeded\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_retries.draw AREA\n"; print "t38_retries.draw AREA\n";
print "t38_retries.label T.38 Retries Exceeded\n"; print "t38_retries.label T.38 Retries Exceeded\n";
print "g711_retries.draw AREA\n"; print "g711_retries.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Rx and Tx Protocol Errors (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Rx and Tx Protocol Errors (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Protocol Errors\n"; print "graph_vlabel Number of Protocol Errors\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_rx_proterror.draw AREA\n"; print "t38_rx_proterror.draw AREA\n";
print "t38_rx_proterror.label T.38 Rx Protocol Errors\n"; print "t38_rx_proterror.label T.38 Rx Protocol Errors\n";
print "t38_tx_proterror.draw AREA\n"; print "t38_tx_proterror.draw AREA\n";

View file

@ -85,7 +85,7 @@ address with the copyright notice upgrade with your name.
print "graph_title Asterisk Fax - Successful Faxes (T.38 and G.711)\n"; print "graph_title Asterisk Fax - Successful Faxes (T.38 and G.711)\n";
print "graph_args --base 1000 -l 0\n"; print "graph_args --base 1000 -l 0\n";
print "graph_vlabel Number of Successful Faxes\n"; print "graph_vlabel Number of Successful Faxes\n";
print "graph_category other\n"; print "graph_category voip\n";
print "t38_success.draw AREA\n"; print "t38_success.draw AREA\n";
print "t38_success.label Successful T.38 Faxes\n"; print "t38_success.label Successful T.38 Faxes\n";
print "g711_success.draw AREA\n"; print "g711_success.draw AREA\n";

Some files were not shown because too many files have changed in this diff Show more