if (($stmt = $dbh->query("SELECT m.name as modulename, count(cm.id) as moduleinstance FROM {$table_prefix}modules m, {$table_prefix}course_modules cm WHERE cm.module=m.id GROUP BY cm.module ORDER BY m.name ASC")) != false) {
$data = $stmt->fetchAll(PDO::FETCH_OBJ);
}
if (count($argv) === 2 && $argv[1] === 'config') {
echo "graph_title Moodle Modules\n";
echo "graph_args --base 1000 --lower-limit 0\n";
echo "graph_vlabel modules\n";
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";