Miscellaneous Status Information

From MythTV Official Wiki
Revision as of 23:32, 10 April 2010 by Sphery (talk | contribs) (Thermal Information: Break out Additional Examples)

Jump to: navigation, search

MythTV now supports "Miscellaneous" status information on the backend status page allowing the user to include any additional status information through a user-specified program or script. The script can be specified on a per-backend basis using the mythtv-setup program, in the General settings section on the page, "Miscellaneous Settings."

Backend Status Format

The miscellaneous status information is output in the <Miscellaneous> element of the backend status document. Each piece of information is output using a single XML tag, <Information>, with any of 3 attributes, "display", "name", and "value":

<Miscellaneous>
  <Information display="display value" name="data name" value="data value" />
</Miscellaneous>

The value of the display attribute is inserted directly into the HTML backend status page. If the display value does not contain any "<p>" or "<br>" HTML breaks, a line break tag (<br />) will be written after the display value. If the display value provides any HTML breaks, no line breaks will be appended to the value (so the display value must provide all the breaks). The name and value attributes are only accessible through the XML backend status page. The display value may contain HTML markup, though doing so may "break" the backend status page, causing it to render incorrectly, so including HTML markup should be done with care.

Script Output Format

The script should output the three values on a single line delimited with []:[], i.e.:

display[]:[]name[]:[]value

Values may be omitted, as long as the order (and placement) remains constant:

display
[]:[]name[]:[]value

If four (or more) fields are output on a line, the extra fields will be ignored.

The script should provide output quickly to ensure the status page is returned in a reasonably short period of time. If you would like to provide information that requires a significant amount of time to compute (or that comes from a remote system whose response time is unknown), you may want to set up another script, i.e. in a cron job, and poll the data at appropriate intervals and write the output to a file, which could then be read (or simply cat'ed, if in the proper format) by the miscellaneous status script.

Thermal Information

Note that previously, MythTV provided CPU temperature information in the "Machine information" section of the status page. The values were retrieved directly using libsensors. The libsensors dependency has since been removed and those wanting this type of information should make it available through the miscellaneous status application.

Previously, CPU temperature was output in XML format as:

 <Thermal temperature="53.5 &#8451;" />

and rendered to HTML as:

 Current CPU temperature: 53.5 &#8451;.<br />

To get equivalent output using the miscellaneous status info, create a script or program that outputs information such as:

 Current CPU temperature: 53.5 &#8451;.[]:[]temperature[]:[]53.5 &#amp;8451;

Given the above script output, the status XML document will contain:

 <Information display="Current CPU temperature: 53.5 &#8451;." name="temperature" value="53.5 &#8451;" />

which will be rendered to HTML as:

 Current CPU temperature: 53.5 &#8451;.<br />

However, now that the display and value are separate, it may make more sense to remove the HTML entity from the value, such as:

 Current CPU temperature: 53.5 &#8451;.[]:[]temperature[]:[]53.5

to make machine parsing the XML easier, especially for display in a non-HTML output format.

Additional Examples

For additional examples, see the example scripts at Category:Miscellaneous_Status_Information_Scripts