Hello ,
Is there a way to monitor API in Nagios xi ?
I have to monitor a API and they have provided me a API key also . Please let me know if there is a way to monitor .
How to monitor an API in Nagios xi
-
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: How to monitor an API in Nagios xi
Hi,
If you're looking to parse some type JSON or XML output from the API, then I would recommend using the JSON or XML wizards that come with Nagios xi.
Just go to Configure > Start Monitoring Now and search for JSON or XML.
Otherwise, you might also be able to set up a simple check using the check_http plugin.
https://www.monitoring-plugins.org/doc/ ... _http.html
Let us know if you have more questions.
If you're looking to parse some type JSON or XML output from the API, then I would recommend using the JSON or XML wizards that come with Nagios xi.
Just go to Configure > Start Monitoring Now and search for JSON or XML.
Otherwise, you might also be able to set up a simple check using the check_http plugin.
https://www.monitoring-plugins.org/doc/ ... _http.html
Let us know if you have more questions.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 194
- Joined: Fri Apr 26, 2019 2:01 am
Re: How to monitor an API in Nagios xi
Hi ,
Actually we wanted to monitor a URL using an api key . And I want the response code as my output . I have tried using check_json plugin , but we are not getting a proper output .
Check command :
check_json
Command view :
php $USER1$/check_json.php $ARG1$
$ARG1$ :
-u 'https://abcd.com:9002/aims_plus/was/status' -k 'lkAIdVfC.nuRMZYMzZAIwuqtapOKACBtpAHsTZEmQVjO' -h 'api-key'
Actually we wanted to monitor a URL using an api key . And I want the response code as my output . I have tried using check_json plugin , but we are not getting a proper output .
Check command :
check_json
Command view :
php $USER1$/check_json.php $ARG1$
$ARG1$ :
-u 'https://abcd.com:9002/aims_plus/was/status' -k 'lkAIdVfC.nuRMZYMzZAIwuqtapOKACBtpAHsTZEmQVjO' -h 'api-key'
You do not have the required permissions to view the files attached to this post.
-
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: How to monitor an API in Nagios xi
Hi,
Typically, what I've seen is to pass the API key with the URL string. They -k parameter would be for the key value of the son output and -s option would be to match the string.
Try modifying th header option ( h) to include the API key and let me know if you able to connect.
Typically, what I've seen is to pass the API key with the URL string. They -k parameter would be for the key value of the son output and -s option would be to match the string.
For example:-u url
-k json key
-s treat key as a string
-r status code if <string> matches <key> value (defaults to 0 when -s used)
-n status code if <string> does not match <key> value (defaults to 2 when -s is used)
-c critical threshold
-w warning threshold
-h additional header add to request
Try modifying th header option ( h) to include the API key and let me know if you able to connect.
Code: Select all
$ARG1$ :
-u 'https://abcd.com:9002/aims_plus/was/status' -k 'json key to check' -h 'api-key:12345'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 194
- Joined: Fri Apr 26, 2019 2:01 am
Re: How to monitor an API in Nagios xi
Hi ,
I tried as you have suggested , but im not getting the output .
I tried as you have suggested , but im not getting the output .
You do not have the required permissions to view the files attached to this post.
-
- Posts: 194
- Joined: Fri Apr 26, 2019 2:01 am
Re: How to monitor an API in Nagios xi
Hi ,
Is there a way to do it through check_http plugin ?
Is there a way to do it through check_http plugin ?
-
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: How to monitor an API in Nagios xi
Hi,
Example:
Checking with a team member on passing API authorizations in the HTTP header and I'll follow up with you on that.
Benjamin
This can be accomplished using the check_http, but you'll need to create on regex patterns to match the appropriate JSON key/values.Is there a way to do it through check_http plugin ?
Example:
Code: Select all
./check_http -H 192.168.23.115 -u /nagiosxi/api/v1/objects/hoststatus?apikey=JdqXNOLmVmGgt7l5NNVDinUho2OUJuuscmIqDM2Xsu8RjJMK0fJbdcnTC7aYalfU -r "localhost"
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 194
- Joined: Fri Apr 26, 2019 2:01 am
Re: How to monitor an API in Nagios xi
Hi ,
Any update on this ?
Any update on this ?
-
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: How to monitor an API in Nagios xi
Hi Deek,
Thanks for your patience. For that plugin, the -k option would allow you to pass data in the header.
Reference:
https://www.monitoring-plugins.org/doc/ ... _http.html
Thanks for your patience. For that plugin, the -k option would allow you to pass data in the header.
--Benjamin-k, --header=STRING
Any other tags to be sent in http header. Use multiple times for additional header
Reference:
https://www.monitoring-plugins.org/doc/ ... _http.html
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!