1. Go to this page and download the library: Download klikar3/rgraph library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
klikar3 / rgraph example snippets
public function actionDetail($cntr,$id,$days)
{
$servername = $this->getServername($id);
date_default_timezone_set('Europe/Berlin');
$dt = date('Y-m-d H:i:s',time() - 60 * 60 * 24 * $days);
return $this->render('detail', [
'id' => $id,
'cntr' => $cntr,
'servername' => $servername,
'dataset' => $this->getPerfmonDataset($servername,$cntr,$dt),
]);
}
public function getServername($id)
{
$lconn = \Yii::$app->db;
$cmd = $lconn
->createCommand('SELECT [Server] FROM ServerData WHERE id=:id');
$cmd->bindValue(':id', $id);
$servername = $cmd->queryScalar();
return $servername;
}
public function getPerfmonDataset($srvr,$cntr,$dt)
{
$pcid = (new \yii\db\Query())
->select('id')->from('PerfCounterDefault')->where('counter_name=:cntr',
array('cntr' => $cntr))
->scalar();
$dataset = (new \yii\db\Query())
->select('value, CaptureDate')->from('PerfMonData')->where('Server=:srvr AND Counter_id=:pcid AND CaptureDate>:dt',
array('srvr' => $srvr, 'pcid' => $pcid, 'dt' => $dt ))
->all();
return $dataset;
}
echo 'Server: '.$servername
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.