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}->{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')); (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 '') { if (defined($self->{option_results}->{unit}) && $self->{option_results}->{unit} ne '') {
$command_options .= ' --unit ' . $self->{option_results}->{unit}; $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> =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. name of the systemd service who created the message.
=item B<--filter-message> =item B<--filter-message>
@ -162,18 +173,23 @@ Filter on message content (can be a regexp).
=item B<--since> =item B<--since>
Defines the amount of time to look back at messages. Defines the amount of time to look back at messages.
Can be minutes (ie 5 "minutes ago") or 'cache' to use the Can be minutes (example: 5 "minutes ago") or 'cache' to use the
timestamp from last execution. (default: 'cache') timestamp from last execution. Default: 'cache'.
=item B<--timezone> =item B<--timezone>
Defines the timezone to convert date/time to the host Defines the timezone to use for date/time conversion when using a timestamp from the cache.
timezone when using timestamp from cache. (default: 'local') Default: 'local'.
=item B<--warning-entries> B<--critical-entries> =item B<--warning-entries>
Thresholds on the number of entries found Thresholds to apply to the number of journal entries
in the journal for the specified parameters. found with the specified parameters.
=item B<--critical-entries>
Thresholds to apply to the number of journal entries
found with the specified parameters.
=back =back

View File

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