From e2f5a1fdf0ece32422f35251f67b23772659e12f Mon Sep 17 00:00:00 2001 From: Mark Schouten Date: Thu, 20 Aug 2015 12:25:47 +0200 Subject: [PATCH] Make app-recognition more efficient --- includes/polling/unix-agent.inc.php | 33 ++++++++--------------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/includes/polling/unix-agent.inc.php b/includes/polling/unix-agent.inc.php index a759313a4..cc0ac1fd2 100644 --- a/includes/polling/unix-agent.inc.php +++ b/includes/polling/unix-agent.inc.php @@ -47,32 +47,17 @@ if ($device['os_group'] == 'unix') { list($section, $data) = explode('>>>', $section); list($sa, $sb) = explode('-', $section, 2); - if ($section == 'apache') { - $sa = 'app'; - $sb = 'apache'; + $agentapps = array( + "apache", + "mysql", + "nginx", + "bind", + "tinydns"); + + if (in_array($section, $agentapps)) { + $agent_data['app'][$section] = trim($data); } - if ($section == 'mysql') { - $sa = 'app'; - $sb = 'mysql'; - } - - if ($section == 'nginx') { - $sa = 'app'; - $sb = 'nginx'; - } - - if ($section == 'bind') { - $sa = 'app'; - $sb = 'bind'; - } - - if ($section == 'tinydns') { - $sa = 'app'; - $sb = 'tinydns'; - } - - // if ($section == "drbd") { $sa = "app"; $sb = "drbd"; } if (!empty($sa) && !empty($sb)) { $agent_data[$sa][$sb] = trim($data); }