Page 1 of 1
Nagios Request API : Request failed: <urlopen error [Errno 1
Posted: Wed Jun 16, 2021 2:24 am
by veeravamsi
Hi Team,
We are trying to automation nagios deployment using ansible . And when im running the Job which has 16+ tasks ( to deploy 16 relevant services ) its failing with error "Status code was not [200]: Request failed: <urlopen error [Errno 104] Connection reset by peer>".
Is there any limitation on nagios end to invoke sequential or paraellel REST calls ?
Also any relevant logs i can see what exactly is happening ?
Re: Nagios Request API : Request failed: <urlopen error [Err
Posted: Wed Jun 16, 2021 11:50 am
by gsmith
Hi,
This doc describes the various Nagios XI logs:
https://assets.nagios.com/downloads/nag ... ptions.pdf
I'd start with /usr/local/nagios/var/nagios.log
As far as limitations on the API, from what I could find, this hasn't been an issue. But you guys might be
the first to be hitting it so quickly. Did any of the REST calls succeed?
Let me know if you can't find anything in logs, and I will mock something up on my system.
Also please send me a System Profile and I can help you look through the logs.
To send us your system profile.
1. Login to the Nagios XI GUI using a web browser.
2. Click the "Admin" > "System Profile" Menu
3. Click the "Download Profile" button
4. Save the profile.zip file and share this in a private message and then reply to this post to bring it up in the queue.
Thanks
Re: Nagios Request API : Request failed: <urlopen error [Err
Posted: Fri Jun 18, 2021 5:29 am
by veeravamsi
I will check with my team if i can share our nagios profile/configuraiton.
Meanwhile wanted to check if there is any better way of REST Calls to deploy multiple services at once ? like using Templates or something else ?
Re: Nagios Request API : Request failed: <urlopen error [Err
Posted: Fri Jun 18, 2021 9:31 am
by gsmith
Hi
I haven't used Ansible so I don't know if this is possible but as part of an experiment/troubleshooting
could you queue up the API calls so they run serially instead of in parallel ? Would like to confirm that
the concurrent requests are the issue.
Thanks
Re: Nagios Request API : Request failed: <urlopen error [Err
Posted: Fri Jun 18, 2021 11:50 am
by veeravamsi
Sure . Here is sample :
url: https://{{ xi_ip }}/nagiosxi/api/v1/config/service?apikey={{ xi_api_key }}
body: "host_name={{ host_fqdn }}&service_description=Service status for: NCPA Listener Service&check_command=check_xi_ncpa\\!-t '{{ ncpa_token }}' -P 5693 -M 'services' -q 'service=ncpa_listener,status=running'&max_check_attempts=6&check_interval=60&retry_interval=10&check_period=xi_timeperiod_24x7&contacts=nagiosadmin¬ification_interval=60¬ification_period=xi_timeperiod_24x7"
method: POST
Re: Nagios Request API : Request failed: <urlopen error [Err
Posted: Fri Jun 18, 2021 1:06 pm
by gsmith
Hi,
Sorry I wasn't clearer.
I meant could you send one request, wait for a response, send the next request, wait for a response, etc
I want to see if the requests completes successfully when sent one at a time
Thanks
Re: Nagios Request API : Request failed: <urlopen error [Err
Posted: Mon Jun 21, 2021 3:39 am
by veeravamsi
No luck. I tried adding sleep() 30seconds till a minutes between statements . Its not like its unable to add but completes say 4 or 6 APIs and throws errors for 7th one. its random.
Also is it possible for me to create template or Custom API for say set of 10 services and then invoke as single call ?
Re: Nagios Request API : Request failed: <urlopen error [Err
Posted: Mon Jun 21, 2021 3:36 pm
by gsmith
Hi,
Thanks for trying.
You can't create a custom api.
You could use a template, but templates are designed for use on one machine at a time, as opposed to
being able to include multiple hosts.
I talked to one of the developers and he said:
I vaguely remember using the API to generate thousands of services through a python script at one point, so I doubt it's a rate limit. He's not using the forceapply GET variable with every callinside Ansible, is he?
Let me know about the forceapply GET please.
Thanks
Re: Nagios Request API : Request failed: <urlopen error [Err
Posted: Wed Jun 23, 2021 2:18 am
by veeravamsi
I figured out whats blocking ... in my api i have dependency to map the HostGroup/ServiceGroup , so when those are missing im getting this error . May be a better API response would help from nagios ?
Re: Nagios Request API : Request failed: <urlopen error [Err
Posted: Wed Jun 23, 2021 9:16 am
by gsmith
Hi,
Good find.
I'll submit a feature request for a more informative
API response on your behalf.
Please keep in mind that the decision to implement an enhancement is at
the discretion of our development team.
Thanks