Esempio n. 1
0
 /**
  * Returns value for server role loadbar (thermometr)
  * @param $hostname
  * @param $roleId
  * @return bool|float
  * @throws \Bitrix\Main\ArgumentNullException
  * @throws \Exception
  * @throws \Bitrix\Main\IO\FileNotFoundException
  */
 public static function getLoadBarValue($hostname, $roleId)
 {
     if (!extension_loaded('rrd')) {
         throw new \Exception("Extension rrd not loaded!");
     }
     if (strlen($hostname) <= 0) {
         throw new \Bitrix\Main\ArgumentNullException("hostname");
     }
     if (strlen($roleId) <= 0) {
         throw new \Bitrix\Main\ArgumentNullException("roleId");
     }
     $role = RolesData::getRole($roleId);
     if (empty($role)) {
         throw new \Exception("Role with id = " . $roleId . " was not defined.");
     }
     if (!isset($role["LOADBAR_INFO"]) || strlen($role["LOADBAR_INFO"]) <= 0) {
         throw new \Exception("Role " . $roleId . " has no correctly defined LOADBAR_INFO param .");
     }
     $rrdFile = str_replace('##HOSTNAME##', $hostname, $role["LOADBAR_INFO"]);
     $rrdPath = "/var/lib/munin/" . $hostname . "/" . $rrdFile;
     $file = new \Bitrix\Main\IO\File($rrdPath);
     if (!$file->isExists()) {
         throw new \Bitrix\Main\IO\FileNotFoundException($rrdPath);
     }
     $data = \rrd_lastupdate($rrdPath);
     $result = static::extractRrdValue($data);
     return $result;
 }
Esempio n. 2
0
 public static function getGraphCategories($hostname)
 {
     $result = array();
     $roles = static::getServerRoles($hostname);
     foreach ($roles as $roleId => $role) {
         $result = array_merge($result, \Bitrix\Scale\RolesData::getGraphsCategories($roleId));
     }
     return $result;
 }
Esempio n. 3
0
BX.message["<?php 
        echo $langMesId;
        ?>
"] ="<?php 
        echo \CUtil::JSEscape(Loc::getMessage($langMesId));
        ?>
"; <?php 
    }
    ?>

			BX.Scale.actionsCollection = new BX.Scale.Collection(BX.Scale.Action, <?php 
    echo CUtil::PhpToJSObject(Bitrix\Scale\ActionsData::getList(true));
    ?>
);
			BX.Scale.rolesList = <?php 
    echo CUtil::PhpToJSObject(\Bitrix\Scale\RolesData::getList());
    ?>
;
			BX.Scale.sitesList = <?php 
    echo CUtil::PhpToJSObject(\Bitrix\Scale\SitesData::getList());
    ?>
;
			BX.Scale.monitoringEnabled = <?php 
    echo Bitrix\Scale\Monitoring::isEnabled() ? "true" : "false";
    ?>
;
			BX.Scale.monitoringCategories = {};
			BX.Scale.isMonitoringDbCreated = {};

			<?php 
    foreach ($serversList as $hostname => $server) {