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

Use correct line endings for the sa-learn plugin

This commit is contained in:
Johann Schmitz 2013-10-29 17:19:25 +01:00
parent e3af199459
commit f1552118ec

View file

@ -1,75 +1,75 @@
#!/bin/bash #!/bin/bash
: <<=cut : <<=cut
=head1 NAME =head1 NAME
sa-learn - Munin plugin to monitor spamassasin bayes database size sa-learn - Munin plugin to monitor spamassasin bayes database size
=head1 APPLICABLE SYSTEMS =head1 APPLICABLE SYSTEMS
Any server running spamassassin Any server running spamassassin
=head1 CONFIGURATION =head1 CONFIGURATION
This plugin assumes your Spamassassin database is in /var/lib/MailScanner. This plugin assumes your Spamassassin database is in /var/lib/MailScanner.
If it's elsewhere (or you want to use a different database) you will need If it's elsewhere (or you want to use a different database) you will need
a configuration such as: a configuration such as:
[sa-learn] [sa-learn]
env.BayesDir /path/to/bayes/directory/ env.BayesDir /path/to/bayes/directory/
user mail user mail
(where 'user mail' refers to a user that can read the database). (where 'user mail' refers to a user that can read the database).
=head1 MAGIC MARKERS =head1 MAGIC MARKERS
#%# family=contrib #%# family=contrib
=head1 VERSION =head1 VERSION
2 2
=head1 AUTHOR =head1 AUTHOR
Paul Saunders L<darac+munin@darac.org.uk> Paul Saunders L<darac+munin@darac.org.uk>
=cut =cut
#' #'
case $1 in case $1 in
config) config)
cat <<'EOM' cat <<'EOM'
graph_title SA-Learn Magic graph_title SA-Learn Magic
graph_vlabel Count graph_vlabel Count
graph_args --base 1000 -l 0 graph_args --base 1000 -l 0
graph_category Mail graph_category Mail
spam.label Num Spam spam.label Num Spam
spam.type GAUGE spam.type GAUGE
ham.label Num Ham ham.label Num Ham
ham.type GAUGE ham.type GAUGE
tokens.label Num Tokens tokens.label Num Tokens
tokens.type GAUGE tokens.type GAUGE
EOM EOM
exit 0;; exit 0;;
esac esac
## Print values ## Print values
BayesDir=${BayesDir:-/var/lib/MailScanner} BayesDir=${BayesDir:-/var/lib/MailScanner}
sa-learn --dbpath $BayesDir/ --dump magic 2>/dev/null | while read line sa-learn --dbpath $BayesDir/ --dump magic 2>/dev/null | while read line
do do
case "$line" in case "$line" in
*nspam*) *nspam*)
echo -n "spam.value " echo -n "spam.value "
echo $line | awk '{print $3}' echo $line | awk '{print $3}'
;; ;;
*nham*) *nham*)
echo -n "ham.value " echo -n "ham.value "
echo $line | awk '{print $3}' echo $line | awk '{print $3}'
;; ;;
*ntokens*) *ntokens*)
echo -n "tokens.value " echo -n "tokens.value "
echo $line | awk '{print $3}' echo $line | awk '{print $3}'
;; ;;
esac esac
done done