Sysadmin > SolarIs > CheckMkSolaris

How to install Check_MK Agent for Solaris

Prerequisits

  • libgcc
  • libstatgrab
  • top

Easy to install via pkgsrc

Download Check_MK Agent (shell script)

We use the version 1.2.6

Paths and directories

I choose to install the agent in /opt/checkmk , if you choose something else you have to adapt the paths accordingly.

mkdir /opt/checkmk
cd /opt/checkmk
mkdir plugins local mrpe job agents

mv check_mk_agent.solaris /opt/checkmk/agents
chmod 744 /opt/checkmk/agents/check_mk_agent.solaris

I have to adapt some PATHs

  • PATH to installation
  • PATH to top
  • PATH to statgrab

/opt/checkmk> diff /tmp/check_mk_agent.solaris.original agents/check_mk_agent.solaris
30,32c30,35
< export MK_LIBDIR="/usr/lib/check_mk_agent"
< export MK_CONFDIR="/etc/check_mk"
< export MK_VARDIR="/var/lib/check_mk_agent"
---
> #export MK_LIBDIR="/usr/lib/check_mk_agent"
> #export MK_CONFDIR="/etc/check_mk"
> #export MK_VARDIR="/var/lib/check_mk_agent"
> export MK_LIBDIR="/opt/checkmk/lib"
> export MK_CONFDIR="/opt/checkmk/etc"
> export MK_VARDIR="/opt/checkmk/var"
175c178
< if type statgrab &>/dev/null
---
> if type /usr/pkg/bin/statgrab &>/dev/null
187c190
<     statgrab $statgrab_vars 1>/tmp/statgrab.$$ 2>/dev/null
---
>     /usr/pkg/bin/statgrab $statgrab_vars 1>/tmp/statgrab.$$ 2>/dev/null
195,196c198,199
<     # However, we make an exception if /usr/bin/top is missing (required by solaris_mem)
<     if [ ! -x /usr/bin/top ]
---
>     # However, we make an exception if /usr/pkg/bin/top is missing (required by solaris_mem)
>     if [ ! -x /usr/pkg/bin/top ]
239c242
< if [ -x /usr/bin/top ]
---
> if [ -x /usr/pkg/bin/top ]
242c245
<     /usr/bin/top | grep '^Memory:'
---
>     /usr/pkg/bin/top | grep '^Memory:'

In the end it looks like:
 find /opt/checkmk/
/opt/checkmk/
/opt/checkmk/var
/opt/checkmk/var/cache
/opt/checkmk/plugins
/opt/checkmk/job
/opt/checkmk/local
/opt/checkmk/mrpe
/opt/checkmk/agents
/opt/checkmk/agents/check_mk_agent.solaris

inetd services

Add thge checkmk service in /etc/services
$ cat /etc/services | grep checkmk
checkmk         6556/tcp        checkmk         # Check_MK_Agent

$ cat - > /tmp/inet.checkmk
checkmk stream  tcp     nowait  root    /opt/checkmk/agents/check_mk_agent.solaris
^D

This file will now be converted to XML and copied to /var/svc/manifest/network/

$ inetconv -i /tmp/inet.checkmk
checkmk -> /var/svc/manifest/network/checkmk-tcp.xml
Importing checkmk-tcp.xml ...Done

Inetd will be restarted and the service is active now

Check installation

$ inetadm | grep checkmk
enabled   maintenance    svc:/network/checkmk/tcp:default
$ netstat -a | grep checkmk
      *.checkmk            *.*                0      0 49152      0 LISTEN
$ telnet localhost 6556
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
<<<check_mk>>>
Version: 1.2.6p11
AgentOS: solaris
<<<df>>>
/usr/lib/libc/libc_hwcap1.so.1 lofs 117662710 12070962 105591748 11% /lib/libc.so.1
<<<zfsget>>>
...........

An example output in full length

Common errors

If your editor breaks the line in two.
 inetconv -i /tmp/inet.checkmk
inetconv: Error /tmp/inet.checkmk line 1 too few fields, skipped
inetconv: Error /tmp/inet.checkmk line 2 too few fields, skipped

If you forget to place the agent into the right directory.
$ inetconv -i /tmp/inet.checkmk
inetconv: Error /tmp/inet.checkmk line 1 server-program not found: /opt/checkmk/agents/check_mk_agent.solaris

If you forget to make the agent executable.
$ inetadm | grep checkmk
enabled   maintenance    svc:/network/checkmk/tcp:default
$ chmod 744 /opt/checkmk/agents/check_mk_agent.solaris
$ inetadm -d /network/checkmk/tcp:default
$ inetadm -e /network/checkmk/tcp:default
$ inetadm | grep checkmk
enabled   online         svc:/network/checkmk/tcp:default