blob: 54a4eb5402e170277a2f4cb62ab83581fd49a181 [file] [log] [blame]
<?php
/**
* Copyright (c) 2013, 2018 Eclipse Foundation and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* Denis Roy (Eclipse Foundation)- initial API and implementation
* Christopher Guindon (Eclipse Foundation)
*
* SPDX-License-Identifier: EPL-2.0
*/
$_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",
"dashboard_opensuse",
"foundation",
"emft",
"asterisk",
"dsdp",
"corona",
"rap",
"higgins",
"hippfedora",
"hippcentos",
"cdo",
"scanserv",
"epf",
"babel",
"xmpp",
"torrent",
"orion",
"orionhub",
"maven2",
"repo",
"news",
"m2m",
"polarsys",
"polarsys_dashboard",
"gyrex",
"lts1",
"puppet",
"recommenders",
"scada",
"science",
"sonar-vm1",
"stardust",
"locationtech",
"rtsc",
"varnish",
"varnish2"
);
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);
}