Installing the Linux agentJanuary 17. 2011
Using the RPM / DEB packagesInstalling the Agent via RPM or DEB is very easy. All you have to do is to make sure xinetd is installed first and the install the package. Usually, you'll also want to install the logwatch extension. For RPM this is done using: root@linux# rpm -i check_mk-agent-1.1.18-1.noarch.rpm root@linux# rpm -i check_mk-agent-logwatch-1.1.18-1.noarch.rpm For DEB type distros: root@linux# dpkg -i check-mk-agent_1.1.18-2_all.deb root@linux# dpkg -i check-mk-agent-logwatch_1.1.18-2_all.deb Installing the Agent manuallyThe check_mk agent for Linux consists of only two files: a shell skript called check_mk_agent.linux and a configuration file for xinetd.conf, both of which can be found in the subdirectory agents. xinetd is an improved version of the classical inetd and a is available or even standard on most current linux distributions. Alternatively you can use the classical inetd, but this documentation focusses on xinetd. Please install the file check_mk_agent.linux on your target host as /usr/bin/check_mk_agent (drop the .linux). You should be able to execute the agent simply by calling it from the command line. It can be run as non-root user, but some diagnostic information can only be retrieved if it is run as root. The output of check_mk_agent looks like this (abbreviated): root@linux# check_mk_agent <<<check_mk>>> Version: 1.1.8 AgentOS: linux <<<df>>> /dev/sda1 ext3 1008888 223832 733808 24% / /dev/sdc1 ext3 1032088 284648 695012 30% /lib/modules <<<ps>>> init [3] /sbin/syslogd /sbin/klogd -x /usr/sbin/cron /sbin/getty 38400 tty2 /sbin/getty 38400 tty3 /sbin/getty 38400 tty4 /sbin/getty 38400 tty5 /sbin/getty 38400 tty6 /sbin/getty 38400 tty1 sshd: linux [priv] sshd: linux@ttyp0 -sh /usr/sbin/sshd The configuration of Xinetd is simple: Copy the file xinetd.conf into /etc/xinetd.d and rename it do check_mk: /etc/xinetd.d/check_mk
service check_mk
{
type = UNLISTED
port = 6556
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/bin/check_mk_agent
# configure the IP address(es) of your Nagios server here:
# only_from = 127.0.0.1 10.0.20.1 10.0.20.2
disable = no
}
You might want to activate the only_from line. It allows you to specify a list of hosts that should be allowed to connect to the client. If you leave it out, there is no restriction. Then (re-)start Xinetd: root@linux# /etc/init.d/xinetd restart On some distributions you also need to activate the start script of Xinetd. Otherwise Xinetd will not be started automatically at the next reboot. On RedHat, SUSE and FEDORA this is done by: root@linux# chkconfig xinetd on On Debian and Ubuntu this is not neccessary. If everything went fine, then you are now able to retrieve the output of the agent by connecing to TCP port 6556 from the Nagios host. You can test this with: user@host> telnet xyzhost123 6556 Trying 10.0.21.47... Connected to xyzhost123. Escape character is '^]'. <<<check_mk>>> Version: 1.1.8 AgentOS: linux <<<df>>> /dev/sda1 ext3 1008888 223832 733808 24% / /dev/sdc1 ext3 1032088 284648 695012 30% /lib/modules <<<ps>>> init [3] /sbin/syslogd /sbin/klogd -x /usr/sbin/cron /sbin/getty 38400 tty2 Note that if you want to test this on the Nagios server itself via localhost, then the IP address 127.0.0.1 has to be allowed in xinetd.conf. You could also check via netstat wether the TCP port 6556 has been opened: root@linux# netstat -ltn Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:6556 0.0.0.0:* LISTEN tcp6 0 0 :::22 :::* LISTEN Accessing the agent via check_mkAfter a successful installation of the agent you can retrieve the data on the Nagios host via check_mk. This is done with user@host> check_mk -d xyzhost123 <<<check_mk>>> Version: 1.1.8 AgentOS: linux <<<df>>> /dev/sda1 ext3 1008888 223832 733808 24% / This should show the complete output from the agent. Your agent is now ready for usage. Please refer to Monitoring of Logfiles for the logwatch configuration. |
| |||||||||||||||||||||