Exemplo n.º 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");
    }
}
Exemplo n.º 2
0
function add_host_based_graphs()
{
    global $config, $device_hashes, $device_query_hashes, $device_health_hashes;
    debug('Adding Host Based Graphs');
    /* check for host level graphs next data queries */
    $host_cpu_dq = read_config_option('mikrotik_dq_host_cpu');
    $host_users_dq = mikrotik_data_query_by_hash('ce63249e6cc3d52bc69659a3f32194fe');
    $hosts = db_fetch_assoc("SELECT host_id, host.description, host.hostname \n\t\tFROM plugin_mikrotik_system\n\t\tINNER JOIN host\n\t\tON host.id=plugin_mikrotik_system.host_id\n\t\tWHERE host_status IN(0,3) AND host.disabled=''");
    if (sizeof($hosts)) {
        foreach ($hosts as $h) {
            debug('Processing Host: ' . $h['description'] . ' [' . $h['hostname'] . ']');
            foreach ($device_hashes as $hash) {
                $template = mikrotik_template_by_hash($hash);
                if (!empty($template)) {
                    debug('Processing ' . db_fetch_cell_prepared('SELECT name FROM graph_templates WHERE hash = ?', array($hash)));
                    mikrotik_gt_graph($h['host_id'], $template);
                }
            }
            foreach ($device_query_hashes as $hash) {
                $query = mikrotik_data_query_by_hash($hash);
                if (!empty($query)) {
                    debug('Processing ' . db_fetch_cell_prepared('SELECT name FROM snmp_query WHERE hash = ?', array($hash)));
                    if ($hash == '7dd90372956af1dc8ec7b859a678f227') {
                        $exclusion = read_config_option('mikrotik_user_exclusion');
                        add_host_dq_graphs($h['host_id'], $query, 'userName', $exclusion, false);
                    } else {
                        add_host_dq_graphs($h['host_id'], $query);
                    }
                }
            }
            $health = db_fetch_row_prepared('SELECT * FROM plugin_mikrotik_system_health WHERE host_id = ?', array($h['host_id']));
            debug('Processing Health');
            if (sizeof($health)) {
                foreach ($device_health_hashes as $column => $hash) {
                    if (!empty($health[$column]) && $health[$column] != 'NULL') {
                        $template = mikrotik_template_by_hash($hash);
                        if (!empty($template)) {
                            debug('Processing ' . db_fetch_cell_prepared('SELECT name FROM graph_templates WHERE hash = ?', array($hash)));
                            mikrotik_gt_graph($h['host_id'], $template);
                        }
                    }
                }
            }
        }
    } else {
        debug('No Hosts Found');
    }
}
Exemplo n.º 3
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');
    }
}
Exemplo n.º 4
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('mikrotik_dq_host_cpu');
    $host_users_dq = mikrotik_data_query_by_hash('ce63249e6cc3d52bc69659a3f32194fe');
    $host_users_gt = mikrotik_template_by_hash('99e37ff13139f586d257ba9a637d7340');
    $host_procs_gt = mikrotik_template_by_hash('e797d967db24fd86341a8aa8c60fa9e0');
    $host_disk_gt = mikrotik_template_by_hash('0ece13b90785aa04d1f554a093685948');
    $host_mem_gt = mikrotik_template_by_hash('4396ae857c4f9bc5ed1f26b5361e42d9');
    $host_cpu_gt = mikrotik_template_by_hash('7df474393f58bae8e8d6b85f10efad71');
    $host_arp_gt = mikrotik_template_by_hash('32bd34d525944127063c2d94e2e8f1de');
    $host_rts_gt = mikrotik_template_by_hash('8856e3943ecc70e5da835072f584d5a0');
    $host_ppp_gt = mikrotik_template_by_hash('47ced1c199d83e8dd79c6ba594c4e3be');
    $host_upt_gt = mikrotik_template_by_hash('7d8dc3050621a2cb937cac3895bc5d5b');
    $hosts = db_fetch_assoc("SELECT host_id, host.description FROM plugin_mikrotik_system\n\t\tINNER JOIN host\n\t\tON host.id=plugin_mikrotik_system.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');
                mikrotik_gt_graph($h['host_id'], $host_users_gt);
            } else {
                debug('Users Graph Template Not Set');
            }
            if ($host_users_gt) {
                debug('Processing Processes');
                mikrotik_gt_graph($h['host_id'], $host_procs_gt);
            } else {
                debug('Processes Graph Template Not Set');
            }
            if ($host_disk_gt) {
                debug('Processing Disk');
                mikrotik_gt_graph($h['host_id'], $host_disk_gt);
            } else {
                debug('Disk Graph Template Not Set');
            }
            if ($host_mem_gt) {
                debug('Processing Memory');
                mikrotik_gt_graph($h['host_id'], $host_mem_gt);
            } else {
                debug('Memory Graph Template Not Set');
            }
            if ($host_cpu_gt) {
                debug('Processing CPU');
                mikrotik_gt_graph($h['host_id'], $host_cpu_gt);
            } else {
                debug('CPU Graph Template Not Set');
            }
            if ($host_arp_gt) {
                debug('Processing ARP');
                mikrotik_gt_graph($h['host_id'], $host_arp_gt);
            } else {
                debug('ARP Graph Template Not Set');
            }
            if ($host_rts_gt) {
                debug('Processing Routes');
                mikrotik_gt_graph($h['host_id'], $host_rts_gt);
            } else {
                debug('Routes Graph Template Not Set');
            }
            if ($host_ppp_gt) {
                debug('Processing PPP Active');
                mikrotik_gt_graph($h['host_id'], $host_ppp_gt);
            } else {
                debug('PPP Active Graph Template Not Set');
            }
            if ($host_upt_gt) {
                debug('Processing Uptime');
                mikrotik_gt_graph($h['host_id'], $host_upt_gt);
            } else {
                debug('Uptime Graph Template Not Set');
            }
            debug('Processing Users');
            if ($host_users_dq) {
                add_host_dq_graphs($h['host_id'], $host_users_dq);
            }
            debug('Processing CPU');
            if ($host_cpu_dq) {
                add_host_dq_graphs($h['host_id'], $host_cpu_dq);
            }
        }
    } else {
        debug('No Hosts Found');
    }
}
Exemplo n.º 5
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("mikrotik_dq_host_cpu");
    $host_users_dq = read_config_option("mikrotik_dq_users");
    $host_users_gt = read_config_option("mikrotik_gt_users");
    $host_procs_gt = read_config_option("mikrotik_gt_processes");
    $host_disk_gt = read_config_option("mikrotik_gt_disk");
    $host_mem_gt = read_config_option("mikrotik_gt_memory");
    $host_cpu_gt = read_config_option("mikrotik_gt_cpu");
    $host_arp_gt = read_config_option("mikrotik_gt_arp");
    $host_rts_gt = read_config_option("mikrotik_gt_routes");
    $host_ppp_gt = read_config_option("mikrotik_gt_ppp");
    $host_upt_gt = read_config_option("mikrotik_gt_uptime");
    $hosts = db_fetch_assoc("SELECT host_id, host.description FROM plugin_mikrotik_system\n\t\tINNER JOIN host\n\t\tON host.id=plugin_mikrotik_system.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");
                mikrotik_gt_graph($h["host_id"], $host_users_gt);
            } else {
                debug("Users Graph Template Not Set");
            }
            if ($host_users_gt) {
                debug("Processing Processes");
                mikrotik_gt_graph($h["host_id"], $host_procs_gt);
            } else {
                debug("Processes Graph Template Not Set");
            }
            if ($host_disk_gt) {
                debug("Processing Disk");
                mikrotik_gt_graph($h["host_id"], $host_disk_gt);
            } else {
                debug("Disk Graph Template Not Set");
            }
            if ($host_mem_gt) {
                debug("Processing Memory");
                mikrotik_gt_graph($h["host_id"], $host_mem_gt);
            } else {
                debug("Memory Graph Template Not Set");
            }
            if ($host_cpu_gt) {
                debug("Processing CPU");
                mikrotik_gt_graph($h["host_id"], $host_cpu_gt);
            } else {
                debug("CPU Graph Template Not Set");
            }
            if ($host_arp_gt) {
                debug("Processing ARP");
                mikrotik_gt_graph($h["host_id"], $host_arp_gt);
            } else {
                debug("ARP Graph Template Not Set");
            }
            if ($host_rts_gt) {
                debug("Processing Routes");
                mikrotik_gt_graph($h["host_id"], $host_rts_gt);
            } else {
                debug("Routes Graph Template Not Set");
            }
            if ($host_ppp_gt) {
                debug("Processing PPP Active");
                mikrotik_gt_graph($h["host_id"], $host_ppp_gt);
            } else {
                debug("PPP Active Graph Template Not Set");
            }
            if ($host_upt_gt) {
                debug("Processing Uptime");
                mikrotik_gt_graph($h["host_id"], $host_upt_gt);
            } else {
                debug("Uptime Graph Template Not Set");
            }
            debug("Processing Users");
            if ($host_users_dq) {
                add_host_dq_graphs($h["host_id"], $host_users_dq);
            }
            debug("Processing CPU");
            if ($host_cpu_dq) {
                add_host_dq_graphs($h["host_id"], $host_cpu_dq);
            }
        }
    } else {
        debug("No Hosts Found");
    }
}