mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Bugfix for no sockets on Unix Agents (#12637)
* Bugfix for no sockets on Unix Agents Fix Bug: Argument #1 ($stream) must be of type resource, bool given... * Update unix-agent.inc.php Fix Style
This commit is contained in:
@@ -15,13 +15,13 @@ if ($device['os_group'] == 'unix' || $device['os'] == 'windows') {
|
||||
$poller_target = Device::pollerTarget($device['hostname']);
|
||||
$agent = fsockopen($poller_target, $agent_port, $errno, $errstr, \LibreNMS\Config::get('unix-agent.connection-timeout'));
|
||||
|
||||
// Set stream timeout (for timeouts during agent fetch
|
||||
stream_set_timeout($agent, \LibreNMS\Config::get('unix-agent.read-timeout'));
|
||||
$agentinfo = stream_get_meta_data($agent);
|
||||
|
||||
if (! $agent) {
|
||||
echo 'Connection to UNIX agent failed on port ' . $agent_port . '.';
|
||||
} else {
|
||||
// Set stream timeout (for timeouts during agent fetch
|
||||
stream_set_timeout($agent, \LibreNMS\Config::get('unix-agent.read-timeout'));
|
||||
$agentinfo = stream_get_meta_data($agent);
|
||||
|
||||
// fetch data while not eof and not timed-out
|
||||
while ((! feof($agent)) && (! $agentinfo['timed_out'])) {
|
||||
$agent_raw .= fgets($agent, 128);
|
||||
|
||||
Reference in New Issue
Block a user