blob: 5172ef01c12f6815c3e3f453ce3032427450d4e4 [file] [log] [blame]
<?php
/*******************************************************************************
* Copyright (c) 2013 Eclipse Foundation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Denis Roy (Eclipse Foundation)- initial API and implementation
*******************************************************************************/
$_DATE = $_GET['date'];
$_HOUR = $_GET['hour'];
$_TXKBPS = $_GET['TXKBPS'];
$_RXKBPS = $_GET['RXKBPS'];
$_HOSTNAME = $_GET['hostname'];
$_L1 = $_GET['l1'];
$_L2 = $_GET['l2'];
$_L3 = $_GET['l3'];
$_HTTPCONN = $_GET['httpconn'];
$_RSYNCCONN = $_GET['rsyncconn'];
$_PSERVERCONN = $_GET['pserverconn'];
$error = "";
$valid = array("dev1", "dev2", "dev3", "egit", "ecf", "cdt", "mylyn", "ajdt", "birt", "foundation", "emft", "asterisk", "dsdp", "corona", "rap", "higgins", "cdo", "scanserv", "epf", "babel", "xmpp", "torrent", "orion", "orionhub", "maven2", "repo", "news", "m2m", "polarsys", "gyrex", "lts1", "puppet", "recommenders", "scada", "sonar", "stardust", "locationtech", "rtsc");
if(!in_array($_HOSTNAME, $valid)) {
echo "aborting on $_HOSTNAME"; exit;
}
$file = fopen("/home/data/common/monitor/bandwdthavg/" . $_HOSTNAME, "w");
if(!$file) {
$error .= "Error opening Bandwidth file.\n";
}
else {
fwrite($file, $_DATE . " " . $_HOUR . " " . $_RXKBPS . " " . $_TXKBPS);
fclose($file);
}
if($_L1 != "") {
$file = fopen("/home/data/common/monitor/loadavg/" . $_HOSTNAME, "w");
if(!$file) {
$error .= "Error opening Load file.\n";
}
else {
fwrite($file, $_L1 . " " . $_L2 . " " . $_L3);
fclose($file);
}
}
if($_HTTPCONN != "") {
$file = fopen("/home/data/common/monitor/apache2/" . $_HOSTNAME, "w");
if(!$file) {
$error .= "Error opening Apache file.\n";
}
else {
fwrite($file, $_HTTPCONN);
fclose($file);
}
}
if($_RSYNCCONN != "") {
$file = fopen("/home/data/common/monitor/rsyncd/" . $_HOSTNAME, "w");
if(!$file) {
$error .= "Error opening RSYNC file.\n";
}
else {
fwrite($file, $_RSYNCCONN);
fclose($file);
}
}
if($_PSERVERCONN != "") {
$file = fopen("/home/data/common/monitor/pserver/" . $_HOSTNAME, "w");
if(!$file) {
$error .= "Error opening PSERVER file.\n";
}
else {
fwrite($file, $_PSERVERCONN);
fclose($file);
}
}
if($error != "") {
echo $error;
exit($error);
}
?>