Difference between revisions of "Monitoring With Cacti"
From MythTV Official Wiki
m (Corrected the URL) |
m (Corrected the URL for 0.25) |
||
Line 44: | Line 44: | ||
#!/usr/bin/php | #!/usr/bin/php | ||
<? | <? | ||
− | $fh = fopen('http://localhost:6544/ | + | $fh = fopen('http://localhost:6544/Status/GetStatus', 'r'); |
$xmlstr = stream_get_contents($fh); | $xmlstr = stream_get_contents($fh); | ||
fclose($fh); | fclose($fh); |
Revision as of 15:19, 22 May 2012
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"; ?>