1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

Fixed some syntax and perldoc

This commit is contained in:
null-git 2017-01-12 15:10:54 +01:00
parent c679de12ce
commit d3de1a48de

52
plugins/other/wordpress-multisite Normal file → Executable file
View file

@ -1,40 +1,51 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# wordpress-multisite plugin # wordpress-multisite plugin
# #
# Version 0.3
# Date 2017-01-12
# Some last minor fixes
#
# Version 0.2 # Version 0.2
# Date 2016-10-24 # Date 2016-10-24
# Code improvements # Code improvements
# #
# Version 0.1 # Version 0.1
# Date 2016-02-07 # Date 2016-02-07
# Initial release # Initial release
# #
: <<=cut : <<=cut
=head1 NAME =head1 NAME
Wordpress-Multisite Munin Plugin Wordpress-Multisite Munin Plugin
A Munin plugin to monitor posts, comments and pingbacks from every multisite instance. A Munin plugin to monitor posts, comments and pingbacks from every multisite instance.
It uses multigraphs and also shows the combined number of posts, comments, pingbacks, instances and users. It uses multigraphs and also shows the combined number of posts, comments, pingbacks, instances and users.
Most database requests came from the wordpress-mu-plugin which was written by Andre Darafarin and Chris Bair Most database queries came from the wordpress-mu-plugin which was written by Andre Darafarin and Chris Bair
=head1 CONFIGURATION =head1 CONFIGURATION
The plugin need access to the wordpress database The plugin need access to the wordpress database
=head2 Config file =head2 Config file
Create the config file plugin-conf.d/wordpress with the following values: Create the config file plugin-conf.d/wordpress with the following values:
=over 4 [wordpress*]
=item * [wordpress*] env.mysqlopts # i.e. -uroot -prootpass
=item * env.mysqlopts <ie -uroot -prootpass> env.mysqlconnection # defaults to -hlocalhost
=item * env.mysqlconnection <defaults to -hlocalhost> env.database # i.e. -Dwordpress
=item * env.database <ie -Dwordpress> env.dbprefix # defaults to wp_
=item * env.dbprefix <defaults to wp_>
=back =head1 VERSION
=head1 VERSION Version 0.3 (2017-01-12)
Version 0.2 (2016-02-07)
=head2 Some minor fixes:
* fixed perldoc
* fixed some syntax warnings from shellcheck
* replaced expr by $(( ))
=head1 AUTHOR =head1 AUTHOR
@ -43,7 +54,6 @@ Jonas Palm <jonaspalm . posteo . de>
=head1 LICENSE =head1 LICENSE
GPLv3 or higher GPLv3 or higher
=cut =cut
# fill vars # fill vars
@ -84,10 +94,10 @@ else
i= i=
test "$n" -gt "1" && i=${n}_ test "$n" -gt "1" && i=${n}_
POSTS=$(expr $POSTS + $(wp_get posts $i)) POSTS=$((POSTS + $(wp_get posts "$i")))
COMMENTS=$(expr $COMMENTS + $(wp_get comments $i)) COMMENTS=$((COMMENTS + $(wp_get comments "$i")))
PINGBACKS=$(expr $PINGBACKS + $(wp_get pingbacks $i)) PINGBACKS=$((PINGBACKS + $(wp_get pingbacks "$i")))
CNT=$(expr $CNT + 1) CNT=$((CNT + 1))
done done
echo "multigraph wordpress" echo "multigraph wordpress"
@ -106,7 +116,7 @@ for n in $(wp_get ids); do
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo "multigraph wordpress.site_${n}" echo "multigraph wordpress.site_${n}"
echo "graph_title $(wp_get title $i)" echo "graph_title $(wp_get title "$i")"
echo "graph_order posts comments pingbacks" echo "graph_order posts comments pingbacks"
echo "graph_vlabel Wordpress ID ${n}" echo "graph_vlabel Wordpress ID ${n}"
echo "posts.label Posts" echo "posts.label Posts"
@ -114,8 +124,8 @@ for n in $(wp_get ids); do
echo "pingbacks.label Pingbacks" echo "pingbacks.label Pingbacks"
else else
echo "multigraph wordpress.site_${n}" echo "multigraph wordpress.site_${n}"
echo "posts.value $(wp_get posts $i)" echo "posts.value $(wp_get posts "$i")"
echo "comments.value $(wp_get comments $i)" echo "comments.value $(wp_get comments "$i")"
echo "pingbacks.value $(wp_get pingbacks $i)" echo "pingbacks.value $(wp_get pingbacks "$i")"
fi fi
done done