The smallest Habra-karmograf - for munin

    Several times already on Habré wrote karmatrekery - showing the change in karma on the chart. The most famous and lively so far is the Habrometer . However, it wasn’t quite suitable for my purposes - a survey is too rare, once a day (however, in accordance with the old rules for using the Habr API, a mass survey with a higher frequency is difficult).

    So I wrote my tiny munin- plugin for Habr. If you don’t need it, then you won’t see anything interesting under the cut: a few lines of PHP, XML parsing by standard means - for everything about everything 10 minutes. The polling frequency is standard, once every 5 minutes.


    Source code


     1) && ($argv[1] == 'config'))
    		print("graph_title KarmaGraph $username
    graph_category web 
    graph_vlabel #
    karma.label Karma
    rating.label Rating
    	$xml = new SimpleXMLElement(file_get_contents("$username/"));
    	print('karma.value ' . $xml->karma . "\n");
    	print('rating.value ' . $xml->rating . "\n");


    • Of course you need munin , almost any version.
    • Put the plugin in / usr / share / munin / plugins /
    • Specify the username inside the plugin. I did not begin to make it into a separate config - so only more work for everyone.
    • Make a symlink on it in / etc / munin / plugins
    • chmod a + x habracarma
    • Restart munin-node

    I hope someone will find it useful.

    Also popular now: