Merge pull request #768 from laf/callback

Callback system for stats
This commit is contained in:
Daniel Preussker
2015-04-12 10:18:52 +00:00
13 changed files with 248 additions and 3 deletions

View File

@@ -599,4 +599,8 @@ $config['distributed_poller_group'] = 0;
$config['distributed_poller_memcached_host'] = 'example.net';
$config['distributed_poller_memcached_port'] = '11211';
// Stats callback system
$config['callback_post'] = 'https://stats.librenms.org/log.php';
$config['callback_clear'] = 'https://stats.librenms.org/clear.php';
?>

View File

@@ -1129,4 +1129,15 @@ function convert_delay($delay) {
return($delay_sec);
}
function guidv4($data) {
// http://stackoverflow.com/questions/2040240/php-function-to-generate-v4-uuid#15875555
// From: Jack http://stackoverflow.com/users/1338292/ja%CD%A2ck
assert(strlen($data) == 16);
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}
?>