コード例 #1
0
ファイル: SmartInfo.php プロジェクト: bergware/dynamix-v6.1
    if (isset($disk['smPort3']) && strlen($disk['smPort3'])) $ports[] = $disk['smPort3'];
    if ($ports) {
      $glue = isset($disk['smGlue']) ? $disk['smGlue'] : ',';
      $type .= ','.implode($glue,$ports);
    }
  }
}
switch ($_POST['cmd']) {
case "attributes":
  require_once 'Wrappers.php';
  require_once 'Preselect.php';
  $select = isset($disk['smSelect']) ? $disk['smSelect'] : -1; if ($select==-1) $select = isset($var['smSelect']) ? $var['smSelect'] : 0;
  $level  = isset($disk['smLevel']) ? $disk['smLevel'] : -1; if ($level==-1) $level = isset($var['smLevel']) ? $var['smLevel'] : 1;
  $events = isset($disk['smEvents']) ? explode('|',$disk['smEvents']) : (isset($var['smEvents']) ? explode('|',$var['smEvents']) : $numbers);
  $temps = [190,194];
  $unraid = parse_plugin_cfg('dynamix',true);
  $max = $unraid['display']['max'];
  $hot = $unraid['display']['hot'];
  exec("smartctl -A $type /dev/$port|awk 'NR>7'",$output);
  $empty = true;
  foreach ($output as $line) {
    if (!$line) continue;
    $info = explode(' ', trim(preg_replace('/\s+/',' ',$line)), 10);
    $color = "";
    $highlight = strpos($info[8],'FAILING_NOW')!==false || ($select ? $info[5]>0 && $info[3]<=$info[5]*$level : $info[9]>0);
    if (in_array($info[0], $events) && $highlight) $color = " class='warn'";
    else if (in_array($info[0], $temps)) {
      if ($info[9]>=$max) $color = " class='alert'"; else if ($info[9]>=$hot) $color = " class='warn'";
    }
    if ($info[8]=='-') $info[8] = 'Never';
    if ($info[0]==9 && is_numeric($info[9])) duration($info[9]);
コード例 #2
0
ファイル: SmartInfo.php プロジェクト: roninkenji/dynamix
 * all copies or substantial portions of the Software.
 */
?>
<?
require_once('Wrappers.php');

function duration($h) {
  $y = intval($h/8760);
  return ' ('.($y?$y.'y, ':'').intval($h%8760/24).'d, '.($h%24).'h)';
}

$port = $_POST['port'];

switch ($_POST['cmd']) {
case "attributes":
  $unraid = parse_plugin_cfg("dynamix",true);
  $events = explode('|', $unraid['notify']['events']);
  $temps = array(190,194);
  $max = $unraid['display']['max'];
  $hot = $unraid['display']['hot'];
  exec("smartctl -A /dev/$port|awk 'NR>7'",$output);
  foreach ($output as $line) {
    if (!$line) continue;
    $info = explode(' ', trim(preg_replace('/\s+/',' ',$line)), 10);
    $color = "";
    if (array_search($info[0], $events)!==false && $info[9]>0) $color = " class='orange-text'";
    else if (array_search($info[0], $temps)!==false) {
      if ($info[9]>=$max) $color = " class='red-text'"; else if ($info[9]>=$hot) $color = " class='orange-text'";
    }
    echo "<tr{$color}>";
    if ($info[0] == 9 && is_numeric($info[9])) $info[9] .= duration($info[9]);
コード例 #3
0
ファイル: template.php プロジェクト: roninkenji/dynamix
require_once('include/PageBuilder.php');

// Extract the 'querystring'
// variables provided by emhttp:
//   path=<path>   page path, e.g., path=Main/Disk
//   prev=<path>   prev path, e.g., prev=Main (used to deterine if page was refreshed)
extract($_GET);

// Define some paths
$docroot = $_SERVER['DOCUMENT_ROOT'];

// The current "task" is the first element of the path
$task = strtok($path, '/');

// Get the webGui configuration preferences
extract(parse_plugin_cfg("dynamix",true));

// Read emhttp status
$var     = parse_ini_file('state/var.ini');
$sec     = parse_ini_file('state/sec.ini',true);
$devs    = parse_ini_file('state/devs.ini',true);
$disks   = parse_ini_file('state/disks.ini',true);
$users   = parse_ini_file('state/users.ini',true);
$shares  = parse_ini_file('state/shares.ini',true);
$sec_nfs = parse_ini_file('state/sec_nfs.ini',true);
$sec_afp = parse_ini_file('state/sec_afp.ini',true);

$site = array();
$base = 'dynamix';
// Build the webGui pages first
build_pages("$base/*.page");
コード例 #4
0
<?php

$cmdline_cfg = parse_plugin_cfg("cmdline");
$shellinabox_ipaddr = isset($cmdline_cfg['IPADDR']) ? $cmdline_cfg['IPADDR'] : "disable";
$shellinabox_host = $shellinabox_ipaddr == "disable" ? $var['NAME'] : $var['IPADDR'];
$shellinabox_port = isset($cmdline_cfg['PORT']) && is_numeric($cmdline_cfg['PORT']) && $cmdline_cfg['PORT'] > 0 && $cmdline_cfg['PORT'] < 65535 ? $cmdline_cfg['PORT'] : "4200";
$shellinabox_ssl = isset($cmdline_cfg['SSL']) ? $cmdline_cfg['SSL'] : "disable";
$shellinabox_running = trim(shell_exec("[ -f /proc/`cat /var/run/shellinaboxd.pid 2> /dev/null`/exe ] && echo 1 || echo 0 2> /dev/null"));
$status_running = "<span class='green'>Running</span>";
$status_stopped = "<span class='orange'>Stopped</span>";
$shellinabox_status = $shellinabox_running ? $status_running : $status_stopped;
$shellinabox_http = $shellinabox_ssl == "disable" ? "http" : "https";
コード例 #5
0
<?php

/* Copyright 2015, Bergware International.
 * Copyright 2015, Lime Technology
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 */
?>
<?
require_once 'Wrappers.php';

$dynamix = parse_plugin_cfg('dynamix',true);
if (strpos($_POST['log'],'*')===false) @unlink("{$dynamix['notify']['path']}/archive/{$_POST['log']}"); else array_map('unlink',glob("{$dynamix['notify']['path']}/archive/{$_POST['log']}",GLOB_NOSORT));
?>
コード例 #6
0
ファイル: parse_cfg.php プロジェクト: eschultz/unRAID-plugins
<?php

require_once "/usr/local/emhttp/webGui/include/Wrappers.php";
$speedtest_cfg = parse_plugin_cfg("speedtest");
$speedtest_filename = "/boot/config/plugins/speedtest/speedtest.xml";
$speedtest_secure = isset($speedtest_cfg['SECURE']) ? $speedtest_cfg['SECURE'] : "no";
$speedtest_share = isset($speedtest_cfg['SHARE']) ? $speedtest_cfg['SHARE'] : "share";
$speedtest_units = isset($speedtest_cfg['UNITS']) ? $speedtest_cfg['UNITS'] : "bits";
$speedtest_server = isset($speedtest_cfg['SERVER']) ? $speedtest_cfg['SERVER'] : "none";
$speedtest_list = isset($speedtest_cfg['LIST']) ? $speedtest_cfg['LIST'] : "auto";
if (!is_file($speedtest_filename)) {
    $xml = new SimpleXMLElement("<tests></tests>");
    $xml->asXML($speedtest_filename);
}
コード例 #7
0
ファイル: DeviceList.php プロジェクト: bergware/dynamix-v6.1
 * modify it under the terms of the GNU General Public License version 2,
 * as published by the Free Software Foundation.
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 */
?>
<?
require_once 'Helpers.php';

$path  = $_POST['path'];
$var   = parse_ini_file('state/var.ini');
$devs  = parse_ini_file('state/devs.ini',true);
$disks = parse_ini_file('state/disks.ini',true);
$sum   = ['count'=>0, 'temp'=>0, 'fsSize'=>0, 'fsUsed'=>0, 'fsFree'=>0, 'numReads'=>0, 'numWrites'=>0, 'numErrors'=>0];
extract(parse_plugin_cfg('dynamix',true));

require_once 'CustomMerge.php';

function in_parity_log($log,$timestamp) {
  if (file_exists($log)) {
    $handle = fopen($log, 'r');
    while (($line = fgets($handle)) !== false) {
      if (strpos($line,$timestamp)!==false) break;
    }
    fclose($handle);
  }
  return !empty($line);
}
function device_info(&$disk) {
  global $path, $var;