Skip to content

Commit

Permalink
Fix memcached always reporting "ERROR" for app_state (librenms#10739)
Browse files Browse the repository at this point in the history
* perform json_encode() on memcached app $response data to match update_application() string parameter

* return raw snmp_get result for memcached response data during update_application()
  • Loading branch information
haydenseitz authored Apr 11, 2020
1 parent 3925e78 commit 8993817
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions includes/polling/applications/memcached.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
} else {
$oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.9.109.101.109.99.97.99.104.101.100';
$result = snmp_get($device, $oid, '-Oqv');
$result = trim($result, '"');
$result = unserialize(stripslashes(str_replace("<<<app-memcached>>>\n", '', $result)));
$data = reset($result);
$data = trim($result, '"');
$data = unserialize(stripslashes(str_replace("<<<app-memcached>>>\n", '', $data)));
$data = reset($data);
}

echo ' memcached('.$app['app_instance'].')';
Expand Down Expand Up @@ -60,4 +60,4 @@

$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields);
update_application($app, $data, $fields);
update_application($app, $result, $fields);

0 comments on commit 8993817

Please sign in to comment.