public function actionIndex()
 {
     $monitorAktif = ServerMonitor::model()->findAll(['select' => 'monitor_id', 'distinct' => true, 'condition' => 'aktif=1']);
     $servers = Server::model()->findAll(['select' => 'id, nama, address', 'order' => 'nama']);
     $dataUptime = [];
     foreach ($servers as $server) {
         $curServer = Server::model()->findByPk($server['id']);
         $data = $curServer->ambilDataUptime();
         $dataUptime[$server['id']] = ['data' => $data['data'], 'terakhir' => $data['terakhir']];
     }
     $this->render('index', ['monitorAktif' => $monitorAktif, 'servers' => $servers, 'dataUptime' => $dataUptime]);
 }
Esempio n. 2
0
 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));
 }
									<td><?php 
    echo "{$server->server->nama} <small>[{$server->server->address}]</small>";
    ?>
										<div class="linechart"><?php 
    echo ServerMonitor::model()->ambilDataTerakhir($server->server_id, $monitorId, 50);
    ?>
</div>
									</td>
									<td>
										<span class="right">
											<a href="<?php 
    echo Yii::app()->createUrl('dashboard/monitordetail', ['id' => $monitorId, 'serverId' => $server->server_id]);
    ?>
">
												<div>Last: <?php 
    $hasil = ServerMonitor::model()->ambilDataTerakhir($server->server_id, $monitorId, 1);
    if ($hasil == 'null') {
        ?>
														<span class="alert label">null</span>
														<?php 
    } else {
        ?>
														<span class="primary label"><?php 
        echo $server->monitor->prefix;
        ?>
															<?php 
        //echo $tipeOutput;
        //var_dump($hasil);
        if ($tipeOutput === 'numeric') {
            echo number_format($hasil * 1, 0, ',', '.');
        } else {
 public function actionUpdateConnectionTimedOut()
 {
     $return = array('sukses' => false);
     if (isset($_POST['pk'])) {
         $pk = $_POST['pk'];
         $timeOut = $_POST['value'];
         $serverMonitor = ServerMonitor::model()->findByPk($pk);
         $serverMonitor->connection_timeout = $timeOut;
         if ($serverMonitor->save()) {
             $return = array('sukses' => true);
         }
     }
     echo CJSON::encode($return);
 }
Esempio n. 5
0
 public function listServerAktif()
 {
     $query = Yii::app()->db->createCommand()->select('sr.id, sr.nama')->from(ServerMonitor::model()->tableName() . ' sm')->join(Server::model()->tableName() . ' sr', 'sm.server_id=sr.id')->where('monitor_id=:monitorId and aktif=1', array(':monitorId' => $this->id))->queryAll();
     return $query;
 }