Project

General

Profile

Actions

Feature #14777

closed

Status output plugin hook for packages to include their own data

Added by Jim Pingle over 1 year ago. Updated about 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Diagnostics
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
23.09
Release Notes:
Default

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.

Actions #1

Updated by Jim Pingle over 1 year ago

First target is FRR: #14588

Actions #2

Updated by Jim Pingle over 1 year ago

  • Status changed from New to In Progress
Actions #3

Updated by Jim Pingle over 1 year ago

  • Status changed from In Progress to Feedback
  • % Done changed from 0 to 100
Actions #4

Updated by Jim Pingle over 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'");
    }
}
Actions #5

Updated by Jim Pingle about 1 year ago

  • Plus Target Version changed from 24.01 to 23.09
Actions #6

Updated by Jim Pingle about 1 year ago

  • Status changed from Feedback to Resolved

This is working well on current snapshots

Actions #7

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.

Actions #8

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.

Actions #9

Updated by Jim Pingle about 1 year ago

  • Target version changed from 2.8.0 to 2.7.1
Actions

Also available in: Atom PDF