mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 02:33:18 +00:00
Whitespace cleanup
* remove trailing whitespace * remove empty lines at the end of files
This commit is contained in:
parent
ef851f0c34
commit
17f784270a
604 changed files with 2927 additions and 2945 deletions
|
@ -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,7 +32,7 @@ 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
|
||||||
|
@ -96,7 +96,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
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -38,7 +38,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,12 +70,12 @@ fi
|
||||||
|
|
||||||
|
|
||||||
$LOGTAIL ${MAIL_LOG} $STATEFILE | \
|
$LOGTAIL ${MAIL_LOG} $STATEFILE | \
|
||||||
awk 'BEGIN { na= 0; nb= 0; nc= 0; nd= 0; total= 0 }
|
awk 'BEGIN { na= 0; nb= 0; nc= 0; nd= 0; total= 0 }
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (index($0, "Passed CLEAN")) { na++ ; total++ }
|
if (index($0, "Passed CLEAN")) { na++ ; total++ }
|
||||||
else if (index($0, "Passed SPAMMY")) { nb++ ; total++ }
|
else if (index($0, "Passed SPAMMY")) { nb++ ; total++ }
|
||||||
else if (index($0, "Blocked SPAMMY")) { nc++ ; total++ }
|
else if (index($0, "Blocked SPAMMY")) { nc++ ; total++ }
|
||||||
else if (index($0, "INFECTED")) { nd++ ; total++ }
|
else if (index($0, "INFECTED")) { nd++ ; total++ }
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -46,13 +46,13 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
|
||||||
}
|
}
|
||||||
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 1;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||

|

|
||||||
|
|
||||||
## 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.
|
||||||

|

|
||||||
|
|
||||||
## 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.
|
||||||

|

|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
|
@ -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 = $_;
|
||||||
|
|
|
@ -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 = $_;
|
||||||
|
|
|
@ -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 = $_;
|
||||||
|
|
|
@ -36,7 +36,7 @@ PROCS=$binname
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo yes
|
echo yes
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -65,5 +65,5 @@ VAL2=`ps auxf | grep ${PROCS} | grep ^${USR} | grep -v grep | awk '{s+=$6} END {
|
||||||
VAL3=`expr $VAL2 / $VAL1`
|
VAL3=`expr $VAL2 / $VAL1`
|
||||||
|
|
||||||
echo "servers.value $VAL3"
|
echo "servers.value $VAL3"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ USR=$apuser
|
||||||
PROCS=$binname
|
PROCS=$binname
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo yes
|
echo yes
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
#
|
#
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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))`"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ PROCS=$binname
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo yes
|
echo yes
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -60,5 +60,5 @@ VAL1=`ps auxf | grep ${PROCS} | grep -v grep | awk '{s+=$6} END {print s}'`
|
||||||
VAL2=`expr $VAL1 / 1024`
|
VAL2=`expr $VAL1 / 1024`
|
||||||
|
|
||||||
echo "servers.value $VAL2"
|
echo "servers.value $VAL2"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,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 +140,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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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") {
|
||||||
|
|
|
@ -43,13 +43,13 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
|
||||||
}
|
}
|
||||||
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 1;
|
||||||
|
@ -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";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 $?
|
||||||
|
|
|
@ -24,8 +24,8 @@ 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
|
||||||
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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)
|
||||||
|
|
|
@ -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])
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
# Parameters:
|
# Parameters:
|
||||||
#
|
#
|
||||||
# config (required)
|
# config (required)
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#%# family=manual
|
#%# family=manual
|
||||||
|
|
||||||
|
|
|
@ -73,13 +73,13 @@ unless( defined(@ARGV) ){
|
||||||
# =============== 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 ){
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -53,11 +53,11 @@ unless( defined(@ARGV) ){
|
||||||
# =============== 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;
|
||||||
|
|
|
@ -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're retrive 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 ( "" )
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,13 +85,13 @@ unless( defined(@ARGV) ){
|
||||||
# =============== 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 ){
|
||||||
|
|
|
@ -63,13 +63,13 @@ unless( defined(@ARGV) ){
|
||||||
# =============== 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 ){
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -53,11 +53,11 @@ unless( defined(@ARGV) ){
|
||||||
# =============== 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;
|
||||||
|
|
|
@ -193,7 +193,7 @@ multigraph asterisk_codecs
|
||||||
graphs_title Asterisk channels per codec
|
graphs_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) {
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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 $@;
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# Converted to /bin/sh by Steve Schnepp
|
# Converted to /bin/sh by Steve Schnepp
|
||||||
# June 2012
|
# June 2012
|
||||||
# Version 1.0
|
# Version 1.0
|
||||||
#
|
#
|
||||||
# Run as root or make sure munin user can run 'asterisk -r' command
|
# Run as root or make sure munin user can run 'asterisk -r' command
|
||||||
#
|
#
|
||||||
# [asterisk_channels]
|
# [asterisk_channels]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# add this into munin/plugin-conf.d/plugins.conf:
|
# add this into munin/plugin-conf.d/plugins.conf:
|
||||||
#
|
#
|
||||||
# [asterisk_inuse]
|
# [asterisk_inuse]
|
||||||
# user root
|
# user root
|
||||||
#
|
#
|
||||||
|
|
|
@ -16,7 +16,7 @@ PORTAUDIT=/usr/local/sbin/portaudit
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
if [ -x $PORTAUDIT ]; then
|
if [ -x $PORTAUDIT ]; then
|
||||||
echo yes
|
echo yes
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo no '(portaudit not found)'
|
echo no '(portaudit not found)'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
# -*- perl -*-
|
# -*- perl -*-
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@ The plugin shows:
|
||||||
|
|
||||||
#%# family=power
|
#%# family=power
|
||||||
|
|
||||||
=head1 VERSION
|
=head1 VERSION
|
||||||
=head1 BUGS
|
=head1 BUGS
|
||||||
|
|
||||||
None known.
|
None known.
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ sub read_data
|
||||||
$val = "unknown";
|
$val = "unknown";
|
||||||
}
|
}
|
||||||
elsif ( $var ne "batery type" or $var ne "serial number" or $var ne "OEM info" )
|
elsif ( $var ne "batery type" or $var ne "serial number" or $var ne "OEM info" )
|
||||||
{
|
{
|
||||||
@tmp = split(" " ,$val);
|
@tmp = split(" " ,$val);
|
||||||
$val = trim($tmp[0]);
|
$val = trim($tmp[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
# -*- perl -*-
|
# -*- perl -*-
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ The plugin shows:
|
||||||
|
|
||||||
#%# family=power
|
#%# family=power
|
||||||
|
|
||||||
=head1 VERSION
|
=head1 VERSION
|
||||||
=head1 BUGS
|
=head1 BUGS
|
||||||
|
|
||||||
None known.
|
None known.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
# -*- perl -*-
|
# -*- perl -*-
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
|
@ -35,11 +35,11 @@ The plugin shows:
|
||||||
#%# family=power
|
#%# family=power
|
||||||
#%# capabilities=autoconf
|
#%# capabilities=autoconf
|
||||||
|
|
||||||
=head1 VERSION
|
=head1 VERSION
|
||||||
|
|
||||||
1.0
|
1.0
|
||||||
|
|
||||||
=head1 BUGS
|
=head1 BUGS
|
||||||
|
|
||||||
None known.
|
None known.
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ sub read_data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my $graphs =
|
my $graphs =
|
||||||
{
|
{
|
||||||
'batteryes_capacity' => { 'vlabel' => 'Capacity, Ah', 'title' => '%s capacity', 'args' => '--base 1000',
|
'batteryes_capacity' => { 'vlabel' => 'Capacity, Ah', 'title' => '%s capacity', 'args' => '--base 1000',
|
||||||
'fields' => [qw/design_capacity last_full_capacity design_capacity_low design_capacity_warning capacity_granularity_1 capacity_granularity_2 remaining_capacity/] },
|
'fields' => [qw/design_capacity last_full_capacity design_capacity_low design_capacity_warning capacity_granularity_1 capacity_granularity_2 remaining_capacity/] },
|
||||||
|
@ -231,7 +231,7 @@ my $graphs =
|
||||||
'fields' => [qw/present_rate/] }
|
'fields' => [qw/present_rate/] }
|
||||||
};
|
};
|
||||||
|
|
||||||
my $fields =
|
my $fields =
|
||||||
{
|
{
|
||||||
'design_capacity' => { 'source' => 'both', 'draw' => 'AREA' , 'label' => 'Design capacity' , 'info' => 'Battery design capacity' },
|
'design_capacity' => { 'source' => 'both', 'draw' => 'AREA' , 'label' => 'Design capacity' , 'info' => 'Battery design capacity' },
|
||||||
'last_full_capacity' => { 'source' => 'both', 'draw' => 'AREA' , 'label' => 'Last full capacity' , 'info' => 'Battery full charge capacity' },
|
'last_full_capacity' => { 'source' => 'both', 'draw' => 'AREA' , 'label' => 'Last full capacity' , 'info' => 'Battery full charge capacity' },
|
||||||
|
@ -250,7 +250,7 @@ my $fields =
|
||||||
|
|
||||||
# ------------------------------------ start here -----------------------------------
|
# ------------------------------------ start here -----------------------------------
|
||||||
|
|
||||||
if (defined($ARGV[0]) and ($ARGV[0] eq 'autoconf'))
|
if (defined($ARGV[0]) and ($ARGV[0] eq 'autoconf'))
|
||||||
{
|
{
|
||||||
printf("%s\n", (-e $proc_path or -e $sys_path) ? "yes" : "no ($proc_path and $sys_path not exists)");
|
printf("%s\n", (-e $proc_path or -e $sys_path) ? "yes" : "no ($proc_path and $sys_path not exists)");
|
||||||
exit (0);
|
exit (0);
|
||||||
|
|
|
@ -23,7 +23,7 @@ STATEFILE=$MUNIN_PLUGSTATE/${B3NAME}.offset
|
||||||
|
|
||||||
mktempfile () {
|
mktempfile () {
|
||||||
mktemp -t $1
|
mktemp -t $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
|
@ -49,7 +49,7 @@ fi
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
echo "graph_title BigBrotherBot errors - ${B3NAME}"
|
echo "graph_title BigBrotherBot errors - ${B3NAME}"
|
||||||
cat <<'EOM'
|
cat <<'EOM'
|
||||||
graph_args --base 1000 -l 0
|
graph_args --base 1000 -l 0
|
||||||
graph_vlabel Errors
|
graph_vlabel Errors
|
||||||
graph_category Games
|
graph_category Games
|
||||||
|
|
|
@ -84,7 +84,7 @@ sub do_stats {
|
||||||
if ($3 eq 'IN' and $4 !~ /^TYPE/) {
|
if ($3 eq 'IN' and $4 !~ /^TYPE/) {
|
||||||
my $crr = lc $2;
|
my $crr = lc $2;
|
||||||
$IN{$crr}++;
|
$IN{$crr}++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(Q);
|
close(Q);
|
||||||
|
|
|
@ -288,7 +288,7 @@ Linux machines running BOINC and munin-node
|
||||||
|
|
||||||
- or -
|
- or -
|
||||||
|
|
||||||
Linux servers (running munin-node) used to collect data from other systems
|
Linux servers (running munin-node) used to collect data from other systems
|
||||||
which are running BOINC, but not running munin-node (e.g. non-Linux systems)
|
which are running BOINC, but not running munin-node (e.g. non-Linux systems)
|
||||||
|
|
||||||
=head1 CONFIGURATION
|
=head1 CONFIGURATION
|
||||||
|
@ -319,48 +319,48 @@ Warning level - minimum estimated work (default: 24.00 hours)
|
||||||
|
|
||||||
=item B<password>
|
=item B<password>
|
||||||
|
|
||||||
Password for BOINC (default: none)
|
Password for BOINC (default: none)
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head2 B<Security Consideration:>
|
=head2 B<Security Consideration:>
|
||||||
|
|
||||||
Using of variable B<password> poses a security risk. Even if the Munin
|
Using of variable B<password> poses a security risk. Even if the Munin
|
||||||
configuration file for this plugin containing BOINC-password is properly
|
configuration file for this plugin containing BOINC-password is properly
|
||||||
protected, the password is exposed as environment variable and finally passed
|
protected, the password is exposed as environment variable and finally passed
|
||||||
to boinccmd as a parameter. It is therefore possible for local users of the
|
to boinccmd as a parameter. It is therefore possible for local users of the
|
||||||
machine running this plugin to eavesdrop the BOINC password.
|
machine running this plugin to eavesdrop the BOINC password.
|
||||||
|
|
||||||
Using of variable password is therefore strongly discouraged and is left here
|
Using of variable password is therefore strongly discouraged and is left here
|
||||||
as a legacy option and for testing purposes.
|
as a legacy option and for testing purposes.
|
||||||
|
|
||||||
It should be always possible to use B<boincdir> variable instead - in such case
|
It should be always possible to use B<boincdir> variable instead - in such case
|
||||||
the file gui_rpc_auth.cfg is read by boinccmd binary directly.
|
the file gui_rpc_auth.cfg is read by boinccmd binary directly.
|
||||||
If this plugin is used to fetch data from remote system, the gui_rpc_auth.cfg
|
If this plugin is used to fetch data from remote system, the gui_rpc_auth.cfg
|
||||||
can be copied to special directory in a secure way (e.g. via scp) and properly
|
can be copied to special directory in a secure way (e.g. via scp) and properly
|
||||||
protected by file permissions.
|
protected by file permissions.
|
||||||
|
|
||||||
=head1 INTERPRETATION
|
=head1 INTERPRETATION
|
||||||
|
|
||||||
This plugin shows the estimated remaining computation time for all CPUs of
|
This plugin shows the estimated remaining computation time for all CPUs of
|
||||||
the machine and the estimated remaining computation time of longest workunit.
|
the machine and the estimated remaining computation time of longest workunit.
|
||||||
The estimation is based on assumption that the workunits of different lengths
|
The estimation is based on assumption that the workunits of different lengths
|
||||||
will be distributed to the CPUs evenly (which is not always the case).
|
will be distributed to the CPUs evenly (which is not always the case).
|
||||||
|
|
||||||
The warning level can be used to warn in forward about the risk of workunits
|
The warning level can be used to warn in forward about the risk of workunits
|
||||||
local cache depletion and BOINC client running out of the work.
|
local cache depletion and BOINC client running out of the work.
|
||||||
Although such warning can be achieved by configuring Munin master, there is
|
Although such warning can be achieved by configuring Munin master, there is
|
||||||
also this option to configure it on munin-node side.
|
also this option to configure it on munin-node side.
|
||||||
|
|
||||||
=head1 EXAMPLES
|
=head1 EXAMPLES
|
||||||
|
|
||||||
=head2 Local BOINC Example
|
=head2 Local BOINC Example
|
||||||
|
|
||||||
BOINC is running on local machine. The BOINC binaries are installed in
|
BOINC is running on local machine. The BOINC binaries are installed in
|
||||||
F</opt/boinc/custom-6.10.1/>, the BOINC is running in directory
|
F</opt/boinc/custom-6.10.1/>, the BOINC is running in directory
|
||||||
F</usr/local/boinc/> under username boinc, group boinc and the password is used
|
F</usr/local/boinc/> under username boinc, group boinc and the password is used
|
||||||
to protect access to BOINC.
|
to protect access to BOINC.
|
||||||
Warning will be set when estimated work for any of CPUs will decrease under
|
Warning will be set when estimated work for any of CPUs will decrease under
|
||||||
48 hours:
|
48 hours:
|
||||||
|
|
||||||
[boinc_*]
|
[boinc_*]
|
||||||
|
@ -371,17 +371,17 @@ Warning will be set when estimated work for any of CPUs will decrease under
|
||||||
|
|
||||||
=head2 Remote BOINC Example
|
=head2 Remote BOINC Example
|
||||||
|
|
||||||
BOINC is running on 2 remote machines C<foo> and C<bar>.
|
BOINC is running on 2 remote machines C<foo> and C<bar>.
|
||||||
On the local machine the binary of command-line interface is installed in
|
On the local machine the binary of command-line interface is installed in
|
||||||
directory F</usr/local/bin/>.
|
directory F</usr/local/bin/>.
|
||||||
The BOINC password used on the remote machine C<foo> is stored in file
|
The BOINC password used on the remote machine C<foo> is stored in file
|
||||||
F</etc/munin/boinc/foo/gui_rpc_auth.cfg>.
|
F</etc/munin/boinc/foo/gui_rpc_auth.cfg>.
|
||||||
The BOINC password used on the remote machine C<bar> is stored in file
|
The BOINC password used on the remote machine C<bar> is stored in file
|
||||||
F</etc/munin/boinc/bar/gui_rpc_auth.cfg>.
|
F</etc/munin/boinc/bar/gui_rpc_auth.cfg>.
|
||||||
These files are owned and readable by root, readable by group munin and not
|
These files are owned and readable by root, readable by group munin and not
|
||||||
readable by others.
|
readable by others.
|
||||||
There are 2 symbolic links to this plugin created in the munin plugins
|
There are 2 symbolic links to this plugin created in the munin plugins
|
||||||
directory (usually F</etc/munin/plugins/>): F<snmp_foo_boincestwk> and
|
directory (usually F</etc/munin/plugins/>): F<snmp_foo_boincestwk> and
|
||||||
F<snmp_bar_boincestwk>
|
F<snmp_bar_boincestwk>
|
||||||
|
|
||||||
[snmp_foo_boinc*]
|
[snmp_foo_boinc*]
|
||||||
|
@ -396,33 +396,33 @@ F<snmp_bar_boincestwk>
|
||||||
env.host bar
|
env.host bar
|
||||||
env.boincdir /etc/munin/boinc/bar
|
env.boincdir /etc/munin/boinc/bar
|
||||||
|
|
||||||
This way the plugin can be used by Munin the same way as the Munin plugins
|
This way the plugin can be used by Munin the same way as the Munin plugins
|
||||||
utilizng SNMP (although this plugin itself does not use SNMP).
|
utilizng SNMP (although this plugin itself does not use SNMP).
|
||||||
|
|
||||||
=head1 BUGS
|
=head1 BUGS
|
||||||
|
|
||||||
The estimation is based on simple assumption, that longest workunits will be
|
The estimation is based on simple assumption, that longest workunits will be
|
||||||
processed first. This is the case when work is distributed evenly among CPUs.
|
processed first. This is the case when work is distributed evenly among CPUs.
|
||||||
But this is not always the case, because various deadlines for various
|
But this is not always the case, because various deadlines for various
|
||||||
workunits may fire the "panic mode" of BOINC and scheduling could be much
|
workunits may fire the "panic mode" of BOINC and scheduling could be much
|
||||||
different.
|
different.
|
||||||
For example, there can be 4 CPUs, and BOINC having downloaded 4 workunits
|
For example, there can be 4 CPUs, and BOINC having downloaded 4 workunits
|
||||||
with estimated run-time 1 hour each and 3 workunits with estimated run-time
|
with estimated run-time 1 hour each and 3 workunits with estimated run-time
|
||||||
4 hours each.
|
4 hours each.
|
||||||
This Munin plugin will report estimated work 4 hours for each CPU.
|
This Munin plugin will report estimated work 4 hours for each CPU.
|
||||||
But if deadline of those 1-hour workunits will be much shorter than deadline
|
But if deadline of those 1-hour workunits will be much shorter than deadline
|
||||||
of those 4-hours workunits, BOINC will schedule short workunits first (for all
|
of those 4-hours workunits, BOINC will schedule short workunits first (for all
|
||||||
4 CPUs) and after finishing them it will schedule those long workunits.
|
4 CPUs) and after finishing them it will schedule those long workunits.
|
||||||
This will result in real computation for 5 hours on 3 CPUs but only 1 hour on
|
This will result in real computation for 5 hours on 3 CPUs but only 1 hour on
|
||||||
remaining 4th CPU. So after 1 hour of computation 1 of CPUs will run out of
|
remaining 4th CPU. So after 1 hour of computation 1 of CPUs will run out of
|
||||||
work.
|
work.
|
||||||
|
|
||||||
There is no C<autoconf> capability at the moment. This is due to the fact, that
|
There is no C<autoconf> capability at the moment. This is due to the fact, that
|
||||||
BOINC installations may vary over different systems, sometimes using default
|
BOINC installations may vary over different systems, sometimes using default
|
||||||
directory from distribution (e.g. F</var/lib/boinc/> in Debian or Ubuntu), but
|
directory from distribution (e.g. F</var/lib/boinc/> in Debian or Ubuntu), but
|
||||||
often running in user directories or in other separate directories.
|
often running in user directories or in other separate directories.
|
||||||
Also the user-ID under which BOINC runs often differs.
|
Also the user-ID under which BOINC runs often differs.
|
||||||
Under these circumstances the C<autoconf> would be either lame or too
|
Under these circumstances the C<autoconf> would be either lame or too
|
||||||
complicated.
|
complicated.
|
||||||
|
|
||||||
=head1 AUTHOR
|
=head1 AUTHOR
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
# Parameters:
|
# Parameters:
|
||||||
#
|
#
|
||||||
# password -- The password for RPC authentication
|
# password -- The password for RPC authentication
|
||||||
# (default: boinc_cmd will look for a file
|
# (default: boinc_cmd will look for a file
|
||||||
# 'gui_rpc_auth.cfg' and use the password in it)
|
# 'gui_rpc_auth.cfg' and use the password in it)
|
||||||
# host -- the host to connect to (default: localhost)
|
# host -- the host to connect to (default: localhost)
|
||||||
# port -- optional (default: 31416)
|
# port -- optional (default: 31416)
|
||||||
#
|
#
|
||||||
# This plugin can monitor boinc processes running on local/remote machines.
|
# This plugin can monitor boinc processes running on local/remote machines.
|
||||||
# You can see the progress on various projects.
|
# You can see the progress on various projects.
|
||||||
#
|
#
|
||||||
# Author: Petr Ruzicka <petr.ruzicka@gmail.com>
|
# Author: Petr Ruzicka <petr.ruzicka@gmail.com>
|
||||||
|
@ -49,14 +49,14 @@ sub autoconf {
|
||||||
|
|
||||||
$reply =~ /<nonce>(.*)<\/nonce>/;
|
$reply =~ /<nonce>(.*)<\/nonce>/;
|
||||||
$hash = md5_hex($1, $password);
|
$hash = md5_hex($1, $password);
|
||||||
|
|
||||||
print $client "<boinc_gui_rpc_request><auth2><nonce_hash>$hash</nonce_hash></auth2></boinc_gui_rpc_request>\003";
|
print $client "<boinc_gui_rpc_request><auth2><nonce_hash>$hash</nonce_hash></auth2></boinc_gui_rpc_request>\003";
|
||||||
|
|
||||||
{
|
{
|
||||||
local $/ = "\003";
|
local $/ = "\003";
|
||||||
$reply = <$client>;
|
$reply = <$client>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($reply =~ /<authorized\/>/) {
|
if ($reply =~ /<authorized\/>/) {
|
||||||
print "yes\n";
|
print "yes\n";
|
||||||
exit 0;
|
exit 0;
|
||||||
|
@ -70,29 +70,29 @@ sub config {
|
||||||
my $client = IO::Socket::INET->new ( PeerAddr => $host,
|
my $client = IO::Socket::INET->new ( PeerAddr => $host,
|
||||||
PeerPort => $port,
|
PeerPort => $port,
|
||||||
Proto => 'tcp' )
|
Proto => 'tcp' )
|
||||||
or die "Can't bind : $@\n";
|
or die "Can't bind : $@\n";
|
||||||
|
|
||||||
print $client "<boinc_gui_rpc_request><auth1/></boinc_gui_rpc_request>\003";
|
print $client "<boinc_gui_rpc_request><auth1/></boinc_gui_rpc_request>\003";
|
||||||
|
|
||||||
{
|
{
|
||||||
local $/ = "\003";
|
local $/ = "\003";
|
||||||
$reply = <$client>;
|
$reply = <$client>;
|
||||||
}
|
}
|
||||||
|
|
||||||
$reply =~ /<nonce>(.*)<\/nonce>/;
|
$reply =~ /<nonce>(.*)<\/nonce>/;
|
||||||
my $hash = md5_hex($1, $password);
|
my $hash = md5_hex($1, $password);
|
||||||
|
|
||||||
print $client "<boinc_gui_rpc_request><auth2><nonce_hash>$hash</nonce_hash></auth2></boinc_gui_rpc_request>\003";
|
print $client "<boinc_gui_rpc_request><auth2><nonce_hash>$hash</nonce_hash></auth2></boinc_gui_rpc_request>\003";
|
||||||
|
|
||||||
{
|
{
|
||||||
local $/ = "\003";
|
local $/ = "\003";
|
||||||
$reply = <$client>;
|
$reply = <$client>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($reply !~ /<authorized\/>/) {
|
if ($reply !~ /<authorized\/>/) {
|
||||||
die "Wrong password: $_";
|
die "Wrong password: $_";
|
||||||
}
|
}
|
||||||
|
|
||||||
print $client "<boinc_gui_rpc_request><get_state></boinc_gui_rpc_request>";
|
print $client "<boinc_gui_rpc_request><get_state></boinc_gui_rpc_request>";
|
||||||
|
|
||||||
while (chomp($reply = <$client>) && ($reply ne "</boinc_gui_rpc_reply>")) {
|
while (chomp($reply = <$client>) && ($reply ne "</boinc_gui_rpc_reply>")) {
|
||||||
|
@ -101,7 +101,7 @@ sub config {
|
||||||
print "graph_category htc\n";
|
print "graph_category htc\n";
|
||||||
print "graph_args -l 0\n";
|
print "graph_args -l 0\n";
|
||||||
print "graph_vlabel %\n";
|
print "graph_vlabel %\n";
|
||||||
}
|
}
|
||||||
if ($reply =~ /<project_name>(.*)<\/project_name>/) {
|
if ($reply =~ /<project_name>(.*)<\/project_name>/) {
|
||||||
my $boinc_munin_name=$1;
|
my $boinc_munin_name=$1;
|
||||||
$boinc_munin_name =~ /(\w+).*/;
|
$boinc_munin_name =~ /(\w+).*/;
|
||||||
|
@ -115,31 +115,31 @@ sub report {
|
||||||
my $client = IO::Socket::INET->new ( PeerAddr => $host,
|
my $client = IO::Socket::INET->new ( PeerAddr => $host,
|
||||||
PeerPort => $port,
|
PeerPort => $port,
|
||||||
Proto => 'tcp' )
|
Proto => 'tcp' )
|
||||||
or die "Can't bind : $@\n";
|
or die "Can't bind : $@\n";
|
||||||
|
|
||||||
print $client "<boinc_gui_rpc_request><auth1/></boinc_gui_rpc_request>\003";
|
print $client "<boinc_gui_rpc_request><auth1/></boinc_gui_rpc_request>\003";
|
||||||
|
|
||||||
{
|
{
|
||||||
local $/ = "\003";
|
local $/ = "\003";
|
||||||
$reply = <$client>;
|
$reply = <$client>;
|
||||||
}
|
}
|
||||||
|
|
||||||
$reply =~ /<nonce>(.*)<\/nonce>/;
|
$reply =~ /<nonce>(.*)<\/nonce>/;
|
||||||
my $hash = md5_hex($1, $password);
|
my $hash = md5_hex($1, $password);
|
||||||
|
|
||||||
print $client "<boinc_gui_rpc_request><auth2><nonce_hash>$hash</nonce_hash></auth2></boinc_gui_rpc_request>\003";
|
print $client "<boinc_gui_rpc_request><auth2><nonce_hash>$hash</nonce_hash></auth2></boinc_gui_rpc_request>\003";
|
||||||
|
|
||||||
{
|
{
|
||||||
local $/ = "\003";
|
local $/ = "\003";
|
||||||
$reply = <$client>;
|
$reply = <$client>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($reply !~ /<authorized\/>/) {
|
if ($reply !~ /<authorized\/>/) {
|
||||||
die "Wrong password: $_";
|
die "Wrong password: $_";
|
||||||
}
|
}
|
||||||
|
|
||||||
print $client "<boinc_gui_rpc_request><get_state></boinc_gui_rpc_request>";
|
print $client "<boinc_gui_rpc_request><get_state></boinc_gui_rpc_request>";
|
||||||
|
|
||||||
while (chomp($reply = <$client>) && ($reply ne "</boinc_gui_rpc_reply>")) {
|
while (chomp($reply = <$client>) && ($reply ne "</boinc_gui_rpc_reply>")) {
|
||||||
if ($reply =~ /<project_name>(\w+).*<\/project_name>/) {
|
if ($reply =~ /<project_name>(\w+).*<\/project_name>/) {
|
||||||
$project = $1;
|
$project = $1;
|
||||||
|
|
|
@ -279,7 +279,7 @@ Linux machines running BOINC and munin-node
|
||||||
|
|
||||||
- or -
|
- or -
|
||||||
|
|
||||||
Linux servers (running munin-node) used to collect data from other systems
|
Linux servers (running munin-node) used to collect data from other systems
|
||||||
which are running BOINC, but not running munin-node (e.g. non-Linux systems)
|
which are running BOINC, but not running munin-node (e.g. non-Linux systems)
|
||||||
|
|
||||||
=head1 CONFIGURATION
|
=head1 CONFIGURATION
|
||||||
|
@ -306,40 +306,40 @@ Directory containing appropriate file gui_rpc_auth.cfg (default: none)
|
||||||
|
|
||||||
=item B<password>
|
=item B<password>
|
||||||
|
|
||||||
Password for BOINC (default: none)
|
Password for BOINC (default: none)
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head2 B<Security Consideration:>
|
=head2 B<Security Consideration:>
|
||||||
|
|
||||||
Using of variable B<password> poses a security risk. Even if the Munin
|
Using of variable B<password> poses a security risk. Even if the Munin
|
||||||
configuration file for this plugin containing BOINC-password is properly
|
configuration file for this plugin containing BOINC-password is properly
|
||||||
protected, the password is exposed as environment variable and finally passed
|
protected, the password is exposed as environment variable and finally passed
|
||||||
to boinccmd as a parameter. It is therefore possible for local users of the
|
to boinccmd as a parameter. It is therefore possible for local users of the
|
||||||
machine running this plugin to eavesdrop the BOINC password.
|
machine running this plugin to eavesdrop the BOINC password.
|
||||||
|
|
||||||
Using of variable password is therefore strongly discouraged and is left here
|
Using of variable password is therefore strongly discouraged and is left here
|
||||||
as a legacy option and for testing purposes.
|
as a legacy option and for testing purposes.
|
||||||
|
|
||||||
It should be always possible to use B<boincdir> variable instead - in such case
|
It should be always possible to use B<boincdir> variable instead - in such case
|
||||||
the file gui_rpc_auth.cfg is read by boinccmd binary directly.
|
the file gui_rpc_auth.cfg is read by boinccmd binary directly.
|
||||||
If this plugin is used to fetch data from remote system, the gui_rpc_auth.cfg
|
If this plugin is used to fetch data from remote system, the gui_rpc_auth.cfg
|
||||||
can be copied to special directory in a secure way (e.g. via scp) and properly
|
can be copied to special directory in a secure way (e.g. via scp) and properly
|
||||||
protected by file permissions.
|
protected by file permissions.
|
||||||
|
|
||||||
=head1 INTERPRETATION
|
=head1 INTERPRETATION
|
||||||
|
|
||||||
This plugin shows the number of currently running BOINC tasks on the machine.
|
This plugin shows the number of currently running BOINC tasks on the machine.
|
||||||
If machine is attached to several BOINC projects, data for all these projects
|
If machine is attached to several BOINC projects, data for all these projects
|
||||||
are displayed.
|
are displayed.
|
||||||
|
|
||||||
=head1 EXAMPLES
|
=head1 EXAMPLES
|
||||||
|
|
||||||
=head2 Local BOINC Example
|
=head2 Local BOINC Example
|
||||||
|
|
||||||
BOINC is running on local machine. The BOINC binaries are installed in
|
BOINC is running on local machine. The BOINC binaries are installed in
|
||||||
F</opt/boinc/custom-6.10.1/>, the BOINC is running in directory
|
F</opt/boinc/custom-6.10.1/>, the BOINC is running in directory
|
||||||
F</usr/local/boinc/> under username boinc, group boinc and the password is used
|
F</usr/local/boinc/> under username boinc, group boinc and the password is used
|
||||||
to protect access to BOINC:
|
to protect access to BOINC:
|
||||||
|
|
||||||
[boinc_*]
|
[boinc_*]
|
||||||
|
@ -349,17 +349,17 @@ to protect access to BOINC:
|
||||||
|
|
||||||
=head2 Remote BOINC Example
|
=head2 Remote BOINC Example
|
||||||
|
|
||||||
BOINC is running on 2 remote machines C<foo> and C<bar>.
|
BOINC is running on 2 remote machines C<foo> and C<bar>.
|
||||||
On the local machine the binary of command-line interface is installed in
|
On the local machine the binary of command-line interface is installed in
|
||||||
directory F</usr/local/bin/>.
|
directory F</usr/local/bin/>.
|
||||||
The BOINC password used on the remote machine C<foo> is stored in file
|
The BOINC password used on the remote machine C<foo> is stored in file
|
||||||
F</etc/munin/boinc/foo/gui_rpc_auth.cfg>.
|
F</etc/munin/boinc/foo/gui_rpc_auth.cfg>.
|
||||||
The BOINC password used on the remote machine C<bar> is stored in file
|
The BOINC password used on the remote machine C<bar> is stored in file
|
||||||
F</etc/munin/boinc/bar/gui_rpc_auth.cfg>.
|
F</etc/munin/boinc/bar/gui_rpc_auth.cfg>.
|
||||||
These files are owned and readable by root, readable by group munin and not
|
These files are owned and readable by root, readable by group munin and not
|
||||||
readable by others.
|
readable by others.
|
||||||
There are 2 symbolic links to this plugin created in the munin plugins
|
There are 2 symbolic links to this plugin created in the munin plugins
|
||||||
directory (usually F</etc/munin/plugins/>): F<boincprojs_foo> and
|
directory (usually F</etc/munin/plugins/>): F<boincprojs_foo> and
|
||||||
F<boincprojs_bar>
|
F<boincprojs_bar>
|
||||||
|
|
||||||
[boincprojs_foo]
|
[boincprojs_foo]
|
||||||
|
@ -379,12 +379,12 @@ SNMP and IPMI plugins.
|
||||||
|
|
||||||
=head1 BUGS
|
=head1 BUGS
|
||||||
|
|
||||||
There is no C<autoconf> capability at the moment. This is due to the fact, that
|
There is no C<autoconf> capability at the moment. This is due to the fact, that
|
||||||
BOINC installations may vary over different systems, sometimes using default
|
BOINC installations may vary over different systems, sometimes using default
|
||||||
directory from distribution (e.g. F</var/lib/boinc/> in Debian or Ubuntu), but
|
directory from distribution (e.g. F</var/lib/boinc/> in Debian or Ubuntu), but
|
||||||
often running in user directories or in other separate directories.
|
often running in user directories or in other separate directories.
|
||||||
Also the user-ID under which BOINC runs often differs.
|
Also the user-ID under which BOINC runs often differs.
|
||||||
Under these circumstances the C<autoconf> would be either lame or too
|
Under these circumstances the C<autoconf> would be either lame or too
|
||||||
complicated.
|
complicated.
|
||||||
|
|
||||||
=head1 AUTHOR
|
=head1 AUTHOR
|
||||||
|
|
|
@ -317,7 +317,7 @@ Linux machines running BOINC and munin-node
|
||||||
|
|
||||||
- or -
|
- or -
|
||||||
|
|
||||||
Linux servers (running munin-node) used to collect data from other systems
|
Linux servers (running munin-node) used to collect data from other systems
|
||||||
which are running BOINC, but not running munin-node (e.g. non-Linux systems)
|
which are running BOINC, but not running munin-node (e.g. non-Linux systems)
|
||||||
|
|
||||||
=head1 CONFIGURATION
|
=head1 CONFIGURATION
|
||||||
|
@ -348,45 +348,45 @@ Display unusual states details (default: 0 = Summarize unusual states as C<other
|
||||||
|
|
||||||
=item B<password>
|
=item B<password>
|
||||||
|
|
||||||
Password for BOINC (default: none)
|
Password for BOINC (default: none)
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head2 B<Security Consideration:>
|
=head2 B<Security Consideration:>
|
||||||
|
|
||||||
Using of variable B<password> poses a security risk. Even if the Munin
|
Using of variable B<password> poses a security risk. Even if the Munin
|
||||||
configuration file for this plugin containing BOINC-password is properly
|
configuration file for this plugin containing BOINC-password is properly
|
||||||
protected, the password is exposed as environment variable and finally passed
|
protected, the password is exposed as environment variable and finally passed
|
||||||
to boinccmd as a parameter. It is therefore possible for local users of the
|
to boinccmd as a parameter. It is therefore possible for local users of the
|
||||||
machine running this plugin to eavesdrop the BOINC password.
|
machine running this plugin to eavesdrop the BOINC password.
|
||||||
|
|
||||||
Using of variable password is therefore strongly discouraged and is left here
|
Using of variable password is therefore strongly discouraged and is left here
|
||||||
as a legacy option and for testing purposes.
|
as a legacy option and for testing purposes.
|
||||||
|
|
||||||
It should be always possible to use B<boincdir> variable instead - in such case
|
It should be always possible to use B<boincdir> variable instead - in such case
|
||||||
the file gui_rpc_auth.cfg is read by boinccmd binary directly.
|
the file gui_rpc_auth.cfg is read by boinccmd binary directly.
|
||||||
If this plugin is used to fetch data from remote system, the gui_rpc_auth.cfg
|
If this plugin is used to fetch data from remote system, the gui_rpc_auth.cfg
|
||||||
can be copied to special directory in a secure way (e.g. via scp) and properly
|
can be copied to special directory in a secure way (e.g. via scp) and properly
|
||||||
protected by file permissions.
|
protected by file permissions.
|
||||||
|
|
||||||
=head1 INTERPRETATION
|
=head1 INTERPRETATION
|
||||||
|
|
||||||
This plugin shows how many BOINC workunits are in all the various states.
|
This plugin shows how many BOINC workunits are in all the various states.
|
||||||
The most important states C<Running>, C<Preempted>, C<Suspended>,
|
The most important states C<Running>, C<Preempted>, C<Suspended>,
|
||||||
C<Ready to run>, C<Ready to report>, C<Downloading> and C<Uploading> are always
|
C<Ready to run>, C<Ready to report>, C<Downloading> and C<Uploading> are always
|
||||||
displayed. All other states are shown as C<other>.
|
displayed. All other states are shown as C<other>.
|
||||||
|
|
||||||
If the variable B<verbose> is used, additionally also states
|
If the variable B<verbose> is used, additionally also states
|
||||||
C<Computation Error> and C<Aborted> are shown separately (they are included in
|
C<Computation Error> and C<Aborted> are shown separately (they are included in
|
||||||
C<other> otherwise).
|
C<other> otherwise).
|
||||||
|
|
||||||
=head1 EXAMPLES
|
=head1 EXAMPLES
|
||||||
|
|
||||||
=head2 Local BOINC Example
|
=head2 Local BOINC Example
|
||||||
|
|
||||||
BOINC is running on local machine. The BOINC binaries are installed in
|
BOINC is running on local machine. The BOINC binaries are installed in
|
||||||
F</opt/boinc/custom-6.10.1/>, the BOINC is running in directory
|
F</opt/boinc/custom-6.10.1/>, the BOINC is running in directory
|
||||||
F</usr/local/boinc/> under username boinc, group boinc and the password is used
|
F</usr/local/boinc/> under username boinc, group boinc and the password is used
|
||||||
to protect access to BOINC:
|
to protect access to BOINC:
|
||||||
|
|
||||||
[boinc_*]
|
[boinc_*]
|
||||||
|
@ -397,17 +397,17 @@ to protect access to BOINC:
|
||||||
|
|
||||||
=head2 Remote BOINC Example
|
=head2 Remote BOINC Example
|
||||||
|
|
||||||
BOINC is running on 2 remote machines C<foo> and C<bar>.
|
BOINC is running on 2 remote machines C<foo> and C<bar>.
|
||||||
On the local machine the binary of command-line interface is installed in
|
On the local machine the binary of command-line interface is installed in
|
||||||
directory F</usr/local/bin/>.
|
directory F</usr/local/bin/>.
|
||||||
The BOINC password used on the remote machine C<foo> is stored in file
|
The BOINC password used on the remote machine C<foo> is stored in file
|
||||||
F</etc/munin/boinc/foo/gui_rpc_auth.cfg>.
|
F</etc/munin/boinc/foo/gui_rpc_auth.cfg>.
|
||||||
The BOINC password used on the remote machine C<bar> is stored in file
|
The BOINC password used on the remote machine C<bar> is stored in file
|
||||||
F</etc/munin/boinc/bar/gui_rpc_auth.cfg>.
|
F</etc/munin/boinc/bar/gui_rpc_auth.cfg>.
|
||||||
These files are owned and readable by root, readable by group munin and not
|
These files are owned and readable by root, readable by group munin and not
|
||||||
readable by others.
|
readable by others.
|
||||||
There are 2 symbolic links to this plugin created in the munin plugins
|
There are 2 symbolic links to this plugin created in the munin plugins
|
||||||
directory (usually F</etc/munin/plugins/>): F<snmp_foo_boincwus> and
|
directory (usually F</etc/munin/plugins/>): F<snmp_foo_boincwus> and
|
||||||
F<snmp_bar_boincwus>
|
F<snmp_bar_boincwus>
|
||||||
|
|
||||||
[snmp_foo_boinc*]
|
[snmp_foo_boinc*]
|
||||||
|
@ -422,17 +422,17 @@ F<snmp_bar_boincwus>
|
||||||
env.host bar
|
env.host bar
|
||||||
env.boincdir /etc/munin/boinc/bar
|
env.boincdir /etc/munin/boinc/bar
|
||||||
|
|
||||||
This way the plugin can be used by Munin the same way as the Munin plugins
|
This way the plugin can be used by Munin the same way as the Munin plugins
|
||||||
utilizng SNMP (although this plugin itself does not use SNMP).
|
utilizng SNMP (although this plugin itself does not use SNMP).
|
||||||
|
|
||||||
=head1 BUGS
|
=head1 BUGS
|
||||||
|
|
||||||
There is no C<autoconf> capability at the moment. This is due to the fact, that
|
There is no C<autoconf> capability at the moment. This is due to the fact, that
|
||||||
BOINC installations may vary over different systems, sometimes using default
|
BOINC installations may vary over different systems, sometimes using default
|
||||||
directory from distribution (e.g. F</var/lib/boinc/> in Debian or Ubuntu), but
|
directory from distribution (e.g. F</var/lib/boinc/> in Debian or Ubuntu), but
|
||||||
often running in user directories or in other separate directories.
|
often running in user directories or in other separate directories.
|
||||||
Also the user-ID under which BOINC runs often differs.
|
Also the user-ID under which BOINC runs often differs.
|
||||||
Under these circumstances the C<autoconf> would be either lame or too
|
Under these circumstances the C<autoconf> would be either lame or too
|
||||||
complicated.
|
complicated.
|
||||||
|
|
||||||
=head1 AUTHOR
|
=head1 AUTHOR
|
||||||
|
|
|
@ -57,7 +57,7 @@ graph_info Filesystem usage
|
||||||
for i in range(1,len(rawdata)):
|
for i in range(1,len(rawdata)):
|
||||||
dataline=rawdata[i].split()
|
dataline=rawdata[i].split()
|
||||||
self.parsed_data[re.sub('/', '_', dataline[0])] = (int(dataline[1]), int(dataline[2]), dataline[5])
|
self.parsed_data[re.sub('/', '_', dataline[0])] = (int(dataline[1]), int(dataline[2]), dataline[5])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
processor = checker()
|
processor = checker()
|
||||||
processor.get_data()
|
processor.get_data()
|
||||||
|
|
|
@ -55,7 +55,7 @@ graph_info Filesystem usage
|
||||||
for i in range(1,len(rawdata)):
|
for i in range(1,len(rawdata)):
|
||||||
dataline=rawdata[i].split()
|
dataline=rawdata[i].split()
|
||||||
self.parsed_data[re.sub('/', '_', dataline[0])] = (re.sub('%', '', dataline[4]), dataline[5])
|
self.parsed_data[re.sub('/', '_', dataline[0])] = (re.sub('%', '', dataline[4]), dataline[5])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
processor = checker()
|
processor = checker()
|
||||||
processor.get_data()
|
processor.get_data()
|
||||||
|
|
|
@ -77,4 +77,4 @@ black.label Blacklisted"""
|
||||||
processor = checker(blacklists)
|
processor = checker(blacklists)
|
||||||
processor.process_lines(logfile)
|
processor.process_lines(logfile)
|
||||||
print processor
|
print processor
|
||||||
|
|
||||||
|
|
|
@ -68,4 +68,4 @@ tarpit.label Average tarpit delay"""
|
||||||
processor = checker()
|
processor = checker()
|
||||||
processor.process_lines(logfile)
|
processor.process_lines(logfile)
|
||||||
print processor
|
print processor
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ def get_data(what, api_url, *args):
|
||||||
except IOError:
|
except IOError:
|
||||||
print 'Could not connect to the celerymon webserver'
|
print 'Could not connect to the celerymon webserver'
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
def check_web_server_status(api_url):
|
def check_web_server_status(api_url):
|
||||||
try:
|
try:
|
||||||
request = urllib.urlopen(api_url)
|
request = urllib.urlopen(api_url)
|
||||||
|
@ -104,25 +104,25 @@ def print_config(task_names):
|
||||||
print '%s.type DERIVE' % (clean_task_name(name))
|
print '%s.type DERIVE' % (clean_task_name(name))
|
||||||
print '%s.min 0' % (clean_task_name(name))
|
print '%s.min 0' % (clean_task_name(name))
|
||||||
print '%s.info number of %s tasks' % (clean_task_name(name), name)
|
print '%s.info number of %s tasks' % (clean_task_name(name), name)
|
||||||
|
|
||||||
# Values
|
# Values
|
||||||
def print_values(task_names = None, api_url = None):
|
def print_values(task_names = None, api_url = None):
|
||||||
for task_name in task_names:
|
for task_name in task_names:
|
||||||
count = len(get_data('task_details', api_url, task_name))
|
count = len(get_data('task_details', api_url, task_name))
|
||||||
print '%s.value %d' % (clean_task_name(task_name), count)
|
print '%s.value %d' % (clean_task_name(task_name), count)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
task_names = os.environ.get('tasks', None)
|
task_names = os.environ.get('tasks', None)
|
||||||
api_url = os.environ.get('api_url', API_URL)
|
api_url = os.environ.get('api_url', API_URL)
|
||||||
|
|
||||||
check_web_server_status(api_url)
|
check_web_server_status(api_url)
|
||||||
|
|
||||||
if not task_names:
|
if not task_names:
|
||||||
print 'You need to define at least one task name'
|
print 'You need to define at least one task name'
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
task_names = task_names.split(',')
|
task_names = task_names.split(',')
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
if sys.argv[1] == 'config':
|
if sys.argv[1] == 'config':
|
||||||
print_config(task_names)
|
print_config(task_names)
|
||||||
|
|
|
@ -82,7 +82,7 @@ def get_data(what, api_url, *args):
|
||||||
except IOError:
|
except IOError:
|
||||||
print 'Could not connect to the celerymon webserver'
|
print 'Could not connect to the celerymon webserver'
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
def check_web_server_status(api_url):
|
def check_web_server_status(api_url):
|
||||||
try:
|
try:
|
||||||
request = urllib.urlopen(api_url)
|
request = urllib.urlopen(api_url)
|
||||||
|
@ -115,33 +115,33 @@ def print_config(workers = None):
|
||||||
# Values
|
# Values
|
||||||
def print_values(workers = None, api_url = None):
|
def print_values(workers = None, api_url = None):
|
||||||
data = get_data('tasks', api_url)
|
data = get_data('tasks', api_url)
|
||||||
|
|
||||||
counters = dict([(key, 0) for key in TASK_STATES])
|
counters = dict([(key, 0) for key in TASK_STATES])
|
||||||
for task_name, task_data in data:
|
for task_name, task_data in data:
|
||||||
state = task_data['state']
|
state = task_data['state']
|
||||||
hostname = task_data['worker']['hostname']
|
hostname = task_data['worker']['hostname']
|
||||||
|
|
||||||
if workers and hostname not in workers:
|
if workers and hostname not in workers:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
counters[state] += 1
|
counters[state] += 1
|
||||||
|
|
||||||
for name in TASK_STATES:
|
for name in TASK_STATES:
|
||||||
name_cleaned = clean_state_name(name)
|
name_cleaned = clean_state_name(name)
|
||||||
value = counters[name]
|
value = counters[name]
|
||||||
print '%s.value %d' % (name_cleaned, value)
|
print '%s.value %d' % (name_cleaned, value)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
workers = os.environ.get('workers', 'all')
|
workers = os.environ.get('workers', 'all')
|
||||||
api_url = os.environ.get('api_url', API_URL)
|
api_url = os.environ.get('api_url', API_URL)
|
||||||
|
|
||||||
check_web_server_status(api_url)
|
check_web_server_status(api_url)
|
||||||
|
|
||||||
if workers in [None, '', 'all']:
|
if workers in [None, '', 'all']:
|
||||||
workers = None
|
workers = None
|
||||||
else:
|
else:
|
||||||
workers = workers.split(',')
|
workers = workers.split(',')
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
if sys.argv[1] == 'config':
|
if sys.argv[1] == 'config':
|
||||||
print_config(workers)
|
print_config(workers)
|
||||||
|
@ -149,4 +149,4 @@ if __name__ == '__main__':
|
||||||
print 'yes'
|
print 'yes'
|
||||||
else:
|
else:
|
||||||
print_values(workers, api_url)
|
print_values(workers, api_url)
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ Jort Bloem
|
||||||
|
|
||||||
This is one of the first programs I wrote in Python. I got carried away
|
This is one of the first programs I wrote in Python. I got carried away
|
||||||
by Python's powerful one-line commands. Just because you can, doesn't
|
by Python's powerful one-line commands. Just because you can, doesn't
|
||||||
mean you should.
|
mean you should.
|
||||||
|
|
||||||
This program needs a rewrite, and if there were any problems with it,
|
This program needs a rewrite, and if there were any problems with it,
|
||||||
I probably would.
|
I probably would.
|
||||||
|
@ -102,7 +102,7 @@ def read_osd(filename):
|
||||||
return json.loads(result)
|
return json.loads(result)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def osd_list():
|
def osd_list():
|
||||||
|
|
|
@ -36,7 +36,7 @@ WARNING_LEVEL=${warning_level:-"80"}
|
||||||
CRITICAL_LEVEL=${critical_level:-"90"}
|
CRITICAL_LEVEL=${critical_level:-"90"}
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
|
|
||||||
echo 'graph_title CEPH capacity'
|
echo 'graph_title CEPH capacity'
|
||||||
echo 'graph_category fs'
|
echo 'graph_category fs'
|
||||||
echo 'graph_vlabel GB'
|
echo 'graph_vlabel GB'
|
||||||
|
|
|
@ -28,7 +28,7 @@ fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
|
|
||||||
echo 'graph_title CEPH OSDs'
|
echo 'graph_title CEPH OSDs'
|
||||||
echo 'graph_category fs'
|
echo 'graph_category fs'
|
||||||
echo 'graph_vlabel nr'
|
echo 'graph_vlabel nr'
|
||||||
|
|
|
@ -65,7 +65,7 @@ for i in environ.get('petitions').split():
|
||||||
continue
|
continue
|
||||||
# NB: user-agent's tweak is needed to avoid a 403
|
# NB: user-agent's tweak is needed to avoid a 403
|
||||||
req = urllib.request.Request("https://api.change.org/v1/petitions/{}?api_key={}&fields=title".format(i, environ.get('APIkey')),
|
req = urllib.request.Request("https://api.change.org/v1/petitions/{}?api_key={}&fields=title".format(i, environ.get('APIkey')),
|
||||||
data=None,
|
data=None,
|
||||||
headers={ 'User-Agent': 'curl/7.38.0' })
|
headers={ 'User-Agent': 'curl/7.38.0' })
|
||||||
response = urllib.request.urlopen(req).read().decode('utf-8')
|
response = urllib.request.urlopen(req).read().decode('utf-8')
|
||||||
petition_titles[i] = json.loads(response)
|
petition_titles[i] = json.loads(response)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#########################
|
#########################
|
||||||
# Munin Plugin to track monitor the number of users a tinychat room gets.
|
# Munin Plugin to track monitor the number of users a tinychat room gets.
|
||||||
# Author Phil Wray ( http://www.infjs.com )
|
# Author Phil Wray ( http://www.infjs.com )
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
|
@ -40,7 +40,7 @@ echo "graph_title Tinychat Users for $room"
|
||||||
echo 'total_count.label Room Users'
|
echo 'total_count.label Room Users'
|
||||||
echo 'total_count.draw AREA'
|
echo 'total_count.draw AREA'
|
||||||
echo 'broadcaster_count.draw STACK'
|
echo 'broadcaster_count.draw STACK'
|
||||||
echo 'broadcaster_count.label Broadcasting'
|
echo 'broadcaster_count.label Broadcasting'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ def get_data():
|
||||||
base64string = base64.standard_b64encode('%s:%s' % (http_user, http_pass))
|
base64string = base64.standard_b64encode('%s:%s' % (http_user, http_pass))
|
||||||
if len(http_user) > 0 and len(http_pass) > 0:
|
if len(http_user) > 0 and len(http_pass) > 0:
|
||||||
#print "DEBUG: AUTH: " + base64string
|
#print "DEBUG: AUTH: " + base64string
|
||||||
request.add_header("Authorization", "Basic %s" % base64string)
|
request.add_header("Authorization", "Basic %s" % base64string)
|
||||||
#print "DEBUG: GET: " + url
|
#print "DEBUG: GET: " + url
|
||||||
raw_data = urllib2.urlopen(request).read()
|
raw_data = urllib2.urlopen(request).read()
|
||||||
#print "DEBUG: " + raw_data
|
#print "DEBUG: " + raw_data
|
||||||
|
@ -129,7 +129,7 @@ def munin_config(response):
|
||||||
for key in section:
|
for key in section:
|
||||||
print key + '.label ' + key.capitalize()
|
print key + '.label ' + key.capitalize()
|
||||||
print key + '.draw AREASTACK'
|
print key + '.draw AREASTACK'
|
||||||
|
|
||||||
if len(sys.argv) > 1 and sys.argv[1] == "config":
|
if len(sys.argv) > 1 and sys.argv[1] == "config":
|
||||||
munin_config(get_data())
|
munin_config(get_data())
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -80,7 +80,7 @@ case "$1" in
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "total"
|
echo "total"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
config)
|
config)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
log=/var/log/clamav/clamd.log
|
log=/var/log/clamav/clamd.log
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
if [ -r $log ]; then
|
if [ -r $log ]; then
|
||||||
echo "yes"
|
echo "yes"
|
||||||
else
|
else
|
||||||
echo "no (cannot read $log)"
|
echo "no (cannot read $log)"
|
||||||
|
@ -16,7 +16,7 @@ if [ "$1" = "config" ]; then
|
||||||
|
|
||||||
cat <<EOT
|
cat <<EOT
|
||||||
graph_title ClamAV stats
|
graph_title ClamAV stats
|
||||||
graph_args --base 1000 -l 0
|
graph_args --base 1000 -l 0
|
||||||
graph_vlabel virus/day
|
graph_vlabel virus/day
|
||||||
graph_category antivirus
|
graph_category antivirus
|
||||||
virus.label virus
|
virus.label virus
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#
|
#
|
||||||
# Author: Šarūnas Burdulis, sarunas(a)mail.saabnet.com, 2008
|
# Author: Šarūnas Burdulis, sarunas(a)mail.saabnet.com, 2008
|
||||||
#
|
#
|
||||||
# Runs 'condor_status' and counts virtual machines by their
|
# Runs 'condor_status' and counts virtual machines by their
|
||||||
# reported Condor "activity" (Idle, Busy, Suspended, Vacating, Benchmarking).
|
# reported Condor "activity" (Idle, Busy, Suspended, Vacating, Benchmarking).
|
||||||
#
|
#
|
||||||
# Parameters understood:
|
# Parameters understood:
|
||||||
#
|
#
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
# env.condor_status - Path to condor_status executable,
|
# env.condor_status - Path to condor_status executable,
|
||||||
# defaults to /usr/local/condor/bin/condor_status
|
# defaults to /usr/local/condor/bin/condor_status
|
||||||
# env.constraint - Condor ClassAds constraint(s), as they are
|
# env.constraint - Condor ClassAds constraint(s), as they are
|
||||||
# specified on the condor_status command line. For example,
|
# specified on the condor_status command line. For example,
|
||||||
# to monitor 64-bit Linux nodes set:
|
# to monitor 64-bit Linux nodes set:
|
||||||
# env.constraint 'arch=="x86_64" && opsys=="linux"'
|
# env.constraint 'arch=="x86_64" && opsys=="linux"'
|
||||||
#
|
#
|
||||||
|
@ -49,7 +49,7 @@ if [ ! -z "$constraint" ]; then
|
||||||
else
|
else
|
||||||
CONS=
|
CONS=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo "no"
|
echo "no"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -73,7 +73,7 @@ if [ "$1" = "config" ]; then
|
||||||
echo "idl.label Idle"
|
echo "idl.label Idle"
|
||||||
echo "idl.draw AREA"
|
echo "idl.draw AREA"
|
||||||
echo "idl.type GAUGE"
|
echo "idl.type GAUGE"
|
||||||
echo "idl.info Idle VMs"
|
echo "idl.info Idle VMs"
|
||||||
echo "bus.label Busy"
|
echo "bus.label Busy"
|
||||||
echo "bus.draw STACK"
|
echo "bus.draw STACK"
|
||||||
echo "bus.type GAUGE"
|
echo "bus.type GAUGE"
|
||||||
|
@ -94,12 +94,12 @@ if [ "$1" = "config" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "idl.value "
|
echo -n "idl.value "
|
||||||
eval $CS $CONS | grep Idle | wc -l
|
eval $CS $CONS | grep Idle | wc -l
|
||||||
echo -n "bus.value "
|
echo -n "bus.value "
|
||||||
eval $CS $CONS | grep Busy | wc -l
|
eval $CS $CONS | grep Busy | wc -l
|
||||||
echo -n "sus.value "
|
echo -n "sus.value "
|
||||||
eval $CS $CONS | grep Suspended | wc -l
|
eval $CS $CONS | grep Suspended | wc -l
|
||||||
echo -n "vac.value "
|
echo -n "vac.value "
|
||||||
eval $CS $CONS | grep Vacating | wc -l
|
eval $CS $CONS | grep Vacating | wc -l
|
||||||
echo -n "ben.value "
|
echo -n "ben.value "
|
||||||
eval $CS $CONS | grep Benchmarking | wc -l
|
eval $CS $CONS | grep Benchmarking | wc -l
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#
|
#
|
||||||
# Author: Šarūnas Burdulis, sarunas(a)mail.saabnet.com, 2008
|
# Author: Šarūnas Burdulis, sarunas(a)mail.saabnet.com, 2008
|
||||||
#
|
#
|
||||||
# Runs 'condor_status -server',
|
# Runs 'condor_status -server',
|
||||||
# gets totals for MIPS and KFLOPS.
|
# gets totals for MIPS and KFLOPS.
|
||||||
#
|
#
|
||||||
# Parameters understood:
|
# Parameters understood:
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
# env.condor_status - Path to condor_status executable,
|
# env.condor_status - Path to condor_status executable,
|
||||||
# defaults to /usr/local/condor/bin/condor_status
|
# defaults to /usr/local/condor/bin/condor_status
|
||||||
# env.constraint - Condor ClassAds constraint(s), as they are
|
# env.constraint - Condor ClassAds constraint(s), as they are
|
||||||
# specified on the condor_status command line. For example,
|
# specified on the condor_status command line. For example,
|
||||||
# to monitor 64-bit Linux nodes only, set:
|
# to monitor 64-bit Linux nodes only, set:
|
||||||
# env.constraint 'arch=="x86_64" && opsys=="linux"'
|
# env.constraint 'arch=="x86_64" && opsys=="linux"'
|
||||||
#
|
#
|
||||||
|
@ -50,7 +50,7 @@ if [ ! -z "$constraint" ]; then
|
||||||
else
|
else
|
||||||
CONS=
|
CONS=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo "no"
|
echo "no"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -75,30 +75,30 @@ if [ "$1" = "config" ]; then
|
||||||
echo 'mips_cur.min 0'
|
echo 'mips_cur.min 0'
|
||||||
echo 'mips_cur.max 200000'
|
echo 'mips_cur.max 200000'
|
||||||
echo 'mips_cur.type GAUGE'
|
echo 'mips_cur.type GAUGE'
|
||||||
echo "mips_cur.info Total (millions of integer operations)/s in Claimed nodes"
|
echo "mips_cur.info Total (millions of integer operations)/s in Claimed nodes"
|
||||||
echo 'mips_max.label MIPS max. possible'
|
echo 'mips_max.label MIPS max. possible'
|
||||||
echo 'mips_max.draw LINE'
|
echo 'mips_max.draw LINE'
|
||||||
echo 'mips_max.min 0'
|
echo 'mips_max.min 0'
|
||||||
echo 'mips_max.max 200000'
|
echo 'mips_max.max 200000'
|
||||||
echo 'mips_max.type GAUGE'
|
echo 'mips_max.type GAUGE'
|
||||||
echo "mips_max.info Total capability in (millions of integer operations)/s"
|
echo "mips_max.info Total capability in (millions of integer operations)/s"
|
||||||
echo 'mflops_cur.label MFLOPS claimed'
|
echo 'mflops_cur.label MFLOPS claimed'
|
||||||
echo 'mflops_cur.draw LINE2'
|
echo 'mflops_cur.draw LINE2'
|
||||||
echo 'mflops_cur.min 0'
|
echo 'mflops_cur.min 0'
|
||||||
echo 'mflops_cur.max 200000'
|
echo 'mflops_cur.max 200000'
|
||||||
echo 'mflops_cur.type GAUGE'
|
echo 'mflops_cur.type GAUGE'
|
||||||
echo "mflops_cur.info Total (millions of floating point operations)/s in Claimed nodes"
|
echo "mflops_cur.info Total (millions of floating point operations)/s in Claimed nodes"
|
||||||
echo 'mflops_max.label MFLOPS max. possible'
|
echo 'mflops_max.label MFLOPS max. possible'
|
||||||
echo 'mflops_max.draw LINE'
|
echo 'mflops_max.draw LINE'
|
||||||
echo 'mflops_max.min 0'
|
echo 'mflops_max.min 0'
|
||||||
echo 'mflops_max.max 200000'
|
echo 'mflops_max.max 200000'
|
||||||
echo 'mflops_max.type GAUGE'
|
echo 'mflops_max.type GAUGE'
|
||||||
echo "mflops_max.info Total capability in (millions of floating point operations)/s"
|
echo "mflops_max.info Total capability in (millions of floating point operations)/s"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# max possible:
|
# max possible:
|
||||||
#condor_status -cons 'arch=="x86_64" && opsys=="linux"' -totals -server
|
#condor_status -cons 'arch=="x86_64" && opsys=="linux"' -totals -server
|
||||||
# Machines Avail Memory Disk MIPS KFLOPS
|
# Machines Avail Memory Disk MIPS KFLOPS
|
||||||
# Total 30 30 48960 257925730 104576 31092042
|
# Total 30 30 48960 257925730 104576 31092042
|
||||||
eval $CS $CONS -totals -server | awk 'BEGIN { mipsc=0; mflopsc=0 } /Total/ {mips = $6; kflops = $7; mflops = int(kflops/1000) } END {print "mips_max.value " mips "\nmflops_max.value " mflops}'
|
eval $CS $CONS -totals -server | awk 'BEGIN { mipsc=0; mflopsc=0 } /Total/ {mips = $6; kflops = $7; mflops = int(kflops/1000) } END {print "mips_max.value " mips "\nmflops_max.value " mflops}'
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#
|
#
|
||||||
# Author: Šarūnas Burdulis, sarunas(a)mail.saabnet.com, 2008
|
# Author: Šarūnas Burdulis, sarunas(a)mail.saabnet.com, 2008
|
||||||
#
|
#
|
||||||
# Runs 'condor_q -g' (list global queue), tail's to the last
|
# Runs 'condor_q -g' (list global queue), tail's to the last
|
||||||
# line of output (contains job summary) and
|
# line of output (contains job summary) and
|
||||||
# gets numbers of queued, idle, running and held jobs.
|
# gets numbers of queued, idle, running and held jobs.
|
||||||
#
|
#
|
||||||
# Parameters understood:
|
# Parameters understood:
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
# env.condor_q - Path to condor_q executable,
|
# env.condor_q - Path to condor_q executable,
|
||||||
# defaults to /usr/local/condor/bin/condor_q
|
# defaults to /usr/local/condor/bin/condor_q
|
||||||
# env.title - Graph title, overrides "Condor Queue [suffix]".
|
# env.title - Graph title, overrides "Condor Queue [suffix]".
|
||||||
# env.options - Additional command line options to condor_q.
|
# env.options - Additional command line options to condor_q.
|
||||||
# Only a limited set of options can be used, as many
|
# Only a limited set of options can be used, as many
|
||||||
# of them eliminate the summary line from condor_q output.
|
# of them eliminate the summary line from condor_q output.
|
||||||
#
|
#
|
||||||
|
@ -87,7 +87,7 @@ if [ "$1" = "config" ]; then
|
||||||
echo "queue.label Queue"
|
echo "queue.label Queue"
|
||||||
echo "queue.draw LINE"
|
echo "queue.draw LINE"
|
||||||
echo "queue.type GAUGE"
|
echo "queue.type GAUGE"
|
||||||
echo "queue.info Queue"
|
echo "queue.info Queue"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
# env.condor_status - Path to condor_status executable,
|
# env.condor_status - Path to condor_status executable,
|
||||||
# defaults to /usr/local/condor/bin/condor_status
|
# defaults to /usr/local/condor/bin/condor_status
|
||||||
# env.constraint - Condor ClassAds constraint(s), as they are
|
# env.constraint - Condor ClassAds constraint(s), as they are
|
||||||
# specified on the condor_status command line. For example,
|
# specified on the condor_status command line. For example,
|
||||||
# to monitor 64-bit Linux nodes only, set:
|
# to monitor 64-bit Linux nodes only, set:
|
||||||
# env.constraint 'arch=="x86_64" && opsys=="linux"'
|
# env.constraint 'arch=="x86_64" && opsys=="linux"'
|
||||||
#
|
#
|
||||||
|
@ -49,7 +49,7 @@ if [ ! -z "$constraint" ]; then
|
||||||
else
|
else
|
||||||
CONS=
|
CONS=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ]; then
|
if [ "$1" = "autoconf" ]; then
|
||||||
echo "no"
|
echo "no"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -72,7 +72,7 @@ if [ "$1" = "config" ]; then
|
||||||
echo 'Preempting.label Preempting'
|
echo 'Preempting.label Preempting'
|
||||||
echo 'Preempting.draw AREA'
|
echo 'Preempting.draw AREA'
|
||||||
echo 'Preempting.type GAUGE'
|
echo 'Preempting.type GAUGE'
|
||||||
echo "Preempting.info Slots in Preempting state"
|
echo "Preempting.info Slots in Preempting state"
|
||||||
echo 'Claimed.label Claimed'
|
echo 'Claimed.label Claimed'
|
||||||
echo 'Claimed.draw STACK'
|
echo 'Claimed.draw STACK'
|
||||||
echo 'Claimed.type GAUGE'
|
echo 'Claimed.type GAUGE'
|
||||||
|
|
|
@ -47,7 +47,7 @@ type=$(basename "$0" | tr "_" "\n" | tail -1)
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
cat <<EOT
|
cat <<EOT
|
||||||
graph_title Courier log ($type)
|
graph_title Courier log ($type)
|
||||||
graph_args --base 1000 -l 0
|
graph_args --base 1000 -l 0
|
||||||
graph_vlabel events per second
|
graph_vlabel events per second
|
||||||
graph_category mail
|
graph_category mail
|
||||||
EOT
|
EOT
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
# that die may not appear on the graph, and anyway their last chunk of
|
# that die may not appear on the graph, and anyway their last chunk of
|
||||||
# CPU usage before they died is lost. You could modify this plugin to
|
# CPU usage before they died is lost. You could modify this plugin to
|
||||||
# read SAR/psacct records if you care about that.
|
# read SAR/psacct records if you care about that.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; version 2 dated June,
|
# as published by the Free Software Foundation; version 2 dated June,
|
||||||
|
|
|
@ -17,7 +17,7 @@ graph="$plugin"
|
||||||
style="AREA"
|
style="AREA"
|
||||||
cpus=$(grep -c ^processor /proc/cpuinfo)
|
cpus=$(grep -c ^processor /proc/cpuinfo)
|
||||||
|
|
||||||
run_watchdog() { # should also trap kill and term signals
|
run_watchdog() { # should also trap kill and term signals
|
||||||
kill -0 $(cat $pidfile) 2> /dev/null || rm -f $pidfile
|
kill -0 $(cat $pidfile) 2> /dev/null || rm -f $pidfile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ run_daemon() {
|
||||||
run_watchdog
|
run_watchdog
|
||||||
if [ -f $pidfile ]; then
|
if [ -f $pidfile ]; then
|
||||||
touch $pidfile
|
touch $pidfile
|
||||||
else
|
else
|
||||||
$pluginfull acquire &
|
$pluginfull acquire &
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -54,9 +54,9 @@ graph_title $graph
|
||||||
graph_category 1sec
|
graph_category 1sec
|
||||||
graph_vlabel average cpu use %
|
graph_vlabel average cpu use %
|
||||||
graph_scale no
|
graph_scale no
|
||||||
graph_total All CPUs
|
graph_total All CPUs
|
||||||
update_rate 1
|
update_rate 1
|
||||||
graph_data_size custom 1d, 10s for 1w, 1m for 1t, 5m for 1y
|
graph_data_size custom 1d, 10s for 1w, 1m for 1t, 5m for 1y
|
||||||
EOF
|
EOF
|
||||||
cpun=0
|
cpun=0
|
||||||
for ((i=0; i<$cpus; i++)); do
|
for ((i=0; i<$cpus; i++)); do
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ] ; then
|
if [ "$1" = "autoconf" ] ; then
|
||||||
if [ -n "$procs" ] ; then
|
if [ -n "$procs" ] ; then
|
||||||
echo "yes"
|
echo "yes"
|
||||||
else
|
else
|
||||||
|
@ -49,23 +49,23 @@ if [ "$1" = "config" ] ; then
|
||||||
echo 'graph_scale no'
|
echo 'graph_scale no'
|
||||||
echo 'graph_period second'
|
echo 'graph_period second'
|
||||||
echo "graph_order $cprocs"
|
echo "graph_order $cprocs"
|
||||||
|
|
||||||
for proc in $procs; do
|
for proc in $procs; do
|
||||||
cproc=${proc//[^A-Za-z0-9_]/_}
|
cproc=${proc//[^A-Za-z0-9_]/_}
|
||||||
echo "${cproc}.label $proc"
|
echo "${cproc}.label $proc"
|
||||||
echo "${cproc}.info CPU used by process $proc"
|
echo "${cproc}.info CPU used by process $proc"
|
||||||
done ;
|
done ;
|
||||||
|
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for proc in $procs ; do {
|
for proc in $procs ; do {
|
||||||
cproc=${proc//[^A-Za-z0-9_]/_}
|
cproc=${proc//[^A-Za-z0-9_]/_}
|
||||||
ps axo '%mem,comm,command' | grep -v grep | grep "$proc" | LC_ALL=us_US awk '
|
ps axo '%mem,comm,command' | grep -v grep | grep "$proc" | LC_ALL=us_US awk '
|
||||||
BEGIN {
|
BEGIN {
|
||||||
SUM=0
|
SUM=0
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
SUM+=1
|
SUM+=1
|
||||||
COMM=$2
|
COMM=$2
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = "autoconf" ] ; then
|
if [ "$1" = "autoconf" ] ; then
|
||||||
if [ -n "$procs" ] ; then
|
if [ -n "$procs" ] ; then
|
||||||
echo "yes"
|
echo "yes"
|
||||||
else
|
else
|
||||||
|
@ -49,13 +49,13 @@ if [ "$1" = "config" ] ; then
|
||||||
echo 'graph_scale no'
|
echo 'graph_scale no'
|
||||||
echo 'graph_period second'
|
echo 'graph_period second'
|
||||||
echo "graph_order $cprocs"
|
echo "graph_order $cprocs"
|
||||||
|
|
||||||
for proc in $procs; do
|
for proc in $procs; do
|
||||||
cproc=${proc//[^A-Za-z0-9_]/_}
|
cproc=${proc//[^A-Za-z0-9_]/_}
|
||||||
echo "${cproc}.label $proc"
|
echo "${cproc}.label $proc"
|
||||||
echo "${cproc}.info CPU used by process $proc"
|
echo "${cproc}.info CPU used by process $proc"
|
||||||
done ;
|
done ;
|
||||||
|
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -64,14 +64,14 @@ fi
|
||||||
for proc in $procs ; do {
|
for proc in $procs ; do {
|
||||||
cproc=${proc//[^A-Za-z0-9_]/_}
|
cproc=${proc//[^A-Za-z0-9_]/_}
|
||||||
ps axo 'pcpu,comm,command' | grep -v grep | grep "$proc" | LC_ALL=us_US awk '
|
ps axo 'pcpu,comm,command' | grep -v grep | grep "$proc" | LC_ALL=us_US awk '
|
||||||
BEGIN {
|
BEGIN {
|
||||||
SUM=0
|
SUM=0
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
SUM+=$1
|
SUM+=$1
|
||||||
}
|
}
|
||||||
END {
|
END {
|
||||||
print "'${cproc}'.value "SUM
|
print "'${cproc}'.value "SUM
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ except:
|
||||||
from urllib2 import Request
|
from urllib2 import Request
|
||||||
from urllib2 import urlopen
|
from urllib2 import urlopen
|
||||||
from urllib2 import URLError
|
from urllib2 import URLError
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def define_graph_types():
|
def define_graph_types():
|
||||||
|
@ -131,7 +131,7 @@ def request_data():
|
||||||
print("API request error: {0}". format(err), file=sys.stderr)
|
print("API request error: {0}". format(err), file=sys.stderr)
|
||||||
exit(1)
|
exit(1)
|
||||||
except:
|
except:
|
||||||
print("Unhandled error:", sys.exc_info()[0])
|
print("Unhandled error:", sys.exc_info()[0])
|
||||||
exit(1)
|
exit(1)
|
||||||
try:
|
try:
|
||||||
result = json.loads(txt.decode("utf-8"))
|
result = json.loads(txt.decode("utf-8"))
|
||||||
|
@ -158,7 +158,7 @@ def write_config_worker():
|
||||||
print("worker_{0}_hashrate.info Hashrate of worker '{1}'".format(worker_name, val["id"]))
|
print("worker_{0}_hashrate.info Hashrate of worker '{1}'".format(worker_name, val["id"]))
|
||||||
print("worker_{0}_hashrate.min 0".format(worker_name))
|
print("worker_{0}_hashrate.min 0".format(worker_name))
|
||||||
print("worker_{0}_hashrate.draw LINE1".format(worker_name))
|
print("worker_{0}_hashrate.draw LINE1".format(worker_name))
|
||||||
|
|
||||||
for val in worker_data:
|
for val in worker_data:
|
||||||
print("")
|
print("")
|
||||||
worker_name = "_".join(val["id"].split())
|
worker_name = "_".join(val["id"].split())
|
||||||
|
@ -234,7 +234,7 @@ def write_data_worker(data):
|
||||||
print("")
|
print("")
|
||||||
print("multigraph worker_shares_{0}.worker_{1}".format(account_address, worker_name))
|
print("multigraph worker_shares_{0}.worker_{1}".format(account_address, worker_name))
|
||||||
print("wshares.value {0} ".format(val["rating"]))
|
print("wshares.value {0} ".format(val["rating"]))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def write_config():
|
def write_config():
|
||||||
|
|
|
@ -25,7 +25,7 @@ cyrus-imapd - Munin plugin to monitor the load on a cyrus imapd server
|
||||||
=head1 CONFIGURATION
|
=head1 CONFIGURATION
|
||||||
|
|
||||||
The user running this plugin needs read and write access to the
|
The user running this plugin needs read and write access to the
|
||||||
cyrus-imapd proc directory. You will need to add the following to the
|
cyrus-imapd proc directory. You will need to add the following to the
|
||||||
munin-node/plugin configuration:
|
munin-node/plugin configuration:
|
||||||
|
|
||||||
[cyrus-imapd]
|
[cyrus-imapd]
|
||||||
|
@ -87,8 +87,8 @@ if [ "x${PROCDIR}x" = "xx" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If run with the "config"-parameter, give out information on how the
|
# If run with the "config"-parameter, give out information on how the
|
||||||
# graphs should look.
|
# graphs should look.
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
echo 'graph_title Cyrus IMAPd Load'
|
echo 'graph_title Cyrus IMAPd Load'
|
||||||
echo 'graph_args --base 1000 -l 0'
|
echo 'graph_args --base 1000 -l 0'
|
||||||
|
|
|
@ -91,7 +91,7 @@ for ( $i = 1; ($i < $#top and $quit == 0); $i++ ) {
|
||||||
print "sys.value " . $sys . "\n";
|
print "sys.value " . $sys . "\n";
|
||||||
print "user.value " . $usr . "\n";
|
print "user.value " . $usr . "\n";
|
||||||
print "idle.value " . $idl . "\n";
|
print "idle.value " . $idl . "\n";
|
||||||
$quit = 1;
|
$quit = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
# -*- perl -*-
|
# -*- perl -*-
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
@ -69,10 +69,10 @@ if ( defined($ARGV[0])) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@uptime = `/usr/bin/uptime`;
|
@uptime = `/usr/bin/uptime`;
|
||||||
foreach(@uptime) {
|
foreach(@uptime) {
|
||||||
$_ =~ m/^.+up (.+?), \d+ us.+$/;
|
$_ =~ m/^.+up (.+?), \d+ us.+$/;
|
||||||
$timestr = $1;
|
$timestr = $1;
|
||||||
if ( $timestr =~ m/^(\d+) day.+?$/ ) {
|
if ( $timestr =~ m/^(\d+) day.+?$/ ) {
|
||||||
$days = $1;
|
$days = $1;
|
||||||
} else { $days = 0; }
|
} else { $days = 0; }
|
||||||
|
|
|
@ -32,12 +32,12 @@ my $cmd = "ps -ef | awk '/[p]ppd/ {print substr(\$NF,2);}' | wc -l";
|
||||||
|
|
||||||
if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
|
if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
|
||||||
print "graph_category network\n";
|
print "graph_category network\n";
|
||||||
print "graph_args --base 1024 -r --lower-limit 0\n";
|
print "graph_args --base 1024 -r --lower-limit 0\n";
|
||||||
print "graph_title Number of VPN Connections\n";
|
print "graph_title Number of VPN Connections\n";
|
||||||
print "graph_vlabel VPN Connections\n";
|
print "graph_vlabel VPN Connections\n";
|
||||||
print "graph_info The Graph shows the Number of VPN Connections\n";
|
print "graph_info The Graph shows the Number of VPN Connections\n";
|
||||||
print "connections.label Number of VPN Connections\n";
|
print "connections.label Number of VPN Connections\n";
|
||||||
print "connections.type GAUGE\n";
|
print "connections.type GAUGE\n";
|
||||||
} else {
|
} else {
|
||||||
my $output = `$cmd`;
|
my $output = `$cmd`;
|
||||||
print "connections.value $output";
|
print "connections.value $output";
|
||||||
|
|
|
@ -51,7 +51,7 @@ elsif ( defined $ARGV[0] and $ARGV[0] eq "config" ) {
|
||||||
|
|
||||||
# Determine the available IP pools
|
# Determine the available IP pools
|
||||||
%pools = determine_pools();
|
%pools = determine_pools();
|
||||||
|
|
||||||
# Print a label for each pool
|
# Print a label for each pool
|
||||||
foreach $start (keys %pools) {
|
foreach $start (keys %pools) {
|
||||||
$label = ip2string($start);
|
$label = ip2string($start);
|
||||||
|
@ -63,10 +63,10 @@ elsif ( defined $ARGV[0] and $ARGV[0] eq "config" ) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my (@activeleases, %pools, $start, $end, $size, $free, $label, $lease);
|
my (@activeleases, %pools, $start, $end, $size, $free, $label, $lease);
|
||||||
|
|
||||||
# Determine all leased IP addresses
|
# Determine all leased IP addresses
|
||||||
@activeleases = determine_active_leases();
|
@activeleases = determine_active_leases();
|
||||||
|
|
||||||
# Determine the available IP pools
|
# Determine the available IP pools
|
||||||
%pools = determine_pools();
|
%pools = determine_pools();
|
||||||
|
|
||||||
|
@ -109,14 +109,14 @@ sub determine_pools {
|
||||||
|
|
||||||
# The range statement gives the lowest and highest IP addresses in a range.
|
# The range statement gives the lowest and highest IP addresses in a range.
|
||||||
$size = $end - $start + 1;
|
$size = $end - $start + 1;
|
||||||
|
|
||||||
$pools{$start} = $size;
|
$pools{$start} = $size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return %pools;
|
return %pools;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Very simple parser for dhcpd.leases. This will break very easily if dhcpd decides to
|
# Very simple parser for dhcpd.leases. This will break very easily if dhcpd decides to
|
||||||
# format the file differently. Ideally a simple recursive-descent parser should be used.
|
# format the file differently. Ideally a simple recursive-descent parser should be used.
|
||||||
#
|
#
|
||||||
# Returns an array with currently leased IP's
|
# Returns an array with currently leased IP's
|
||||||
|
@ -155,7 +155,7 @@ sub determine_active_leases {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set TZ back to its original setting
|
# Set TZ back to its original setting
|
||||||
if (defined($mytz)) {
|
if (defined($mytz)) {
|
||||||
$ENV{'TZ'} = $mytz;
|
$ENV{'TZ'} = $mytz;
|
||||||
|
@ -186,9 +186,9 @@ sub string2ip {
|
||||||
}
|
}
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns a dotted quad notation of an
|
# Returns a dotted quad notation of an
|
||||||
#
|
#
|
||||||
sub ip2string {
|
sub ip2string {
|
||||||
my $ip = shift;
|
my $ip = shift;
|
||||||
|
|
|
@ -19,8 +19,8 @@ env.fsroot /path/to/btrfs/filesystem
|
||||||
|
|
||||||
=head1 USAGE
|
=head1 USAGE
|
||||||
|
|
||||||
Link/Copy this plugin to /etc/munin/plugins/ and restart the munin-node.
|
Link/Copy this plugin to /etc/munin/plugins/ and restart the munin-node.
|
||||||
|
|
||||||
=head1 AUTHOR
|
=head1 AUTHOR
|
||||||
|
|
||||||
Alexander Knöbel <alex@belogy.de>
|
Alexander Knöbel <alex@belogy.de>
|
||||||
|
|
|
@ -60,7 +60,7 @@ if [ "$1" = "autoconf" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clean_name() {
|
clean_name() {
|
||||||
echo $1 $7 $2 | sed 's/[\/.-]/_/g'| awk "{
|
echo $1 $7 $2 | sed 's/[\/.-]/_/g'| awk "{
|
||||||
if (\$3 == \"tmpfs\")
|
if (\$3 == \"tmpfs\")
|
||||||
n=\$1\$2
|
n=\$1\$2
|
||||||
else
|
else
|
||||||
|
@ -80,12 +80,12 @@ if [ "$1" = "config" ]; then
|
||||||
df -T -P -l -x none -x unknown -x udf -x iso9660 -x romfs -x ramfs -x tmpfs | sed 1d | grep -v "//" | sort | while read i; do
|
df -T -P -l -x none -x unknown -x udf -x iso9660 -x romfs -x ramfs -x tmpfs | sed 1d | grep -v "//" | sort | while read i; do
|
||||||
name=`clean_name $i`
|
name=`clean_name $i`
|
||||||
echo -n "$name.label "
|
echo -n "$name.label "
|
||||||
echo $i | awk "{
|
echo $i | awk "{
|
||||||
dir=\$7
|
dir=\$7
|
||||||
if (length(dir) <= $MAXLABEL)
|
if (length(dir) <= $MAXLABEL)
|
||||||
print dir
|
print dir
|
||||||
else
|
else
|
||||||
printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3))
|
printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3))
|
||||||
print \"$name.info \" \$7 \" (\" \$2 \") -> \" \$1;
|
print \"$name.info \" \$7 \" (\" \$2 \") -> \" \$1;
|
||||||
}"
|
}"
|
||||||
echo "$name.warning 92"
|
echo "$name.warning 92"
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
# Requirements
|
# Requirements
|
||||||
# - bash (or change first line to sh instead of bash or any other shell)
|
# - bash (or change first line to sh instead of bash or any other shell)
|
||||||
# - existing and readable directory to scan
|
# - existing and readable directory to scan
|
||||||
# - du command, it exists on most of the *nix operating systems
|
# - du command, it exists on most of the *nix operating systems
|
||||||
#
|
#
|
||||||
#################################################################
|
#################################################################
|
||||||
#
|
#
|
||||||
# Configuration
|
# Configuration
|
||||||
#
|
#
|
||||||
# directory to check
|
# directory to check
|
||||||
|
@ -44,8 +44,8 @@ ID=1;
|
||||||
# Changelog
|
# Changelog
|
||||||
#
|
#
|
||||||
# Revision 0.1 Tue 03 Feb 2009 02:16:02 PM CET _KaszpiR_
|
# Revision 0.1 Tue 03 Feb 2009 02:16:02 PM CET _KaszpiR_
|
||||||
# - initial release,
|
# - initial release,
|
||||||
#
|
#
|
||||||
#################################################################
|
#################################################################
|
||||||
# Magick markers (optional - used by munin-config and som installation
|
# Magick markers (optional - used by munin-config and som installation
|
||||||
# scripts):
|
# scripts):
|
||||||
|
|
|
@ -33,7 +33,7 @@ print_details() {
|
||||||
val=`echo ${line#*:}`
|
val=`echo ${line#*:}`
|
||||||
val1=${val%% *}
|
val1=${val%% *}
|
||||||
[ -z "$line" ] && break
|
[ -z "$line" ] && break
|
||||||
|
|
||||||
case "$key" in
|
case "$key" in
|
||||||
"Mount count") myname=$1; mc=$val ;;
|
"Mount count") myname=$1; mc=$val ;;
|
||||||
"Maximum mount count") mmc=$val ;;
|
"Maximum mount count") mmc=$val ;;
|
||||||
|
@ -90,7 +90,7 @@ if [ "$1" = "config" ]; then
|
||||||
echo "graph_category disk"
|
echo "graph_category disk"
|
||||||
args="-l 0"
|
args="-l 0"
|
||||||
case "$plugin" in
|
case "$plugin" in
|
||||||
mounts)
|
mounts)
|
||||||
echo "graph_vlabel times"
|
echo "graph_vlabel times"
|
||||||
echo "graph_title Ext2 Filesystem mount details"
|
echo "graph_title Ext2 Filesystem mount details"
|
||||||
;;
|
;;
|
||||||
|
@ -98,14 +98,14 @@ if [ "$1" = "config" ]; then
|
||||||
echo "graph_vlabel days"
|
echo "graph_vlabel days"
|
||||||
echo "graph_title Ext2 Filesystem fsck interval"
|
echo "graph_title Ext2 Filesystem fsck interval"
|
||||||
;;
|
;;
|
||||||
writes)
|
writes)
|
||||||
args="$args --base 1024"
|
args="$args --base 1024"
|
||||||
echo "graph_vlabel bytes"
|
echo "graph_vlabel bytes"
|
||||||
echo "graph_title Ext2 Filesystem lifetime writes$blkdevAppend"
|
echo "graph_title Ext2 Filesystem lifetime writes$blkdevAppend"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
echo "graph_args $args"
|
echo "graph_args $args"
|
||||||
|
|
||||||
if [ -z "$blkdev" ]; then
|
if [ -z "$blkdev" ]; then
|
||||||
lse2
|
lse2
|
||||||
else
|
else
|
||||||
|
|
|
@ -8,23 +8,23 @@ case $1 in
|
||||||
COUNTER=1
|
COUNTER=1
|
||||||
while [ $COUNTER -gt 0 ]; do
|
while [ $COUNTER -gt 0 ]; do
|
||||||
FILE_PATH="file${COUNTER}_path"
|
FILE_PATH="file${COUNTER}_path"
|
||||||
|
|
||||||
# Is the path for this file specified?
|
# Is the path for this file specified?
|
||||||
eval FILE=\$$FILE_PATH
|
eval FILE=\$$FILE_PATH
|
||||||
if [ "$FILE" == "" ]; then
|
if [ "$FILE" == "" ]; then
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# It is! Add it to the graphs.
|
# It is! Add it to the graphs.
|
||||||
GRAPH_ORDER="$GRAPH_ORDER file_$COUNTER"
|
GRAPH_ORDER="$GRAPH_ORDER file_$COUNTER"
|
||||||
|
|
||||||
# Does this file have a specified label?
|
# Does this file have a specified label?
|
||||||
LABEL_COUNTER="file${COUNTER}_label"
|
LABEL_COUNTER="file${COUNTER}_label"
|
||||||
eval LABEL=\$$LABEL_COUNTER
|
eval LABEL=\$$LABEL_COUNTER
|
||||||
if [ "$LABEL" == "" ]; then
|
if [ "$LABEL" == "" ]; then
|
||||||
LABEL=`basename $FILE`
|
LABEL=`basename $FILE`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Associated warning level?
|
# Associated warning level?
|
||||||
WARNING="file${COUNTER}_warning"
|
WARNING="file${COUNTER}_warning"
|
||||||
eval WARNING=\$$WARNING
|
eval WARNING=\$$WARNING
|
||||||
|
@ -44,7 +44,7 @@ case $1 in
|
||||||
echo "file_$COUNTER.min 0"
|
echo "file_$COUNTER.min 0"
|
||||||
let COUNTER=COUNTER+1
|
let COUNTER=COUNTER+1
|
||||||
done;
|
done;
|
||||||
|
|
||||||
echo "graph_order $GRAPH_ORDER"
|
echo "graph_order $GRAPH_ORDER"
|
||||||
echo "graph_title File age"
|
echo "graph_title File age"
|
||||||
echo 'graph_args --base 1000 -l 0'
|
echo 'graph_args --base 1000 -l 0'
|
||||||
|
@ -63,14 +63,14 @@ while [ $COUNTER -gt 0 ]; do
|
||||||
if [ "$FILE" == "" ]; then
|
if [ "$FILE" == "" ]; then
|
||||||
break;
|
break;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the file isn't readable, say it's zero.
|
# If the file isn't readable, say it's zero.
|
||||||
if [ ! -r "$FILE" ]; then
|
if [ ! -r "$FILE" ]; then
|
||||||
VALUE=0
|
VALUE=0
|
||||||
else
|
else
|
||||||
VALUE=$(($(date +%s) - $(stat -c '%Y' "$FILE")))
|
VALUE=$(($(date +%s) - $(stat -c '%Y' "$FILE")))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "file_$COUNTER.value $VALUE"
|
echo "file_$COUNTER.value $VALUE"
|
||||||
let COUNTER=COUNTER+1
|
let COUNTER=COUNTER+1
|
||||||
done;
|
done;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# -*- sh -*-
|
# -*- sh -*-
|
||||||
#
|
#
|
||||||
# Multigraph plugin to monitor harddrive temperature, condition,
|
# Multigraph plugin to monitor harddrive temperature, condition,
|
||||||
# performance and estimated remaining lifetime through HDSentinel.
|
# performance and estimated remaining lifetime through HDSentinel.
|
||||||
#
|
#
|
||||||
# To use, download the latest HDSentinel for Linux x86 or x64 from
|
# To use, download the latest HDSentinel for Linux x86 or x64 from
|
||||||
|
|
|
@ -77,7 +77,7 @@ while (<HPT>)
|
||||||
$name =~ s/\ /_/g;
|
$name =~ s/\ /_/g;
|
||||||
# add the ID to be 100% unique
|
# add the ID to be 100% unique
|
||||||
$name .= '_'.$id;
|
$name .= '_'.$id;
|
||||||
|
|
||||||
if ($mode eq 'config')
|
if ($mode eq 'config')
|
||||||
{
|
{
|
||||||
# only needed here in config
|
# only needed here in config
|
||||||
|
@ -95,7 +95,7 @@ while (<HPT>)
|
||||||
}
|
}
|
||||||
# calc warning from threshold, 5% less
|
# calc warning from threshold, 5% less
|
||||||
my $warning = sprintf("%.0f", $threshold * 95 / 100);
|
my $warning = sprintf("%.0f", $threshold * 95 / 100);
|
||||||
|
|
||||||
print $name.".label ".$location."\n";
|
print $name.".label ".$location."\n";
|
||||||
print $name.".warning ".$warning."\n";
|
print $name.".warning ".$warning."\n";
|
||||||
print $name.".critical ".$threshold."\n";
|
print $name.".critical ".$threshold."\n";
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# Plugin to monitor the % of allocated area of a LVM snapshot
|
# Plugin to monitor the % of allocated area of a LVM snapshot
|
||||||
#
|
#
|
||||||
# Parameters:
|
# Parameters:
|
||||||
#
|
#
|
||||||
# config
|
# config
|
||||||
# autoconf
|
# autoconf
|
||||||
#
|
#
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
#
|
#
|
||||||
#%# family=auto
|
#%# family=auto
|
||||||
#%# capabilities=autoconf
|
#%# capabilities=autoconf
|
||||||
#
|
#
|
||||||
# 2011/05/20 - pmoranga - initial version
|
# 2011/05/20 - pmoranga - initial version
|
||||||
#
|
#
|
||||||
# 2012/01/27 - Sébastien Gross
|
# 2012/01/27 - Sébastien Gross
|
||||||
|
@ -35,7 +35,7 @@ fi
|
||||||
|
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
echo 'graph_title Allocated space for snapshot'
|
echo 'graph_title Allocated space for snapshot'
|
||||||
echo 'graph_vlabel %'
|
echo 'graph_vlabel %'
|
||||||
echo 'graph_category disk'
|
echo 'graph_category disk'
|
||||||
echo 'graph_args -l 0 -u 100 -r'
|
echo 'graph_args -l 0 -u 100 -r'
|
||||||
|
@ -48,7 +48,7 @@ ${lvdisplay} -C | awk '$3 ~ /^s/{print}' | while read line; do
|
||||||
origin="$(echo $line | awk '{print $5}')"
|
origin="$(echo $line | awk '{print $5}')"
|
||||||
origin="$(clean_fieldname "$origin")"
|
origin="$(clean_fieldname "$origin")"
|
||||||
percent="$(echo $line | awk '{print $6}')"
|
percent="$(echo $line | awk '{print $6}')"
|
||||||
|
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
echo "$id.label $name snapshot of $origin"
|
echo "$id.label $name snapshot of $origin"
|
||||||
else
|
else
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue