Difference between revisions of "Monitoring With Cacti"

From MythTV Official Wiki
Jump to: navigation, search
m
Line 1: Line 1:
 
{{Note box|This page is work in progress}}  
 
{{Note box|This page is work in progress}}  
  
[http://en.wikipedia.org/wiki/Cacti_%28software%29 Cacti] is a frontend for the popular RRDTool, Cacti can produce graphing for any pollable service, which includes MythTV. While the tuner utilisation on MythWeb is usually enough to identify how much you are using your system, I required a few more details on when were the peak recording times.
+
[http://en.wikipedia.org/wiki/Cacti_%28software%29 Cacti] is a frontend for the popular RRDTool, Cacti can produce graphing for any pollable service, which includes MythTV. While the tuner utilisation on MythWeb is usually enough to identify how much you are using your system, A Cacti graph will help you identify your peak usage.
  
 
== Tuner usage statisics ==
 
== Tuner usage statisics ==

Revision as of 10:11, 31 December 2007

Important.png Note: This page is work in progress

Cacti is a frontend for the popular RRDTool, Cacti can produce graphing for any pollable service, which includes MythTV. While the tuner utilisation on MythWeb is usually enough to identify how much you are using your system, A Cacti graph will help you identify your peak usage.

Tuner usage statisics

Cacti tuner.png


Php.png tuner_usage.php

#!/usr/bin/php
<?
$fh = fopen('http://10.1.1.14:6544/xml', 'r');
$xmlstr = stream_get_contents($fh);
fclose($fh);

$xml = new SimpleXMLElement($xmlstr);

$total = $xml->Encoders['count'];
$active = 0;
$inactive = 0;

foreach ($xml->Encoders->Encoder as $encoder) {
    switch($encoder['state']) {
    case 0:
        $inactive = $inactive + 1;
        break;
    default:
        $active = $active + 1;
    }
}

//print_r($xml);

print "total:$total active:$active inactive:$inactive\n";
?>

Pending Job Queue

Php.png job_queue.php

#!/usr/bin/php
<?
$fh = fopen('http://10.1.1.14:6544/xml', 'r');
$xmlstr = stream_get_contents($fh);
fclose($fh);

$xml = new SimpleXMLElement($xmlstr);

$total = $xml->JobQueue['count'];
$running = 0;
$queued = 0;
$error = 0;

foreach ($xml->JobQueue->Job as $job) {
    switch($job['status']) {
    case 0:
        $running = $running + 1;
        break;
    case 1:
        $queued = $queued + 1;
        break;
    case 304:
        $error = $error + 1;
        break;
    }
}

//print_r($xml);

print "total:$total running:$running queued:$queued error:$error\n";
?>