×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    Munin/mediawiki: Difference between revisions

    Content added Content deleted
    imported>mutante
    mNo edit summary
    imported>mutante
    mNo edit summary
     
    Line 5: Line 5:
    <?php
    <?php
    # mediawiki plugin for munin
    # mediawiki plugin for munin
    # reads number of edits,views,articles,pages,users,admins and images from a Mediawiki
    # http://www.mediawiki.org/wiki/MediaWiki | http://munin.projects.linpro.no/wiki
    # http://www.mediawiki.org/wiki/MediaWiki | http://munin.projects.linpro.no/wiki
    # by mutante of S23 | http://s23.org/wiki
    # by mutante of S23 | http://s23.org/wiki
    Line 30: Line 31:
    graph_scale no
    graph_scale no
    graph_category wiki
    graph_category wiki
    graph_info Reads number of edits,views,articles,pages,users,admins and images from a Mediawiki
    graph_vlabel number
    views.info Total number of page views
    views.info Total number of page views
    views.label views
    views.label views

    Latest revision as of 01:50, 12 February 2007

    A Mediawiki plugin for Munin.

    <HighlightSyntax>

    1. !/usr/bin/php

    <?php

    1. mediawiki plugin for munin
    2. reads number of edits,views,articles,pages,users,admins and images from a Mediawiki
    3. http://www.mediawiki.org/wiki/MediaWiki | http://munin.projects.linpro.no/wiki
    4. by mutante of S23 | http://s23.org/wiki
    5. 2007-02-12 | greets to hundfred
    1. Needs a valid mysql user to connect to the wiki database

    require_once("/home/mutante/wiki_mysql_conf.php");

    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 graph_args --base 1000 -l 0 graph_scale no graph_category wiki graph_info Reads number of edits,views,articles,pages,users,admins and images from a Mediawiki 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>

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.