Commit cc813853 authored by 's avatar

Files moved to another repository


git-svn-id: file:///home/svn/mapi/trunk@1436 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent dee85e94
CC = gcc
CFLAGS = -g -O2 -W -Wall
LDFLAGS = -lmapi -lcurses -lrrd
BINS_PACKETLOSS = packetloss
CFLAGS_APPMON = -g -W -Wall -Wshadow -Wcast-align -Wpointer-arith
LDFLAGS_APPMON = -lmapi -lrrd -lcgic
BINS_APPMON = appmon appform.cgi
all: $(BINS_PACKETLOSS) $(BINS_APPMON)
.PHONY: clean run
# packetloss
packetloss: packetloss.o pl_conf.o pl_misc.o
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
packetloss.o: packetloss.c cgi_headers_packetloss.h pl_conf.h pl_misc.h
$(CC) $(CFLAGS) -c -o $@ $<
pl_conf.o: pl_conf.c pl_conf.h pl_misc.h
$(CC) $(CFLAGS) -c -o $@ $<
pl_misc.o: pl_misc.c pl_misc.h
$(CC) $(CFLAGS) -c -o $@ $<
# appmon
appmon: appmon.o util.o anon_prefix_preserving.o
$(CC) $(CFLAGS_APPMON) $^ -o $@ $(LDFLAGS_APPMON)
appform.cgi: appform.o util.o
$(CC) $(CFLAGS_APPMON) $^ -o $@ $(LDFLAGS_APPMON)
appmon.o: ../appmon/appmon.c cgi_headers.h
$(CC) $(CFLAGS_APPMON) -c ../appmon/appmon.c -o $@ -include cgi_headers.h
util.o: ../appmon/util.c
$(CC) $(CFLAGS_APPMON) -c $^ -o $@
anon_prefix_preserving.o: ../appmon/anon_prefix_preserving.c
$(CC) $(CFLAGS_APPMON) -c $^ -o $@
appform.o: ../appmon/appform.c
$(CC) $(CFLAGS_APPMON) -c $^ -o $@
clean:
@echo 'Cleaning up ...'
rm -rf $(BINS_PACKETLOSS) $(BINS_APPMON) appmon_top.html appmon_top_private.html appmon.cgi packetcount.cgi packetloss.cgi *.log *.o
OVERVIEW
--------
Packet loss occurs when correctly transmitted packets from a source never arrive at the
intended destination. Packets are usually lost due to congestion, e.g., at the
queue of some router, routing problems, or poor network conditions that may
result to datagram damages.
Packet loss application is a novel real-time, end-to-end packet loss estimation method
based on distributed passive network monitoring. This application does not add any overhead
to the network since it passively monitors the network traffic without injecting any probe packets.
At the same time, it estimates almost in real-time the actual packet loss faced by
the active applications. Moreover, it offers the capability for measuring the
loss rates of particular Grid services, allowing for fine-grained per-application
packet loss estimation, which is important in case different applications on the
same path face different degrees of packet loss.
(for more details see : http://dcs.ics.forth.gr/Activities/papers/loss-estimation.coregrid.2006.pdf)
PREREQUISITES
-------------
+ MAPI should have been configured with the flags
--enable-dimapi , --enable-extraflib and --enable-trackflib (need for appmon application),
enabled for the required functions to be included.
+ Packet loss requires a web server and rrdtool version 1.2 or higher (need for appmon application)
(in Debian, apt-get install apache rrdtool)
+ Packet loss requires librrd, libncurses and libcgi (need for appmon application)
(in Debian, apt-get install librrd2-dev libcgicg1-dev)
COMPILATION
-----------
+ Compile packet loss using 'make' (executable files packetloss and appmon will be generated)
Server Configuration
--------------------
- You should configure your webserver to allow cgi script execution.
For Apache, just edit /etc/apache/httpd.conf (or /usr/local/apache/conf/httpd.conf)
and, uncomment the following:
AddHandler cgi-script .cgi
- Also you should define the cgi-bin directory where the server can find the
cgi executables. Simply add:
ScriptAlias /packetloss/cgi-bin/ /var/www/packetloss/cgi-bin/
into the virtual host entry of your apache configuration file.
Web Directory Initialization
----------------------------
- Run the script setupdirs.sh to set up the necessary files in your web
server's root directory. It takes as parameter the absolute path of the
web server's root directory. The script will create a directory packetloss
and all the necessary files and symbolic links for the web interface.
For example :
If you are using the root folder and the root folder is /var/www, then $WEB_DIR=/var/www.
If you are using the user home directories which may are /home/username/public_html then
$WEB_DIR=/home/username/public_html
./setupdirs.sh $WEB_DIR
will create '$WEB_DIR/packetloss', and the web interface will be accessible
at http://www.yourserver.com/packetloss/
Specifically, for the above paths, setupdirs.sh will create:
$WEB_DIR/packetloss/cgi-bin
$WEB_DIR/packetloss/img/lobster-logo.jpg
$WEB_DIR/packetloss/index.html
$WEB_DIR/packetloss/packetloss_top.html -> /home/username/mapi/trunk/applications/packetloss/packetloss_top.html
$WEB_DIR/packetloss/cgi-bin/packetloss.cgi -> /home/username/mapi/trunk/applications/packetloss/packetloss.cgi
$WEB_DIR/packetloss/cgi-bin/packetloss3.cgi -> /home/username/mapi/trunk/applications/packetloss/packetloss3.cgi
$WEB_DIR/packetloss/cgi-bin/packetloss24.cgi -> /home/username/mapi/trunk/applications/packetloss/packetloss24.cgi
$WEB_DIR/packetloss/cgi-bin/packetlossWeek.cgi -> /home/username/mapi/trunk/applications/packetloss/packetlossWeek.cgi
$WEB_DIR/packetloss/cgi-bin/packetlossMonth.cgi -> /home/username/mapi/trunk/applications/packetloss/packetlossMonth.cgi
$WEB_DIR/packetloss/cgi-bin/packetlossYear.cgi -> /home/username/mapi/trunk/applications/packetloss/packetlossYear.cgi
$WEB_DIR/packetloss/cgi-bin/packetcount.cgi -> /home/username/mapi/trunk/applications/packetloss/packetcount.cgi
$WEB_DIR/packetloss/cgi-bin/packetcount3.cgi -> /home/username/mapi/trunk/applications/packetloss/packetcount3.cgi
$WEB_DIR/packetloss/cgi-bin/packetcount24.cgi -> /home/username/mapi/trunk/applications/packetloss/packetcount24.cgi
$WEB_DIR/packetloss/cgi-bin/packetcountWeek.cgi -> /home/username/mapi/trunk/applications/packetloss/packetcountWeek.cgi
$WEB_DIR/packetloss/cgi-bin/packetcountMonth.cgi -> /home/username/mapi/trunk/applications/packetloss/packetcountMonth.cgi
$WEB_DIR/packetloss/cgi-bin/packetcountYear.cgi -> /home/username/mapi/trunk/applications/packetloss/packetcountYear.cgi
$WEB_DIR/packetloss/cgi-bin/appmon.cgi -> /home/username/mapi/trunk/applications/packetloss/appmon.cgi
$WEB_DIR/packetloss/cgi-bin/appmon3.cgi -> /home/username/mapi/trunk/applications/packetloss/appmon3.cgi
$WEB_DIR/packetloss/cgi-bin/appmon24.cgi -> /home/username/mapi/trunk/applications/packetloss/appmon24.cgi
$WEB_DIR/packetloss/cgi-bin/appmonWeek.cgi -> /home/username/mapi/trunk/applications/packetloss/appmonWeek.cgi
$WEB_DIR/packetloss/cgi-bin/appmonMonth.cgi -> /home/username/mapi/trunk/applications/packetloss/appmonMonth.cgi
$WEB_DIR/packetloss/cgi-bin/appmonYear.cgi -> /home/username/mapi/trunk/applications/packetloss/appmonYear.cgi
(We assume that mapi has been installed in /home/username/mapi/ directory)
USAGE
-----
- mapid and mapicommd should be running at the two monitoring sensors (see 'trunk/doc/mapitutor.pdf' for details)
- packet loss takes three arguments: the IP address of each monitoring sensor concatenated with it's interface (e.g eth0) and a pcap filter.
Let's see the following scenario:
We want to measure the packet loss between monitoring sensors with IP addresses 139.91.70.38 and 139.91.70.173
Their monitoring interface is eth0.
packetloss should be invoked as: ./packetloss 139.91.70.38:eth0 139.91.70.173:eth0 "host 139.91.70.38 and host 139.91.70.173"
- In order to provide tha figure of appmon application, we must execute this application between the two monitoring sensors.
appmon should be invoked as: ./appmon -V -s 139.91.70.38:eth0 -u 139.91.70.173 "139.91.70.38"
appmon executable file exists in directory /home/username/mapi/trunk/applications/packetloss/
- If packetloss runs on workstation.ics.forth.gr, then the web interface will be accessible at http://workstation.ics.forth.gr/packetloss/
#ifndef __CGI_HEADERS_H__
#define __CGI_HEADERS_H__
#define BASENAME "appmon"
#define RRD_FILENAME BASENAME".rrd"
#define CGI_FILENAME BASENAME".cgi"
#define FORM_FILENAME BASENAME"_form.html"
#define TOP_FILENAME BASENAME"_top.html"
#define PTOP_FILENAME BASENAME"_top_private.html"
static char cgiHead[] = "\
#!/usr/bin/rrdcgi\n\
<HTML>\n<HEAD>\n\
<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n\
<META Http-Equiv=\"Expires\" Content=\"10\">\n\
<META Http-Equiv=\"Refresh\" Content=\"10;url=./appmon.cgi\">\n\
<style type=\"text/css\">\n\
div.invisible {visibility:hidden}\n\
</style>\n\
<script language=\"JavaScript\">\n\
<!--var time = null\n\
function move() {\n\
parent.appmon.location = '"CGI_FILENAME"';\n\
} //-->\n\
</script>\n\
</HEAD>\n<BODY vlink=\"blue\">\n<div class=\"invisible\">";
static char cgiHead2[] = "\
</div>\n<center><table><tr><td valign=\"top\">\n\
<table align=\"left\">\n\
<tr><td><div class=\"invisible\"><a href=\"packetcount.cgi\">Packet Loss Count</a></div></td></tr>\n\
<tr><td><a href=\"appmon.cgi\">1 hour</a></td></tr>\n\
<tr><td><a href=\"appmon3.cgi\">3 hour</a></td></tr>\n\
<tr><td><a href=\"appmon24.cgi\">1 day</a></td></tr>\n\
<tr><td><a href=\"appmonWeek.cgi\">1 week</a></td></tr>\n\
<tr><td><a href=\"appmonMonth.cgi\">1 month</a></td></tr>\n\
<tr><td><a href=\"appmonYear.cgi\">1 year</a></td></tr>\n\
</table></td><td align=\"right\">\n\
<RRD::GRAPH\n";
#define IMAGE_NAME "../%s \n %s "
#define RRD_ATRS "--width 500 --height 300\n\--imginfo '<IMG SRC=../%s WIDTH=%lu HEIGHT=%lu>'\n"
#define cgiHead3 "--end now --start end-%s --lazy\n\ --slope-mode --interlaced --vertical-label \"outbound Mbit/s inbound\"\n"
#endif
#ifndef __PACKETLOSS_HEADERS_H__
#define __PACKETLOSS_HEADERS_H__
#define BASENAME "packetloss"
#define RRD_FILENAME BASENAME".rrd"
#define RRD_FILENAME_PACKETS BASENAME"_packets.rrd"
#define CGI_FILENAME BASENAME".cgi"
#define CGI_PACKETCOUNT_FILENAME "packetcount.cgi"
#define TOP_FILENAME BASENAME"_top.html" // right frame
#define TOP_FILENAME_CSV BASENAME"_status.csv"
static char cgi_head[] = "\
#!/usr/bin/rrdcgi\n\
<HTML>\n<HEAD>\n\
<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n\
<META Http-Equiv=\"Expires\" Content=\"10\">\n\
<META Http-Equiv=\"Refresh\" Content=\"10;url=";
static char cgi_head2[] = "\
<script language=\"JavaScript\">\n\
<!--var time = null\n\
function move() {\n\
parent.packetloss.location = ";
static char cgi_head3[] = "\
} //-->\n</script>\n</HEAD>\n<BODY vlink=\"blue\">\n<center>\n\
<table><tr><td valign=\"middle\" align=\"left\">\n\
<table align=\"left\">\n\
<tr><td><a href=\"packetcount.cgi\">Packet Loss Count</a></td></tr>\n\
<tr><td><br></td></tr>\n\
<tr><td><a href=\"packetloss.cgi\">1 hour</a></td></tr>\n\
<tr><td><a href=\"packetloss3.cgi\">3 hour</a></td></tr>\n\
<tr><td><a href=\"packetloss24.cgi\">1 day</a></td></tr>\n\
<tr><td><a href=\"packetlossWeek.cgi\">1 week</a></td></tr>\n\
<tr><td><a href=\"packetlossMonth.cgi\">1 month</a></td></tr>\n\
<tr><td><a href=\"packetlossYear.cgi\">1 year</a></td></tr>\n\
</table></td><td align=\"right\">\n\
<RRD::GRAPH\n";
static char cgi_pkcount_head[] = "\
#!/usr/bin/rrdcgi\n\
<HTML>\n<HEAD>\n\
<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n\
<META Http-Equiv=\"Expires\" Content=\"10\">\n\
<META Http-Equiv=\"Refresh\" Content=\"10;url=";
static char cgi_pkcount_head2[] = "\
<script language=\"JavaScript\">\n\
<!--var time = null\n\
function move() {\n\
parent.packetcount.location = ";
static char cgi_pkcount_head3[] = "\
} //-->\n</script>\n</HEAD>\n<BODY vlink=\"blue\">\n<center>\n\
<table><tr><td valign=\"middle\" align=\"left\">\n\
<table align=\"left\">\n\
<tr><td><a href=\"packetloss.cgi\">Packet Loss Ratio</a></td></tr>\n\
<tr><td><br></td></tr>\n\
<tr><td><a href=\"packetcount.cgi\">1 hour</a></td></tr>\n\
<tr><td><a href=\"packetcount3.cgi\">3 hour</a></td></tr>\n\
<tr><td><a href=\"packetcount24.cgi\">1 day</a></td></tr>\n\
<tr><td><a href=\"packetcountWeek.cgi\">1 week</a></td></tr>\n\
<tr><td><a href=\"packetcountMonth.cgi\">1 month</a></td></tr>\n\
<tr><td><a href=\"packetcountYear.cgi\">1 year</a></td></tr>\n\
</table></td><td align=\"right\">\n\
<RRD::GRAPH\n";
#define IMAGE_NAME "../%s \n %s "
#define RRD_ATRS "--width 500 --height 300 \n --imginfo '<IMG SRC=../%s WIDTH=%lu HEIGHT=%lu>'\n"
#define cgi_head4 "--end now --start end-%s --lazy \n --slope-mode --interlaced --vertical-label \"Packet Loss Ratio (%%)\"\n"
#define cgi_pkcount_head4 "--end now --start end-%s --lazy \n --slope-mode --interlaced --vertical-label \"Lost Packets\"\n"
// not a cgi header. Need in packetloss GUI (right frame)
static char top_page[] = "\
<html>\n<head>\n\
<script language=\"JavaScript\">\
function toggleDisplay(me,hnr){\
if (parent.hiddenFrame.hidden[hnr]==1){\
parent.hiddenFrame.hidden[hnr]=0;\
me.style.display=\"inline\";\
}\
else {\
if (parent.hiddenFrame.hidden[hnr]==0){\
parent.hiddenFrame.hidden[hnr]=1;\
me.style.display=\"none\";\
}\
}\
}\
function setdisplay(me, hnr) {\
if( parent.hiddenFrame.hidden[hnr] == 1 )\
me.style.display=\"none\";\
else\
me.style.display=\"inline\";\
}\
function appendmydiv(idname, htmltext, hnr) {\
var newhtml = document.createElement(\"div\");\
newhtml.id = idname;\
if( parent.hiddenFrame.hidden[hnr] == 1)\
newhtml.style.display = 'none';\
else\
newhtml.style.display = 'inline';\
newhtml.innerHTML = htmltext;\
var prtable = document.getElementById('protocolstable');\
document.body.insertBefore(newhtml, prtable);\
}\
var sensorstatshtml=\"%s\";\
var sensorsstatslink=\"%s\";\
</script>\
<style type=\"text/css\">\n\
<!--\
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}\n\
.style6 {color: #000000}\n\
.style7 {color: #CCCCCC}\n\
.style8 {color: #00CC00}\n\
.style9 {font-size: 15}\n\
-->\
</style>\n\
<META Http-Equiv=\"Cache-Control\" Content=\"no-cache\">\n\
<META Http-Equiv=\"Pragma\" Content=\"no-cache\">\n\
<META Http-Equiv=\"Expires\" Content=\"0\">\n\
<META Http-Equiv=\"Refresh\" Content=\"10;url=./%s\">\
</head>\n<body onload='appendmydiv(\"sensorsstatslink\",sensorsstatslink,0), appendmydiv(\"sensorstats\",sensorstatshtml,1)'>\n\
<div class=style9 id='bigdiv'>\n\
<table><tr><td width=25%% align=\"center\">\n\
<a href=\"http://www.ist-lobster.org\" style=\"color: white\" target=_new title=\"Large-scale Monitoring of Broadband Internet Infrastructures\">\n\
<img src=\"/packetloss/img/lobster-logo.jpg\"></a></td></tr>\n\
<tr><td width=75%% align=\"center\"><i><b>Distributed Packet Loss Measurement</b></i></td></tr></table><hr>\n";
#endif
<html>
<script language="JavaScript">
var hidden = new Array(2);
hidden[0] = 0;
hidden[1] = 1;
</script>
<html>
<head>
<title>LOBSTER - Distributed PacketLoss</title>
</head>
<frameset cols="60%, 40%, *" framespacing="1" border="1">
<frameset rows="50%, 50%">
<frame src="cgi-bin/packetloss.cgi" name="packetloss">
<frame src="cgi-bin/appmon.cgi" name="appmon">
</frameset>
<frame src="./packetloss_top.html" name="top">
<frame name="hiddenFrame" id="hiddenFrame" src="./hidden.html">
</frameset>
</html>
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* File name: pl_conf.c
* Date: 2008/01/26
* Author: Ales Friedl
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "pl_misc.h"
#include "pl_conf.h"
#define BUFSIZE 1024
char *trim(char *s) {
char *start;
if(s == NULL) return s;
while(*s == ' ' && *s != '\0') s++; start = s;
while(*s != '\n' && *s != '\r' && *s != '\0') s++; *s = '\0';
while((*s == '\0' || *s == ' ') && s != start) *s-- = '\0';
return start;
}
struct pl_conf *pl_conf_load(char *filename) {
FILE *f;
char buf[BUFSIZE];
char *line;
char *tok;
struct pl_conf *pl_conf = NULL;
struct pl_conf *category = NULL;
struct pl_conf *parameter = NULL;
if((f = fopen(filename, "r")) != NULL) {
// pl_conf
pl_conf = (struct pl_conf *) getmem(sizeof(struct pl_conf));
pl_conf->name = strdup(filename);
pl_conf->value = calloc(1, sizeof(char));
pl_conf->item = NULL;
pl_conf->next = NULL;
// category
pl_conf->item = (struct pl_conf *) getmem(sizeof(struct pl_conf));
category = pl_conf->item;
category->name = strdup("none");
category->value = calloc(1, sizeof(char));
category->item = NULL;
category->next = NULL;
parameter = category;
while(fgets(buf, BUFSIZE, f) != NULL) {
line = trim((char *) buf);
if(*line == '[') {
tok = strchr(++line, ']');
if(tok != NULL) { *tok = '\0'; tok++; }
category->next = (struct pl_conf *) getmem(sizeof(struct pl_conf));
category = category->next;
category->name = strdup(trim(line));
category->value = calloc(1, sizeof(char));
category->item = NULL;
category->next = NULL;
parameter = category;
}
else if(*line != ';' && *line != '#' && *line != '\0') {
tok = strchr(line, '=');
if(tok != NULL) { *tok = '\0'; tok++; } else { tok = calloc(1, sizeof(char));};
if(parameter == category) {
category->item = (struct pl_conf *) getmem(sizeof(struct pl_conf));
parameter = category->item;
}
else {
parameter->next = (struct pl_conf *) getmem(sizeof(struct pl_conf));
parameter = parameter->next;
}
parameter->name = strdup(trim(line));
parameter->value = strdup(trim(tok));
parameter->item = NULL;
parameter->next = NULL;
}
}
fclose(f);
}
return pl_conf;
};
int pl_conf_categories(struct pl_conf *pl_conf, const char *name) {
struct pl_conf *category = pl_conf->item;
int categories = 0;
while(category != NULL) {
if(strcmp(category->name, name) == 0) categories++;
category = category->next;
}
return categories;
}
struct pl_conf *pl_conf_get_category(struct pl_conf *pl_conf, const char *name) {
struct pl_conf *category = pl_conf->item;
while(category != NULL) {
if(strcmp(category->name, name) == 0) return category;
else category = category->next;
}
return NULL;
}
struct pl_conf *pl_conf_get_next_category(struct pl_conf *category, const char *name) {
struct pl_conf *cat = category;
if(cat != NULL) cat = cat->next;
while(cat != NULL) {
if(strcmp(cat->name, name) == 0) return cat;
else cat = cat->next;
}
return NULL;
}
/*
int pl_conf_parameters(struct pl_conf *pl_conf, const char *name) {
struct pl_conf *parameter = pl_conf;
int parameters = 0;
while(parameter != NULL) {
//fprintf(stdout, "trying...: %s\n", parameter->name);
if(strcmp(parameter->name, name) == 0) parameters++;
parameter = parameter->next;
}
return parameters;
}
*/
struct pl_conf *pl_conf_get_parameter(struct pl_conf *category, const char *name) {
struct pl_conf *parameter = category->item;
while(parameter != NULL) {
if(strcmp(parameter->name, name) == 0) return parameter;
else parameter = parameter->next;
}
return NULL;
}
struct pl_conf *pl_conf_get_next_parameter(struct pl_conf *parameter, const char *name) {
struct pl_conf *param = parameter;
if(param != NULL) param = param->next;
while(param != NULL) {
if(strcmp(param->name, name) == 0) return param;
else param = param->next;
}
return NULL;
}
void pl_conf_unload(struct pl_conf *pl_conf) {
struct pl_conf *category = pl_conf->item;
struct pl_conf *parameter;
while(category != NULL) {
parameter = category->item;
while(parameter != NULL) {
free(parameter->name);
free(parameter->value);
parameter = parameter->next;
}
free(category->name);
free(category->value);
category = category->next;
}
}
/* vim: set foldmethod=marker foldmarker=\ {{{,\ }}} foldclose= foldcolumn=0 : */
/*
* File name: pl_conf.h
* Date: 2008/01/26
* Author: Ales Friedl
*/
#ifndef __APP_CONF_H__
#define __APP_CONF_H__
struct pl_conf {
char *name;
char *value;
struct pl_conf *item;
struct pl_conf *next;
};
struct pl_conf *pl_conf_load(char *filename);
int pl_conf_categories(struct pl_conf *pl_conf, const char *name);
struct pl_conf *pl_conf_get_category(struct pl_conf *pl_conf, const char *name);
struct pl_conf *pl_conf_get_next_category(struct pl_conf *category, const char *name);
int pl_conf_parameters(struct pl_conf *pl_conf, const char *name);
struct pl_conf *pl_conf_get_parameter(struct pl_conf *pl_conf, const char *name);
struct pl_conf *pl_conf_get_next_parameter(struct pl_conf *parameter, const char *name);
void pl_conf_unload(struct pl_conf *pl_conf);
#endif
/* vim: set foldmethod=marker foldmarker=\ {{{,\ }}} foldclose= foldcolumn=0 : */
/*
* File name: pl_misc.c
* Date: 2008/01/27
* Author: Ales Friedl
*/
#include <stdio.h>
#include "pl_misc.h"
void *getmem(size_t size) {
void *mem;
if((mem = (void *) malloc (size)) == NULL) perror("malloc");
return mem;
}
void *getcmem(size_t nmemb, size_t size) {
void *mem;
if((mem = (void *) calloc (nmemb, size)) == NULL) perror("calloc");
return mem;
}
/* vim: set foldmethod=marker foldmarker=\ {{{,\ }}} foldclose= foldcolumn=0 : */
/*
* File name: pl_misc.h
* Date: 2008/01/27
* Author: Ales Friedl
*/
#ifndef __APP_MISC_H__
#define __APP_MISC_H__
#include <stdlib.h>
void *getmem(size_t size);
void *getcmem(size_t nmemb, size_t size);
#endif
/* vim: set foldmethod=marker foldmarker=\ {{{,\ }}} foldclose= foldcolumn=0 : */
#!/bin/sh
if [ $# -ne 1 ]; then
echo 1>&2 "Usage: $0 <path to web server's root directory (e.g. /var/www)>"
exit 1
fi
mkdir $1/packetloss
mkdir $1/packetloss/cgi-bin
mkdir $1/packetloss/img
chmod 777 $1/packetloss
chmod +rx $1/packetloss/img
cp `pwd`/lobster-logo.jpg $1/packetloss/img/lobster-logo.jpg
chmod +x $1/packetloss/img/lobster-logo.jpg
cp index.html $1/packetloss
ln -fs `pwd`/packetloss_top.html $1/packetloss/packetloss_top.html
ln -fs `pwd`/hidden.html $1/packetloss/hidden.html
ln -fs `pwd`/led-green.gif $1/packetloss/led-green.gif
ln -fs `pwd`/led-red.gif $1/packetloss/led-red.gif
ln -fs `pwd`/packetloss.cgi $1/packetloss/cgi-bin/packetloss.cgi
ln -fs `pwd`/packetloss3.cgi $1/packetloss/cgi-bin/packetloss3.cgi
ln -fs `pwd`/packetloss24.cgi $1/packetloss/cgi-bin/packetloss24.cgi
ln -fs `pwd`/packetlossWeek.cgi $1/packetloss/cgi-bin/packetlossWeek.cgi
ln -fs `pwd`/packetlossMonth.cgi $1/packetloss/cgi-bin/packetlossMonth.cgi
ln -fs `pwd`/packetlossYear.cgi $1/packetloss/cgi-bin/packetlossYear.cgi
ln -fs `pwd`/packetcount.cgi $1/packetloss/cgi-bin/packetcount.cgi
ln -fs `pwd`/packetcount3.cgi $1/packetloss/cgi-bin/packetcount3.cgi
ln -fs `pwd`/packetcount24.cgi $1/packetloss/cgi-bin/packetcount24.cgi
ln -fs `pwd`/packetcountWeek.cgi $1/packetloss/cgi-bin/packetcountWeek.cgi
ln -fs `pwd`/packetcountMonth.cgi $1/packetloss/cgi-bin/packetcountMonth.cgi
ln -fs `pwd`/packetcountYear.cgi $1/packetloss/cgi-bin/packetcountYear.cgi
ln -fs `pwd`/appmon.cgi $1/packetloss/cgi-bin/appmon.cgi
ln -fs `pwd`/appmon3.cgi $1/packetloss/cgi-bin/appmon3.cgi
ln -fs `pwd`/appmon24.cgi $1/packetloss/cgi-bin/appmon24.cgi
ln -fs `pwd`/appmonWeek.cgi $1/packetloss/cgi-bin/appmonWeek.cgi
ln -fs `pwd`/appmonMonth.cgi $1/packetloss/cgi-bin/appmonMonth.cgi
ln -fs `pwd`/appmonYear.cgi $1/packetloss/cgi-bin/appmonYear.cgi
echo -e "\nDONE - created the following files in $1/packetloss\n"
ls -Rl $1/packetloss
echo -e "\nDon't forget to enable script execution for $1/packetloss/cgi-bin in your web server's configuration"
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment