1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Plugin-Gallery: Get better 2nd level headings

amule -> filetransfer (amule)
torrent -> filetransfer (rtorrent)
This commit is contained in:
dipohl 2017-02-24 18:29:14 +01:00
parent 95de964ec9
commit 4b400a7320
30 changed files with 19 additions and 19 deletions

View file

@ -1,83 +0,0 @@
#!/bin/sh
: << =cut
=head1 NAME
deborphan - Monitor orphaned Debian packages
=head1 APPLICABLE SYSTEMS
Debian-ish systems with deborphan installed.
=head1 CONFIGURATION
None needed.
=head1 AUTHOR
Olivier Mehani <shtrom+munin@ssji.net>
Based on the debsecan plugin by Nicolas Bouthors. 2016-09-02
=head1 LICENSE
GPLv2
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
# shellcheck disable=SC1090
. "$MUNIN_LIBDIR/plugins/plugin.sh"
# Auto enable if we have deborphan only
if [ "$1" = "autoconf" ] ; then
if which deborphan >/dev/null; then
echo yes
else
echo "no (deborphan is missing)"
fi
exit 0
fi
# Fail if we don't have deborphan
if ! which deborphan >/dev/null; then
echo "deborphan is missing" >&2
exit 1
fi
OUT=$(deborphan --show-section --guess-all | sort)
CATEGORIES="$(echo "${OUT}" | awk '{print $1}' | uniq)"
if [ "$1" = "config" ]; then
cat <<EOF
graph_title Orphaned packages
graph_args -l 0 --base 1000
graph_vlabel number of packages
graph_category system
graph_period second
graph_info This graph show the number of orphaned packages on your system. Use deborphan to see details.
EOF
for CAT in ${CATEGORIES}; do
CATFIELD=$(clean_fieldname "${CAT}")
cat <<EOF
${CATFIELD}.label ${CAT}
${CATFIELD}.type GAUGE
${CATFIELD}.draw AREASTACK
${CATFIELD}.min 0
${CATFIELD}.info The number of orphaned packages in ${CAT}
EOF
done
else
for CAT in ${CATEGORIES}; do
CATFIELD=$(clean_fieldname "${CAT}")
CATDATA=$(echo "${OUT}" | sed -n "s#${CAT} \+##p")
echo "${CATFIELD}.value $(echo "${CATDATA}" | wc -l)"
echo "${CATFIELD}.extinfo $(echo "${CATDATA}" | tr '\n' ' ')"
done
fi

View file

@ -1,147 +0,0 @@
#!/bin/sh
: << =cut
=head1 NAME
debsecan - Plugin to monitor the number of CVE vulnerabilities present on a Debian
system (using debsecan). Might work on other distib, who knows...
=head1 CONFIGURATION
[debsecan]
env.suite jessie
env.fixed_warn 1
env.fixed_critical 1000
env.remote_warn 1
env.remote_critical 10
=head1 AUTHORS
* Nicolas BOUTHORS <nbouthors@nbi.fr> http://nbi.fr/, Inspiration of the moment 10/10/2007
* Olivier Mehani <shtrom+munin@ssji.net>, 2016
=head1 LICENSE
Public Domain
=head1 MAGIC MARKERS
%# family=auto
%# capabilities=autoconf
=cut
# Auto enable if we have debsecan only
if [ "$1" = "autoconf" ] ; then
if [ -x /usr/bin/debsecan ]; then
echo yes
else
echo 'no (/usr/bin/debsecan not found)'
fi
exit 0
fi
# Fail if we don't have debsecan
if [ ! -x /usr/bin/debsecan ]; then
echo 'error: /usr/bin/debsecan not found' >&2
exit 1
fi
# Determine suite from filename...
SUITE=$(echo "$0" | sed 's/.*_//')
if [ "${SUITE}" = "${0}" ]; then
# ...or fall back onto configuration in environment
SUITE=${suite:-sid}
fi
FIXEDWARN=${fixed_warning:-1}
FIXEDCRIT=${fixed_critical:-1000}
REMOTEWARN=${remote_warning:-1}
REMOTECRIT=${remote_critical:-10}
if [ "$1" = "config" ] ; then
cat <<EOF_
graph_title DebSecan : vulnerabilities for ${SUITE}
graph_args -l 0 --base 1000
graph_vlabel number of CVE
graph_category system
graph_period second
graph_info This graph show the number of known vulnerabilities present on your system. Use debsecan to see details.
remote.label remote
remote.colour FF0000
remote.type GAUGE
remote.draw AREASTACK
remote.min 0
remote.info The number of remotely exploitable CVEs with any priority
remote.warning ${REMOTEWARN}
remote.critical ${REMOTECRIT}
high.label high
high.colour DD2200
high.type GAUGE
high.draw AREASTACK
high.min 0
high.info The number of CVEs marked high priority
medium.label medium
medium.colour FFAA00
medium.type GAUGE
medium.draw AREASTACK
medium.min 0
medium.info The number of CVEs marked medium priority
low.label low
low.colour 0000FF
low.type GAUGE
low.draw AREASTACK
low.min 0
low.info The number of CVEs marked low priority
other.label other
other.colour 00AAFF
other.type GAUGE
other.draw AREASTACK
other.min 0
other.info The number of CVEs with unspecified priority
fixed.label fixed
fixed.type GAUGE
fixed.draw LINE2
fixed.min 0
fixed.info The number of CVEs fixed by available updates
fixed.warning ${FIXEDWARN}
fixed.critical ${FIXEDCRIT}
EOF_
exit 0
fi
ALL=$(debsecan --suite "${SUITE}" 2> /dev/null)
REMOTE=$(echo "$ALL" | grep 'remotely')
NONREMOTE=$(echo "$ALL" | grep -v 'remotely')
HIGH=$(echo "${NONREMOTE}" | grep 'high urgency')
MEDIUM=$(echo "${NONREMOTE}" | grep 'medium urgency')
LOW=$(echo "${NONREMOTE}" | grep 'low urgency')
OTHER=$(echo "${NONREMOTE}" | grep -v 'urgency')
FIXED=$(echo "${ALL}" | grep '(fixed')
remote_count=$(echo "${REMOTE}" | wc -l)
high_count=$(echo "${HIGH}" | wc -l)
medium_count=$(echo "${MEDIUM}" | wc -l)
low_count=$(echo "${LOW}" | wc -l)
other_count=$(echo "${OTHER}" | wc -l)
fixed_count=$(echo "${FIXED}" | wc -l)
CVECOUNTRE="s/^ *\([0-9]\+\) \+\([^ ]\+\)/\2 (\1)/"
# shellcheck disable=SC2005 disable=SC2046
# The nested $(echo ...)s are needed to yet the newlines
cat <<EOF
remote.value $remote_count
remote.extinfo $(echo $(echo "${REMOTE}" | cut -f 2 -d " "| uniq -c | sort -nr | sed "${CVECOUNTRE}"))
high.value $high_count
high.extinfo $(echo $(echo "${HIGH}" | cut -f 2 -d " " | uniq -c | sort -nr | sed "${CVECOUNTRE}"))
medium.value $medium_count
medium.extinfo $(echo $(echo "${MEDIUM}" | cut -f 2 -d " " | uniq -c | sort -nr | sed "${CVECOUNTRE}"))
low.value $low_count
low.extinfo $(echo $(echo "${LOW}" | cut -f 2 -d " " | uniq -c | sort -nr | sed "${CVECOUNTRE}"))
other.value $other_count
other.extinfo $(echo $(echo "${OTHER}" | cut -f 2 -d " " | uniq -c | sort -nr | sed "${CVECOUNTRE}"))
fixed.value $fixed_count
fixed.extinfo $(echo $(echo "${FIXED}" | cut -f 2 -d " " | uniq -c | sort -nr | sed "${CVECOUNTRE}"))
EOF

82
plugins/system/fresh-backups Executable file
View file

@ -0,0 +1,82 @@
#!/bin/sh
: << =cut
=head1 NAME
fresh-backups - Plugin to monitor the freshness of backup files
=head1 APPLICABLE SYSTEMS
Any system with some automated backup creating or updating archive files.
This works well with backup-manager.
=head1 CONFIGURATION
The following example checks all tar.bz2 files in /path/to/your/backups/, and
counts all those that are less than 2 days old, and there should be 4 separate
daily archives.
[fresh-backups]
user root
env.backup_dir /path/to/your/backups/
env.lifetime 2
env.archive_pattern *.tar.bz2
env.backup_number 4
This will also set the warning and critical values for this plugin to 2*4 and
4, respectively, meaning that if the number of fresh files goes below those
limits, the relevant notifications will be triggerred.
An example configuration snippet for backup-manager [0] follows.
export BM_REPOSITORY_ROOT="/path/to/your/backups"
export BM_TARBALL_FILETYPE="tar.bz2"
export BM_TARBALL_DIRECTORIES="/etc /home /srv /data"
[0] https://github.com/sukria/Backup-Manager
=head1 AUTHOR
Olivier Mehani <shtrom+munin@ssji.net>
=head1 LICENSE
GPLv2
=head1 MAGIC MARKERS
#%# family=manual
=cut
# Configuration directives, edit before first use.
BACKUP_DIR=${backup_dir:-/data/backup}
ARCHIVE_PATTERN="${archive_pattern:-*.tar.bz2}"
# How old backups should be considered as non-yound anymore in [days].
LIFETIME=${lifetime:-2}
# Critical states will be issued when the number of fresh backups archives is below `backup_number`,
# and warnings below `backup_number*lifetime`
CRIT=${backup_number:-1}
WARN=$((CRIT*LIFETIME))
# The situation is critical if there are no young files, the backup is down.
case $1 in
config)
cat << EOF
graph_title Fresh (<=${LIFETIME}d) backups archives in ${BACKUP_DIR}
graph_vlabel number
graph_args -l 0
graph_category backup
freshcount.label number
freshcount.critical ${CRIT}:
freshcount.warning ${WARN}:
EOF
exit 0;;
esac
printf "freshcount.value "
find "${BACKUP_DIR}" -name "${ARCHIVE_PATTERN}" -a -mtime "-${LIFETIME}" | wc -l
printf "freshcount.extinfo "
du -sh "${BACKUP_DIR}"

View file

@ -1,42 +0,0 @@
#!/bin/sh
#
# Plugin to monitor fan speed on an IBM/Lenovo Laptop
#
# This plugin reads the current speed of the system fan from
# the /proc file system. As it queries specific files provided
# by kernel modules for IBM/Lenovo Laptops, it probably only
# works for those, but it should be easy to adapt to others
# if similar information is available for other types of laptops.
#
# By dominik dot stadler at gmx dot at
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -r /proc/acpi/ibm/fan ]; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Fan speed'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel speed'
echo 'graph_scale no'
echo 'graph_category sensors'
echo 'graph_info This graph shows the speed of the system fan.'
echo 'fan.label speed'
echo 'fan.info The current speed of the system fan.'
exit 0
fi
cat /proc/acpi/ibm/fan | grep "speed:" | awk '{print "fan.value " $2}'

View file

@ -19,7 +19,7 @@ fi
if [ "$1" = "config" ]; then
echo "graph_args --base 1000 -r --lower-limit 0"
echo "graph_title Memory usage, by user"
echo "graph_category system"
echo "graph_category memory"
echo "graph_info This graph shows memory usage, for monitored users."
echo "graph_vlabel KB"
echo "graph_scale no"

View file

@ -1,70 +0,0 @@
#!/bin/sh
#
# Copyright (C) 2006 Holger Levsen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 dated June,
# 1991.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
if [ "$1" = "config" ]; then
echo "graph_title VM by Process"
echo 'graph_args --base 1024k'
echo 'graph_vlabel VM size'
echo 'graph_category system'
echo "graph_info Shows contribution of each process to VM size"
ps auxww | perl -e '
$junk = <>;
while (<>)
{
@a = split;
$proc = $a[10];
$label = $proc;
$proc =~ s/ .*//;
if($proc =~ /^\[/) { $proc =~ s|/.*||; } else { $proc =~ s|.*/||; }
$proc =~ s/:.*//;
$proc =~ tr/[]//d;
$proc =~ tr/A-Za-z0-9/_/c;
$vsz = $a[4];
$total{$proc} += $vsz;
$labels{$proc} = $label;
}
my $stack = 0;
sub draw() { return $stack++ ? "STACK" : "AREA" }
print map
{
"$_.label " . $labels{$_} . "\n" .
"$_.min 0\n" .
"$_.draw " . draw() . "\n" .
"$_.cdef $_,1024,*\n"
}
sort keys %total;
'
exit 0
else
ps auxww | perl -e '
$junk = <>;
while (<>)
{
@a = split;
$proc = $a[10];
if($proc =~ /^\[/) { $proc =~ s|/.*||; } else { $proc =~ s|.*/||; }
$proc =~ s/:.*//;
$proc =~ tr/[]//d;
$proc =~ tr/A-Za-z0-9/_/c;
$vsz = $a[4];
$total{$proc} += $vsz;
}
print map {"$_.value $total{$_}\n"} sort keys %total'
fi