Feature #14777
closedStatus output plugin hook for packages to include their own data
100%
Description
The status output page (status.php
) gathers system information that is helpful for diagnosing problems, but it is currently limited to base system information only.
Rather than hardcoding specific items from packages in status.php
directly, we should craft a simple plugin hook where packages can declare their own files and commands to include in status output. There are already similar plugin hooks in place for other functions such as logging/rotation.
This should also include packages having some way to sanitize their own data before including it, since there could be sensitive info inside (keys, passwords, etc) and that information may not be sanitized as expected by base system functions.
Updated by Jim Pingle about 1 year ago
- Status changed from In Progress to Feedback
- % Done changed from 0 to 100
Applied in changeset edba13d595cd270be852b29fed96029e622282f7.
Updated by Jim Pingle about 1 year ago
To use this, packages need to make two changes:
First define the plugin in their main XML file (e.g. frr.xml)
<plugins>
<item>
<type>plugin_statusoutput</type>
</item>
</plugins>
If there are existing plugins, add the new one as an additional item:
<plugins>
<item>
<type>plugin_carp</type>
</item>
<item>
<type>plugin_statusoutput</type>
</item>
</plugins>
Next, add a new function named <packagename>_plugin_statusoutput()
which defines commands and/or log files to include. For example:
function frr_plugin_statusoutput($pluginparams) {
require_once('status_output.inc');
$entry_prefix = 'Package-FRR-';
if (is_readable('/var/etc/frr/frr.conf')) {
status_cmd_define("{$entry_prefix}Config-FRR", "cat /var/etc/frr/frr.conf");
}
if ($frr_enabled) {
status_cmd_define("{$entry_prefix}Config-running", "/usr/local/bin/vtysh -c 'show run'");
}
}
Updated by Jim Pingle about 1 year ago
- Plus Target Version changed from 24.01 to 23.09
Updated by Jim Pingle about 1 year ago
- Status changed from Feedback to Resolved
This is working well on current snapshots
Updated by Chris Linstruth about 1 year ago
This looks wonderful. Thank you.
My only concern would be showing the full BGP route table. But since we're already including the kernel FIB and state table, etc, it should be OK. If they are running full tables they should be on hardware that can handle the show command.
Updated by Jim Pingle about 1 year ago
Chris Linstruth wrote in #note-7:
This looks wonderful. Thank you.
My only concern would be showing the full BGP route table. But since we're already including the kernel FIB and state table, etc, it should be OK. If they are running full tables they should be on hardware that can handle the show command.
I was wondering about that as well. I suppose it could try to check the output of something like show ip route summ
and skip certain commands if there are more than X number of entries. We can address that in the future if it becomes a problem.
Updated by Jim Pingle about 1 year ago
- Target version changed from 2.8.0 to 2.7.1