本文整理汇总了PHP中Monitor类的典型用法代码示例。如果您正苦于以下问题:PHP Monitor类的具体用法?PHP Monitor怎么用?PHP Monitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Monitor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createApplication
public function createApplication()
{
$ems = new Monitor();
$ems->run();
$app = $ems->getApp();
$app['debug'] = true;
unset($app['exception_handler']);
return $app;
}
示例2: testGetMonitorOptions
public function testGetMonitorOptions()
{
$monitors = Monitor::model()->getMonitorOptions();
$this->assertTrue(3 === count($monitors));
$this->assertTrue(is_array($monitors));
$this->assertTrue(in_array('monitor1', $monitors));
$this->assertFalse(in_array('monitor4', $monitors));
}
示例3: actionUbah
/**
* Updates a particular model.
* @param integer $id the ID of the model to be updated
*/
public function actionUbah($id)
{
$model = $this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Server'])) {
$model->attributes = $_POST['Server'];
$model->save();
}
$monitorListBukan = new Monitor('search');
$monitorListBukan->unsetAttributes();
$monitorListBukan->serverId = $id;
$monitorList = new ServerMonitor('search');
$monitorList->unsetAttributes();
$monitorList->server_id = $id;
$this->render('ubah', array('model' => $model, 'monitorListBukan' => $monitorListBukan, 'monitorList' => $monitorList));
}
示例4: actionSort
public function actionSort()
{
$return = array('sukses' => false);
if (isset($_POST['mon'])) {
Monitor::model()->updateOrder($_POST['mon']);
$return = array('sukses' => true);
}
$this->renderJSON($return);
}
示例5: outputToDevice
public static function outputToDevice($deviceID)
{
if ($deviceID == 1) {
Monitor::drawDataToMonitor();
}
if ($deviceID == 2) {
Printer::sendDataToPrinter();
}
}
示例6: getMonitors
public static function getMonitors()
{
$monitors = array();
$mrows = $GLOBALS['PW_DB']->executeSelect('*', 'monitors', '');
foreach ($mrows as $m) {
$monitors[] = Monitor::fetch($m);
}
return $monitors;
}
示例7: actionMonitorDetail
public function actionMonitorDetail($id, $serverId)
{
$namaTabel = "{$serverId}_{$id}";
$model = new MonitorDetail($namaTabel);
$model->scenario = 'search';
$monitor = Monitor::model()->findByPk($id);
$server = Server::model()->findByPk($serverId);
$this->render('monitor_detail', ['model' => $model, 'server' => $server, 'monitor' => $monitor]);
}
示例8: checkAll
public static function checkAll()
{
$monitors = $GLOBALS['PW_DB']->executeSelect('*', 'monitors', '');
foreach ($monitors as $mrow) {
$monitor = Monitor::fetch($mrow);
$up = $monitor->poll();
echo $monitor->getAlias(), $up;
$monitor->saveToDb();
}
}
示例9: runTestFunction
/**
* @param string $func_name
* @param string $desc
* @return array
*/
private function runTestFunction($func_name, $desc)
{
$start_mem_usage = memory_get_usage();
$start_time = Monitor::getMicroTime();
for ($i = $this->num_runs; $i > 0; $i--) {
$this->{$func_name}();
}
$memory = memory_get_usage() - $start_mem_usage;
return array('function' => $func_name, 'description' => $desc, 'mem_usage' => round($memory / 1024 / 1024, 4), 'time' => bcsub(Monitor::getMicroTime(), $start_time, 4));
}
示例10: processDelete
public function processDelete($data)
{
$this->customProcessDelete();
$mons = $GLOBALS['PW_DB']->executeSelect('*', 'monitors', 'WHERE ' . intval($this->id) . ' IN
(notification_channels)');
foreach ($mons as $mon) {
$mhandle = Monitor::fetch($mon);
$mhandle->deleteChannel($mhandle);
$mhandle->saveToDb();
}
$GLOBALS['PW_DB']->executeDelete('channels', 'WHERE id=' . intval($this->id));
}
示例11: pushError
public function pushError($error)
{
$di = \Phalcon\DI::getDefault();
if (isset($di['request'])) {
$error['url'] = $di['request']->getHttpHost() . $di['request']->getUri();
}
if (isset($di['local']->rawData['service'])) {
$error['callinfo'] = json_encode($di['local']->rawData);
if ($di['local']->rawData['service'] == 'Api\\Services\\Monitor') {
return;
}
}
$error['app'] = Monitor::getProject();
$error['serverip'] = sprintf("%u\n", ip2long(Monitor::getLocalip()));
$di['remote']->swooleCall(array('service' => 'Api\\Services\\Monitor', 'method' => 'addlog', 'args' => array($error)));
}
示例12: run
public function run()
{
$servers = ServerMonitor::model()->ambilServers($this->monitorId);
$monitor = Monitor::model()->findByPk($this->monitorId);
$tipeOutput = $monitor->outputType->nama;
$tipeView = $monitor->viewType->nama;
switch ($tipeView) {
case 'linechart':
$view = 'boxMonitorLineChart';
break;
case 'onoffstatus':
$view = 'boxMonitorOnOffStatus';
break;
case 'text':
$view = 'boxMonitorText';
break;
}
$this->render($view, array('title' => $this->title, 'monitorId' => $this->monitorId, 'servers' => $servers, 'tipeOutput' => $tipeOutput));
}
示例13: disabletestMaxSize
/**
* test file writing stops at max size. max size is set to 10 in setUp, so there is only space for 1 log
* @todo doesn't work as fileSize always returns the same value as at first read. So test manually instead.
*/
public function disabletestMaxSize()
{
AmfphpMonitor::addTime('test time 0 ');
$this->object->filterSerializedResponse(null);
AmfphpMonitor::addTime('should not log');
$this->object->filterSerializedResponse(null);
$this->object->filterSerializedResponse(null);
$this->object->filterSerializedResponse(null);
$this->object->filterSerializedResponse(null);
$log = file_get_contents($this->logPath);
//echo $log;
//echo "ertert " . filesize($this->logPath);
$this->assertTrue(strpos($log, 'should not log') === false);
}
示例14: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer $id the ID of the model to be loaded
* @return Monitor the loaded model
* @throws CHttpException
*/
public function loadModel($id)
{
$model = Monitor::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例15: generate_entity
//.........这里部分代码省略.........
'cartridgeitems_id' => $ctypeID,
'printers_id' => $printID,
'date_in' => date("Y-m-d",$date1),
'date_use' => date("Y-m-d",$date1+$j*$inter),
'date_out' => date("Y-m-d",$date1+($j+1)*$inter),
'pages' => $printed));
}
// Add current cartridges
$c->add(array('entities_id' => $ID_entity,
'cartridgeitems_id' => $ctypeID,
'printers_id' => $printID,
'date_in' => $date,
'date_use' => date("Y-m-d",$date2)));
}
$iface = mt_rand(1,$MAX['iface']);
// Add networking ports
addNetworkEthernetPort('Printer', $printID, $ID_entity, $i);
}
unset($NET_LOC);
$LAST["networking"] = getMaxItem("glpi_networkequipments");
//////////// INVENTORY
// glpi_computers
$FIRST["computers"] = getMaxItem("glpi_computers")+1;
$FIRST["monitors"] = getMaxItem("glpi_monitors")+1;
$FIRST["phones"] = getMaxItem("glpi_phones")+1;
$FIRST["peripherals"] = getMaxItem("glpi_peripherals")+1;
$c = new Computer();
$mon = new Monitor();
$cdevmb = new Item_DeviceMotherBoard();
$cdevproc = new Item_DeviceProcessor();
$cdevmem = new Item_DeviceMemory();
$cdevhd = new Item_DeviceHardDrive();
$cdevnc = new Item_DeviceNetworkCard();
$cdevdr = new Item_DeviceDrive();
$cdevcon = new Item_DeviceControl();
$cdevgc = new Item_DeviceGraphicCard();
$cdevsc = new Item_DeviceSoundCard();
$cdevpci = new Item_DevicePci();
$cdevcase = new Item_DeviceCase();
$cdevps = new Item_DevicePowerSupply();
$cdisk = new ComputerDisk();
$np = new Netpoint();
$ci = new Computer_Item();
$phone = new Phone();
$print = new Printer();
$periph = new Peripheral();
$cart = new Cartridge();
for ($i=0 ; $i<$MAX['computers'] ; $i++) {
$loc = mt_rand($FIRST["locations"],$LAST['locations']);
$techID = mt_rand($FIRST['users_sadmin'],$LAST['users_admin']);
$userID = mt_rand($FIRST['users_normal'],$LAST['users_postonly']);
$groupID = mt_rand($FIRST["groups"],$LAST["groups"]);
$gtechID = mt_rand($FIRST["techgroups"],$LAST["techgroups"]);
$domainID = mt_rand($FIRST['domain'],$LAST['domain']);
$networkID = mt_rand(1,$MAX['network']);
$compID = $c->add(toolbox::addslashes_deep(
array('entities_id' => $ID_entity,