aboutsummaryrefslogtreecommitdiffstats
path: root/config/nrpe2
diff options
context:
space:
mode:
authorErik <erik@erikkristensen.com>2009-05-18 20:39:14 -0400
committerErik <erik@erikkristensen.com>2009-05-18 20:39:14 -0400
commitcb331a55ab44eef169f3fbc3e752f2935439fa01 (patch)
tree1f35d1d350db248173dc61b67a4b43348ebdf512 /config/nrpe2
parent7e0b010d5ceecfc786cfadb0ad4ae6bf338eb5b2 (diff)
downloadpfsense-packages-cb331a55ab44eef169f3fbc3e752f2935439fa01.tar.gz
pfsense-packages-cb331a55ab44eef169f3fbc3e752f2935439fa01.tar.bz2
pfsense-packages-cb331a55ab44eef169f3fbc3e752f2935439fa01.zip
Adding the tbz files and include files for the Nagios NRPE v2.11 package
Diffstat (limited to 'config/nrpe2')
-rw-r--r--config/nrpe2/nrpe2.inc188
-rw-r--r--config/nrpe2/nrpe2.xml166
2 files changed, 354 insertions, 0 deletions
diff --git a/config/nrpe2/nrpe2.inc b/config/nrpe2/nrpe2.inc
new file mode 100644
index 00000000..b0f4f761
--- /dev/null
+++ b/config/nrpe2/nrpe2.inc
@@ -0,0 +1,188 @@
+<?php
+
+/**
+ * Author: Erik Kristensen
+ * Email: erik@erikkristensen.com
+ *
+ * Developed for: pfSense.com
+ *
+ * Copyright (c) 2009, pfSense.com
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in thedocumentation and/or other materials provided with the distribution.
+ * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+require('filter.inc');
+
+function nrpe2_custom_php_install_command()
+{
+ global $g, $config;
+ conf_mount_rw();
+
+ $ip = $config['interfaces']['lan']['ipaddr'];
+
+ $config['installedpackages']['nrpe2']['config'][0]['enabled'] = TRUE;
+ $config['installedpackages']['nrpe2']['config'][0]['server_address'] = $ip;
+ $config['installedpackages']['nrpe2']['config'][0]['server_port'] = 5666;
+ $config['installedpackages']['nrpe2']['config'][0]['allowed_hosts'] = "127.0.0.1";
+
+ $config['installedpackages']['nrpe2']['config'][0]['row'] = array(
+ 0 => array(
+ 'name' => 'check_users',
+ 'command' => 'check_users',
+ 'warning' => '5',
+ 'critical' => '10'
+ ),
+ 1 => array(
+ 'name' => 'check_load',
+ 'command' => 'check_load',
+ 'warning' => '15,10,5',
+ 'critical' => '30,25,20',
+ ),
+ 2 => array(
+ 'name' => 'check_root',
+ 'command' => 'check_disk',
+ 'warning' => '20%',
+ 'critical' => '10%',
+ 'extra' => '-p /'
+ ),
+ 3 => array(
+ 'name' => 'check_var',
+ 'command' => 'check_disk',
+ 'warning' => '20%',
+ 'critical' => '10%',
+ 'extra' => '-p /var/run'
+ ),
+ 4 => array(
+ 'name' => 'check_zombie_procs',
+ 'command' => 'check_procs',
+ 'warning' => '5',
+ 'critical' => '10',
+ 'extra' => '-s Z'
+ ),
+ 5 => array(
+ 'name' => 'check_total_procs',
+ 'command' => 'check_procs',
+ 'warning' => '150',
+ 'critical' => '200'
+ )
+ );
+
+ $fd = fopen('/usr/local/etc/rc.d/nrpe2', 'w');
+ $rc_file = <<<EOD
+#!/bin/sh
+#
+# $FreeBSD: ports/net-mgmt/nrpe2/files/nrpe2.in,v 1.3 2008/12/25 20:24:43 miwi 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
+
+nrpe2_enable=\${nrpe2_enable-"YES"}
+name="nrpe2"
+rcvar=`set_rcvar`
+
+command="/usr/local/sbin/nrpe2"
+command_args="-d"
+extra_commands="reload"
+
+sig_reload=HUP
+
+[ -z "\${nrpe2_flags}" ] && nrpe2_flags=""
+[ -z "\${nrpe2_configfile}" ] && nrpe2_configfile="/usr/local/etc/nrpe.cfg"
+[ -z "\${nrpe2_pidfile}" ] && nrpe2_pidfile="/var/run/nrpe2.pid"
+
+load_rc_config "\${name}"
+
+pidfile="\${nrpe2_pidfile}"
+
+required_files="\${nrpe2_configfile}"
+command_args="\${command_args} -c \${nrpe2_configfile}"
+
+run_rc_command "$1"
+EOD;
+ fwrite($fd, $rc_file);
+ fclose($fd);
+
+ conf_mount_ro();
+}
+
+function nrpe2_custom_php_deinstall_command()
+{
+ global $g, $config;
+ conf_mount_rw();
+
+ conf_mount_ro();
+}
+
+function nrpe2_custom_php_write_config()
+{
+ global $g, $config;
+
+ foreach ($config['installedpackages']['nrpe2']['config'][0]['row'] as $cmd)
+ {
+ $cmds[] = "command[{$cmd['command']}]=/usr/local/libexec/nagios/{$cmd['command']} -w {$cmd['warning']} -c {$cmd['critical']} {$cmd['extra']}\n";
+ }
+ $commands = implode($cmds);
+
+ $server_port = $config['installedpackages']['nrpe2']['config'][0]['server_port'];
+ $server_address = $config['installedpackages']['nrpe2']['config'][0]['server_address'];
+ $allowed_hosts = $config['installedpackages']['nrpe2']['config'][0]['allowed_hosts'];
+
+ $fd = fopen('/usr/local/etc/nrpe.cfg', 'w');
+ $nrpe_cfg = <<<EOD
+log_facility=daemon
+pid_file=/var/run/nrpe2.pid
+server_port={$server_port}
+server_address={$server_address}
+nrpe_user=nagios
+nrpe_group=nagios
+allowed_hosts={$allowed_hosts}
+dont_blame_nrpe=0
+debug=0
+command_timeout=60
+connection_timeout=300
+{$commands}
+EOD;
+ fwrite($fd, $nrpe_cfg);
+ fclose($fd);
+}
+
+function nrpe2_custom_php_service()
+{
+ global $g, $config;
+
+ if ($config['installedpackages']['nrpe2']['config'][0]['enabled'] == "on")
+ {
+ exec("/usr/local/etc/rc.d/nrpe2 restart");
+ }
+ else
+ {
+ exec("/usr/local/etc/rc.d/nrpe2 stop");
+ }
+}
+
+?> \ No newline at end of file
diff --git a/config/nrpe2/nrpe2.xml b/config/nrpe2/nrpe2.xml
new file mode 100644
index 00000000..723bbba9
--- /dev/null
+++ b/config/nrpe2/nrpe2.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<packagegui>
+ <description>Nagios NRPEv2</description>
+ <requirements>Describe your package requirements here</requirements>
+ <name>nrpe2</name>
+ <version>2.11</version>
+ <title>NRPEv2</title>
+ <aftersaveredirect>/pkg_edit.php?xml=nrpe2.xml&amp;id=0</aftersaveredirect>
+ <include_file>/usr/local/pkg/nrpe2.inc</include_file>
+ <menu>
+ <name>NRPEv2</name>
+ <tooltiptext></tooltiptext>
+ <section>Services</section>
+ <url>/pkg_edit.php?xml=nrpe2.xml&amp;id=0</url>
+ </menu>
+ <service>
+ <name>NRPEv2</name>
+ <rcfile>nrpe2</rcfile>
+ <executable>nrpe2</executable>
+ <description>Nagios NRPE Daemon</description>
+ </service>
+ <configpath>installedpackages->package->nrpe2</configpath>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>077</chmod>
+ <item>http://www.pfsense.com/packages/config/nrpe2/nrpe2.inc</item>
+ </additional_files_needed>
+ <fields>
+ <field>
+ <type>listtopic</type>
+ <name>NRPE Options</name>
+ <fieldname>temp</fieldname>
+ </field>
+ <field>
+ <fielddescr>Enabled</fielddescr>
+ <fieldname>enabled</fieldname>
+ <description>Check this to enable NRPE daemon</description>
+ <type>checkbox</type>
+ </field>
+ <field>
+ <type>listtopic</type>
+ <name>Configuration Options</name>
+ <fieldname>temp</fieldname>
+ </field>
+ <field>
+ <fielddescr>Port Number</fielddescr>
+ <fieldname>server_port</fieldname>
+ <description>Port number we should wait for connections on. (Default: 5666)</description>
+ <type>input</type>
+ <required/>
+ </field>
+ <field>
+ <fielddescr>Bind IP Address</fielddescr>
+ <fieldname>server_address</fieldname>
+ <description>Set this to the IP address of the interface you want the daemon to listen on.</description>
+ <type>input</type>
+ <required/>
+ </field>
+ <field>
+ <fielddescr>Nagios Server(s)</fielddescr>
+ <fieldname>allowed_hosts</fieldname>
+ <description>IP Address of Nagios server, usualy a single IP, but if multiple delimit by comma</description>
+ <type>input</type>
+ <required/>
+ </field>
+ <field>
+ <type>listtopic</type>
+ <name>Commands</name>
+ <fieldname>temp</fieldname>
+ </field>
+ <field>
+ <fielddescr>Command Definitions that the Nagios server can call via the NRPE daemon.</fielddescr>
+ <fieldname>none</fieldname>
+ <type>rowhelper</type>
+ <rowhelper>
+ <rowhelperfield>
+ <fielddescr>Name (Allowed Characters: a-zA-Z_)</fielddescr>
+ <fieldname>name</fieldname>
+ <type>input</type>
+ <size>20</size>
+ <required/>
+ </rowhelperfield>
+ <rowhelperfield>
+ <fielddescr>Command</fielddescr>
+ <fieldname>command</fieldname>
+ <type>select</type>
+ <options>
+ <option><name></name><value></value></option>
+ <option><name>check_dhcp</name><value>check_dhcp</value></option>
+ <option><name>check_dig</name><value>check_dig</value></option>
+ <option><name>check_disk</name><value>check_disk</value></option>
+ <option><name>check_dns</name><value>check_dns</value></option>
+ <option><name>check_file_age</name><value>check_file_age</value></option>
+ <option><name>check_http</name><value>check_http</value></option>
+ <option><name>check_icmp</name><value>check_icmp</value></option>
+ <option><name>check_ifoperstatus</name><value>check_ifoperstatus</value></option>
+ <option><name>check_ifstatus</name><value>check_ifstatus</value></option>
+ <option><name>check_load</name><value>check_load</value></option>
+ <option><name>check_log</name><value>check_log</value></option>
+ <option><name>check_nntp</name><value>check_nntp</value></option>
+ <option><name>check_nntps</name><value>check_nntps</value></option>
+ <option><name>check_ntp</name><value>check_ntp</value></option>
+ <option><name>check_ntp_peer</name><value>check_ntp_peer</value></option>
+ <option><name>check_ntp_time</name><value>check_ntp_time</value></option>
+ <option><name>check_oracle</name><value>check_oracle</value></option>
+ <option><name>check_ping</name><value>check_ping</value></option>
+ <option><name>check_procs</name><value>check_procs</value></option>
+ <option><name>check_rpc</name><value>check_rpc</value></option>
+ <option><name>check_ssh</name><value>check_ssh</value></option>
+ <option><name>check_swap</name><value>check_swap</value></option>
+ <option><name>check_tcp</name><value>check_tcp</value></option>
+ <option><name>check_time</name><value>check_time</value></option>
+ <option><name>check_udp</name><value>check_udp</value></option>
+ <option><name>check_ups</name><value>check_ups</value></option>
+ <option><name>check_users</name><value>check_users</value></option>
+ </options>
+ </rowhelperfield>
+ <rowhelperfield>
+ <fielddescr>Warning Level</fielddescr>
+ <fieldname>warning</fieldname>
+ <description>At which level do you want a warning to be alerted on?</description>
+ <type>input</type>
+ <size>15</size>
+ <required/>
+ </rowhelperfield>
+ <rowhelperfield>
+ <fielddescr>Critical Level</fielddescr>
+ <fieldname>critical</fieldname>
+ <description>At which level do you want a warning to be alerted on?</description>
+ <type>input</type>
+ <size>15</size>
+ <required/>
+ </rowhelperfield>
+ <rowhelperfield>
+ <fielddescr>Extra Options</fielddescr>
+ <fieldname>extra</fieldname>
+ <description>Warning! Use at your own risk, incorrect settings here may prevent NRPE from starting!</description>
+ <type>input</type>
+ <size>25</size>
+ </rowhelperfield>
+ </rowhelper>
+ </field>
+ </fields>
+ <custom_delete_php_command>
+ nrpe2_custom_php_write_config();
+ nrpe2_custom_php_service();
+ </custom_delete_php_command>
+ <custom_add_php_command>
+ nrpe2_custom_php_write_config();
+ nrpe2_custom_php_service();
+ </custom_add_php_command>
+ <custom_php_install_command>
+ nrpe2_custom_php_install_command();
+ nrpe2_custom_php_write_config();
+ nrpe2_custom_php_service();
+ </custom_php_install_command>
+ <custom_php_deinstall_command>
+ nrpe2_custom_php_deinstall_command();
+ nrpe2_custom_php_write_config();
+ </custom_php_deinstall_command>
+ <custom_php_resync_config_command>
+ </custom_php_resync_config_command>
+ <custom_php_command_before_form>
+ unset($_POST['temp']);
+ </custom_php_command_before_form>
+</packagegui>