コード例 #1
0
ファイル: wmi.inc.php プロジェクト: Natolumin/observium
        if ($wmi['processors']) {
            include $GLOBALS['config']['install_dir'] . "/includes/polling/processors/wmi.inc.php";
        }
    }
    // Logical Disks
    if ($wmi_attribs['wmi_poll_storage']) {
        $wql = "SELECT * FROM Win32_LogicalDisk WHERE Description='Local Fixed Disk'";
        $wmi['disk']['logical'] = wmi_parse(wmi_query($wql, $override));
        if ($wmi['disk']['logical']) {
            include $GLOBALS['config']['install_dir'] . "/includes/polling/storage/wmi.inc.php";
        }
    }
    // Microsoft Exchange
    if ($wmi_attribs['wmi_poll_exchange']) {
        $wql = "SELECT Name FROM Win32_Service WHERE Name LIKE '%MSExchange%'";
        $wmi['exchange']['services'] = wmi_parse(wmi_query($wql, $override), TRUE);
        if ($wmi['exchange']['services']) {
            include $GLOBALS['config']['install_dir'] . "/includes/polling/applications/exchange.inc.php";
        }
    }
    // Microsoft SQL Server
    if ($wmi_attribs['wmi_poll_mssql']) {
        $wql = "SELECT Name, ProcessId FROM Win32_Service WHERE Name LIKE '%MSSQL\$%' OR Name = 'MSSQLSERVER'";
        $wmi['mssql']['services'] = wmi_parse(wmi_query($wql, $override));
        if ($wmi['mssql']['services']) {
            include $GLOBALS['config']['install_dir'] . "/includes/polling/applications/mssql.inc.php";
        }
    }
    unset($wmi);
}
// EOF
コード例 #2
0
    // Exchange Information Store
    $wql = "SELECT * FROM Win32_PerfFormattedData_MSExchangeIS_MSExchangeIS";
    $wmi['exchange']['mailbox']['is'] = wmi_parse(wmi_query($wql, $override), TRUE);
    if ($wmi['exchange']['mailbox']['is']) {
        $app_found['exchange'] = TRUE;
        echo "IS; ";
        $rrd_filename = $GLOBALS['config']['rrd_dir'] . "/" . $device['hostname'] . "/wmi-app-exchange-is.rrd";
        if (!is_file($rrd_filename)) {
            rrdtool_create($rrd_filename, "DS:activeconcount:GAUGE:600:0:125000000000 " . "DS:usercount:GAUGE:600:0:125000000000 " . "DS:rpcrequests:GAUGE:600:0:125000000000 " . "DS:rpcavglatency:GAUGE:600:0:125000000000 " . "DS:clientrpcfailbusy:GAUGE:600:0:125000000000 ");
        }
        rrdtool_update($rrd_filename, "N:" . $wmi['exchange']['mailbox']['is']['ActiveConnectionCount'] . ":" . $wmi['exchange']['mailbox']['is']['UserCount'] . ":" . $wmi['exchange']['mailbox']['is']['RPCRequests'] . ":" . $wmi['exchange']['mailbox']['is']['RPCAveragedLatency'] . ":" . $wmi['exchange']['mailbox']['is']['ClientRPCsFailedServerTooBusy']);
        unset($wmi['exchange']['mailbox']['is'], $rrd_filename);
    }
    // Exchange Information Store - Mailbox Data
    $wql = "SELECT * FROM Win32_PerfFormattedData_MSExchangeIS_MSExchangeISMailbox WHERE Name='_total'";
    $wmi['exchange']['mailbox']['mailbox'] = wmi_parse(wmi_query($wql, $override), TRUE);
    if ($wmi['exchange']['mailbox']['mailbox']) {
        $app_found['exchange'] = TRUE;
        echo "Mailbox; ";
        $rrd_filename = $GLOBALS['config']['rrd_dir'] . "/" . $device['hostname'] . "/wmi-app-exchange-mailbox.rrd";
        if (!is_file($rrd_filename)) {
            rrdtool_create($rrd_filename, "DS:rpcavglatency:GAUGE:600:0:125000000000 " . "DS:msgqueued:GAUGE:600:0:125000000000 " . "DS:msgsentsec:GAUGE:600:0:125000000000 " . "DS:msgdeliversec:GAUGE:600:0:125000000000 " . "DS:msgsubmitsec:GAUGE:600:0:125000000000 ");
        }
        rrdtool_update($rrd_filename, "N:" . $wmi['exchange']['mailbox']['mailbox']['RPCAverageLatency'] . ":" . $wmi['exchange']['mailbox']['mailbox']['MessagesQueuedForSubmission'] . ":" . $wmi['exchange']['mailbox']['mailbox']['MessagesSentPersec'] . ":" . $wmi['exchange']['mailbox']['mailbox']['MessagesDeliveredPersec'] . ":" . $wmi['exchange']['mailbox']['mailbox']['MessagesSubmittedPersec']);
    }
    echo "\n";
}
if ($app_found['exchange'] == TRUE) {
    $app['type'] = "exchange";
    $app['name'] = "Exchange";
    wmi_dbAppInsert($device['device_id'], $app);
コード例 #3
0
     $app_found['mssql'] = TRUE;
     echo "Buffer; ";
     $rrd_filename = $GLOBALS['config']['rrd_dir'] . "/" . $device['hostname'] . "/wmi-app-mssql_" . $instance['Name'] . "-buffer.rrd";
     if (!is_file($rrd_filename)) {
         rrdtool_create($rrd_filename, "DS:pagelifeexpect:GAUGE:600:0:125000000000 " . "DS:pagelookupssec:GAUGE:600:0:125000000000 " . "DS:pagereadssec:GAUGE:600:0:125000000000 " . "DS:pagewritessec:GAUGE:600:0:125000000000 " . "DS:freeliststalls:GAUGE:600:0:125000000000 ");
     }
     $app_data['buffer']['LifeExp'] = $wmi['mssql'][$instance['Name']]['buffer']['Pagelifeexpectancy'];
     $app_data['buffer']['PgLook'] = $wmi['mssql'][$instance['Name']]['buffer']['PagelookupsPersec'];
     $app_data['buffer']['PgRead'] = $wmi['mssql'][$instance['Name']]['buffer']['PagereadsPersec'];
     $app_data['buffer']['PgWrite'] = $wmi['mssql'][$instance['Name']]['buffer']['PagewritesPersec'];
     $app_data['buffer']['Stalls'] = $wmi['mssql'][$instance['Name']]['buffer']['FreeliststallsPersec'];
     rrdtool_update($rrd_filename, "N:" . $wmi['mssql'][$instance['Name']]['buffer']['Pagelifeexpectancy'] . ":" . $wmi['mssql'][$instance['Name']]['buffer']['PagelookupsPersec'] . ":" . $wmi['mssql'][$instance['Name']]['buffer']['PagereadsPersec'] . ":" . $wmi['mssql'][$instance['Name']]['buffer']['PagewritesPersec'] . ":" . $wmi['mssql'][$instance['Name']]['buffer']['FreeliststallsPersec']);
 }
 // CPU Usage
 $wql = "SELECT * FROM Win32_PerfRawData_PerfProc_Process WHERE IDProcess=" . $instance['ProcessId'];
 $wmi['mssql'][$instance['Name']]['cpu'] = wmi_parse(wmi_query($wql, $override), TRUE);
 // Windows measures CPU usage using the PERF_100NSEC_TIMER_INV counter type, meaning measurements are in 100 nanosecond increments
 // http://msdn.microsoft.com/en-us/library/ms803963.aspx
 $cpu_ntime = sprintf('%u', utime() * 100000000);
 if ($wmi['mssql'][$instance['Name']]['cpu']) {
     $app_found['mssql'] = TRUE;
     echo "CPU; ";
     $rrd_filename = $GLOBALS['config']['rrd_dir'] . "/" . $device['hostname'] . "/wmi-app-mssql_" . $instance['Name'] . "-cpu.rrd";
     if (!is_file($rrd_filename)) {
         rrdtool_create($rrd_filename, "DS:percproctime:COUNTER:600:0:125000000000 " . "DS:threads:GAUGE:600:0:125000000000 " . "DS:lastpoll:COUNTER:600:0:125000000000 ", "RRA:LAST:0.5:1:2016  RRA:LAST:0.5:6:2976  RRA:LAST:0.5:24:1440  RRA:LAST:0.5:288:1440 " . $GLOBALS['config']['rrd']['rra']);
     }
     $app_data['cpu']['proc'] = $wmi['mssql'][$instance['Name']]['cpu']['PercentProcessorTime'];
     $app_data['cpu']['time'] = $cpu_ntime;
     rrdtool_update($rrd_filename, "N:" . $wmi['mssql'][$instance['Name']]['cpu']['PercentProcessorTime'] . ":" . $wmi['mssql'][$instance['Name']]['cpu']['ThreadCount'] . ":" . $cpu_ntime);
 }
 if ($app_found['mssql'] == TRUE) {