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_once('filter.inc'); $pfs_version = substr(trim(file_get_contents("/etc/version")),0,3); if ($pfs_version == "2.0") { define('NRPE_BASE', '/usr/local'); } else { define('NRPE_BASE', '/usr/pbi/nrpe-' . php_uname("m")); } if ($pfs_version == "2.1") define('NRPE_BINARY', NRPE_BASE . "/sbin/nrpe2"); else define('NRPE_BINARY', "/usr/local/sbin/nrpe2"); define('NRPE_CONFIG_DIR', NRPE_BASE . '/etc'); define('NRPE_RCFILE', '/usr/local/etc/rc.d/nrpe2.sh'); function nrpe2_custom_php_install_command() { global $g, $config; conf_mount_rw(); $NRPE_BASE = NRPE_BASE; $NRPE_CONFIG_DIR = NRPE_CONFIG_DIR; $ip = $config['interfaces']['lan']['ipaddr']; if (!is_array($config['installedpackages']['nrpe2'])) { $config['installedpackages']['nrpe2']['config'][0]['enabled'] = "on"; $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]['dont_blame_nrpe'] = "on"; } if (!is_array($config['installedpackages']['nrpe2']['config'][0]['row'])) { $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' ) ); } unlink_if_exists(NRPE_CONFIG_DIR . '/rc.d/nrpe2'); $nrpe2_binary = NRPE_BINARY; $fd = fopen(NRPE_RCFILE, 'w'); $rc_file = <<