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

Delete apticron

plugin canceled
This commit is contained in:
JoHartmann 2017-02-20 17:57:50 +01:00 committed by GitHub
parent d0216f0090
commit 2d521bbb57

View file

@ -1,228 +0,0 @@
#!/bin/bash
# -*- sh -*-
: <<=cut
=head1 NAME
apticron - Show the result of I<"apt-get -u dist-upgrade"> with four different graphs
=head1 APPLICABLE SYSTEMS
All systems with "apt-get" and "grep"
=head1 CONFIGURATION
The following is the default configuration
[apticron]
user root
You could define two alert levels and the graph language
[apticron]
env.warning [value] (default: 80)
env.critical [value] (default: 100)
env.language [en|de|es] (default: en)
or if you like define more details
env.warning_update [value] (default: 80 or env.warning, if set)
env.warning_newone [value] (default: 25% of env.warning_update)
env.warning_remove [value] (default: 2% of env.warning_update)
env.warning_holdit [value] (default: 2% of env.warning_update)
env.critical_update [value] (default: 100 or env.critical, if set)
env.critical_newone [value] (default: 25% of env.critical_update)
env.critical_remove [value] (default: 2% of env.critical_update)
env.critical_holdit [value] (default: 2% of env.critical_update)
=head1 DESCRIPTION
This plugin is a graphic version of die I<apicron package>, but it sends no mails.
It showns graphs for
- upgraded
- newly installed
- to remove
- not upgraded
The plugin itself can be stored in any directory.
A symbolic link must be createdin the /etc/munin/plugins/ directory as follows:
=over
I<<< ln -s /<path to file>/apticron apticron >>>
=back
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=head1 VERSION
V17.0211
=head1 HISTORY
V17.0211
add POD documentation
add check if apt-get is installed
add check if grep is installed
add if no limitations administered via 'quota' for the device the total line is shown only
add example graph for Munin Plugin Gallery
add env.language, env.warning_*, env.critical_*
V16.0219
first - unpublished - version
=head1 AUTHOR
Jo Hartmann
=head1 LICENSE
GPLv2 (L<http://www.gnu.org/licenses/gpl-2.0.html>)
=cut
###################################################
# Autoconf section #
###################################################
if [ "$1" = "autoconf" ]; then
if ! grep -V &> /dev/null ; then
echo "no ('grep' executable is missing)"
exit 0
fi
if ! apt-get -v &> /dev/null ; then
echo "no ('apt-get' executable is missing)"
exit 0
fi
echo yes
exit 0
fi
###################################################
# Preparation section #
###################################################
# parse the the munin-node configuration for settings
. "$MUNIN_LIBDIR/plugins/plugin.sh"
# Checking if grep installed and on the path
if ! grep -V &> /dev/null ; then
echo "The script 'grep' is not installed or on the path" >&2
# Send the exit code FATAL ERROR happens
exit 127
fi
# Checking if apt-get installed and on the path
if ! apt-get -v &> /dev/null ; then
echo "The script 'apt-get' is not installed or on the path" >&2
# Send the exit code FATAL ERROR happens
exit 128
fi
###################################################
# Munin Configuration Section #
###################################################
if [ "$1" = "config" ]; then
# if any fetched from munin-node file otherwise ...
Warning=${warning:-80}
Critical=${critical:-100}
Language=${language:-en}
Warning_Update=${warning_update:-$Warning}
Warning_Newone=${warning_newone:-$((Warning_Update/4+1))}
Warning_Remove=${warning_remove:-$((Warning_Update/50+1))}
Warning_Holdit=${warning_holdit:-$((Warning_Update/50+1))}
Critical_Update=${critical_update:-$Critical}
Critical_Newone=${critical_newone:-$((Critical_Update/4+1))}
Critical_Remove=${critical_remove:-$((Critical_Update/50+1))}
Critical_Holdit=${critical_holdit:-$((Critical_Update/50+1))}
# Localisation of the graphic texts
case $Language in
de)
echo "graph_title Ausstehende Aktualisierungen"
echo "graph_vlabel Anzahl Pakete"
echo "graph_info Die Grafik zeigt die Ausgabe von: apt-get -u dist-upgrade."
update_label="aktualisieren"
newone_label="neu installieren"
remove_label="entfernen"
holdit_label="nicht aktualisieren"
;;
es)
echo "graph_title Actualizaciones pendientes "
echo "graph_vlabel Número de paquetes de software"
echo "graph_info El gráfico muestra el resultado de: apt-get -u dist-upgrade. "
update_label="actualización"
newone_label="reinstalar "
remove_label="eliminar"
holdit_label="no actualizar"
;;
*)
echo "graph_title Pending updates"
echo "graph_vlabel Count of packages"
echo "graph_info The graph shows the optput of: apt-get -u dist-upgrade."
update_label="upgraded"
newone_label="newly installed"
remove_label="to remove"
holdit_label="not upgraded"
;;
esac
echo "graph_args --base 1000 -l 100"
echo "graph_scale no"
echo "graph_category system"
echo "update.label $update_label"
echo "newone.label $newone_label"
echo "remove.label $remove_label"
echo "holdit.label $holdit_label"
echo "update.warning $Warning_Update"
echo "newone.warning $Warning_Newone"
echo "remove.warning $Warning_Remove"
echo "holdit.warning $Warning_Holdit"
echo "update.critical $Critical_Update"
echo "newone.critical $Critical_Newone"
echo "remove.critical $Critical_Remove"
echo "holdit.critical $Critical_Holdit"
exit 0
fi
###################################################
# Data reading sections #
###################################################
# call apt-get command and sepate the results
AptInfo=$(apt-get -u dist-upgrade --print-uris --yes | grep upgraded.)
Ausgabe=($(echo "${AptInfo}" | awk 'match($0,/([0-9]+) upgraded, ([0-9]+) newly installed, ([0-9]+) to remove and ([0-9]+) not upgraded./,arr){print arr[1], arr[2], arr[3], arr[4]};'))
###################################################
# Munin value section #
###################################################
echo "update.value ${Ausgabe[0]}"
echo "newone.value ${Ausgabe[1]}"
echo "remove.value ${Ausgabe[2]}"
echo "holdit.value ${Ausgabe[3]}"
###################################################
# Script end #
###################################################