Files
tevkar f8a8dc8143 Deliver output for a specific memcached instance (#504)
To fix issues around 'no memcache output'. Associated with the relevant branch for librenms.
2024-02-22 09:27:36 -06:00

27 lines
595 B
PHP
Executable File

#!/usr/bin/php
<?php
if (! class_exists('Memcached')) {
echo json_encode(array(
'data' => false,
'error' => 99,
'errorString' => 'php-memcached extension is not available, it must be installed and enabled.',
'version' => '1.1'
));
exit;
}
$server='localhost';
$port=11211;
$m = new Memcached();
$m->addServer($server, $port);
echo json_encode(array(
// 'data' => $m->getStats(),
'data' => ($m->getStats())["$server:$port"],
'error' => $m->getLastErrorCode(),
'errorString' => $m->getLastErrorMessage(),
'version' => '1.1',
));