Exemple #1
0
                } else {
                    if (eregi("Local", $linea)) {
                        $counter_channels_local++;
                    } else {
                        if (preg_match("/^([[:digit:]]+)[[:space:]]+active calls?/", $linea, $arrReg)) {
                            $simCalls = $arrReg[1];
                        }
                    }
                }
            }
        }
    }
}
$counter_channels_total = $counter_channels_dahdi + $counter_channels_sip + $counter_channels_iax + $counter_channels_h323 + $counter_channels_local;
$timestamp = time();
$oSampler->insertSample(1, $timestamp, $simCalls);
$arrSysInfo = obtener_info_de_sistema();
// CPU Usage
$cpuUsage = number_format($arrSysInfo['CpuUsage'] * 100, 2);
$timestamp = time();
$oSampler->insertSample(2, $timestamp, $cpuUsage);
// Memory Usage
$memUsage = number_format(($arrSysInfo['MemTotal'] - $arrSysInfo['MemFree'] - $arrSysInfo['Cached'] - $arrSysInfo['MemBuffers']) / 1024, 2);
$timestamp = time();
$oSampler->insertSample(3, $timestamp, $memUsage);
// Total Channels Usage
$timestamp = time();
$oSampler->insertSample(4, $timestamp, $counter_channels_total);
// DAHDI Channels Usage
$timestamp = time();
$oSampler->insertSample(5, $timestamp, $counter_channels_dahdi);