I’ve got one AD integrated NAS4FREE server running on Supermicro hardware. It is rock solid but still, it would be nice to pull some monitoring info from it, innit?
Related to previous post about local checks with check_mk – based on Monitoring FreeBSD but slightly adapted for use with NAS4FREE, here are quick steps to make it happen. Tested on 9 and 10.
pkg install xinetd
vi /usr/local/etc/xinetd.conf
defaults { # Please note that you need a log_type line to be able to use log_on_success # and log_on_failure. The default is the following : # log_type = SYSLOG daemon info service check_mk { type = UNLISTED port = 6556 socket_type = stream protocol = tcp wait = no user = root server = /mnt/tank/service/local/bin/check_mk_agent only_from = 10.10.8.130 disable = no } }
vi /etc/services
check_mk 6556/tcp #check_mk agent
vi /etc/hosts.allow
check_mk_agent : 10.10.8.130 : allow check_mk_agent : ALL : deny
vi /etc/rc.conf
xinetd_enable="YES"
and then
/usr/local/etc/rc.d/xinetd start
Check_MK comes with a dedicated agent for FreeBSD: check_mk_agent.freebsd – make sure to copy it from OMD server /omd/sites/mysite/share/check_mk/agents/ to /mnt/tank/service/local/bin/check_mk_agent on NAS4FREE server.
Oh, and check out my sophisticated check_mk script that pulls SMART status from disks!
https://github.com/zmielna/smart_diskinfo/blob/master/check_mk_smart_freebsd.sh
That’s a real piece of art, init?
[…] Click here. […]
Hi,
Thanks for the article,
Where did you got the xinetd package (for Nas4Free )
For nas4free 10-series simple “pkg install xinetd” should do the trick. For nas4free 9, well you have to find this package on FreeBSD 9 mirror, download and install it with “pkg_add -r xinted.tgz” if I’m not mistaken. But better upgrade to ver 10 🙂 Hope this helps.
Thanx for your work, but …
there is some mistakes in there!
1)
your “/usr/local/etc/xinetd.conf” does NOT work on my NAS4Free (10.2.0.2 Prester). It turned out that not only the syntax lacks a closing bracket, but also that it might be better to split it up into two parts like on the check_mk – server itself, having a xinet.d – directory and a separate config file.
2)
the “/etc/rc.conf” file only need ONE additional line. The second one is the start command for xinetd – service (just mentioning)
Hiya, thanks for poiting this out. Yeah, I messed up syntax when “pretty formatting” code. Now fixed.
It’s amazing to see that someone is actually reading this stuff 🙂
Cheerio.
Hello, thanks for your hint. Even when I start xintetd, I get:
bnas02: run# /usr/local/etc/rc.d/xinetd start
Starting xinetd.
And then:
bnas02: run# /usr/local/etc/rc.d/xinetd restart
xinetd not running? (check /var/run/xinetd.pid).
Starting xinetd.
It ssems, that xintetd is not working properly. At the monitoring-box, I try to connect via telnet and get:
telnet: Unable to connect to remote host: Connection refused
Do have a hint, what there is going wrong?
Assuming you are on ver 10? By a quick look at the init script, it runs /usr/local/sbin/xinetd binary.
Check with file and ldd
# file /usr/local/sbin/xinetd
/usr/local/sbin/xinetd: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 10.1, stripped
# ldd /usr/local/sbin/xinetd
/usr/local/sbin/xinetd:
libwrap.so.6 => /usr/lib/libwrap.so.6 (0x800843000)
libm.so.5 => /lib/libm.so.5 (0x800a4c000)
libcrypt.so.5 => /lib/libcrypt.so.5 (0x800c75000)
libc.so.7 => /lib/libc.so.7 (0x800e95000)
Maybe try removing xinetd package and then putting it back? Try running binary without init script, to see if it produces any output at all.
Essentially you need to have it running before you can pull any info from it.
# /usr/local/etc/rc.d/xinetd status
xinetd is running as pid 5132.
HTH
I’m in Version 11…
I’m in Version 11…
hostname: ~# file /usr/local/sbin/xinetd
/usr/local/sbin/xinetd: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 11.0 (1100122), FreeBSD-style, stripped
hostname: ~# ldd /usr/local/sbin/xinetd
/usr/local/sbin/xinetd:
libwrap.so.6 => /usr/lib/libwrap.so.6 (0x800846000)
libm.so.5 => /lib/libm.so.5 (0x800a4f000)
libcrypt.so.5 => /lib/libcrypt.so.5 (0x800c7a000)
libc.so.7 => /lib/libc.so.7 (0x800e99000)
hostname: ~# /usr/local/etc/rc.d/xinetd status
xinetd is not running.
hostname: ~# /usr/local/etc/rc.d/xinetd start
Starting xinetd.
hostname: ~# /usr/local/etc/rc.d/xinetd status
xinetd is not running.
hostname: ~#
And what’s happening when you start binary directly, bypassing init script, so
/usr/local/sbin/xinetd
do you get ANY output?
Try it with DEBUG option turned on:
# /usr/local/sbin/xinetd -d
which gives you all errors in the config file or other things and was very helpful for me 🙂
Same problem with latest NAS4Free 11.1.0.4 – Atomics (rev. 5127) from Feb 2018 (on FreeBSD 11.1):
# ldd /usr/local/sbin/xinetd
/usr/local/sbin/xinetd:
libwrap.so.6 => /usr/lib/libwrap.so.6 (0x800847000)
libm.so.5 => /lib/libm.so.5 (0x800a50000)
libcrypt.so.5 => /lib/libcrypt.so.5 (0x800c7b000)
libc.so.7 => /lib/libc.so.7 (0x800e9a000)
xinetd ist not running, even after starting it. It neither creates a pid-file, nor gives any output when launched directly via
# /usr/local/sbin/xinetd
Please give us any hint. SNMP is lacking the whole info needed …
Ok, my fault, was a config (syntax) error in xinetd.conf.
Please kick the reply from today (8th March 2018) and this statement also …