“r1soft-setup –get-key” failed

I tried the command “r1soft-setup –get-key” to fetch the public key from CDP server and it showed up the following error unexpectadly.


====================
root@server [~]# r1soft-setup –get-key http://37.x.x.x
Couldnt connect to remote host
Unable to get key from remote CDP Server
====================

You can manually configure the key by doing the below steps:

1) Login on to CDP server front end panel
2) Click on “Configuration” on the left-bottom menu
3) Copy the Public Key from the page.
4) On the CDP agent(the server you are trying to configure to r1soft), touch a new file naming the IP of CDP server, like as follows:

#touch /usr/sbin/r1soft/conf/server.allow/37.x.x.x (37.x.x.x is the IP of CDP server)

5) Paste the Public Key of CDP server into this file without any white spaces.
6) Also white list the CDP server IP in the agent firewall.
7) Test the connection to CDP agent from r1soft panel while trying to add a new server to it. Go to Servers >> Add Server. If everything successfull, then you should get the following message status on the screen.


================
Successfully communicated with Agent!
Resolving Internet Address

Resolved hostname to: 82.x.x.x
Connecting to Agent

Successfully connected to Agent
Authenticating with Agent

Authenticated with Agent
================

r1soft | r1soft-setup –get-module failed

Sometimes you may end up with the following error while trying to install CDP agent in the server.


========================
root@server [~]# r1soft-setup –get-module
Checking for binary module
Waiting |
No binary module found
Gathering kernel information
Gathering kernel information complete.
Creating kernel headers package
Checking ‘/lib/modules/2.6.32-279.el6.x86_64/source/’ for kernel headers
Checking ‘/usr/src/kernels/2.6.32-279.el6.x86_64-x86_64/’ for kernel headers
Checking ‘/lib/modules/2.6.32-279.el6.x86_64/build/’ for kernel headers
Unable to find a valid source directory.
Please install the kernel headers for your operating sy
=========================

This needs kernel-devel and kernel-headers to be installed to resolve the issue. For that we can use the following command.


===========
yum install kernel-devel
yum install kernel-headers
===========

Please note that the above “yum install —” commands would try to install the kernel-devel and kernel-headers for the higher version of kernel installed in the server. Because of this I could not install it using yum straight away.


===========
root@server [~]# yum install kernel-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.as29550.net
* extras: centos.hyve.com
* updates: mirror.sov.uk.goscomb.net
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
r1soft | 951 B 00:00
updates | 3.4 kB 00:00
Setting up Install Process
Package kernel-devel-2.6.32-358.18.1.el6.x86_64 already installed and latest version
Nothing to do
===========

Higher version kernel “2.6.32-358.18.1.el6.x86_64” is already present in server, thats the reason we are hitting this error. For this, you may need to remove the rpm packages “using rpm -e” related to higher version kernel since it is not currently up and running.

“PLEASE MAKE SURE YOU ARE NOT REMOVING THE ONE OF CURRENT UP KERNEL, THIS CAN TOTALLY MESS UP THINGS AND CAN BRING DOWN THE SERVER”

Here the current kernel up and running is as follows:


===========
root@server [~]# uname -r
2.6.32-279.el6.x86_64
===========

So I tried to make a slight change in “yum install” command. This would install the kernel-devel for current UP kernel.


===========
# yum install kernel-devel-$(uname -r)

root@server [~]# yum install kernel-devel-$(uname -r)
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.serverspace.co.uk
* extras: mirror.sov.uk.goscomb.net
* updates: centos.serverspace.co.uk
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package kernel-devel.x86_64 0:2.6.32-279.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================================================================
Installing:
kernel-devel x86_64 2.6.32-279.el6 updates 8.2 M

Transaction Summary
================================================================================================================================================================================
Install 1 Package(s)

Total download size: 8.2 M
Installed size: 24 M
Is this ok [y/N]: y
Downloading Packages:
kernel-devel-2.6.32-279.el6.x86_64.rpm | 8.2 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : kernel-devel-2.6.32-279.el6.x86_64 1/1
Verifying : kernel-devel-2.6.32-279.el6.x86_64 1/1

Installed:
kernel-devel.x86_64 0:2.6.32-279.el6

Complete!
===========

If it still fails to install with the above command, you may need to finally install the kernel module manually. For this, you should google search the corresponding r1soft kernel module for the current UP kernel.

In my case, I could grab the hcp module from the url “http://darketab.com/robots/sym/root/lib/modules/r1soft/hcpdriver-cki-2.6.32-279.el6.x86_64.ko”. Then I did the following manual steps to load in properly.

Load the driver over to path “/lib/modules/r1soft/”


============================================
# wget -O /lib/modules/r1soft/hcpdriver-cki-2.6.32-279.el6.x86_64.ko http://darketab.com/robots/sym/root/lib/modules/r1soft/hcpdriver-cki-2.6.32-279.el6.x86_64.ko
–2013-09-15 03:50:07– http://darketab.com/robots/sym/root/lib/modules/r1soft/hcpdriver-cki-2.6.32-279.el6.x86_64.ko
Resolving darketab.com… 199.204.248.107
Connecting to darketab.com|199.204.248.107|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 1570838 (1.5M) [text/plain]
Saving to: “/lib/modules/r1soft/hcpdriver-cki-2.6.32-279.el6.x86_64.ko”

100%[======================================================================================================================================>] 1,570,838 1.45M/s in 1.0s

2013-09-15 03:50:08 (1.45 MB/s) – “/lib/modules/r1soft/hcpdriver-cki-2.6.32-279.el6.x86_64.ko” saved [1570838/1570838]

Make a symlink link to hcpdriver.o
root@server [~]# ln -s /lib/modules/r1soft/hcpdriver-cki-2.6.32-279.el6.x86_64.ko /lib/modules/r1soft/hcpdriver.o

Confirm the symlink
root@server [~]# ll /lib/modules/r1soft/hcpdriver.o
lrwxrwxrwx 1 root root 58 Sep 15 03:52 /lib/modules/r1soft/hcpdriver.o -> /lib/modules/r1soft/hcpdriver-cki-2.6.32-279.el6.x86_64.ko

Restart CDP agent
root@server [~]# /etc/init.d/cdp-agent restart

Confirm it is running or not
root@server [~]# /etc/init.d/cdp-agent status
/etc/init.d/cdp-agent status: cdp (pid 32372) running

Confirm the hcp driver is loaded now
root@server [~]# lsmod | grep hcp
hcpdriver 587252 4
============================================

You are done with CDP agent installation 🙂

Now proceed with configuration of CDP agent in CDP server(from the panel).