Révision b1121b88
Initial version
| plugins/other/s9y | ||
|---|---|---|
| 1 |
#!/bin/bash |
|
| 2 |
# $Id: s9y 7 2010-02-24 22:15:37Z root $ |
|
| 3 |
# $Rev: 7 $ |
|
| 4 |
# $Author: root $ |
|
| 5 |
# $Date: 2010-02-24 23:15:37 +0100 (Mi, 24. Feb 2010) $ |
|
| 6 |
# |
|
| 7 |
# |
|
| 8 |
: <<EOF |
|
| 9 |
|
|
| 10 |
=head1 NAME |
|
| 11 |
|
|
| 12 |
s9y - Plugin to monitor the daily Spam entries for the Blog Serendipity |
|
| 13 |
http://s9y.org |
|
| 14 |
|
|
| 15 |
=head1 CONFIGURATION |
|
| 16 |
|
|
| 17 |
The user running this plugin needs read access to the |
|
| 18 |
mysql Database will need to add this: |
|
| 19 |
|
|
| 20 |
[s9y] |
|
| 21 |
user root |
|
| 22 |
|
|
| 23 |
|
|
| 24 |
The following configuration parameters are used by this plugin |
|
| 25 |
|
|
| 26 |
[s9y] |
|
| 27 |
env.database |
|
| 28 |
env.extrafile path/to/extrafile e.g. /etc/mysql/debian.cnf |
|
| 29 |
env.warning Warning Count of Spam |
|
| 30 |
env.critical Critical Count of Spam |
|
| 31 |
env.resettype one of monthly weekly daily number (must be greater than env.critical) |
|
| 32 |
(currently only monthly is supported) |
|
| 33 |
|
|
| 34 |
=head2 DEFAULT CONFIGURATION |
|
| 35 |
|
|
| 36 |
[s9y] |
|
| 37 |
env.database null |
|
| 38 |
env.extrafile null |
|
| 39 |
env.warning 15000 |
|
| 40 |
env.critical 20000 |
|
| 41 |
env.resettype monthly |
|
| 42 |
|
|
| 43 |
=head1 AUTHORS |
|
| 44 |
|
|
| 45 |
Bernd Dau |
|
| 46 |
visit my Blog: http://zockertown.de/s9y/ |
|
| 47 |
|
|
| 48 |
=head1 LICENSE |
|
| 49 |
|
|
| 50 |
GPL3.0 |
|
| 51 |
|
|
| 52 |
=head1 VERSION |
|
| 53 |
|
|
| 54 |
Version # $Rev: 7 $ |
|
| 55 |
|
|
| 56 |
=head1 BUGS |
|
| 57 |
|
|
| 58 |
The resetting is done only when the minute is 00 and the hour is 00 |
|
| 59 |
if the script is running to late because of heavy load or when other |
|
| 60 |
plungins are running to long, the emptiness of the table is not guarantied |
|
| 61 |
|
|
| 62 |
This plugin is in heavy development |
|
| 63 |
expect all but functionality |
|
| 64 |
|
|
| 65 |
|
|
| 66 |
=head1 MAGIC MARKERS |
|
| 67 |
|
|
| 68 |
#%# family=manual |
|
| 69 |
#%# capabilities=autoconf |
|
| 70 |
|
|
| 71 |
=cut |
|
| 72 |
|
|
| 73 |
EOF |
|
| 74 |
|
|
| 75 |
. $MUNIN_LIBDIR/plugins/plugin.sh |
|
| 76 |
#echo "ENV=`env`">/tmp/s9y-env.txt |
|
| 77 |
|
|
| 78 |
if [ "$1" = "autoconf" ]; then |
|
| 79 |
echo no |
|
| 80 |
echo "Set the needed Variables in munin-node" |
|
| 81 |
exit 0 |
|
| 82 |
fi |
|
| 83 |
SPAM=`mysql --defaults-extra-file=$extrafile -D $database -B --skip-column-names -e "select count(*) from serendipity_spamblocklog;"` |
|
| 84 |
|
|
| 85 |
if [ "$1" = "config" ]; then |
|
| 86 |
|
|
| 87 |
echo 'graph_title Spam Entries in Serendipity' |
|
| 88 |
echo 'graph_args --base 1000 --lower-limit 0' |
|
| 89 |
echo 'graph_vlabel Entries' |
|
| 90 |
echo 'graph_category other' |
|
| 91 |
echo 'graph_total Total' |
|
| 92 |
echo 'graph_info counts the moderated and rejected Comment Entries in Serendipity which where classified as Spam' |
|
| 93 |
echo 'spam.label SPAM' |
|
| 94 |
echo "resettype $resettype" |
|
| 95 |
echo "spam.value $SPAM" |
|
| 96 |
|
|
| 97 |
exit 0 |
|
| 98 |
fi |
|
| 99 |
|
|
| 100 |
#### resettype? |
|
| 101 |
if [ -n $resettype ] |
|
| 102 |
then |
|
| 103 |
if [ "$resettype" = "monthly" ] |
|
| 104 |
then |
|
| 105 |
day=`date '+%d'` |
|
| 106 |
if [ $day -eq 1 && "`date '+%H%M'`" -eq 0 ] |
|
| 107 |
then |
|
| 108 |
mysql --defaults-extra-file=$extrafile -D $database -B --skip-column-names -e "delete from serendipity_spamblocklog where 1=1;" |
|
| 109 |
fi |
|
| 110 |
fi |
|
| 111 |
fi |
|
| 112 |
|
|
| 113 |
echo "spam.value $SPAM" |
|
Formats disponibles : Unified diff