fix(plugin) Linux local - mode systemd-journal : --output-fields added in version 236 (#5180)

Co-authored-by: omercier <32134301+omercier@users.noreply.github.com>
Co-authored-by: sdepassio <114986849+sdepassio@users.noreply.github.com>
REFS: CTOR-877
This commit is contained in:
Stéphane Duret 2024-10-04 14:17:15 +02:00 committed by GitHub
parent df03cc5037
commit ab7218d3ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 95 additions and 84 deletions

View File

@ -69,7 +69,18 @@ sub manage_selection {
(defined($self->{option_results}->{filter_message}) ? md5_hex($self->{option_results}->{filter_message}) : md5_hex('all')) . '_' .
(defined($self->{option_results}->{since}) ? md5_hex($self->{option_results}->{since}) : md5_hex('all'));
my $command_options = '--output json --output-fields MESSAGE --no-pager';
my ($stdout_version) = $options{custom}->execute_command(
command => '/usr/bin/journalctl',
command_options => '--version'
);
$stdout_version =~ /^systemd\s(\d+)\s/;
my $journalctl_version = $1;
my $command_options = '--output json --no-pager';
# --output-field option has been added in version 236
if ($journalctl_version >= 236) {
$command_options .= ' --output-fields MESSAGE';
};
if (defined($self->{option_results}->{unit}) && $self->{option_results}->{unit} ne '') {
$command_options .= ' --unit ' . $self->{option_results}->{unit};
@ -152,7 +163,7 @@ OK: Centreon Engine reloads over the last hour: 0 | 'centreon.engine.reload.coun
=item B<--unit>
Only look for messages of the specified unit, ie the
Only look for messages from the specified unit, i.e. the
name of the systemd service who created the message.
=item B<--filter-message>
@ -162,18 +173,23 @@ Filter on message content (can be a regexp).
=item B<--since>
Defines the amount of time to look back at messages.
Can be minutes (ie 5 "minutes ago") or 'cache' to use the
timestamp from last execution. (default: 'cache')
Can be minutes (example: 5 "minutes ago") or 'cache' to use the
timestamp from last execution. Default: 'cache'.
=item B<--timezone>
Defines the timezone to convert date/time to the host
timezone when using timestamp from cache. (default: 'local')
Defines the timezone to use for date/time conversion when using a timestamp from the cache.
Default: 'local'.
=item B<--warning-entries> B<--critical-entries>
=item B<--warning-entries>
Thresholds on the number of entries found
in the journal for the specified parameters.
Thresholds to apply to the number of journal entries
found with the specified parameters.
=item B<--critical-entries>
Thresholds to apply to the number of journal entries
found with the specified parameters.
=back

View File

@ -1,23 +1,52 @@
2c
3CX
--3cx-version
--add-sysdesc
ADSL
Alcatel
allCapacity
Ansible
--api-filter-orgs
api.meraki.com
--api-password
--api-path
--api-token
--api-username
--api-version
ASAM
Avigilon
Backbox
--cacert-file
cardtemperature
Centreon
--cert-pkcs12
--cert-pwd
connections-dhcp
connections-dns
cpu-utilization-1m
cpu-utilization-5m
cpu-utilization-5s
--critical-backend-congestions
--critical-backend-outstanding-io
--critical-bytesallocatedpercentage
--critical-na
Datacore
datasource
DC4
dcdiag
deduplication
deltaps
df
--dfsr
dfsrevent
--display-transform-dst
--display-transform-src
--dyn-mode
-EncodedCommand
eth
--exclude-fs
fanspeed
FCCapacity
--filter-fs
--filter-imei
--filter-vdom
@ -26,100 +55,43 @@
--force-counters32
--force-counters64
--force-oid
--get-param
--ignore-orgs-api-disabled
--jobq
--legacy-api-beta
--lookup-perfdatas-nagios
--map-speed-dsl
--mqtt
--mqtt-allow-insecure
--mqtt-ca-certificate
--mqtt-password
--mqtt-port
--mqtt-ssl
--mqtt-ssl-certificate
--mqtt-ssl-key
--mqtt-timeout
--mqtt-username
--nagvis-perfdata
--noeventlog
--nomachineaccount
--ntlmv2
--oid
--oid-display
--oid-extra-display
--oid-filter
--patch-redhat
--scope-datacenter
--sql-errors-exit
--urlpath
--use-ucd
--warning-backend-congestions
--warning-backend-outstanding-io
--warning-bytesallocatedpercentage
--warning-na
-EncodedCommand
-InputFormat
-NoLogo
2c
3CX
ADSL
Alcatel
allCapacity
Ansible
api.meraki.com
ASAM
Avigilon
Backbox
cardtemperature
Centreon
connections-dhcp
connections-dns
cpu-utilization-1m
cpu-utilization-5m
cpu-utilization-5s
Datacore
datasource
DC4
dcdiag
deduplication
deltaps
df
dfsrevent
eth
fanspeed
FCCapacity
Fortigate
Fortinet
frsevent
--get-param
HashiCorp
hashicorpvault
HPE
ifAlias
ifDesc
ifName
--ignore-orgs-api-disabled
IMEI
in-bcast
in-mcast
in-ucast
-InputFormat
interface-dsl-name
in-ucast
IpAddr
ipv4
ipv6
ISAM
Iwsva
--jobq
JOBQ
jobqueue
jobqueues
journalctl
kccevent
keepass
Kubernetes
Kubernetes
ldap
--legacy-api-beta
license-instances-usage-prct
Loggly
--lookup-perfdatas-nagios
machineaccount
--map-speed-dsl
MBean
memAvailReal
memBuffer
@ -133,23 +105,43 @@ module-cellradio-rsrq
module-cellradio-snr
modules-cellradio-detected
Mosquitto
--mqtt
MQTT
--mqtt-allow-insecure
--mqtt-ca-certificate
--mqtt-password
--mqtt-port
--mqtt-ssl
--mqtt-ssl-certificate
--mqtt-ssl-key
--mqtt-timeout
--mqtt-username
multiple
Nagios
nagios
Nagios
NagVis
net-snmp
--nagvis-perfdata
Netscaler
net-snmp
NLCapacity
--noeventlog
-NoLogo
--nomachineaccount
--ntlmv2
NTLMv2
NTP
--oid
OID
--oid-display
--oid-extra-display
--oid-filter
okta
oneaccess-sys-mib
out-bcast
out-mcast
out-ucast
overprovisioning
--patch-redhat
perfdata
physicaldrive
PKCS1
@ -162,16 +154,18 @@ psu
QoS
queue-messages-inflighted
RestAPI
RestAPI
RFC1628
RRDCached
Sansymphony
--scope-datacenter
sfp.temperature
SNMP
space-usage-prct
--sql-errors-exit
SSDCapacity
SSH
SureBackup
systemd
SysVol
TCP
teampass
@ -187,21 +181,22 @@ TrendMicro
UCD
UDP
uptime
--urlpath
usage-prct
userpass
--use-ucd
v1
v2
VDSL2
VDSL2
Veeam
Veeam
VeloCloud
VeloCloud
VM
VMware
VMware
VPN
vSAN
--warning-backend-congestions
--warning-backend-outstanding-io
--warning-bytesallocatedpercentage
--warning-na
WSMAN
WSMAN
XPath
XPath