Munin/mediawiki

 <?php
 * 1) !/usr/bin/php
 * 1) mediawiki plugin for munin
 * 2) http://www.mediawiki.org/wiki/MediaWiki | http://munin.projects.linpro.no/wiki
 * 3) by mutante of S23 | http://s23.org/wiki
 * 4) 2007-02-12 | greets to hundfred

require_once("/home/mutante/wiki_mysql_conf.php");
 * 1) Needs a valid mysql user to connect to the wiki database


 * 1) I include the database settings from elsewhere, so i dont have to show the password in /usr/share/..
 * 2) I also set "[mediawiki] user mutante" in plugin-conf.d/ so that my user can read the config
 * 3) alternatively set them in here like:


 * 1) $dbhost="localhost";
 * 2) $dbname="wikidb";
 * 3) $dbuser="wikiuser";
 * 4) $dbpass="yourpassword";

switch ($argv[1]) { case config:

print <<<CONFIG graph_title Mediawiki graph_vlabel number views.info Total number of page views views.label views views.type COUNTER edits.info Total number of page edits edits.label edits edits.type COUNTER articles.info Total number of 'good' pages (articles) articles.label articles pages.info Total number of all pages pages.label pages users.info Total number of user accounts users.label users admins.info Total number of admins (sysops) admins.label admins images.info Total number of uploaded images images.label images\n CONFIG; break;

default:

mysql_connect("$dbhost", "$dbuser", "$dbpass") or die(mysql_error); mysql_select_db("$dbname") or die(mysql_error);

$query="select * from site_stats"; $result = mysql_query("$query") or die(mysql_error); $row = mysql_fetch_array( $result );

print << 