2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

remove computed total to let munin do the work

This commit is contained in:
ak4t0sh 2014-09-15 23:10:00 +02:00
parent 5ac6279f44
commit ac1f67b28e
2 changed files with 6 additions and 22 deletions

View File

@ -56,20 +56,16 @@ if (count($argv) === 2 && $argv[1] === 'config') {
echo "graph_category Moodle\n";
echo "graph_scale no\n";
echo "graph_info Displays the sum of module, as well as module instance number by type, in your Moodle site\n";
echo "graph_total.label total\n";
foreach($data as $entry) {
echo "modules_".$entry->modulename.".label ".$entry->modulename."\n";
echo "modules_".$entry->modulename.".min 0\n";
echo "modules_".$entry->modulename.".draw AREA\n";
}
echo "modules_total.label total users\n";
echo "modules_total.min 0\n";
exit(0);
}
$total = 0;
foreach($data as $entry) {
echo "modules_".$entry->modulename.".label ".$entry->modulename."\n";
echo "modules_".$entry->modulename.".value ".$entry->moduleinstance."\n";
$total += $entry->moduleinstance;
}
echo "modules_total.value $total\n";
}

View File

@ -43,17 +43,14 @@ if (count($argv) === 2 && $argv[1] === 'config') {
echo "graph_category Moodle\n";
echo "graph_scale no\n";
echo "graph_info Displays the sum of users, as well as active, suspended and deleted accounts, in your Moodle site\n";
echo "graph_total total\n";
echo "users_total.label total users\n";
echo "users_active.label active users\n";
echo "users_suspended.label suspended users\n";
echo "users_deleted.label deleted users\n";
echo "users_total.min 0\n";
echo "users_active.label active\n";
echo "users_suspended.label suspended\n";
echo "users_deleted.label deleted\n";
echo "users_active.min 0\n";
echo "users_suspended.min 0\n";
echo "users_deleted.min 0\n";
exit(0);
}
@ -65,15 +62,6 @@ try {
exit(1);
}
//All users
$nbusers = 0;
if (($stmt = $dbh->query("SELECT COUNT(id) FROM {$table_prefix}user")) != false) {
$nbusers = $stmt->fetchColumn();
}
echo "users_total.value $nbusers\n";
//Active users (not deleted or suspended)
$nbusers = 0;
if (($stmt = $dbh->query("SELECT COUNT(id) FROM {$table_prefix}user WHERE deleted=0 AND suspended=0")) != false) {