Monitoring With Cacti

From MythTV Official Wiki
Jump to: navigation, search

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://localhost:6544/Status/GetStatus', '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://localhost:6544/Status/GetStatus', '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";
?>
Personal tools
Namespaces
Variants
Actions
Wiki Navigation
Official Resources
Toolbox
Print/export