Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / other / wordpress @ e5ce7492

Historique | Voir | Annoter | Télécharger (2,11 ko)

1 46804929 Andre Darafarin
#!/bin/sh
2
# wordpress-munin plugin
3
# 
4
# Author Andre Darafarin
5 51ee702d Various
# Improvements by Chris Bair
6
# Version 0.2 15 Feb 2011
7 46804929 Andre Darafarin
#
8
#
9
: <<=cut
10
=head1 NAME
11
12
Wordpress-Munin plugin
13
14
A simple Munin plugin to monitor some data from a running wordpress instance
15
16
=head1 CONFIGURATION
17
18
The plugin need access to the database of the wordpress instance.
19
20
21
=head2 Config file
22
23
Add file plugin-conf.d/wordpress and fill like this
24
25
26
=over 4
27
28
=item * [wordpress]
29
# Name of section. Must be wordpress.
30
31
=item * env.DB_NAME your_db_name
32
# Replace your_db_name
33
34
=item * env.DB_USER your_db_username
35
# Replace you_db_username
36
37
=item * env.DB_PASSWORD your_db_pass
38
# Replace your_db_pass
39
40
=item * env.DB_HOST host_of_your_db
41
# Replace with host of database server. Will be localhost for many users. 
42
43
=back
44
45
46
47
=head1 VERSION
48
49 51ee702d Various
0.2 15 Feb 2011
50 46804929 Andre Darafarin
51
=head1 AUTHOR
52
53
Andre Darafarin, happypork.com
54
=cut
55
56 51ee702d Various
57
if [ "$1" = "config" ]; then
58
	echo 'graph_title Wordpress average'
59
	echo 'graph_order posts comments pingbacks users'
60
	echo 'graph_vlabel Wordpress'
61
	echo 'graph_info Some Statistics of Wordpress'
62
	echo 'posts.label Posts'
63
	echo 'posts.draw LINE3'
64
	echo 'comments.label Comments'
65
	echo 'pingbacks.label Pingbacks'
66
	echo 'users.label Users'
67
        exit 0
68
fi
69
70
POSTS=0
71
COMMENTS=0
72
PINGBACKS=0
73
USERS=0
74 46804929 Andre Darafarin
75
# DBNAME=${logfile:-/var/log/syslog}
76
77 51ee702d Various
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';"`
78 46804929 Andre Darafarin
79 51ee702d Various
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 = '';"`
80 46804929 Andre Darafarin
81 51ee702d Various
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';"`
82 46804929 Andre Darafarin
83 51ee702d Various
USERS=`mysql -h$DB_HOST -p$DB_PASSWORD -u$DB_USER -D $DB_NAME  --column-names=0 -s --execute="SELECT COUNT(*) FROM wp_users ;"`
84 46804929 Andre Darafarin
85
86
#AUSGABE BEREICH
87 51ee702d Various
echo "posts.value $POSTS"
88
echo "comments.value $COMMENTS"
89
echo "pingbacks.value $PINGBACKS"
90
echo "users.value $USERS"
91 46804929 Andre Darafarin
92