Installation of NRPE in FreeNAS8

Status
Not open for further replies.

snowmirage

Dabbler
Joined
Sep 20, 2011
Messages
29
I had been trying to follow a procedure I came across here

http://www.it-slav.net/blogs/2011/08/25/monitor-freenas-with-op5-monitor-or-nagios/

when trying to install the package it looks like it requires a previous version of perl, I didnt want to try to install the old version and break something on box before I back everything up.


[nagios@freenas8] /> su root
Password:
[nagios@freenas8] /# pkg_add -r nrpe2
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/Latest/nrpe2.tbz... Done.
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/perl-5.10.1_3.tbz... Done.
pkg_add: package 'perl-5.10.1_3' conflicts with perl-5.12.4
pkg_add: please use pkg_delete first to remove conflicting package(s) or -f to force installation
pkg_add: pkg_add of dependency 'perl-5.10.1_3' failed!
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/nagios-plugins-1.4.15_1,1.tbz... Done.
pkg_add: could not find package perl-5.10.1_3 !
pkg_add: pkg_add of dependency 'nagios-plugins-1.4.15_1,1' failed!


Has any one had success getting NRPE to run, would be nice to monitor some aspects of the system from Nagios (or similar).

I'm currently running FreeNAS-8.0.1-RC2-amd64 (7813)
 

StewLG

Cadet
Joined
Oct 11, 2011
Messages
1
Not a complete answer, but here's a start

I had the same failure. If I were more of a FreeBSD guy, I might have been able to get NRPE fully installed.

What I did instead was run NRPE commands via SSH. There are several tutorials for getting that working, but I'm afraid I can't find one just now. Any of the general tutorials for getting SSH to log in with private/public keys should be a good start.

Anyhow, once I got that working, I just downloaded the plugins from the same address the pkg_add we both tried failed on, and manually made a directory for them:

[stew@dory] /mnt/TheBackupVolume# cd /tmp
[stew@dory] /tmp# mkdir nrpe_temp
[stew@dory] /tmp# cd nrpe_temp/
[stew@dory] /tmp/nrpe_temp# wget ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/nagios-plugins-1.4.15_1,1.tbz
--2011-10-11 19:50:09-- ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/nagios-plugins-1.4.15_1,1.tbz
=> `nagios-plugins-1.4.15_1,1.tbz'
Resolving ftp.freebsd.org (ftp.freebsd.org)... 87.51.34.132, 149.20.64.73, 204.152.184.73, ...
Connecting to ftp.freebsd.org (ftp.freebsd.org)|87.51.34.132|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /pub/FreeBSD/ports/amd64/packages-8.2-release/All ... done.
==> SIZE nagios-plugins-1.4.15_1,1.tbz ... 501325
==> PASV ... done. ==> RETR nagios-plugins-1.4.15_1,1.tbz ... done.
Length: 501325 (490K) (unauthoritative)

100%[===================================================================================================>] 501,325 88.5K/s in 5.8s

2011-10-11 19:50:19 (84.1 KB/s) - `nagios-plugins-1.4.15_1,1.tbz' saved [501325]

[stew@dory] /tmp/nrpe_temp# tar xvf nagios-plugins-1.4.15_1,1.tbz
x +CONTENTS
x +COMMENT
x +DESC
x +MTREE_DIRS
x libexec/nagios/check_apt
x libexec/nagios/check_breeze
x libexec/nagios/check_by_ssh
x libexec/nagios/check_clamd
x libexec/nagios/check_cluster
x libexec/nagios/check_dhcp
x libexec/nagios/check_dig
x libexec/nagios/check_disk
x libexec/nagios/check_disk_smb
x libexec/nagios/check_dns
x libexec/nagios/check_dummy
x libexec/nagios/check_file_age
x libexec/nagios/check_flexlm
x libexec/nagios/check_ftp
x libexec/nagios/check_http
x libexec/nagios/check_icmp
x libexec/nagios/check_ifoperstatus
x libexec/nagios/check_ifstatus
x libexec/nagios/check_imap
x libexec/nagios/check_ircd
x libexec/nagios/check_jabber
x libexec/nagios/check_load
x libexec/nagios/check_log
x libexec/nagios/check_mailq
x libexec/nagios/check_mrtg
x libexec/nagios/check_mrtgtraf
x libexec/nagios/check_nagios
x libexec/nagios/check_nntp
x libexec/nagios/check_nntps
x libexec/nagios/check_nt
x libexec/nagios/check_ntp
x libexec/nagios/check_ntp_peer
x libexec/nagios/check_ntp_time
x libexec/nagios/check_nwstat
x libexec/nagios/check_oracle
x libexec/nagios/check_overcr
x libexec/nagios/check_ping
x libexec/nagios/check_pop
x libexec/nagios/check_procs
x libexec/nagios/check_real
x libexec/nagios/check_rpc
x libexec/nagios/check_sensors
x libexec/nagios/check_simap
x libexec/nagios/check_smtp
x libexec/nagios/check_spop
x libexec/nagios/check_ssh
x libexec/nagios/check_ssmtp
x libexec/nagios/check_swap
x libexec/nagios/check_tcp
x libexec/nagios/check_time
x libexec/nagios/check_udp
x libexec/nagios/check_ups
x libexec/nagios/check_users
x libexec/nagios/check_wave
x libexec/nagios/negate
x libexec/nagios/urlize
x libexec/nagios/utils.pm
x libexec/nagios/utils.sh
x share/locale/fr/LC_MESSAGES/nagios-plugins.mo
x share/locale/de/LC_MESSAGES/nagios-plugins.mo
[stew@dory] /tmp/nrpe_temp#

These commands should be copied to someone on your system that will survive a reboot. For me that's the NAS volume. (I prefer the USB boot key, but I confess I don't know how to do this).

Here's bits from my Nagios config to get you started:

dory.cfg:
---------
define service {
use generic-service
host_name dory.stumpfactory.local
service_description Check disk free space
check_command check_disk_via_ssh!20!10!/mnt/TheBackupVolume
retry_check_interval 1
}

commands.cfg:
----------------

define command {
command_name check_freenas_raid_health_via_ssh
command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -C "/mnt/TheBackupVolume/System/check_zpool.sh"
}


define command {
command_name check_disk_via_ssh
command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -C "/mnt/TheBackupVolume/System/Nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$"
}

I hope that's at least a little helpful. If SSH is not an option for you, and you do get NRPE straight-up working, please let us know how!

- Stew
 

snowmirage

Dabbler
Joined
Sep 20, 2011
Messages
29
Great idea, thanks for the info

It never occurred to me to just run the scripts via SSH. I've already built a few custom scripts to check for running processes via SSH so this shouldn't be to hard to implement (knock on wood)

I'll have to give this a try when I get time

Thanks!
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I got nrpe working but I screwed up my python trying to add nagios-check_smartmon. I ended up recovering with and iso. I'm gonna try again, should have a working tutorial within a few hours.

What I got settup monitering..
cpu_load / memory / ups / zpool

what I'm still working on
smart data - multiple reason this wont work... (sudo and python dependancies)
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
WARNING - YOU MAY LIKELY BREAK YOUR GUI, IF YOU MAKE ANY MISTAKES YOU MAY DELETE THE SPECIFIC PYTHON FREENAS NEEDS!
YOU HAVE BEEN WARNED! BE PATIENT WHEN PUTTING IN PKG_ADD COMMANDS!

I tested this, no reboot needed. But everything will work after reboot. Fresh FreeNAS 8.0.4beta2 install (with old config restored)

Assumptions..
zpool = /mnt/RAID
nagios/icinga is at 192.168.1.1
ups name = ups
ups service turned on
downloaded check_zpool, check_mem and moved them to /usr/local/libexec/nagios

___
cd /mnt/RAID

mount -uw /
fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/perl-5.10.1_3.tbz
fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/libiconv-1.13.1_1.tbz
fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/gettext-0.18.1.1.tbz
fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/nagios-plugins-1.4.15_1,1.tbz
fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.2-release/All/nrpe-2.12_3.tbz
pkg_add perl-5.10.1_3.tbz
pkg_add libiconv-1.13.1_1.tbz
pkg_add gettext-0.18.1.1.tbz
pkg_add nagios-plugins-1.4.15_1,1.tbz
pkg_add nrpe-2.12_3.tbz
rm perl-5.10.1_3.tbz
rm libiconv-1.13.1_1.tbz
rm gettext-0.18.1.1.tbz
rm nagios-plugins-1.4.15_1,1.tbz
rm nrpe-2.12_3.tbz

chmod +x /usr/local/libexec/nagios/check_zpool /usr/local/libexec/nagios/check_mem

nano /conf/base/etc/rc.conf
===
nrpe2_enable="YES"
===

touch /conf/base/etc/rc.d/nrpe2
chmod +x /conf/base/etc/rc.d/nrpe2
nano /conf/base/etc/rc.d/nrpe2
===
#!/bin/sh
#
# $FreeBSD: ports/net-mgmt/nrpe2/files/nrpe2.in,v 1.5 2010/03/27 00:14:26 dougb Exp $
#
# PROVIDE: nrpe2
# REQUIRE: NETWORKING
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable nrpe2:
# nrpe2_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable nrpe2.
# nrpe2_flags (str): Set to "" by default.
# nrpe2_configfile (str): Set to "/usr/local/etc/nrpe.cfg" by default.
# nrpe2_pidfile (str): Set to "/var/spool/nagios/nrpe2.pid" by default.
#
. /etc/rc.subr
name="nrpe2"
rcvar=`set_rcvar`
command="/usr/local/sbin/nrpe2"
command_args="-d"
extra_commands="reload"
sig_reload=HUP
[ -z "${nrpe2_enable}" ] && nrpe2_enable="NO"
[ -z "${nrpe2_configfile}" ] && nrpe2_configfile="/conf/base/etc/nrpe.cfg"
[ -z "${nrpe2_pidfile}" ] && nrpe2_pidfile="/var/spool/nagios/nrpe2.pid"
load_rc_config "${name}"
pidfile="${nrpe2_pidfile}"
required_files="${nrpe2_configfile}"
command_args="${command_args} -c ${nrpe2_configfile}"
run_rc_command "$1"
===

nano /conf/base/etc/nrpe.cfg
===
log_facility=daemon
pid_file=/var/spool/nagios/nrpe2.pid
server_port=5666
nrpe_user=nagios
nrpe_group=nagios
allowed_hosts=192.168.1.1
dont_blame_nrpe=0
debug=0
command_timeout=60
connection_timeout=300
command[check_load]=/usr/local/libexec/nagios/check_load -w 15,10,5 -c 30,25,20
command[check_disk]=/usr/local/libexec/nagios/check_disk -w 20% -c 10% -p /mnt/RAID
command[check_zpool]=/usr/local/libexec/nagios/check_zpool
command[check_mem]=/usr/local/libexec/nagios/check_mem -u -w 80 -c 90
command[check_ups]=/usr/local/libexec/nagios/check_ups -H 127.0.0.1 -u ups
===

___


This next bit just starts everything without having to reboot, you can also just reboot and everything should start on it's own
___
cp /conf/base/etc/rc.conf /etc/rc.conf
cp /conf/base/etc/rc.d/nrpe2 /etc/rc.d/nrpe2
service nrpe2 start
___

NOTES
Still trying to get sudoing to work so that we can run S.M.A.R.T. checks, the problem is the sudo binary wants to look for /usr/local/etc/sudoers but this file is deleted every reboot. There are easy workaround for this but I see them as hacks and am fine with configuring freenas to tell me of smart failures (hopefully this actually works)
 

Peter Bowler

Dabbler
Joined
Dec 18, 2011
Messages
21
I realize this thread is old but I am attempting this currently.

Everything acted accordingly but the service start at the end.

service nrpe2 start yields an error

[root@freenas] ~# service nrpe2 start
00:14:26: not found
Starting nrpe2.
/etc/rc.d/nrpe2: WARNING: failed to start nrpe2

*FreeNAS-8.2.0-RELEASE-p1-x86 (r11950)*
 

lrusak

Explorer
Joined
Dec 20, 2011
Messages
56
I realize this thread is old but I am attempting this currently.

Everything acted accordingly but the service start at the end.

service nrpe2 start yields an error

[root@freenas] ~# service nrpe2 start
00:14:26: not found
Starting nrpe2.
/etc/rc.d/nrpe2: WARNING: failed to start nrpe2

*FreeNAS-8.2.0-RELEASE-p1-x86 (r11950)*

As you are on 8.2 I would recommend not following the tutorial exactly.

I would do all this within the plugins jail, then you don't have to mess with the main filesystem.

Install the plugins jail via the plugins service in the gui, then via SSH access the jail with jexec 1 csh
 
Status
Not open for further replies.
Top