imported>mutante mNo edit summary |
imported>mutante mNo edit summary |
||
Line 26: | Line 26: | ||
print <<<CONFIG |
print <<<CONFIG |
||
graph_title Mediawiki |
graph_title Mediawiki |
||
graph_vlabel number |
|||
graph_args --base 1000 -l 0 |
|||
graph_scale no |
|||
graph_category wiki |
|||
graph_vlabel number |
graph_vlabel number |
||
views.info Total number of page views |
views.info Total number of page views |
Revision as of 01:46, 12 February 2007
<HighlightSyntax>
- !/usr/bin/php
<?php
- mediawiki plugin for munin
- http://www.mediawiki.org/wiki/MediaWiki | http://munin.projects.linpro.no/wiki
- by mutante of S23 | http://s23.org/wiki
- 2007-02-12 | greets to hundfred
- Needs a valid mysql user to connect to the wiki database
require_once("/home/mutante/wiki_mysql_conf.php");
- I include the database settings from elsewhere, so i dont have to show the password in /usr/share/..
- I also set "[mediawiki] user mutante" in plugin-conf.d/ so that my user can read the config
- alternatively set them in here like:
- $dbhost="localhost";
- $dbname="wikidb";
- $dbuser="wikiuser";
- $dbpass="yourpassword";
switch ($argv[1]) { case config:
print <<<CONFIG graph_title Mediawiki graph_vlabel number graph_args --base 1000 -l 0 graph_scale no graph_category wiki 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 <<<OUTPUT views.value {$row['ss_total_views']} edits.value {$row['ss_total_edits']} articles.value {$row['ss_good_articles']} pages.value {$row['ss_total_pages']} users.value {$row['ss_users']} admins.value {$row['ss_admins']} images.value {$row['ss_images']}\n OUTPUT;
} ?> </HighlightSyntax>