diff --git a/doc/Extensions/Agent-Setup.md b/doc/Extensions/Agent-Setup.md index 652d9a792..767e179bf 100644 --- a/doc/Extensions/Agent-Setup.md +++ b/doc/Extensions/Agent-Setup.md @@ -15,7 +15,15 @@ On each of the hosts you would like to use the agent on then you need to do the cd /opt/ git clone https://github.com/librenms/librenms-agent.git cd librenms-agent -cp check_mk_agent /usr/bin/check_mk_agent +``` + +Now copy the relevant check_mk_agent: + +| linux | freebsd | +| --- | --- | +| `cp check_mk_agent /usr/bin/check_mk_agent` | `cp check_mk_agent_freebsd /usr/bin/check_mk_agent` | + +```shell chmod +x /usr/bin/check_mk_agent ``` diff --git a/html/includes/modal/new_service.inc.php b/html/includes/modal/new_service.inc.php index e1b973c74..9891c2441 100644 --- a/html/includes/modal/new_service.inc.php +++ b/html/includes/modal/new_service.inc.php @@ -11,17 +11,20 @@ * the source code distribution for details. */ -if(is_admin() !== false) { +if (is_admin() !== false) { // Build the types list. - if ($handle = opendir($config['nagios_plugins'])) { - while (false !== ($file = readdir($handle))) { - if ($file != '.' && $file != '..' && !strstr($file, '.') && strstr($file, 'check_')) { - list(,$check_name) = explode('_',$file,2); + $dir = $config['nagios_plugins']; + if (file_exists($dir) && is_dir($dir)) { + $files = scandir($dir); + $dir .= DIRECTORY_SEPARATOR; + d_print_r($files); + foreach ($files as $file) { + if (is_executable($dir.$file) && is_file($dir.$file) && strstr($file, 'check_')) { + list(,$check_name) = explode('_', $file, 2); $stype .= ""; } } - closedir($handle); } ?> @@ -142,4 +145,4 @@ $('#service-submit').click('', function(e) { $device['device_id'], 'pid' => $pid, 'user' => $user, 'vsz' => $vsz, 'rss' => $rss, 'cputime' => $cputime, 'command' => $command); diff --git a/poller-service.py b/poller-service.py index b545e4bcd..69a436176 100755 --- a/poller-service.py +++ b/poller-service.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python2 """ poller-service A service to wrap SNMP polling. It will poll up to $threads devices at a time, and will not re-poll devices that have been polled within the last $poll_frequency seconds. It will prioritize devices based diff --git a/poller-wrapper.py b/poller-wrapper.py index 43e91f76a..1fa00b461 100755 --- a/poller-wrapper.py +++ b/poller-wrapper.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python2 """ poller-wrapper A small tool which wraps around the poller and tries to guide the polling process with a more modern approach with a diff --git a/scripts/agent-local/nginx b/scripts/agent-local/nginx index d6319f1b2..b0a6a5092 100755 --- a/scripts/agent-local/nginx +++ b/scripts/agent-local/nginx @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 import urllib2 import re diff --git a/scripts/mysql-stats b/scripts/mysql-stats index 1a215832e..d191bdbbc 100644 --- a/scripts/mysql-stats +++ b/scripts/mysql-stats @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 import warnings import re warnings.filterwarnings(action="ignore", message='the sets module is deprecated') diff --git a/scripts/nginx-stats b/scripts/nginx-stats index a3c14fa52..1cedca5ba 100644 --- a/scripts/nginx-stats +++ b/scripts/nginx-stats @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 import urllib2 import re