Miscellaneous Status Information

From MythTV Official Wiki
Jump to: navigation, search

MythTV 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.


Miscellaneous Status Information Scripts provide a way for users to add additional information to the "Miscellaneous" section of the backend status page, available through MythWeb's Backend Status page or http://[hostname]:6544/ . Specify the full path to the Miscellaneous Status Information script in the setting Miscellaneous Status Application in mythtv-setup General settings on the page Miscellaneous Settings. The setting can be specified per-backend, allowing different backends to provide different status information (note, though, that the MythWeb Backend Status page will always show the master backend status).

An XML version of the backend's status including this information is also available through the Services_API. Use: <BackendIP>:6544/Status/GetStatus.

The easiest way to configure your Miscellaneous Status Information script is to specify a user-created script that simply calls other scripts. For example, create a script, misc_status_info.sh and place it in /home/mythtv/bin/misc_status_info.sh, then set Miscellaneous Status Application to /home/mythtv/bin/misc_status_info.sh. Then, to update your Miscellaneous Status Information output, simply edit the script.

Script.png misc_status_info.sh


# Show all the shows recorded today
myth_recent_recordings.pl --recordings=-1 --hours=24 \
                          --heading '<h3>Shows Recorded Today</h3>'

# Show all upcoming conflicts
myth_upcoming_recordings.pl --recordings -1 \
                            --no_show_scheduled \
                            --heading '<h3>Recording Conflicts</h3>' \
                            --no_conflicts_message '<h3>No Conflicts</h3>' 

see myth_recent_recordings.pl and myth_upcoming_recordings.pl for more information on the scripts used above.

Example Scripts

See the example scripts at Category:Miscellaneous_Status_Information_Scripts

Writing Miscellaneous Status Information Scripts

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":

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

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.:


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


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.

See, also, myth_sensors.pl for an example script.