Example #1
0
function add_host_based_graphs()
{
    global $config;
    debug("Adding Host Based Graphs");
    /* check for host level graphs next data queries */
    $host_cpu_dq = read_config_option("hmib_dq_host_cpu");
    $host_disk_dq = read_config_option("hmib_dq_host_disk");
    $host_users_gt = read_config_option("hmib_gt_users");
    $host_procs_gt = read_config_option("hmib_gt_processes");
    $hosts = db_fetch_assoc("SELECT host_id, host.description FROM plugin_hmib_hrSystem\n\t\tINNER JOIN host\n\t\tON host.id=plugin_hmib_hrSystem.host_id\n\t\tWHERE host_status=3 AND host.disabled=''");
    if (sizeof($hosts)) {
        foreach ($hosts as $h) {
            debug("Processing Host '" . $h["description"] . "[" . $h["host_id"] . "]'");
            if ($host_users_gt) {
                debug("Processing Users");
                hmib_gt_graph($h["host_id"], $host_users_gt);
            } else {
                debug("Users Graph Template Not Set");
            }
            if ($host_users_gt) {
                debug("Processing Processes");
                hmib_gt_graph($h["host_id"], $host_procs_gt);
            } else {
                debug("Processes Graph Template Not Set");
            }
            debug("Processing Disks");
            if ($host_disk_dq) {
                /* only numeric > 0 */
                $regex = "^[1-9][0-9]*";
                $field = "hrStorageSizeInput";
                add_host_dq_graphs($h["host_id"], $host_disk_dq, $field, $regex);
            }
            if ($host_cpu_dq) {
                add_host_dq_graphs($h["host_id"], $host_cpu_dq);
            }
            debug("Processing CPU");
        }
    } else {
        debug("No Hosts Found");
    }
}
Example #2
0
function add_host_based_graphs()
{
    global $config;
    debug('Adding Host Based Graphs');
    /* check for host level graphs next data queries */
    $host_cpu_dq = db_fetch_cell("SELECT id \n\t\tFROM snmp_query \n\t\tWHERE hash='0d1ab53fe37487a5d0b9e1d3ee8c1d0d'");
    $host_disk_dq = db_fetch_cell("SELECT id \n\t\tFROM snmp_query \n\t\tWHERE hash='9343eab1f4d88b0e61ffc9d020f35414'");
    $host_users_gt = db_fetch_cell("SELECT id\n\t\tFROM graph_templates\n\t\tWHERE hash='e8462bbe094e4e9e814d4e681671ea82'");
    $host_procs_gt = db_fetch_cell("SELECT id\n\t\tFROM graph_templates\n\t\tWHERE hash='62205afbd4066e5c4700338841e3901e'");
    $hosts = db_fetch_assoc("SELECT host_id, host.description FROM plugin_hmib_hrSystem\n\t\tINNER JOIN host\n\t\tON host.id=plugin_hmib_hrSystem.host_id\n\t\tWHERE host_status=3 AND host.disabled=''");
    if (sizeof($hosts)) {
        foreach ($hosts as $h) {
            debug("Processing Host '" . $h['description'] . '[' . $h['host_id'] . "]'");
            if ($host_users_gt) {
                debug('Processing Users');
                hmib_gt_graph($h['host_id'], $host_users_gt);
            } else {
                debug('Users Graph Template Not Set');
            }
            if ($host_users_gt) {
                debug('Processing Processes');
                hmib_gt_graph($h['host_id'], $host_procs_gt);
            } else {
                debug('Processes Graph Template Not Set');
            }
            debug('Processing Disks');
            if ($host_disk_dq) {
                /* only numeric > 0 */
                $regex = '^[1-9][0-9]*';
                $field = 'hrStorageSizeInput';
                add_host_dq_graphs($h['host_id'], $host_disk_dq, $field, $regex);
            }
            if ($host_cpu_dq) {
                add_host_dq_graphs($h['host_id'], $host_cpu_dq);
            }
            debug('Processing CPU');
        }
    } else {
        debug('No Hosts Found');
    }
}