diff --git a/doc/Extensions/Applications.md b/doc/Extensions/Applications.md index a0f1b3a38b2b..d380ada25357 100644 --- a/doc/Extensions/Applications.md +++ b/doc/Extensions/Applications.md @@ -909,10 +909,10 @@ pass .1.3.6.1.4.1.3582 /usr/sbin/lsi_mrdsnmpmain ### SNMP Extend 1. Copy the [memcached - script](https://github.com/librenms/librenms-agent/blob/master/agent-local/memcached) + script](https://github.com/librenms/librenms-agent/blob/master/snmp/memcached) to `/etc/snmp/` on your remote server. ``` -wget https://raw.githubusercontent.com/librenms/librenms-agent/master/agent-local/memcached -O /etc/snmp/memcached +wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/memcached -O /etc/snmp/memcached ``` 2. Make the script executable: diff --git a/includes/polling/applications/memcached.inc.php b/includes/polling/applications/memcached.inc.php index 7bf223122f32..263e05c7498a 100644 --- a/includes/polling/applications/memcached.inc.php +++ b/includes/polling/applications/memcached.inc.php @@ -1,20 +1,25 @@ >>\n", '', $data))); - $data = reset($data); -} + try { + $data = json_app_get($device, $name, '1.1')['data']; + $data = $data['data'][$app->app_instance] ?? reset($data['data']); + } catch (JsonAppException $e) { + echo PHP_EOL . $name . ':' . $e->getCode() . ':' . $e->getMessage() . PHP_EOL; + update_application($app, $e->getCode() . ':' . $e->getMessage(), []); // Set empty metrics and error message -echo ' memcached(' . $app['app_instance'] . ')'; + return; + } +} +echo ' memcached(' . $app->app_instance . ')'; +$data = $data[$app->app_instance] ?? reset($data); // specified instance or just the first one $rrd_name = ['app', $name, $app->app_id]; $rrd_def = RrdDefinition::make() diff --git a/includes/polling/unix-agent.inc.php b/includes/polling/unix-agent.inc.php index 6f88ffddb2a4..94d8c4cc1f7f 100644 --- a/includes/polling/unix-agent.inc.php +++ b/includes/polling/unix-agent.inc.php @@ -159,7 +159,7 @@ // memcached if (! empty($agent_data['app']['memcached'])) { - $agent_data['app']['memcached'] = unserialize($agent_data['app']['memcached']); + $agent_data['app']['memcached'] = json_decode($agent_data['app']['memcached'], true); foreach ($agent_data['app']['memcached'] as $memcached_host => $memcached_data) { if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ? AND `app_instance` = ?', [$device['device_id'], 'memcached', $memcached_host]) == '0') { echo "Found new application 'Memcached' $memcached_host\n"; diff --git a/misc/notifications.rss b/misc/notifications.rss index 788235d813e9..bb6aeb78d20a 100644 --- a/misc/notifications.rss +++ b/misc/notifications.rss @@ -88,5 +88,10 @@ Adsl statistics are now discovered and polled in a new module. Vdsl stats were also added. `lnms config:set enable_ports_adsl true`is not supported anymore. See https://github.com/librenms/librenms/pull/14207 for more information. Wed, 7 Sept 2022 18:00:00 +0000 + + Memcached application compatibility break + Due to a security vulnerability, you must upgrade your memcached application scripts to the latest version. (1.1) + Fri, 10 Oct 2022 18:00:00 +0000 +