contrib-munin/plugins/other/wordpress

94 lines
2.1 KiB
Plaintext
Raw Normal View History

2010-10-05 23:09:47 +02:00
#!/bin/sh
# wordpress-munin plugin
#
# Author Andre Darafarin
2011-12-18 15:11:52 +01:00
# Improvements by Chris Bair
# Version 0.2 15 Feb 2011
2010-10-05 23:09:47 +02:00
#
#
: <<=cut
=head1 NAME
Wordpress-Munin plugin
A simple Munin plugin to monitor some data from a running wordpress instance
=head1 CONFIGURATION
The plugin need access to the database of the wordpress instance.
=head2 Config file
Add file plugin-conf.d/wordpress and fill like this
=over 4
=item * [wordpress]
# Name of section. Must be wordpress.
=item * env.DB_NAME your_db_name
# Replace your_db_name
=item * env.DB_USER your_db_username
# Replace you_db_username
=item * env.DB_PASSWORD your_db_pass
# Replace your_db_pass
=item * env.DB_HOST host_of_your_db
# Replace with host of database server. Will be localhost for many users.
=back
=head1 VERSION
2011-12-18 15:11:52 +01:00
0.2 15 Feb 2011
2010-10-05 23:09:47 +02:00
=head1 AUTHOR
Andre Darafarin, happypork.com
=cut
2011-12-18 15:11:52 +01:00
if [ "$1" = "config" ]; then
echo 'graph_title Wordpress average'
echo 'graph_order posts comments pingbacks users'
echo 'graph_vlabel Wordpress'
echo 'graph_info Some Statistics of Wordpress'
echo 'posts.label Posts'
echo 'posts.draw LINE3'
echo 'comments.label Comments'
echo 'pingbacks.label Pingbacks'
echo 'users.label Users'
exit 0
fi
POSTS=0
COMMENTS=0
PINGBACKS=0
USERS=0
2010-10-05 23:09:47 +02:00
# DBNAME=${logfile:-/var/log/syslog}
2011-12-18 15:11:52 +01:00
POSTS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME --column-names=0 -s --execute="SELECT COUNT(*) FROM wp_posts WHERE post_status = 'publish' AND post_password = '' AND post_type = 'post';"`
2010-10-05 23:09:47 +02:00
2011-12-18 15:11:52 +01:00
COMMENTS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME --column-names=0 -s --execute="SELECT COUNT(*) FROM wp_comments WHERE comment_approved = '1' AND comment_type = '';"`
2010-10-05 23:09:47 +02:00
2011-12-18 15:11:52 +01:00
PINGBACKS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME --column-names=0 -s --execute="SELECT COUNT(*) FROM wp_comments WHERE comment_approved = '1' AND comment_type = 'pingback';"`
2010-10-05 23:09:47 +02:00
2011-12-18 15:11:52 +01:00
USERS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME --column-names=0 -s --execute="SELECT COUNT(*) FROM wp_users ;"`
2010-10-05 23:09:47 +02:00
#AUSGABE BEREICH
2011-12-18 15:11:52 +01:00
echo "posts.value $POSTS"
echo "comments.value $COMMENTS"
echo "pingbacks.value $PINGBACKS"
echo "users.value $USERS"
2010-10-05 23:09:47 +02:00