Permalink
Browse files

Fixing some stuff, adding INSTALL file

  • Loading branch information...
Cyril Feraudet
Cyril Feraudet committed Feb 28, 2012
1 parent 0d840c5 commit 58d4343bfd2b6903e1b2f93ab505dce9405964ee
Showing with 703 additions and 81 deletions.
  1. +339 −0 COPYING
  2. +16 −0 INSTALL
  3. +11 −0 README
  4. +1 −0 admin
  5. +6 −11 bin/peuplator
  6. +1 −1 core/json_tree.php
  7. +0 −32 core/ocsinfo.php
  8. +6 −6 core/serverslist.php
  9. +15 −0 etc/config.php
  10. BIN img/bnplogo.png
  11. +306 −0 install/create.sql
  12. +0 −29 tpl/ocsinfo.html
  13. +2 −2 tpl/rrdlist.html
View
339 COPYING

Large diffs are not rendered by default.

Oops, something went wrong.
View
16 INSTALL
@@ -0,0 +1,16 @@
+
+- git clone git://github.com/feraudet/perfwatcher.git
+- cd perfwatcher
+- Be sure having a MySQL server > 5.1.38 installed
+- cat install/create.sql | mysql -u <your mysql user> -p
+- modify etc/config.php to overide etc/config.default.php :
+ - adjust db setting
+ - adjust $rrds_path
+- Make sure PHP >= 5.3 is compiled with rrd > 1.4 support
+- Make sure PHP in command line is installed in /usr/bin/php
+- run ./bin/peuplator and check for error
+- put in cron * * * * * /<path to perfwatcher>/bin/peuplator
+- run ./bin/peuplator and check for error
+- put in cron * * * * * /<path to perfwatcher>/bin/peuplator
+- install rrdcached and make sure socket is : /var/run/rrdcached/rrdcached.sock
+-
View
11 README
@@ -0,0 +1,11 @@
+ perfwatcher - Performance Monitoring
+======================================
+http://perfwatcher.org
+
+About
+-----
+
+ perfwatcher is a frontend for collectd witch show you graph and
+ aggregate data over several host
+
+
View
1 admin
View
@@ -21,7 +21,7 @@ if (isset($argv[1])) {
$jstree = new json_tree();
-$list = file($serverlisturl);
+/*$list = file($serverlisturl);
list(, $list[0]) = split('<br>', $list[0], 2);
foreach($list as $key => $val) {
$list[$key] = str_replace('<br>', '', $val);
@@ -31,10 +31,11 @@ if (count($list) < 1000) {
if ($debug) { echo "List < 1000 entry \n"; }
die('No enough entry in gprime');
}
+*/
foreach ($jstree->get_containers() as $container) {
$datas = $jstree->get_datas($container['id']);
$serverlist = array();
- // Gprime
+ /* Gprime
if (isset($datas['serverslist']) && isset($datas['serverslist']['gprimeregex']) && trim($datas['serverslist']['gprimeregex']) != '') {
if ($debug) { echo "Processing ".$container['title']."(".$container['id'].") for Gprime list\n"; }
foreach($list as $key => $val) {
@@ -45,7 +46,7 @@ foreach ($jstree->get_containers() as $container) {
if ( $server != '') { $serverlist[] = $server; }
}
}
- }
+ }*/
// Servername
if (isset($datas['serverslist']) && isset($datas['serverslist']['servernameregex']) && trim($datas['serverslist']['servernameregex']) != '') {
if ($debug) { echo "Processing ".$container['title']."(".$container['id'].") for server list\n"; }
@@ -56,7 +57,7 @@ foreach ($jstree->get_containers() as $container) {
}
closedir($dh);
}
- // Switch name
+ /* Switch name
if (isset($datas['serverslist']) && isset($datas['serverslist']['switchregex']) && trim($datas['serverslist']['switchregex']) != '') {
if ($debug) { echo "Processing ".$container['title']."(".$container['id'].") for server list\n"; }
if ($fp = fopen('/var/www/html/phpcollectd/tmp/netlist.txt', 'r')) {
@@ -70,7 +71,7 @@ foreach ($jstree->get_containers() as $container) {
fclose($fp);
}
- }
+ }*/
// Manual list
if (isset($datas['serverslist']) && isset($datas['serverslist']['manuallist']) && trim($datas['serverslist']['manuallist']) != '') {
if ($debug) { echo "Processing ".$container['title']."(".$container['id'].") for server list\n"; }
@@ -106,25 +107,19 @@ foreach ($jstree->get_containers() as $container) {
) {
$childrens = $jstree->_get_children($container['id']);
$childrenslist = array();
- $invalidatecache = false;
foreach($childrens as $children) {
if ($children['type'] != 'default') { continue; }
if (!in_array($children['title'], $serverlist)) {
if ($debug) { echo "Removing child ".$children['title']."(".$children['id'].") from ".$container['title']."(".$container['id'].")"."\n"; }
$jstree->_remove($children['id']);
- $invalidatecache = true;
} else { $childrenslist[] = $children['title']; }
}
foreach($serverlist as $server) {
if (!in_array($server, $childrenslist)) {
$jstree->add_node($container['id'], $server);
if ($debug) { echo "Adding child $server to ".$container['title']."(".$container['id'].")"."\n"; }
- $invalidatecache = true;
}
}
- if($invalidatecache && file_exists('/var/lib/collectd/_cache/aggregator_'.$container['id'].'/pluginslist.dat')) {
- unlink('/var/lib/collectd/_cache/aggregator_'.$container['id'].'/pluginslist.dat');
- }
}
}
View
@@ -28,7 +28,7 @@
case "remove_node":
case "rename_node":
case "move_node":
- if(!ereg("/admin/", $_SERVER["REQUEST_URI"]) || !is_numeric($_SERVER["PHP_AUTH_USER"])) { die(); }
+// if(!ereg("/admin/", $_SERVER["REQUEST_URI"]) || !is_numeric($_SERVER["PHP_AUTH_USER"])) { die(); }
break;
case "get_children":
case "search":
View
@@ -1,32 +0,0 @@
-<?php
-/**
- *
- * PHP version 5
- *
- * LICENSE: 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 3 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. See the
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * @category Monitoring
- * @author Cyril Feraudet <cyril@feraudet.com>
- * @copyright 2011 Cyril Feraudet
- * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
- * @link http://www.perfwatcher.org/
- */
-
-if (!isset($_GET['server'])) { die("No server specified !\n"); }
-$oscdb = new _database;
-$oscdb->settings = array_merge($oscdb->settings, $ocsdb_config);
-if (!$oscdb->connect()) { die("Can't connect to OCS database\n"); }
-$oscdb->query("SELECT * FROM hardware WHERE NAME LIKE '".$oscdb->escape($_GET['server'])."'");
-$oscdb->nextr();
-$tpl->assign('ocs',$oscdb->get_row('assoc'));
-$oscdb->destroy();
-?>
View
@@ -22,7 +22,7 @@
*/
switch ($_POST['action']) {
- case 'gprimetest':
+/* case 'gprimetest':
$list = file($serverlisturl);
$i=0;
foreach($list as $line) {
@@ -49,7 +49,7 @@
if (!isset($datas['serverslist'])) { $datas['serverslist'] = array(); }
$datas['serverslist']['gprimeregex'] = $_POST['gprimeregex'];
$jstree->set_datas($_GET['id'], $datas);
- break;
+ break;*/
case 'servernametest':
$dh = opendir($rrds_path);
while ($hostdir = readdir($dh)) {
@@ -62,15 +62,15 @@
closedir($dh);
break;
case 'servernamesave':
- if(!ereg("/admin/", $_SERVER["REQUEST_URI"]) || !is_numeric($_SERVER["PHP_AUTH_USER"])) { die(); }
+ //if(!ereg("/admin/", $_SERVER["REQUEST_URI"]) || !is_numeric($_SERVER["PHP_AUTH_USER"])) { die(); }
echo "Regex saved";
$jstree = new json_tree();
$datas = $jstree->get_datas($_GET['id']);
if (!isset($datas['serverslist'])) { $datas['serverslist'] = array(); }
$datas['serverslist']['servernameregex'] = $_POST['servernameregex'];
$jstree->set_datas($_GET['id'], $datas);
break;
- case 'switchtest':
+/* case 'switchtest':
echo "#hostname;switchportname<br/><br/>";
echo "2000 First results<br/><br/>";
$i = 0;
@@ -93,9 +93,9 @@
if (!isset($datas['serverslist'])) { $datas['serverslist'] = array(); }
$datas['serverslist']['switchregex'] = $_POST['switchregex'];
$jstree->set_datas($_GET['id'], $datas);
- break;
+ break;*/
case 'manuallistsave':
- if(!ereg("/admin/", $_SERVER["REQUEST_URI"]) || !is_numeric($_SERVER["PHP_AUTH_USER"])) { die(); }
+ //if(!ereg("/admin/", $_SERVER["REQUEST_URI"]) || !is_numeric($_SERVER["PHP_AUTH_USER"])) { die(); }
echo "Manual list saved";
$jstree = new json_tree();
$datas = $jstree->get_datas($_GET['id']);
View
@@ -1,3 +1,18 @@
<?php
+$db_config = array(
+ "servername"=> "localhost",
+ "username" => "root",
+ "password" => "FPSllsker",
+ "database" => "jsTree2"
+);
+
+$collectd_db_config = array(
+ 'phptype' => 'mysql',
+ "hostspec"=> "localhost",
+ "username" => "root",
+ "password" => "FPSllsker",
+ "database" => "collectd"
+);
+
?>
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit 58d4343

Please sign in to comment.