Thursday, September 5, 2013

check_mk on OpenBSD

First, grab the most recent source, and extract and install it.
wget http://mathias-kettner.de/download/check_mk-1.2.2p2.tar.gz
gunzip check_mk-1.2.2p2.tar.gz
tar xf check_mk-1.2.2p2.tar
cd check_mk-1.2.2p2
gunzip agents.tar.gz
tar xf agents.tar
sudo cp check_mk_agent.openbsd /usr/local/bin/check_mk_agent
sudo chmod 755 /usr/local/bin/check_mk_agent
Then add the check_mk service to /etc/services.
$ rcsdiff /etc/services
===================================================================
RCS file: /etc/services,v
retrieving revision 1.1
diff -r1.1 /etc/services
1c1
< #     $OpenBSD: services,v 1.1 2013/09/03 18:52:00 beaty Exp beaty $
---
> #     $OpenBSD: services,v 1.1 2013/09/03 18:52:00 beaty Exp $
296a297,298
>
> check_mk      6556/tcp
Add the service to /etc/inetd.conf and restart inetd
$ rcsdiff /etc/inetd.conf
===================================================================
RCS file: /etc/inetd.conf,v
retrieving revision 1.1
diff -r1.1 /etc/inetd.conf
1c1
< #     $OpenBSD: inetd.conf,v 1.1 2013/09/03 18:49:57 beaty Exp beaty $
---
> #     $OpenBSD: inetd.conf,v 1.1 2013/09/03 18:49:57 beaty Exp $
50a51,52
> check_mk      stream  tcp     nowait  root    /usr/local/bin/check_mk_agent
> check_mk      stream  tcp6    nowait  root    /usr/local/bin/check_mk_agent

$ sudo kill -HUP `cat /var/run/inetd.pid `
Open up the port in pf (and probably allow pings from the nagios host).
$ sudo rcsdiff -r1.1 /etc/pf.conf
===================================================================
RCS file: /etc/pf.conf,v
retrieving revision 1.1
diff -r1.1 /etc/pf.conf
1c1
< #     $OpenBSD: pf.conf,v 1.1 2013/09/03 18:54:56 beaty Exp $
---
> #     $OpenBSD: pf.conf,v 1.2 2013/09/03 21:57:17 beaty Exp $
38c38,39
<
---
> pass in proto tcp from 128.117.64.51 to any port 6556
> pass in proto icmp from 128.117.64.51 to any icmp-type echoreq

$ sudo pfctl -f /etc/pf.conf

No comments: