check_mk error Cannot fetch deployment URL via curl error

Article explaining ‘ERROR Cannot fetch deployment URL via curl: Couldn’t resolve host. The given remote host was not resolved.’ and how to resolve it.

check_mk register error

check_mk is a utility that helps you configure your server to be monitored via nagios monitoring tool. While configuring one of the clients I came across below error :

ERROR Cannot fetch deployment URL via curl: Couldn't resolve host. The given remote host was not resolved.

This error came after I tried to register the client with the monitoring server with below command :

root@kerneltalks # /usr/bin/cmk-update-agent register -s monitor.kerneltalks.com -i master -H `hostname` -p http -U omdadmin -S ASFKWEFUNSHEFKG -v

Here in this command –

-s is monitoring server
-i is Name of Check_MK site on that server
-H is Hostname to fetch agent for
-p is protocol Either HTTP or HTTPS (default is HTTPS)
-U  User-ID of a user who is allowed to download the agent.
-S is secret. Automation secret of that user (in case of automation user)
From the error, you can figure out that command is not able to resolve to monitor server DNS name monitor.kerneltalks.com

Solution

Its pretty simple. Check /etc/resolv.conf to make sure that you have proper DNS server entry for your environment. If it still doesn’t resolve the issue then you can add an entry in /etc/hosts for it.

root@kerneltalks # cat /etc/hosts
10.0.10.9 monitor.kerneltalks.com

Thats it. You would be able to register now successfully.

root@kerneltalks # /usr/bin/cmk-update-agent register -s monitor.kerneltalks.com -i master -H `hostname` -p http -U omdadmin -S ASFKWEFUNSHEFKG -v
Going to register agent at deployment server
Successfully registered agent for deployment.
You can now update your agent by running 'cmk-update-agent -v'
Saved your registration settings to /etc/cmk-update-agent.state.

By the way, you can directly use the IP address for -s switch and get rid of all the above jargon including error itself!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.