Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External command parse errors #398

Open
dt770pro opened this issue Oct 24, 2022 · 9 comments
Open

External command parse errors #398

dt770pro opened this issue Oct 24, 2022 · 9 comments

Comments

@dt770pro
Copy link

Using passive checks from numerous different systems via NRDP REST API using XML.

I frequently see one of two external command parse errors when receiving an "OK" check result following a fault state of "CRITICAL".

Two examples being:

[2022-10-22 12:58:59] Warning: External command parse error [1666439939] [1666439939] PROCESS_HOST_CHECK_RESULT;HOST_A;0;HOST_A_IS_OK (Unknown command '[1666439939] PROCESS_HOST_CHECK_RESULT')

[2022-10-22 12:58:59] Warning: External command parse error PROCESS_HOST_CHECK_RESULT;HOST_B;0;HOST_B_IS_OK (Commands must begin with a timestamp inside square brackets)

This seems to imply an issue related to the format of the received command, which we have verified as being sent correctly by the remote host, possibly related to the timestamp and its square brackets.

@sni
Copy link
Contributor

sni commented Oct 24, 2022

How do you submit the passive results to naemon? The fifo command file may have issues if several processes/threads try to write simultaneously.
Better choices would be using the query handler api or write spool files into the check results folder or livestatus (which internally uses the query api). All alternative handle parallel writes much better.

@dt770pro
Copy link
Author

Thank you for the quick response.

They are submitted via HTTP GET - and yes we frequently have up to 100 arriving virtually simultaneously.

I've had a quick look and I'm not sure how I would go about moving to using the Query Handler API or Livestatus API. Should I follow the guide here https://docs.checkmk.com/latest/en/web_api_references.html ?

@sni
Copy link
Contributor

sni commented Oct 24, 2022

the question was more how this NRDP submits its results to naemon.

@dt770pro
Copy link
Author

Sorry I'm a Linux beginner.. I'm not sure what you mean...

We have third party applications that do an HTTP GET on "fail" state and another on "ok". Simply:

GET /nrdp/?cmd=submitcmd&token=XXXXXXXXXX&command=PROCESS_HOST_CHECK_RESULT;HOST_A;1;Host_A_Fail\r\nHTTP/1.1\r\nHOST: fqdn.domain.local\r\n\r\n

I hope I am making sense!

@sni
Copy link
Contributor

sni commented Oct 24, 2022

i am sorry, but nrdp is not affiliated with this project. You could try to open an issue there.

@dt770pro
Copy link
Author

Ok understood. However, could you point me in the direction of achieving the same using the Livestatus API instead of NRDP?

@sni
Copy link
Contributor

sni commented Oct 24, 2022

Naemon itself does not offer a rest api. This can be done by 3rd party tools.
Naemon offers the APIs mentioned above:

  • Livestatus: local unix socket or tcp
  • query handler: local unix socket
  • check results spool folder: local spool directory
  • command file: local fifo pipe

So you are using a 3rd party tool already which is then probably using one of the above APIs. I further assume it uses the deprecated command file api which had known shortcomings like this.

I suggest you get in contact with the nrdp people to see if it can connect to naemon in a different way.

@dt770pro
Copy link
Author

Ok, thank you.

Is the Thruk REST API a suitable alternative?

@sni
Copy link
Contributor

sni commented Oct 24, 2022

Sure, that'll work too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants