📜 ⬆️ ⬇️

The smallest Habra-karmograf - for munin

Several times already on Habré wrote karmatrekery - showing the change of karma on the chart. The most famous and lively so far - Habrometer . However, for my purposes, it was not quite suitable - the survey was 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 do not need it, then you will not see anything interesting under the cut: a few lines of PHP, parsing XML using standard tools - for everything about 10 minutes. Poll frequency - standard, once every 5 minutes.

Result


')

Sources

Download: s.14.by/habracarma

#!/usr/bin/php <?php error_reporting(0); $username = "BarsMonster";//Change this to your username! if ((count($argv) > 1) && ($argv[1] == 'config')) { print("graph_title KarmaGraph $username graph_category web graph_vlabel # karma.label Karma rating.label Rating "); exit(); } $xml = new SimpleXMLElement(file_get_contents("http://habrahabr.ru/api/profile/$username/")); print('karma.value ' . $xml->karma . "\n"); print('rating.value ' . $xml->rating . "\n"); ?> 


Installation


I hope someone will find it useful.

Source: https://habr.com/ru/post/218681/


All Articles