Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap Port NRPE #115

Merged
merged 2 commits into from
May 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions net-mgmt/pfSense-pkg-nrpe/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# $FreeBSD$

PORTNAME= pfSense-pkg-nrpe
PORTVERSION= 2.3.1
PORTREVISION= 1
CATEGORIES= net-mgmt
MASTER_SITES= # empty
DISTFILES= # empty
EXTRACT_ONLY= # empty

MAINTAINER= tech@voleatech.de
COMMENT= pfSense package nrpe

LICENSE= ESF

RUN_DEPENDS= ${LOCALBASE}/sbin/nrpe2:net-mgmt/nrpe-ssl

NO_BUILD= yes
NO_MTREE= yes

SUB_FILES= pkg-install pkg-deinstall
SUB_LIST= PORTNAME=${PORTNAME}

do-extract:
${MKDIR} ${WRKSRC}

do-install:
${MKDIR} ${STAGEDIR}${PREFIX}/pkg
${MKDIR} ${STAGEDIR}/etc/inc/priv
${MKDIR} ${STAGEDIR}${DATADIR}
${INSTALL_DATA} -m 0644 ${FILESDIR}${PREFIX}/pkg/nrpe.xml \
${STAGEDIR}${PREFIX}/pkg
${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/nrpe2.inc \
${STAGEDIR}${PREFIX}/pkg
${INSTALL_DATA} ${FILESDIR}/etc/inc/priv/nrpe2.priv.inc \
${STAGEDIR}/etc/inc/priv
${INSTALL_DATA} ${FILESDIR}${DATADIR}/info.xml \
${STAGEDIR}${DATADIR}
@${REINPLACE_CMD} -i '' -e "s|%%PKGVERSION%%|${PKGVERSION}|" \
${STAGEDIR}${DATADIR}/info.xml

.include <bsd.port.mk>

37 changes: 37 additions & 0 deletions net-mgmt/pfSense-pkg-nrpe/files/etc/inc/priv/nrpe2.priv.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/*
nrpe2.priv.inc
part of pfSense (http://www.pfSense.org/)
Copyright (C) 2015 ESF, LLC
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED ``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
AUTHOR 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.
*/
global $priv_list;

$priv_list['page-services-nrpe2'] = array();
$priv_list['page-services-nrpe2']['name'] = "WebCfg - Services: nrpe2 package";
$priv_list['page-services-nrpe2']['descr'] = "Allow access to nrpe2 package GUI";
$priv_list['page-services-nrpe2']['match'] = array();
$priv_list['page-services-nrpe2']['match'][] = "pkg_edit.php?xml=nrpe2.xml*";

?>
3 changes: 3 additions & 0 deletions net-mgmt/pfSense-pkg-nrpe/files/pkg-deinstall.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

/usr/local/bin/php -f /etc/rc.packages %%PORTNAME%% ${2}
7 changes: 7 additions & 0 deletions net-mgmt/pfSense-pkg-nrpe/files/pkg-install.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

if [ "${2}" != "POST-INSTALL" ]; then
exit 0
fi

/usr/local/bin/php -f /etc/rc.packages %%PORTNAME%% ${2}
181 changes: 181 additions & 0 deletions net-mgmt/pfSense-pkg-nrpe/files/usr/local/pkg/nrpe.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE packagegui SYSTEM "../schema/packages.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?>
<packagegui>
<copyright>
<![CDATA[
/* $Id$ */
/* ====================================================================================== */
/*
nrpe.xml
part of pfSense (https://www.pfSense.org/)
Copyright (C) 2009 Erik Kristensen
Copyright (C) 2011-2013 Jim Pingle
Copyright (C) 2015 ESF, LLC
All rights reserved.
*/
/* ====================================================================================== */
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:


1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.


THIS SOFTWARE IS PROVIDED ``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
AUTHOR 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.
*/
/* ====================================================================================== */
]]>
</copyright>
<name>nrpe2</name>
<version>2.3</version>
<title>Services: NRPEv2</title>
<aftersaveredirect>/pkg_edit.php?xml=nrpe.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=nrpe.xml&amp;id=0</url>
</menu>
<service>
<name>nrpe2</name>
<rcfile>nrpe2.sh</rcfile>
<executable>nrpe2</executable>
<description>Nagios NRPEv2 Daemon</description>
</service>
<configpath>installedpackages->package->nrpe2</configpath>
<fields>
<field>
<type>listtopic</type>
<name>Service Options</name>
</field>
<field>
<fielddescr>Enable NRPE</fielddescr>
<fieldname>enabled</fieldname>
<description>Check this to enable NRPE daemon.</description>
<type>checkbox</type>
<default_value>on</default_value>
</field>
<field>
<type>listtopic</type>
<name>Configuration Options</name>
</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>
<default_value>5666</default_value>
<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. (Optional)</description>
<type>input</type>
</field>
<field>
<fielddescr>Nagios Server(s)</fielddescr>
<fieldname>allowed_hosts</fieldname>
<description>IP Address of Nagios server. Usually a single IP; multiple IPs must be delimited by comma.</description>
<type>input</type>
<required/>
</field>
<field>
<fielddescr>Allow Arguments (dont_blame_nrpe)</fielddescr>
<fieldname>dont_blame_nrpe</fieldname>
<description>Check this to enable accept NRPE arguments. (Default: 0)</description>
<type>checkbox</type>
<default_value>on</default_value>
</field>

<field>
<type>listtopic</type>
<name>Commands</name>
</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>Sudo</fielddescr>
<fieldname>sudo</fieldname>
<type>checkbox</type>
</rowhelperfield>
<rowhelperfield>
<fielddescr>Command</fielddescr>
<fieldname>command</fieldname>
<type>select_source</type>
<source><![CDATA[nrpe2_get_commands()]]></source>
<source_name>command</source_name>
<source_value>command</source_value>
</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 (Example: -s Z \$ARG1\$ \$ARG2\$)</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_php_install_command>
nrpe2_custom_php_install_command();
</custom_php_install_command>
<custom_php_deinstall_command>
nrpe2_custom_php_deinstall_command();
</custom_php_deinstall_command>
<custom_add_php_command>
nrpe2_resync_package();
</custom_add_php_command>
<custom_delete_php_command>
nrpe2_resync_package();
</custom_delete_php_command>
<custom_php_resync_config_command>
nrpe2_resync_package();
</custom_php_resync_config_command>
<custom_php_validation_command>
nrpe2_custom_php_validation_command($_POST, $input_errors);
</custom_php_validation_command>
</packagegui>
Loading