Solved

Issue nsclient restapi output Command too long to execute (timeout)...

  • 8 April 2024
  • 2 replies
  • 27 views

Badge +1

Hello,

I’ve an issue with the plugin centreon_nsclient_restapi for the veeam application i’ve a timeout with the mode  “job-status”

/usr/lib/centreon/plugins/centreon_nsclient_restapi.pl --plugin=apps::nsclient::restapi::plugin --mode=query --hostname='172.17.70.72' --port='8443' --proto='https' --http-backend=curl --insecure  --timeout='300'  --legacy-password='xxxxx'  --command=check_centreon_plugins --arg='apps::backup::veeam::local::plugin' --arg='job-status' --arg=' --filter-name="" --filter-start-time="" --filter-end-time="86400" --filter-counters="" --ok-status="" --warning-status="" --critical-status="%{is_running} == 0 and not %{status} =~ /Success/i" --warning-long="" --critical-long="" --verbose' --debug
UNKNOWN: Command too long to execute (timeout)...
== Info:   Trying 172.17.70.72...
== Info: TCP_NODELAY set
== Info: Connected to 172.17.70.72 (172.17.70.72) port 8443 (#0)
== Info: ALPN, offering http/1.1
== Info: successfully set certificate verify locations:
== Info:   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
== Info: TLSv1.3 (OUT), TLS handshake, Client hello (1):
== Info: TLSv1.3 (IN), TLS handshake, Server hello (2):
== Info: TLSv1.2 (IN), TLS handshake, Certificate (11):
== Info: TLSv1.2 (IN), TLS handshake, Server finished (14):
== Info: TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
== Info: TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
== Info: TLSv1.2 (OUT), TLS handshake, Finished (20):
== Info: TLSv1.2 (IN), TLS handshake, Finished (20):
== Info: SSL connection using TLSv1.2 / AES256-GCM-SHA384
== Info: ALPN, server did not agree to a protocol
== Info: Server certificate:
== Info:  subject: CN=localhost
== Info:  start date: Mar 25 09:29:58 2024 GMT
== Info:  expire date: Mar 25 09:29:58 2025 GMT
== Info:  issuer: CN=localhost
== Info:  SSL certificate verify result: self signed certificate (18), continuing anyway.
=> Send header: GET /query/check_centreon_plugins?apps%3A%3Abackup%3A%3Aveeam%3A%3Alocal%3A%3Aplugin&job-status&%20--filter-name%3D%22%22%20--filter-start-time%3D%22%22%20--filter-end-time%3D%2286400%22%20--filter-counters%3D%22%22%20--ok-status%3D%22%22%20--warning-status%3D%22%22%20--critical-status%3D%22%25%7Bis_running%7D%20%3D%3D%200%20and%20not%20%25%7Bstatus%7D%20%3D~%20%2FSuccess%2Fi%22%20--warning-long%3D%22%22%20--critical-long%3D%22%22%20--verbose HTTP/1.1
Host: 172.17.70.72:8443
Accept: */*
password:******

== Info: HTTP 1.0, assume close after body
=> Recv header: HTTP/1.0 200
=> Recv header: Content-Length: 169
=> Recv header:
=> Recv data: {"header":{"source_id":""},"payload":[{"command":"check_centreon_plugins","lines":[{"message":"UNKNOWN: Command too long to execute (timeout)..."}],"result":"UNKNOWN"}]}
== Info: Closing connection 0
== Info: TLSv1.2 (OUT), TLS alert, close notify (256):

 

Locally on the windows machine the command is correctly executed :

C:\Users\Administrator>"c:\Program Files\centreon-nsclient\NSClient++\scripts\centreon\centreon_plugins.exe" --plugin=apps::backup::veeam::local::plugin --mode=job-status --filter-name="" --filter-start-time="" --filter-end-time="86400" --filter-counters="" --ok-status="" --warning-status="" --critical-status="%{is_running} == 0 and not %{status} =~ /Success/i" --warning-long="" --critical-long="" --verbose
CRITICAL: Job '**** - INFRA- CIFS' status: failed [type: Backup] - Job '**** - PROD - DMZPublic' status: failed [type: Backup] - Job '**** - PROD - *****' status: failed [type: Backup]

 

With the mode licence it works :

/usr/lib/centreon/plugins/centreon_nsclient_restapi.pl --plugin=apps::nsclient::restapi::plugin --mode=query --hostname='172.17.70.72' --port='8443' --proto='https'  --http-backend=curl --insecure --timeout=300 --legacy-password='centreon'  --command=check_centreon_plugins --arg='apps::backup::veeam::local::plugin'  --arg='licenses' ​--verbose --debug
OK: Number of licenses: 1 - License '*****' [type: perpetual] status: valid, instances total: 6 used: 0 (0.00%) free: 6 (100.00%) | 'licenses.total.count'=1;;;0; '*****#license.instances.usage.count'=0;;;0;6 '****#license.instances.free.count'=6;;;0;6 '*****#license.instances.usage.percentage'=0.00%;;;0;100
== Info:   Trying 172.17.70.72...
== Info: TCP_NODELAY set
== Info: Connected to 172.17.70.72 (172.17.70.72) port 8443 (#0)
== Info: ALPN, offering http/1.1
== Info: successfully set certificate verify locations:
== Info:   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
== Info: TLSv1.3 (OUT), TLS handshake, Client hello (1):
== Info: TLSv1.3 (IN), TLS handshake, Server hello (2):
== Info: TLSv1.2 (IN), TLS handshake, Certificate (11):
== Info: TLSv1.2 (IN), TLS handshake, Server finished (14):
== Info: TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
== Info: TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
== Info: TLSv1.2 (OUT), TLS handshake, Finished (20):
== Info: TLSv1.2 (IN), TLS handshake, Finished (20):
== Info: SSL connection using TLSv1.2 / AES256-GCM-SHA384
== Info: ALPN, server did not agree to a protocol
== Info: Server certificate:
== Info:  subject: CN=localhost
== Info:  start date: Mar 25 09:29:58 2024 GMT
== Info:  expire date: Mar 25 09:29:58 2025 GMT
== Info:  issuer: CN=localhost
== Info:  SSL certificate verify result: self signed certificate (18), continuing anyway.
=> Send header: GET /query/check_centreon_plugins?apps%3A%3Abackup%3A%3Aveeam%3A%3Alocal%3A%3Aplugin&licenses HTTP/1.1
Host: 172.17.70.72:8443
Accept: */*
password:******

== Info: HTTP 1.0, assume close after body
=> Recv header: HTTP/1.0 200
=> Recv header: Content-Length: 460
=> Recv header:
=> Recv data: {"header":{"source_id":""},"payload":[{"command":"check_centreon_plugins","lines":[{"message":"OK: Number of licenses: 1 - License '****' [type: perpetual] status: valid, instances total: 6 used: 0 (0.00%) free: 6 (100.00%) | 'licenses.total.count'=1;;;0; '**** #license.instances.usage.count'=0;;;0;6 '****#license.instances.free.count'=6;;;0;6 '*****#license.instances.usage.percentage'=0.00%;;;0;100"}],"result":"OK"}]}
== Info: Closing connection 0
== Info: TLSv1.2 (OUT), TLS alert, close notify (256):

 

could you help me please ?

 

 

 

icon

Best answer by Ludovic 11 April 2024, 16:25

View original

2 replies

Userlevel 5
Badge +11

Hello,

You can try to set the timeout at a higher value on the agent conf

By default it’s 30 seconds, but you can try to change the value on nsclient.ini file, with something like this

[/settings/default]
timeout = 180
; ...
[/settings/external scripts]
timeout = 180

Hope it helps

Badge +1

Hi Vcoum,

 

Thank you for comment. Already tried to add timeouts in the nsclient.ini configuration without success.

I finally get rid of it be reading again de man page of the plugin and found that we can add another timeout value after the mode:

/usr/lib/centreon/plugins/centreon_nsclient_restapi.pl --plugin=apps::nsclient::restapi::plugin --mode=query --hostname='172.17.70.72' --port='8443' --proto='https' --legacy-password='***' --http-backend=curl --insecure --timeout=300 --command=check_centreon_plugins --arg='apps::backup::veeam::local::plugin' --arg='job-status'  --arg=' --filter-name="" --filter-start-time="" --filter-end-time="86400" --filter-counters="" --ok-status="" --warning-status="" --critical-status="%{is_running} == 0 and not %{status} =~ /Success/i" --warning-long="" --critical-long="" --verbose --timeout=80'

 

So it’s resolved.

 

Kr,

 

Ludovic

 

Reply