Skip to content
Snippets Groups Projects
Commit c10a7a43 authored by Olav Morken's avatar Olav Morken
Browse files

memcacheMonitor: sanity check which checks availability of memcache servers

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1334 44740490-163a-0410-bde0-09ae8108e29a
parent 0003f8dd
No related branches found
No related tags found
No related merge requests found
<?php
/**
* Sanity check for memcache servers.
*
* This function verifies that all memcache servers work.
*
* @param array &$hookinfo hookinfo
*/
function memcacheMonitor_hook_sanitycheck(&$hookinfo) {
assert('is_array($hookinfo)');
assert('array_key_exists("errors", $hookinfo)');
assert('array_key_exists("info", $hookinfo)');
try {
$servers = SimpleSAML_Memcache::getRawStats();
} catch (Exception $e) {
$hookinfo['errors'][] = '[memcacheMonitor] Error parsing memcache configuration: ' . $e->getMessage();
return;
}
$allOK = TRUE;
foreach ($servers as $group) {
foreach ($group as $server => $status) {
if ($status === FALSE) {
$hookinfo['errors'][] = '[memcacheMonitor] No response from server: ' . $server;
$allOK = FALSE;
}
}
}
if ($allOK) {
$hookinfo['info'][] = '[memcacheMonitor] All servers responding.';
}
}
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment