Whitespace cleanup

* remove trailing whitespace
* remove empty lines at the end of files
This commit is contained in:
Lars Kruse 2018-08-02 02:03:42 +02:00
parent ef851f0c34
commit 17f784270a
604 changed files with 2927 additions and 2945 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
#
#
# Plugin to monitor the amavis mail filter for Debian
# (based upon a plugin authored by Geoffroy Desvernay)
#
@ -32,7 +32,7 @@ BC=${bc:-`which bc`}
mktempfile () {
mktemp
}
}
if [ "$1" = "autoconf" ]; 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`
spam=`grep 'Blocked SPAM' ${TEMP_FILE} | wc -l`
other=`echo ${total}-${clean}-${virus}-${other}-${spam} | ${BC}`
/bin/rm -f $TEMP_FILE
fi

View File

@ -2,7 +2,7 @@
#
# Plugin to monitor Amavis virus and spam statistics.
#
#
#
# Based on a routine by William Towle
# 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.
@ -38,7 +38,7 @@ if [ "$1" = "config" ]; then
echo 'graph_args --base 1000 -l 0'
echo 'graph_order clean p_spam b_spam virus total'
echo 'clean.min 0'
echo 'clean.type ABSOLUTE'
#echo 'clean.cdef clean,60,*'
@ -70,12 +70,12 @@ fi
$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++ }
else if (index($0, "Passed SPAMMY")) { nb++ ; total++ }
{
if (index($0, "Passed CLEAN")) { na++ ; total++ }
else if (index($0, "Passed SPAMMY")) { nb++ ; total++ }
else if (index($0, "Blocked SPAMMY")) { nc++ ; total++ }
else if (index($0, "INFECTED")) { nd++ ; total++ }
}

View File

@ -1,13 +1,13 @@
#!/bin/sh
#
# 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
# available in aMule's configuration options. You will also need to tell aMule to save
# the signature file in '/tmp' .
# For detailed instructions with screenshots, see http://linux.andreagozzi.com/content/munin_stuff.php
#
#
#
# Parameters understood:
#
# config (required)

View File

@ -1,13 +1,13 @@
#!/bin/sh
#
# 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
# available in aMule's configuration options. You will also need to tell aMule to save
# the signature file in '/tmp' .
# For detailed instructions with screenshots, see http://linux.andreagozzi.com/content/munin_stuff.php
#
#
#
# Parameters understood:
#
# config (required)

View File

@ -1,13 +1,13 @@
#!/bin/sh
#
# 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
# available in aMule's configuration options. You will also need to tell aMule to save
# the signature file in '/tmp' .
# For detailed instructions with screenshots, see http://linux.andreagozzi.com/content/munin_stuff.php
#
#
#
# Parameters understood:
#
# config (required)

View File

@ -1,13 +1,13 @@
#!/bin/sh
#
# Plugin to monitor the current aMule ed2k/KAD client uptime.
#
#
# 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
# the signature file in '/tmp' .
# For detailed instructions with screenshots, see http://linux.andreagozzi.com/content/munin_stuff.php
#
#
#
# Parameters understood:
#
# config (required)

View File

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

View File

@ -3,7 +3,7 @@
# Raphaël Droz <raphael.droz@gmail.com> - 2016-01-08
#
# 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.
#
# 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.
# 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"
# 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
total => {
munin_fields => {
label => 'All requests',
label => 'All requests',
draw => 'LINE2',
info => 'Average seconds per any request',
},
sum => 0,
lines => 0,
matches => sub {
return 1;
matches => sub {
return 1;
},
},
@ -82,11 +82,11 @@ my $types = {
},
sum => 0,
lines => 0,
matches => sub {
my ($fields) = @_;
my $script;
($script = $fields->[6]) =~ s/\?.*\z //mx;
return $script =~ m{ \.(png|jpe?g|gif|tiff|ilbm|tga) \z }mx;
matches => sub {
my ($fields) = @_;
my $script;
($script = $fields->[6]) =~ s/\?.*\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);
}
}
my $config_file = `ls -1 $ACCESS_LOG_PATTERN | tail -n 1`;
@ -121,13 +121,13 @@ foreach my $line (@lines) {
$types->{$type}->{'lines'}++;
}
}
}
}
}
foreach my $type (keys %{$types}) {
my $value = $types->{$type}->{'lines'} ? $types->{$type}->{'sum'} / $types->{$type}->{'lines'} : 'U';
printf "%s.value %s\n", ($type, $value);
}
}

View File

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

View File

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

View File

@ -3,16 +3,16 @@ use strict;
#
# 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.
#
# Danny Fullerton <northox@mantor.org>
# Danny Fullerton <northox@mantor.org>
# Mantor Organization <www.mantor.org>
# This work is licensed under a MIT license.
#
# 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.
#
# - 'prod' => [ {'path' => '/home/prod/log/access.log'} ],
@ -74,7 +74,7 @@ foreach my $project ( keys %logs ) {
my @paths = glob $log->{'path'};
foreach my $path (@paths) {
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 : $!";
while (<LT>) {
my $buf = $_;

View File

@ -3,10 +3,10 @@ use strict;
#
# 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.
#
# Danny Fullerton <northox@mantor.org>
# Danny Fullerton <northox@mantor.org>
# Mantor Organization <www.mantor.org>
# 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"
# 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.
#
# - 'prod' => [ {'path' => '/home/prod/log/access.log'} ],
@ -81,7 +81,7 @@ foreach my $project ( keys %logs ) {
my @paths = glob $log->{'path'};
foreach my $path (@paths) {
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 : $!";
while (<LT>) {
my $buf = $_;

View File

@ -3,10 +3,10 @@ use strict;
#
# 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.
#
# Danny Fullerton <northox@mantor.org>
# Danny Fullerton <northox@mantor.org>
# Mantor Organization <www.mantor.org>
# 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"
# 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.
#
# - 'prod' => [ {'path' => '/home/prod/log/access.log'} ],
@ -84,7 +84,7 @@ foreach my $project ( keys %logs ) {
my @paths = glob $log->{'path'};
foreach my $path (@paths) {
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 : $!";
while (<LT>) {
my $buf = $_;

View File

@ -36,7 +36,7 @@ PROCS=$binname
if [ "$1" = "autoconf" ]; then
echo yes
echo yes
exit 0
fi
@ -65,5 +65,5 @@ VAL2=`ps auxf | grep ${PROCS} | grep ^${USR} | grep -v grep | awk '{s+=$6} END {
VAL3=`expr $VAL2 / $VAL1`
echo "servers.value $VAL3"

View File

@ -34,7 +34,7 @@ USR=$apuser
PROCS=$binname
if [ "$1" = "autoconf" ]; then
echo yes
echo yes
exit 0
fi

View File

@ -8,7 +8,7 @@
# to Apache2::SizeLimit.
# 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>
#

View File

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

View File

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

View File

@ -35,7 +35,7 @@ PROCS=$binname
if [ "$1" = "autoconf" ]; then
echo yes
echo yes
exit 0
fi
@ -60,5 +60,5 @@ VAL1=`ps auxf | grep ${PROCS} | grep -v grep | awk '{s+=$6} END {print s}'`
VAL2=`expr $VAL1 / 1024`
echo "servers.value $VAL2"

View File

@ -100,7 +100,7 @@ do
else
USERNAME[$I]="anonymous"
fi
NAME[$I]="_${USERNAME[I]}" # Output sort order
NAME[$I]="_${USERNAME[I]}" # Output sort order
else
NAME[$I]="${USERNAME[I]}"
fi
@ -140,7 +140,7 @@ then
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 )
for FILENAME in $( echo "$FILENAMES" | tail -n+2)
do
awk '{ printf "%s.label %s\n%s.draw STACK\n", $1, $3, $1 }' $FILENAME

View File

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

View File

@ -40,12 +40,12 @@ while (<STDIN>) {
# sanity check
next unless m/^([\d\w\.\-_]+\s){5}([\d\w\.\-_]+$)/; # escaped "." and "-"
# sitename to munin fieldname
my $vpm=clean_fieldname($vhost);
$temp{$vpm}{'label'}=$vhost;
$temp{$vpm}{'label'}=~s/www\.//;
# count all requests
$temp{$vpm}{'requests'}++;
@ -60,7 +60,7 @@ while (<STDIN>) {
# average bytes
$temp{$vpm}{'avg_bytes'}=$temp{$vpm}{'bytes'}/$temp{$vpm}{'requests'} || 0 if ($bytes);
}
# count by status / error code
$temp{$vpm}{"status"}{$status}++ if $status;
@ -77,9 +77,9 @@ while (<STDIN>) {
};
sub periodic_write {
# begin transaction
# begin transaction
$share->lock(LOCK_EX);
# 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

View File

@ -18,13 +18,13 @@ This plugin requires data from apache. You can get at the data in two ways:
- slightly less performant, but easier to apply to existing installations
- If you want response time stats, you have to log them in apache:
<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>
- 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.
Install plugin conf (after [apache_*])
[apache_vhosts]
@ -36,14 +36,14 @@ env.checks requests bytes time
# 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
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.
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.
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.
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.
With subgraphs off, you do 3 main graphs * 4 timescales (day, week, month, year).
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 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.
@ -152,7 +152,7 @@ ${site}_${graph}_$check.type GAUGE
END
} # end graph
} # end sites
} # end subgraph
} # end subgraph
} # end checks
@ -173,7 +173,7 @@ graph_period minute
graph_order $order
END
foreach my $site (keys %data) {
print <<END;
${site}_requests.label $data{$site}{'label'}
${site}_requests.info $site
@ -230,7 +230,7 @@ foreach my $check (keys %checks) {
} # end sites
if ($subgraphs{$check}) {
# subgraph values
# subgraph values
foreach my $site (keys %data) {
print "\nmultigraph apache_vhosts_$check.$site\n";
foreach my $graph ("avg","max") {

View File

@ -43,13 +43,13 @@ if (exists $ARGV[0] and $ARGV[0] eq "autoconf") {
}
my $ua = LWP::UserAgent->new (timeout => 30);
my @badports;
foreach my $port (@PORTS) {
my $url = sprintf $URL, $port;
my $response = $ua->request (HTTP::Request->new('GET', $url));
push @badports, $port unless $response->is_success;
}
if (@badports) {
print "no (no mod_watch exists on ports @badports)\n";
exit 1;
@ -76,7 +76,7 @@ foreach my $port (@PORTS) {
my ($server, undef, $ifInOctets, $ifOutOctets, $ifRequests,
$ifDocuments) = split (/\s/, $string, 6);
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";
}
}

View File

@ -22,38 +22,38 @@
#
# apache2.conf
# 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
# %D The time taken to serve the request, in microseconds.
# In our case %D -> 9
######################################################################################################
######################################################################################################
# GLOBALS
LOGFILE="/var/log/apache2/access.log"
BUFFER_SIZE=500
######################################################################################################
do_ () {
command="tail -n $BUFFER_SIZE $LOGFILE | awk '{sum=sum+\$9} END {print \"exec_time.value \"(sum/$BUFFER_SIZE)/1000000}'"
eval $command
exit 0
}
do_config () {
echo "graph_title Average page execution time"
echo "graph_vlabel Seconds"
echo "graph_category webserver"
echo "graph_args --base 1000 -l 0"
echo "graph_info Average page execution time"
echo "exec_time.label Execution time"
echo "exec_time.type GAUGE"
}
case $1 in
config|'')
eval do_$1
esac
exit $?

View File

@ -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
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
git clone git://github.com/munin-monitoring/contrib.git
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
# default if not set is 3540 (one hour)
# at the moment this is not used, the plugin always runs (if munin calls it)
#
#
env.CACHE_FILE_MAX_AGE 3540
# All these numbers are only for sorting, so you can use env.graph01_sort_by_0

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
"""
A munin plugin that prints archive and their upgradable packets
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
(WONTFIX unless someone asks for)
TODO:
TODO:
addinge alternative names for archives "stable -> squeeze"
TODO: add gray as
TODO: add gray as
foo.colour 000000
to 'now', '', '', '', '', 'Debian dpkg status file'
TODO: update only if system was updated (aptitutde update has been run)
check modification date of /var/cache/apt/pkgcache.bin
cache file must not be older than mod_date of pkgcache.bin + X
TODO: shorten ext_info with getShortestConfigOfOptions
TODO: check whether cachefile matches the config
TODO: shorten ext_info with getShortestConfigOfOptions
TODO: check whether cachefile matches the config
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
"""
import sys
@ -32,7 +32,7 @@ import argparse
import apt_pkg
from apt.progress.base import OpProgress
from time import time, strftime
import os
import os
import StringIO
import string
import re
@ -41,7 +41,7 @@ from types import StringTypes, TupleType, DictType, ListType, BooleanType
class EnvironmentConfigBroken(Exception): pass
# print environmental things
# print environmental things
# for k,v in os.environ.iteritems(): print >> sys.stderr, "%r : %r" % (k,v)
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='.')
CACHE_FILE = os.path.join(STATE_DIR, "deb_packages.state")
"""
"""
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
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)
"""
"""
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"
def fget(self):
class NullProgress(OpProgress):
""" used for do not giving any progress info,
while doing apt things used, cause documented
use of None as OpProgress did not worked in
""" used for do not giving any progress info,
while doing apt things used, cause documented
use of None as OpProgress did not worked in
python-apt 0.7
"""
def __init__(self):
@ -119,8 +119,8 @@ class Apt(object):
def update(*args,**kwords):
pass
if self._cache is None:
self._cache = apt_pkg.Cache(NullProgress())
if self._cache is None:
self._cache = apt_pkg.Cache(NullProgress())
return self._cache
return locals()
@ -129,7 +129,7 @@ class Apt(object):
doc = "apt_pkg.DepCache object"
def fget(self):
if self._depcache is None:
if self._depcache is None:
self._depcache = apt_pkg.DepCache(self.cache)
return self._depcache
@ -180,7 +180,7 @@ apt = Apt()
apt.installedPackages
apt.upgradablePackages
initialisation is lazy
initialisation is lazy
"""
def weightOfPackageFile(detail_tuple, option_tuple):
@ -214,7 +214,7 @@ def Tree():
class TreeTwig(defaultdict):
def __init__(self, defaultFactory):
super(TreeTwig, self).__init__(defaultFactory)
super(TreeTwig, self).__init__(defaultFactory)
def printAsTree(self, indent=0):
for k, tree in self.iteritems():
@ -245,16 +245,16 @@ class TreeTwig(defaultdict):
def getShortestConfigOfOptions(optionList = ['label', 'archive', 'site']):
"""
"""
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:
'component'
'label'
'site'
'archive'
'origin'
'architecture'
'origin'
'architecture'
Architecture values are usually the same and can be ignored.
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.
"""
l = optionList # just because l is much shorter
# creating possible iterations
fieldCount = len(optionList)
if fieldCount == 1:
selection = l
elif fieldCount == 2:
selection = [(x,y)
for x in l
selection = [(x,y)
for x in l
for y in l if x!=y ]
elif fieldCount == 3:
selection = [(x,y,z)
for x in l
for y in l if x!=y
selection = [(x,y,z)
for x in l
for y in l if x!=y
for z in l if z!=y and z!=x]
else:
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] )
return list(r[0]), r[1]
def getOptionsTree(cache, keys=None):
"""
t = getOptionsTree(cache, ['archive', 'site', 'label'])
@ -322,16 +322,16 @@ def createKey(key, file):
"""
if type(key) in StringTypes:
return file.__getattribute__(key)
elif type(key) in (TupleType, ListType):
elif type(key) in (TupleType, ListType):
nKey = tuple()
for pKey in key:
nKey = nKey.__add__((file.__getattribute__(pKey),))
return nKey
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):
"""
"""
primary muss ein iterable oder StringType sein
secondary muss iterable oder StringType sein
t1 = getOptionsTree2(apt.cache, 'origin', ['site', 'archive'])
@ -369,24 +369,24 @@ def getOptionsTree2(cache, primary=None, secondary=None):
dKey = file.__getattribute__(sKey)
d = d[dKey]
return t
#def getAttributeSet(iterable, attribute):
# return set(f.__getattribute__(attribute) for f in iterable)
#
#def getOrigins(cache):
# return getAttributeSet(cache.file_list, 'origin')
# return getAttributeSet(cache.file_list, 'origin')
#
#def getArchives(cache):
# return getAttributeSet(cache.file_list, 'archive')
# return getAttributeSet(cache.file_list, 'archive')
#
#def getComponents(cache):
# return getAttributeSet(cache.file_list, 'component')
# return getAttributeSet(cache.file_list, 'component')
#
#def getLabels(cache):
# return getAttributeSet(cache.file_list, 'label')
# return getAttributeSet(cache.file_list, 'label')
#
#def getSites(cache):
# return getAttributeSet(cache.file_list, 'site')
# return getAttributeSet(cache.file_list, 'site')
#
class PackageStat(defaultdict):
@ -397,16 +397,16 @@ class PackageStat(defaultdict):
with some abilities to print output munin likes
"""
sortDict = { 'label': defaultdict( lambda : 20,
{'Debian': 90,
sortDict = { 'label': defaultdict( lambda : 20,
{'Debian': 90,
'' : 1,
'Debian Security' : 90,
'Debian Backports': 90}),
'archive': defaultdict( lambda : 5,
{ 'now': 0,
{ 'now': 0,
'experimental': 10,
'unstable': 50,
'sid': 50,
'unstable': 50,
'sid': 50,
'testing': 70,
'wheezy': 70,
'squeeze-backports': 80,
@ -426,9 +426,9 @@ class PackageStat(defaultdict):
}
"""
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)
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' }
@ -443,7 +443,7 @@ class PackageStat(defaultdict):
'component' : 10**2,
}
"""
Dict that stores multipliers
Dict that stores multipliers
to compile a sorting value for each archivefile
"""
@ -483,7 +483,7 @@ class PackageStat(defaultdict):
def addPackage(self, sourceFile, package):
if self.packetHandler.decider(package):
self.packetHandler.adder(package, self)
@classmethod
def configD(cls, key, value):
i = { 'rrdName': cls.generate_rrd_name_from(key),
@ -514,8 +514,8 @@ class PackageStat(defaultdict):
print "{rrdName}.draw AREASTACK".format(**i)
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'.
"""
# setting defaults
@ -530,7 +530,7 @@ class PackageStat(defaultdict):
return isNow
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)
for options, item in self.options_sorted:
if not self.packetHandler.includeNow and self.optionIsDpkgStatus(details=options):
@ -555,7 +555,7 @@ packetHandlerD = {}
class PacketHandler(object):
"""
Baseclass, that represents the Interface which is used
Baseclass, that represents the Interface which is used
"""
type = None
@ -591,7 +591,7 @@ class PacketHandler(object):
return weightOfPackageFile(details, options)
class PacketHandlerUpgradable(PacketHandler):
type='upgradable'
includeNow = False
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
item = package
packageStat[keys].append(item)
# registering PackageHandler for Usage
packetHandlerD[PacketHandlerInstalled.type] = PacketHandlerInstalled
@ -637,7 +637,7 @@ class Munin(object):
def __init__(self, commandLineArgs=None):
self.commandLineArgs = commandLineArgs
self.argParser = self._argParser()
self.executionMatrix = {
self.executionMatrix = {
'config': self.config,
'run' : self.run,
'autoconf' : self.autoconf,
@ -685,7 +685,7 @@ class Munin(object):
else:
raise Exception('DPKG-statusfile %r not found, really strange!!!'%dpkgStatusFile)
newestFileTimestamp = max(timeL)
age = newestFileTimestamp - cacheMTime
age = newestFileTimestamp - cacheMTime
if age > 0:
return True
else:
@ -709,7 +709,7 @@ class Munin(object):
# cacheNeedUpdate = True
if self._cacheIsOutdated() or self.args.nocache:
# save stdout
# save stdout
stdoutDef = sys.stdout
try:
out = StringIO.StringIO()
@ -765,7 +765,7 @@ class Munin(object):
def _argParser(self):
parser = argparse.ArgumentParser(description="Show some statistics "\
"about debian packages installed on system by archive",
)
)
parser.set_defaults(command='run', debug=True, nocache=True)
parser.add_argument('--nocache', '-n', default=False, action='store_true',
@ -775,7 +775,7 @@ class Munin(object):
run ........ munin run (writes values)
autoconf ... writes 'yes'
"""
parser.add_argument('command', nargs='?',
parser.add_argument('command', nargs='?',
choices=['config', 'run', 'autoconf', 'drun'],
help='mode munin wants to use. "run" is default' + helpCommand)
return parser
@ -783,10 +783,10 @@ class Munin(object):
def _envParser(self):
"""
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.
[
{ 'type' = 'installed',
[
{ 'type' = 'installed',
'sort_by' = ['label', 'archive'],
'show_ext' = ['origin', 'site'],
},
@ -816,7 +816,7 @@ class Munin(object):
configPart['show_ext'][m.group('optNumber')] = os.getenv(var)
else:
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
for graphConfig in config.itervalues():
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"
raise EnvironmentConfigBroken("Environment Config broken")
# check for valid options for sort_by
unusableOptions = set(graph['sort_by']) - PackageStat.viewSet
if unusableOptions:
unusableOptions = set(graph['sort_by']) - PackageStat.viewSet
if unusableOptions:
print >> sys.stderr, \
"%r are not valid options for 'sort_by'" % (unusableOptions)
raise EnvironmentConfigBroken("Environment Config broken")
# check for valid options for sort_by
unusableOptions = set(graph['show_ext']) - PackageStat.viewSet
unusableOptions = set(graph['show_ext']) - PackageStat.viewSet
if unusableOptions:
print >> sys.stderr, \
"%r are not valid options for 'show_ext'" % (x)

View File

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

View File

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

View File

@ -73,13 +73,13 @@ unless( defined(@ARGV) ){
# =============== THE GET ====================
if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new();
$agent->agent("$agentname");
$agent->agent("$agentname");
$response = $agent->get( $url );
&response_error() unless $response->is_success;
@content = split( /\n/, $response->content );
my $line = "";
my $count = $index{from};
my $count = $index{from};
my $label;
my( $key, $value, $last );
while( 1 ){

View File

@ -12,7 +12,7 @@
use strict;
use warnings;
use File::Basename;
use File::Basename;
use LWP;
use Mail::Sendmail;
@ -53,11 +53,11 @@ unless( defined(@ARGV) ){
# =============== THE GET ====================
if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new();
$agent->agent("$agentname");
$agent->agent("$agentname");
$response = $agent->get( $url );
&response_error() unless $response->is_success;
@content = split( /\n/, $response->content );
my $line = "";
my $count = $index{from};
my $label;

View File

@ -17,23 +17,23 @@ use LWP;
use Mail::Sendmail;
# -------------------------- DEBUG VARS ---------------------------------
my $DEBUG = 0; # for debugging purpose
my $EMAILDEBUG = 0; # for email debugging
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 $from = "$pluginname-at-host\@guel.info"; # the host 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 $DEBUG = 0; # for debugging purpose
my $EMAILDEBUG = 0; # for email debugging
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 $from = "$pluginname-at-host\@guel.info"; # the host 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
# ------------------------- GLOBAL VARS ---------------------------------
my $version = "1.0"; # UA Version
my $agentname = "$pluginname Munin Plugin V$version"; # UA String
my $url = "http://localhost:55553/"; # (defaults to localhost)
my $response = 0; # the server output
my @content = (); # the content we're retrive from $response
my $version = "1.0"; # UA Version
my $agentname = "$pluginname Munin Plugin V$version"; # UA String
my $url = "http://localhost:55553/"; # (defaults to localhost)
my $response = 0; # the server output
my @content = (); # the content we're retrive from $response
my %index = ( # for Version 2
'from' => 66, # <-- index frame from ( a tweak for other ASSP Versions )
'to' => 100 # <-- index frame to ( "" )
'from' => 66, # <-- index frame from ( a tweak for other ASSP Versions )
'to' => 100 # <-- index frame to ( "" )
);
@ -85,13 +85,13 @@ unless( defined(@ARGV) ){
# =============== THE GET ====================
if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new();
$agent->agent("$agentname");
$agent->agent("$agentname");
$response = $agent->get( $url );
&response_error() unless $response->is_success;
@content = split( /\n/, $response->content );
my $line = "";
my $count = $index{from};
my $count = $index{from};
my $label;
my( $key, $value, $last );
while( 1 ){

View File

@ -63,13 +63,13 @@ unless( defined(@ARGV) ){
# =============== THE GET ====================
if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new();
$agent->agent("$agentname");
$agent->agent("$agentname");
$response = $agent->get( $url );
&response_error() unless $response->is_success;
@content = split( /\n/, $response->content );
my $line = "";
my $count = $index{from};
my $count = $index{from};
my $label;
my( $key, $value, $last );
while( 1 ){

View File

@ -12,7 +12,7 @@
use strict;
use warnings;
use File::Basename;
use File::Basename;
use LWP;
use Mail::Sendmail;
@ -53,11 +53,11 @@ unless( defined(@ARGV) ){
# =============== THE GET ====================
if( $ARGV[0] eq "" ){
my $agent = LWP::UserAgent->new();
$agent->agent("$agentname");
$agent->agent("$agentname");
$response = $agent->get( $url );
&response_error() unless $response->is_success;
@content = split( /\n/, $response->content );
my $line = "";
my $count = $index{from};
my $label;

View File

@ -193,7 +193,7 @@ multigraph asterisk_codecs
graphs_title Asterisk channels per codec
graph_args --base 1000 -l 0
graph_vlabel channels
graph_category voip
graph_category voip
END
foreach my $codec (@CODECS) {

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

@ -77,7 +77,7 @@ address with the copyright notice upgrade with your name.
use strict;
use Asterisk::AMI;
eval "use Asterisk::AMI";
eval "use Asterisk::AMI";
print "Asterisk::AMI not found. Exiting...\n" if $@;
exit( 0 ) if $@;

View File

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

View File

@ -5,7 +5,7 @@
# Converted to /bin/sh by Steve Schnepp
# June 2012
# Version 1.0
#
#
# Run as root or make sure munin user can run 'asterisk -r' command
#
# [asterisk_channels]

View File

@ -1,7 +1,7 @@
#!/bin/sh
#
# add this into munin/plugin-conf.d/plugins.conf:
#
#
# [asterisk_inuse]
# user root
#

View File

@ -16,7 +16,7 @@ PORTAUDIT=/usr/local/sbin/portaudit
if [ "$1" = "autoconf" ]; then
if [ -x $PORTAUDIT ]; then
echo yes
echo yes
exit 0
else
echo no '(portaudit not found)'

View File

@ -1,5 +1,5 @@
#!/usr/bin/perl -w
# -*- perl -*-
# -*- perl -*-
=head1 NAME
@ -41,8 +41,8 @@ The plugin shows:
#%# family=power
=head1 VERSION
=head1 BUGS
=head1 VERSION
=head1 BUGS
None known.
@ -99,7 +99,7 @@ sub read_data
$val = "unknown";
}
elsif ( $var ne "batery type" or $var ne "serial number" or $var ne "OEM info" )
{
{
@tmp = split(" " ,$val);
$val = trim($tmp[0]);
}

View File

@ -1,5 +1,5 @@
#!/usr/bin/perl -w
# -*- perl -*-
# -*- perl -*-
=head1 NAME
@ -36,8 +36,8 @@ The plugin shows:
#%# family=power
=head1 VERSION
=head1 BUGS
=head1 VERSION
=head1 BUGS
None known.

View File

@ -1,5 +1,5 @@
#!/usr/bin/perl -w
# -*- perl -*-
# -*- perl -*-
=head1 NAME
@ -35,11 +35,11 @@ The plugin shows:
#%# family=power
#%# capabilities=autoconf
=head1 VERSION
=head1 VERSION
1.0
=head1 BUGS
=head1 BUGS
None known.
@ -219,7 +219,7 @@ sub read_data
}
my $graphs =
my $graphs =
{
'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/] },
@ -231,7 +231,7 @@ my $graphs =
'fields' => [qw/present_rate/] }
};
my $fields =
my $fields =
{
'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' },
@ -250,7 +250,7 @@ my $fields =
# ------------------------------------ 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)");
exit (0);

View File

@ -23,7 +23,7 @@ STATEFILE=$MUNIN_PLUGSTATE/${B3NAME}.offset
mktempfile () {
mktemp -t $1
}
}
if [ "$1" = "autoconf" ]; then
@ -49,7 +49,7 @@ fi
if [ "$1" = "config" ]; then
echo "graph_title BigBrotherBot errors - ${B3NAME}"
cat <<'EOM'
cat <<'EOM'
graph_args --base 1000 -l 0
graph_vlabel Errors
graph_category Games

View File

@ -84,7 +84,7 @@ sub do_stats {
if ($3 eq 'IN' and $4 !~ /^TYPE/) {
my $crr = lc $2;
$IN{$crr}++;
}
}
}
}
close(Q);

View File

@ -288,7 +288,7 @@ Linux machines running BOINC and munin-node
- 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)
=head1 CONFIGURATION
@ -319,48 +319,48 @@ Warning level - minimum estimated work (default: 24.00 hours)
=item B<password>
Password for BOINC (default: none)
Password for BOINC (default: none)
=back
=head2 B<Security Consideration:>
Using of variable B<password> poses a security risk. Even if the Munin
configuration file for this plugin containing BOINC-password is properly
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
machine running this plugin to eavesdrop the BOINC password.
Using of variable B<password> poses a security risk. Even if the Munin
configuration file for this plugin containing BOINC-password is properly
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
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.
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.
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
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.
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
protected by file permissions.
=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 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).
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.
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.
=head1 EXAMPLES
=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</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.
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:
[boinc_*]
@ -371,17 +371,17 @@ Warning will be set when estimated work for any of CPUs will decrease under
=head2 Remote BOINC Example
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
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
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>.
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>.
These files are owned and readable by root, readable by group munin and not
readable by others.
There are 2 symbolic links to this plugin created in the munin plugins
directory (usually F</etc/munin/plugins/>): F<snmp_foo_boincestwk> and
These files are owned and readable by root, readable by group munin and not
readable by others.
There are 2 symbolic links to this plugin created in the munin plugins
directory (usually F</etc/munin/plugins/>): F<snmp_foo_boincestwk> and
F<snmp_bar_boincestwk>
[snmp_foo_boinc*]
@ -396,33 +396,33 @@ F<snmp_bar_boincestwk>
env.host 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).
=head1 BUGS
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.
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
different.
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
4 hours each.
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.
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
different.
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
4 hours each.
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
of those 4-hours workunits, BOINC will schedule short workunits first (for all
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
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
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.
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
directory from distribution (e.g. F</var/lib/boinc/> in Debian or Ubuntu), but
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
directory from distribution (e.g. F</var/lib/boinc/> in Debian or Ubuntu), but
often running in user directories or in other separate directories.
Also the user-ID under which BOINC runs often differs.
Under these circumstances the C<autoconf> would be either lame or too
Also the user-ID under which BOINC runs often differs.
Under these circumstances the C<autoconf> would be either lame or too
complicated.
=head1 AUTHOR

View File

@ -5,12 +5,12 @@
# Parameters:
#
# 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)
# host -- the host to connect to (default: localhost)
# 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.
#
# Author: Petr Ruzicka <petr.ruzicka@gmail.com>
@ -49,14 +49,14 @@ sub autoconf {
$reply =~ /<nonce>(.*)<\/nonce>/;
$hash = md5_hex($1, $password);
print $client "<boinc_gui_rpc_request><auth2><nonce_hash>$hash</nonce_hash></auth2></boinc_gui_rpc_request>\003";
{
local $/ = "\003";
$reply = <$client>;
}
if ($reply =~ /<authorized\/>/) {
print "yes\n";
exit 0;
@ -70,29 +70,29 @@ sub config {
my $client = IO::Socket::INET->new ( PeerAddr => $host,
PeerPort => $port,
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";
{
{
local $/ = "\003";
$reply = <$client>;
}
$reply =~ /<nonce>(.*)<\/nonce>/;
my $hash = md5_hex($1, $password);
print $client "<boinc_gui_rpc_request><auth2><nonce_hash>$hash</nonce_hash></auth2></boinc_gui_rpc_request>\003";
{
local $/ = "\003";
$reply = <$client>;
}
if ($reply !~ /<authorized\/>/) {
die "Wrong password: $_";
}
print $client "<boinc_gui_rpc_request><get_state></boinc_gui_rpc_request>";
while (chomp($reply = <$client>) && ($reply ne "</boinc_gui_rpc_reply>")) {
@ -101,7 +101,7 @@ sub config {
print "graph_category htc\n";
print "graph_args -l 0\n";
print "graph_vlabel %\n";
}
}
if ($reply =~ /<project_name>(.*)<\/project_name>/) {
my $boinc_munin_name=$1;
$boinc_munin_name =~ /(\w+).*/;
@ -115,31 +115,31 @@ sub report {
my $client = IO::Socket::INET->new ( PeerAddr => $host,
PeerPort => $port,
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";
{
{
local $/ = "\003";
$reply = <$client>;
}
$reply =~ /<nonce>(.*)<\/nonce>/;
my $hash = md5_hex($1, $password);
print $client "<boinc_gui_rpc_request><auth2><nonce_hash>$hash</nonce_hash></auth2></boinc_gui_rpc_request>\003";
{
local $/ = "\003";
$reply = <$client>;
}
if ($reply !~ /<authorized\/>/) {
die "Wrong password: $_";
}
print $client "<boinc_gui_rpc_request><get_state></boinc_gui_rpc_request>";
while (chomp($reply = <$client>) && ($reply ne "</boinc_gui_rpc_reply>")) {
if ($reply =~ /<project_name>(\w+).*<\/project_name>/) {
$project = $1;

View File

@ -279,7 +279,7 @@ Linux machines running BOINC and munin-node
- 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)
=head1 CONFIGURATION
@ -306,40 +306,40 @@ Directory containing appropriate file gui_rpc_auth.cfg (default: none)
=item B<password>
Password for BOINC (default: none)
Password for BOINC (default: none)
=back
=head2 B<Security Consideration:>
Using of variable B<password> poses a security risk. Even if the Munin
configuration file for this plugin containing BOINC-password is properly
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
machine running this plugin to eavesdrop the BOINC password.
Using of variable B<password> poses a security risk. Even if the Munin
configuration file for this plugin containing BOINC-password is properly
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
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.
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.
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
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.
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
protected by file permissions.
=head1 INTERPRETATION
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
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
are displayed.
=head1 EXAMPLES
=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</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:
[boinc_*]
@ -349,17 +349,17 @@ to protect access to BOINC:
=head2 Remote BOINC Example
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
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
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>.
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>.
These files are owned and readable by root, readable by group munin and not
readable by others.
There are 2 symbolic links to this plugin created in the munin plugins
directory (usually F</etc/munin/plugins/>): F<boincprojs_foo> and
These files are owned and readable by root, readable by group munin and not
readable by others.
There are 2 symbolic links to this plugin created in the munin plugins
directory (usually F</etc/munin/plugins/>): F<boincprojs_foo> and
F<boincprojs_bar>
[boincprojs_foo]
@ -379,12 +379,12 @@ SNMP and IPMI plugins.
=head1 BUGS
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
directory from distribution (e.g. F</var/lib/boinc/> in Debian or Ubuntu), but
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
directory from distribution (e.g. F</var/lib/boinc/> in Debian or Ubuntu), but
often running in user directories or in other separate directories.
Also the user-ID under which BOINC runs often differs.
Under these circumstances the C<autoconf> would be either lame or too
Also the user-ID under which BOINC runs often differs.
Under these circumstances the C<autoconf> would be either lame or too
complicated.
=head1 AUTHOR

View File

@ -317,7 +317,7 @@ Linux machines running BOINC and munin-node
- 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)
=head1 CONFIGURATION
@ -348,45 +348,45 @@ Display unusual states details (default: 0 = Summarize unusual states as C<other
=item B<password>
Password for BOINC (default: none)
Password for BOINC (default: none)
=back
=head2 B<Security Consideration:>
Using of variable B<password> poses a security risk. Even if the Munin
configuration file for this plugin containing BOINC-password is properly
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
machine running this plugin to eavesdrop the BOINC password.
Using of variable B<password> poses a security risk. Even if the Munin
configuration file for this plugin containing BOINC-password is properly
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
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.
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.
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
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.
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
protected by file permissions.
=head1 INTERPRETATION
This plugin shows how many BOINC workunits are in all the various states.
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
This plugin shows how many BOINC workunits are in all the various states.
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
displayed. All other states are shown as C<other>.
If the variable B<verbose> is used, additionally also states
C<Computation Error> and C<Aborted> are shown separately (they are included in
C<other> otherwise).
If the variable B<verbose> is used, additionally also states
C<Computation Error> and C<Aborted> are shown separately (they are included in
C<other> otherwise).
=head1 EXAMPLES
=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</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:
[boinc_*]
@ -397,17 +397,17 @@ to protect access to BOINC:
=head2 Remote BOINC Example
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
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
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>.
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>.
These files are owned and readable by root, readable by group munin and not
readable by others.
There are 2 symbolic links to this plugin created in the munin plugins
directory (usually F</etc/munin/plugins/>): F<snmp_foo_boincwus> and
These files are owned and readable by root, readable by group munin and not
readable by others.
There are 2 symbolic links to this plugin created in the munin plugins
directory (usually F</etc/munin/plugins/>): F<snmp_foo_boincwus> and
F<snmp_bar_boincwus>
[snmp_foo_boinc*]
@ -422,17 +422,17 @@ F<snmp_bar_boincwus>
env.host 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).
=head1 BUGS
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
directory from distribution (e.g. F</var/lib/boinc/> in Debian or Ubuntu), but
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
directory from distribution (e.g. F</var/lib/boinc/> in Debian or Ubuntu), but
often running in user directories or in other separate directories.
Also the user-ID under which BOINC runs often differs.
Under these circumstances the C<autoconf> would be either lame or too
Also the user-ID under which BOINC runs often differs.
Under these circumstances the C<autoconf> would be either lame or too
complicated.
=head1 AUTHOR

View File

@ -57,7 +57,7 @@ graph_info Filesystem usage
for i in range(1,len(rawdata)):
dataline=rawdata[i].split()
self.parsed_data[re.sub('/', '_', dataline[0])] = (int(dataline[1]), int(dataline[2]), dataline[5])
if __name__ == "__main__":
processor = checker()
processor.get_data()

View File

@ -55,7 +55,7 @@ graph_info Filesystem usage
for i in range(1,len(rawdata)):
dataline=rawdata[i].split()
self.parsed_data[re.sub('/', '_', dataline[0])] = (re.sub('%', '', dataline[4]), dataline[5])
if __name__ == "__main__":
processor = checker()
processor.get_data()

View File

@ -77,4 +77,4 @@ black.label Blacklisted"""
processor = checker(blacklists)
processor.process_lines(logfile)
print processor

View File

@ -68,4 +68,4 @@ tarpit.label Average tarpit delay"""
processor = checker()
processor.process_lines(logfile)
print processor

View File

@ -79,7 +79,7 @@ def get_data(what, api_url, *args):
except IOError:
print 'Could not connect to the celerymon webserver'
sys.exit(-1)
def check_web_server_status(api_url):
try:
request = urllib.urlopen(api_url)
@ -104,25 +104,25 @@ def print_config(task_names):
print '%s.type DERIVE' % (clean_task_name(name))
print '%s.min 0' % (clean_task_name(name))
print '%s.info number of %s tasks' % (clean_task_name(name), name)
# Values
def print_values(task_names = None, api_url = None):
for task_name in task_names:
count = len(get_data('task_details', api_url, task_name))
print '%s.value %d' % (clean_task_name(task_name), count)
if __name__ == '__main__':
task_names = os.environ.get('tasks', None)
api_url = os.environ.get('api_url', API_URL)
check_web_server_status(api_url)
if not task_names:
print 'You need to define at least one task name'
sys.exit(-1)
task_names = task_names.split(',')
if len(sys.argv) > 1:
if sys.argv[1] == 'config':
print_config(task_names)

View File

@ -82,7 +82,7 @@ def get_data(what, api_url, *args):
except IOError:
print 'Could not connect to the celerymon webserver'
sys.exit(-1)
def check_web_server_status(api_url):
try:
request = urllib.urlopen(api_url)
@ -115,33 +115,33 @@ def print_config(workers = None):
# Values
def print_values(workers = None, api_url = None):
data = get_data('tasks', api_url)
counters = dict([(key, 0) for key in TASK_STATES])
for task_name, task_data in data:
state = task_data['state']
hostname = task_data['worker']['hostname']
if workers and hostname not in workers:
continue
counters[state] += 1
for name in TASK_STATES:
name_cleaned = clean_state_name(name)
value = counters[name]
print '%s.value %d' % (name_cleaned, value)
if __name__ == '__main__':
workers = os.environ.get('workers', 'all')
api_url = os.environ.get('api_url', API_URL)
check_web_server_status(api_url)
if workers in [None, '', 'all']:
workers = None
else:
workers = workers.split(',')
if len(sys.argv) > 1:
if sys.argv[1] == 'config':
print_config(workers)
@ -149,4 +149,4 @@ if __name__ == '__main__':
print 'yes'
else:
print_values(workers, api_url)

View File

@ -31,7 +31,7 @@ Jort Bloem
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
mean you should.
mean you should.
This program needs a rewrite, and if there were any problems with it,
I probably would.
@ -102,7 +102,7 @@ def read_osd(filename):
return json.loads(result)
except:
pass
return None
def osd_list():

View File

@ -36,7 +36,7 @@ WARNING_LEVEL=${warning_level:-"80"}
CRITICAL_LEVEL=${critical_level:-"90"}
if [ "$1" = "config" ]; then
echo 'graph_title CEPH capacity'
echo 'graph_category fs'
echo 'graph_vlabel GB'

View File

@ -28,7 +28,7 @@ fi
if [ "$1" = "config" ]; then
echo 'graph_title CEPH OSDs'
echo 'graph_category fs'
echo 'graph_vlabel nr'

View File

@ -65,7 +65,7 @@ for i in environ.get('petitions').split():
continue
# 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')),
data=None,
data=None,
headers={ 'User-Agent': 'curl/7.38.0' })
response = urllib.request.urlopen(req).read().decode('utf-8')
petition_titles[i] = json.loads(response)

View File

@ -4,7 +4,7 @@
#########################
# Munin Plugin to track monitor the number of users a tinychat room gets.
# Author Phil Wray ( http://www.infjs.com )
#
#
#
#
# Usage:
@ -40,7 +40,7 @@ echo "graph_title Tinychat Users for $room"
echo 'total_count.label Room Users'
echo 'total_count.draw AREA'
echo 'broadcaster_count.draw STACK'
echo 'broadcaster_count.label Broadcasting'
echo 'broadcaster_count.label Broadcasting'
exit 0
fi

View File

@ -82,7 +82,7 @@ def get_data():
base64string = base64.standard_b64encode('%s:%s' % (http_user, http_pass))
if len(http_user) > 0 and len(http_pass) > 0:
#print "DEBUG: AUTH: " + base64string
request.add_header("Authorization", "Basic %s" % base64string)
request.add_header("Authorization", "Basic %s" % base64string)
#print "DEBUG: GET: " + url
raw_data = urllib2.urlopen(request).read()
#print "DEBUG: " + raw_data
@ -129,7 +129,7 @@ def munin_config(response):
for key in section:
print key + '.label ' + key.capitalize()
print key + '.draw AREASTACK'
if len(sys.argv) > 1 and sys.argv[1] == "config":
munin_config(get_data())
else:

View File

@ -80,7 +80,7 @@ case "$1" in
done
echo "total"
exit 0
;;
config)

View File

@ -4,7 +4,7 @@
log=/var/log/clamav/clamd.log
if [ "$1" = "autoconf" ]; then
if [ -r $log ]; then
if [ -r $log ]; then
echo "yes"
else
echo "no (cannot read $log)"
@ -16,7 +16,7 @@ if [ "$1" = "config" ]; then
cat <<EOT
graph_title ClamAV stats
graph_args --base 1000 -l 0
graph_args --base 1000 -l 0
graph_vlabel virus/day
graph_category antivirus
virus.label virus

View File

@ -4,8 +4,8 @@
#
# Author: Šarūnas Burdulis, sarunas(a)mail.saabnet.com, 2008
#
# Runs 'condor_status' and counts virtual machines by their
# reported Condor "activity" (Idle, Busy, Suspended, Vacating, Benchmarking).
# Runs 'condor_status' and counts virtual machines by their
# reported Condor "activity" (Idle, Busy, Suspended, Vacating, Benchmarking).
#
# Parameters understood:
#
@ -18,7 +18,7 @@
# env.condor_status - Path to condor_status executable,
# defaults to /usr/local/condor/bin/condor_status
# 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:
# env.constraint 'arch=="x86_64" && opsys=="linux"'
#
@ -49,7 +49,7 @@ if [ ! -z "$constraint" ]; then
else
CONS=
fi
if [ "$1" = "autoconf" ]; then
echo "no"
exit 1
@ -73,7 +73,7 @@ if [ "$1" = "config" ]; then
echo "idl.label Idle"
echo "idl.draw AREA"
echo "idl.type GAUGE"
echo "idl.info Idle VMs"
echo "idl.info Idle VMs"
echo "bus.label Busy"
echo "bus.draw STACK"
echo "bus.type GAUGE"
@ -94,12 +94,12 @@ if [ "$1" = "config" ]; then
fi
echo -n "idl.value "
eval $CS $CONS | grep Idle | wc -l
eval $CS $CONS | grep Idle | wc -l
echo -n "bus.value "
eval $CS $CONS | grep Busy | wc -l
eval $CS $CONS | grep Busy | wc -l
echo -n "sus.value "
eval $CS $CONS | grep Suspended | wc -l
eval $CS $CONS | grep Suspended | wc -l
echo -n "vac.value "
eval $CS $CONS | grep Vacating | wc -l
eval $CS $CONS | grep Vacating | wc -l
echo -n "ben.value "
eval $CS $CONS | grep Benchmarking | wc -l
eval $CS $CONS | grep Benchmarking | wc -l

View File

@ -5,7 +5,7 @@
#
# Author: Šarūnas Burdulis, sarunas(a)mail.saabnet.com, 2008
#
# Runs 'condor_status -server',
# Runs 'condor_status -server',
# gets totals for MIPS and KFLOPS.
#
# Parameters understood:
@ -19,7 +19,7 @@
# env.condor_status - Path to condor_status executable,
# defaults to /usr/local/condor/bin/condor_status
# 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:
# env.constraint 'arch=="x86_64" && opsys=="linux"'
#
@ -50,7 +50,7 @@ if [ ! -z "$constraint" ]; then
else
CONS=
fi
if [ "$1" = "autoconf" ]; then
echo "no"
exit 1
@ -75,30 +75,30 @@ if [ "$1" = "config" ]; then
echo 'mips_cur.min 0'
echo 'mips_cur.max 200000'
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.draw LINE'
echo 'mips_max.min 0'
echo 'mips_max.max 200000'
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.draw LINE2'
echo 'mflops_cur.min 0'
echo 'mflops_cur.max 200000'
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.draw LINE'
echo 'mflops_max.min 0'
echo 'mflops_max.max 200000'
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
fi
# 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
# 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}'

View File

@ -4,8 +4,8 @@
#
# Author: Šarūnas Burdulis, sarunas(a)mail.saabnet.com, 2008
#
# Runs 'condor_q -g' (list global queue), tail's to the last
# line of output (contains job summary) and
# Runs 'condor_q -g' (list global queue), tail's to the last
# line of output (contains job summary) and
# gets numbers of queued, idle, running and held jobs.
#
# Parameters understood:
@ -19,7 +19,7 @@
# env.condor_q - Path to condor_q executable,
# defaults to /usr/local/condor/bin/condor_q
# 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
# of them eliminate the summary line from condor_q output.
#
@ -87,7 +87,7 @@ if [ "$1" = "config" ]; then
echo "queue.label Queue"
echo "queue.draw LINE"
echo "queue.type GAUGE"
echo "queue.info Queue"
echo "queue.info Queue"
exit 0
fi

View File

@ -18,7 +18,7 @@
# env.condor_status - Path to condor_status executable,
# defaults to /usr/local/condor/bin/condor_status
# 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:
# env.constraint 'arch=="x86_64" && opsys=="linux"'
#
@ -49,7 +49,7 @@ if [ ! -z "$constraint" ]; then
else
CONS=
fi
if [ "$1" = "autoconf" ]; then
echo "no"
exit 1
@ -72,7 +72,7 @@ if [ "$1" = "config" ]; then
echo 'Preempting.label Preempting'
echo 'Preempting.draw AREA'
echo 'Preempting.type GAUGE'
echo "Preempting.info Slots in Preempting state"
echo "Preempting.info Slots in Preempting state"
echo 'Claimed.label Claimed'
echo 'Claimed.draw STACK'
echo 'Claimed.type GAUGE'

View File

@ -47,7 +47,7 @@ type=$(basename "$0" | tr "_" "\n" | tail -1)
if [ "$1" = "config" ]; then
cat <<EOT
graph_title Courier log ($type)
graph_args --base 1000 -l 0
graph_args --base 1000 -l 0
graph_vlabel events per second
graph_category mail
EOT

View File

@ -17,7 +17,7 @@
# 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
# read SAR/psacct records if you care about that.
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 dated June,

View File

@ -17,7 +17,7 @@ graph="$plugin"
style="AREA"
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
}
@ -33,7 +33,7 @@ run_daemon() {
run_watchdog
if [ -f $pidfile ]; then
touch $pidfile
else
else
$pluginfull acquire &
fi
}
@ -54,9 +54,9 @@ graph_title $graph
graph_category 1sec
graph_vlabel average cpu use %
graph_scale no
graph_total All CPUs
graph_total All CPUs
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
cpun=0
for ((i=0; i<$cpus; i++)); do

View File

@ -26,7 +26,7 @@
if [ "$1" = "autoconf" ] ; then
if [ "$1" = "autoconf" ] ; then
if [ -n "$procs" ] ; then
echo "yes"
else
@ -49,23 +49,23 @@ if [ "$1" = "config" ] ; then
echo 'graph_scale no'
echo 'graph_period second'
echo "graph_order $cprocs"
for proc in $procs; do
for proc in $procs; do
cproc=${proc//[^A-Za-z0-9_]/_}
echo "${cproc}.label $proc"
echo "${cproc}.info CPU used by process $proc"
done ;
exit
fi
for proc in $procs ; do {
cproc=${proc//[^A-Za-z0-9_]/_}
ps axo '%mem,comm,command' | grep -v grep | grep "$proc" | LC_ALL=us_US awk '
BEGIN {
SUM=0
BEGIN {
SUM=0
}
{
{
SUM+=1
COMM=$2
}

View File

@ -26,7 +26,7 @@
if [ "$1" = "autoconf" ] ; then
if [ "$1" = "autoconf" ] ; then
if [ -n "$procs" ] ; then
echo "yes"
else
@ -49,13 +49,13 @@ if [ "$1" = "config" ] ; then
echo 'graph_scale no'
echo 'graph_period second'
echo "graph_order $cprocs"
for proc in $procs; do
for proc in $procs; do
cproc=${proc//[^A-Za-z0-9_]/_}
echo "${cproc}.label $proc"
echo "${cproc}.info CPU used by process $proc"
done ;
exit
fi
@ -64,14 +64,14 @@ fi
for proc in $procs ; do {
cproc=${proc//[^A-Za-z0-9_]/_}
ps axo 'pcpu,comm,command' | grep -v grep | grep "$proc" | LC_ALL=us_US awk '
BEGIN {
SUM=0
BEGIN {
SUM=0
}
{
SUM+=$1
{
SUM+=$1
}
END {
print "'${cproc}'.value "SUM
END {
print "'${cproc}'.value "SUM
}
'
}

View File

@ -75,7 +75,7 @@ except:
from urllib2 import Request
from urllib2 import urlopen
from urllib2 import URLError
def define_graph_types():
@ -131,7 +131,7 @@ def request_data():
print("API request error: {0}". format(err), file=sys.stderr)
exit(1)
except:
print("Unhandled error:", sys.exc_info()[0])
print("Unhandled error:", sys.exc_info()[0])
exit(1)
try:
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.min 0".format(worker_name))
print("worker_{0}_hashrate.draw LINE1".format(worker_name))
for val in worker_data:
print("")
worker_name = "_".join(val["id"].split())
@ -234,7 +234,7 @@ def write_data_worker(data):
print("")
print("multigraph worker_shares_{0}.worker_{1}".format(account_address, worker_name))
print("wshares.value {0} ".format(val["rating"]))
def write_config():

View File

@ -25,7 +25,7 @@ cyrus-imapd - Munin plugin to monitor the load on a cyrus imapd server
=head1 CONFIGURATION
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:
[cyrus-imapd]
@ -87,8 +87,8 @@ if [ "x${PROCDIR}x" = "xx" ]; then
fi
# If run with the "config"-parameter, give out information on how the
# graphs should look.
# graphs should look.
if [ "$1" = "config" ]; then
echo 'graph_title Cyrus IMAPd Load'
echo 'graph_args --base 1000 -l 0'

View File

@ -91,7 +91,7 @@ for ( $i = 1; ($i < $#top and $quit == 0); $i++ ) {
print "sys.value " . $sys . "\n";
print "user.value " . $usr . "\n";
print "idle.value " . $idl . "\n";
$quit = 1;
$quit = 1;
}
}

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/perl
# -*- perl -*-
=head1 NAME
@ -69,10 +69,10 @@ if ( defined($ARGV[0])) {
}
}
@uptime = `/usr/bin/uptime`;
@uptime = `/usr/bin/uptime`;
foreach(@uptime) {
$_ =~ m/^.+up (.+?), \d+ us.+$/;
$timestr = $1;
$timestr = $1;
if ( $timestr =~ m/^(\d+) day.+?$/ ) {
$days = $1;
} else { $days = 0; }

View File

@ -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" ) {
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_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.type GAUGE\n";
print "connections.type GAUGE\n";
} else {
my $output = `$cmd`;
print "connections.value $output";

View File

@ -51,7 +51,7 @@ elsif ( defined $ARGV[0] and $ARGV[0] eq "config" ) {
# Determine the available IP pools
%pools = determine_pools();
# Print a label for each pool
foreach $start (keys %pools) {
$label = ip2string($start);
@ -63,10 +63,10 @@ elsif ( defined $ARGV[0] and $ARGV[0] eq "config" ) {
}
else {
my (@activeleases, %pools, $start, $end, $size, $free, $label, $lease);
# Determine all leased IP addresses
# Determine all leased IP addresses
@activeleases = determine_active_leases();
# Determine the available IP pools
%pools = determine_pools();
@ -109,14 +109,14 @@ sub determine_pools {
# The range statement gives the lowest and highest IP addresses in a range.
$size = $end - $start + 1;
$pools{$start} = $size;
}
}
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.
#
# Returns an array with currently leased IP's
@ -155,7 +155,7 @@ sub determine_active_leases {
}
}
# Set TZ back to its original setting
if (defined($mytz)) {
$ENV{'TZ'} = $mytz;
@ -186,9 +186,9 @@ sub string2ip {
}
return undef;
}
#
# Returns a dotted quad notation of an
# Returns a dotted quad notation of an
#
sub ip2string {
my $ip = shift;

View File

@ -19,8 +19,8 @@ env.fsroot /path/to/btrfs/filesystem
=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
Alexander Knöbel <alex@belogy.de>

View File

@ -60,7 +60,7 @@ if [ "$1" = "autoconf" ]; then
fi
clean_name() {
echo $1 $7 $2 | sed 's/[\/.-]/_/g'| awk "{
echo $1 $7 $2 | sed 's/[\/.-]/_/g'| awk "{
if (\$3 == \"tmpfs\")
n=\$1\$2
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
name=`clean_name $i`
echo -n "$name.label "
echo $i | awk "{
echo $i | awk "{
dir=\$7
if (length(dir) <= $MAXLABEL)
print dir
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;
}"
echo "$name.warning 92"

View File

@ -16,10 +16,10 @@
# Requirements
# - bash (or change first line to sh instead of bash or any other shell)
# - 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
#
# directory to check
@ -44,8 +44,8 @@ ID=1;
# Changelog
#
# 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
# scripts):

View File

@ -33,7 +33,7 @@ print_details() {
val=`echo ${line#*:}`
val1=${val%% *}
[ -z "$line" ] && break
case "$key" in
"Mount count") myname=$1; mc=$val ;;
"Maximum mount count") mmc=$val ;;
@ -90,7 +90,7 @@ if [ "$1" = "config" ]; then
echo "graph_category disk"
args="-l 0"
case "$plugin" in
mounts)
mounts)
echo "graph_vlabel times"
echo "graph_title Ext2 Filesystem mount details"
;;
@ -98,14 +98,14 @@ if [ "$1" = "config" ]; then
echo "graph_vlabel days"
echo "graph_title Ext2 Filesystem fsck interval"
;;
writes)
writes)
args="$args --base 1024"
echo "graph_vlabel bytes"
echo "graph_title Ext2 Filesystem lifetime writes$blkdevAppend"
;;
esac
echo "graph_args $args"
if [ -z "$blkdev" ]; then
lse2
else

View File

@ -8,23 +8,23 @@ case $1 in
COUNTER=1
while [ $COUNTER -gt 0 ]; do
FILE_PATH="file${COUNTER}_path"
# Is the path for this file specified?
eval FILE=\$$FILE_PATH
if [ "$FILE" == "" ]; then
break;
fi
# It is! Add it to the graphs.
GRAPH_ORDER="$GRAPH_ORDER file_$COUNTER"
# Does this file have a specified label?
LABEL_COUNTER="file${COUNTER}_label"
eval LABEL=\$$LABEL_COUNTER
if [ "$LABEL" == "" ]; then
LABEL=`basename $FILE`
fi
# Associated warning level?
WARNING="file${COUNTER}_warning"
eval WARNING=\$$WARNING
@ -44,7 +44,7 @@ case $1 in
echo "file_$COUNTER.min 0"
let COUNTER=COUNTER+1
done;
echo "graph_order $GRAPH_ORDER"
echo "graph_title File age"
echo 'graph_args --base 1000 -l 0'
@ -63,14 +63,14 @@ while [ $COUNTER -gt 0 ]; do
if [ "$FILE" == "" ]; then
break;
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
VALUE=0
else
VALUE=$(($(date +%s) - $(stat -c '%Y' "$FILE")))
fi
echo "file_$COUNTER.value $VALUE"
let COUNTER=COUNTER+1
done;

View File

@ -1,7 +1,7 @@
#!/bin/bash
# -*- sh -*-
#
# Multigraph plugin to monitor harddrive temperature, condition,
# Multigraph plugin to monitor harddrive temperature, condition,
# performance and estimated remaining lifetime through HDSentinel.
#
# To use, download the latest HDSentinel for Linux x86 or x64 from

View File

@ -77,7 +77,7 @@ while (<HPT>)
$name =~ s/\ /_/g;
# add the ID to be 100% unique
$name .= '_'.$id;
if ($mode eq 'config')
{
# only needed here in config
@ -95,7 +95,7 @@ while (<HPT>)
}
# calc warning from threshold, 5% less
my $warning = sprintf("%.0f", $threshold * 95 / 100);
print $name.".label ".$location."\n";
print $name.".warning ".$warning."\n";
print $name.".critical ".$threshold."\n";

View File

@ -3,7 +3,7 @@
# Plugin to monitor the % of allocated area of a LVM snapshot
#
# Parameters:
#
#
# config
# autoconf
#
@ -12,7 +12,7 @@
#
#%# family=auto
#%# capabilities=autoconf
#
#
# 2011/05/20 - pmoranga - initial version
#
# 2012/01/27 - Sébastien Gross
@ -35,7 +35,7 @@ fi
if [ "$1" = "config" ]; then
echo 'graph_title Allocated space for snapshot'
echo 'graph_title Allocated space for snapshot'
echo 'graph_vlabel %'
echo 'graph_category disk'
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="$(clean_fieldname "$origin")"
percent="$(echo $line | awk '{print $6}')"
if [ "$1" = "config" ]; then
echo "$id.label $name snapshot of $origin"
else

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