Monitoring With Cacti
From MythTV Official Wiki
Note: This page is work in progress. This uses MythXML to grab Tuner and Encoder info so it does not work in 0.25 and newer.
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
#!/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
#!/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"; ?>