enh(centreon/broker): split input, output and consumer endpoints
Globally enhance Broker statistics mode by splitting and identifying input and output endpoint, and adding consumers listed on input. You can either just look at the number of consumers (to determine if nothing is connected to your listening input) or look at the statistics too (careful because consumer name changes over time, so will the metric name, use --change-perfdata when possible). Old status thresholds are handled for compatibility. It also inludes new perfdata.
# perl centreon_plugins.pl --plugin=apps::centreon::local::plugin --hostname=10.1.2.3 --mode=broker-stats --broker-stats-file='/var/lib/centreon-broker/central-broker-master-stats.json' --broker-stats-file='/var/lib/centreon-broker/central-rrd-master-stats.json' --broker-stats-file='/var/lib/centreon-engine/central-module-master-stats.json' --filter-name='^central-broker-master-input$' --critical-status='%{state} ne "listening"' --filter-counters='input-status|consumers$' --verbose
OK: Input 'central-broker-master-input' state: listening, Consumers: 7 | 'central-broker-master-input#input.consumers.count'=7;;;0;
Input 'central-broker-master-input'
state: listening, Consumers: 7
# perl centreon_plugins.pl --plugin=apps::centreon::local::plugin --hostname=10.1.2.3 --mode=broker-stats --broker-stats-file='/var/lib/centreon-broker/central-broker-master-stats.json' --broker-stats-file='/var/lib/centreon-broker/central-rrd-master-stats.json' --broker-stats-file='/var/lib/centreon-engine/central-module-master-stats.json' --filter-name=Centreon-Studio --change-perfdata='.*#(.*),$1' --verbose
OK: Input 'Centreon-Studio' state: listening, Consumers: 1 - Consumer 'Centreon-Studio-296' state: connected, Events processing speed: 253.43/s, Queued events: 8, Unacknowledged events: 0 | 'input.consumers.count'=1;;;0; 'consumer.events.processing_speed.persecond'=253.43events/s;;;0; 'consumer.events.queued.count'=8events;;;0; 'consumer.events.unacknowledged.count'=0events;;;0;
Input 'Centreon-Studio'
state: listening, Consumers: 1
Consumer 'Centreon-Studio-296' state: connected, Events processing speed: 253.43/s, Queued events: 8, Unacknowledged events: 0
# perl centreon_plugins.pl --plugin=apps::centreon::local::plugin --hostname=10.1.2.3 --mode=broker-stats --broker-stats-file='/var/lib/centreon-broker/central-broker-master-stats.json' --broker-stats-file='/var/lib/centreon-broker/central-rrd-master-stats.json' --broker-stats-file='/var/lib/centreon-engine/central-module-master-stats.json' --filter-name='sql' --critical-status='%{queue_file_enabled} =~ /true|yes/i' --change-perfdata='.*#(.*),$1'
OK: Output 'central-broker-master-unified-sql' state : connected [status : reading event from multiplexing engine] [queue file enabled : no], Events processing speed: 564.90/s, Queued events: 67, Unacknowledged events: 0 | 'output.events.processing_speed.persecond'=564.90events/s;;;0; 'output.events.queued.count'=67events;;;0; 'output.events.unacknowledged.count'=0events;;;0;
Also, the statistics file has a peers entry but it always shows "0: " (cc @bouda1).
Also, the statistics file has a peers entry but it always shows "0: " (cc @bouda1).
Looks like it's fixed by https://github.com/centreon/centreon-collect/pull/1122