#!/usr/bin/php connect()) { logdie($myLog, 'ERROR Database connect error (1)'); } function get_count($db, $table, $conditions) { $res = $db->customQuery('SELECT count(1) as count FROM ' . $table . ' WHERE ' . $conditions); if ($res) { $r = $res->fetch(PDO::FETCH_ASSOC); return $r['count']; } return Null; } if ($count = get_count($db, 'yubikeys', 'active=true')) { echo "yubikeys_enabled.value " . $count . "\n"; } if ($count = get_count($db, 'yubikeys', 'active=false')) { echo "yubikeys_disabled.value " . $count . "\n"; } if ($count = get_count($db, 'yubikeys', 'modified >= ' . (time() - (31 * 86400)))) { echo "yubikeys_1month.value " . $count . "\n"; } if ($count = get_count($db, 'clients', 'active=true')) { echo "clients_enabled.value " . $count . "\n"; } if ($count = get_count($db, 'clients', 'active=false')) { echo "clients_disabled.value " . $count . "\n"; }