linux:serverstats_howto
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revisionLast revision | |||
— | linux:serverstats_howto [2018/04/17 09:07] – dodger | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== [HOWTO] Serverstats ====== | ||
+ | ====== Descripción ====== | ||
+ | Como poner a trabajar la herramienta [[http:// | ||
+ | |||
+ | |||
+ | ====== Plugins adicionales ====== | ||
+ | ===== diskinfo ===== | ||
+ | He modificado el plugin ya que tenía alguna función deprecated en php y fallaba al situar los parámetros devueltos por "'' | ||
+ | ==== Instalación ==== | ||
+ | * Copiar el php del plugin a '' | ||
+ | * Editar el fichero '' | ||
+ | <code php> | ||
+ | * Editar el fichero '' | ||
+ | * Para una gráfica porcentual: | ||
+ | <code php> | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | array( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ) | ||
+ | ) | ||
+ | ); | ||
+ | </ | ||
+ | * Para una gráfica con datos reales: | ||
+ | <code php> | ||
+ | $config[' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | array( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ), | ||
+ | array( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ) | ||
+ | ) | ||
+ | ); | ||
+ | </ | ||
+ | |||
+ | |||
+ | graph.php | ||
+ | simple.php | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==== Codigo ==== | ||
+ | <file php diskinfo.php> | ||
+ | <?php | ||
+ | /** | ||
+ | * | ||
+ | * Author: Jannis Leidel, jl@concetto.net | ||
+ | * Modified by: dodger, dodger@ciberterminal.net | ||
+ | * Project: Serverstats, | ||
+ | * License: GPL v2 or later (http:// | ||
+ | * | ||
+ | * Copyright (C) 2006 Jannis Leidel | ||
+ | * | ||
+ | * This program is free software; you can redistribute it and/or modify | ||
+ | * it under the terms of the GNU General Public License as published by | ||
+ | * the Free Software Foundation; either version 2 of the License, or | ||
+ | * (at your option) any later version. | ||
+ | * | ||
+ | * This program is distributed in the hope that it will be useful, | ||
+ | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
+ | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
+ | * GNU General Public License for more details. | ||
+ | * | ||
+ | * You should have received a copy of the GNU General Public License | ||
+ | * along with this program; if not, write to the Free Software | ||
+ | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 | ||
+ | */ | ||
+ | |||
+ | class diskinfo extends source implements source_rrd | ||
+ | { | ||
+ | private $disk; | ||
+ | private $freespace; | ||
+ | private $usedspace; | ||
+ | private $percentage; | ||
+ | private $availablespace; | ||
+ | |||
+ | public function __construct($disk = '/ | ||
+ | { | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | public function refreshData() | ||
+ | { | ||
+ | $return = 0; | ||
+ | $datarows = array(); | ||
+ | exec(" | ||
+ | // exec(" | ||
+ | if ($return !== 0) | ||
+ | { | ||
+ | throw new Exception(' | ||
+ | } | ||
+ | $cmdoutput = implode(' | ||
+ | $parts = explode("::", | ||
+ | foreach ($parts as $key => $part) { | ||
+ | // | ||
+ | $parts[$key] = preg_replace(' | ||
+ | // printf(" | ||
+ | } | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | public function initRRD(rrd $rrd) | ||
+ | { | ||
+ | $rrd-> | ||
+ | $rrd-> | ||
+ | $rrd-> | ||
+ | $rrd-> | ||
+ | } | ||
+ | |||
+ | public function fetchValues() | ||
+ | { | ||
+ | $values = array(); | ||
+ | $values[' | ||
+ | $values[' | ||
+ | $values[' | ||
+ | $values[' | ||
+ | return $values; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ?> | ||
+ | |||
+ | </ |
linux/serverstats_howto.txt · Last modified: 2022/02/11 11:36 by 127.0.0.1