From 2cb4585ea18dd667b79c6c8c9377ea8574517026 Mon Sep 17 00:00:00 2001
From: Manuel Kasper
Date: Wed, 12 Mar 2014 13:45:30 +0100
Subject: [PATCH] Merge pull request #22
manually fixed merge conflict
---
contrib/centos/as-stats | 3 +-
disableSeLinux.sh | 3 ++
installAS-Stats.sh | 50 +++++++++++++++++
tools/add_ds.sh | 2 +-
www/asset.php | 24 +++++++--
www/config.inc | 2 +
www/gengraph.php | 7 ++-
www/headermenu.inc | 45 ++++++++++++++++
www/history.php | 49 ++++++++++++-----
www/linkgraph.php | 7 ++-
www/linkusage.php | 10 ++--
www/style.css | 15 +++++-
www/top.php | 9 ++--
www/top12.php | 116 ++++++++++++++++++++++++++++++++++++++++
www/top4.php | 116 ++++++++++++++++++++++++++++++++++++++++
15 files changed, 425 insertions(+), 33 deletions(-)
create mode 100644 disableSeLinux.sh
create mode 100644 installAS-Stats.sh
create mode 100644 www/headermenu.inc
create mode 100644 www/top12.php
create mode 100644 www/top4.php
diff --git a/contrib/centos/as-stats b/contrib/centos/as-stats
index bab4b28..b39cfa3 100755
--- a/contrib/centos/as-stats
+++ b/contrib/centos/as-stats
@@ -20,7 +20,7 @@ start() {
echo -n $"Starting $prog: "
# start daemon
- daemon /data/as-stats/bin/$DAEMON $RRDDIR $KNOWNLINKS >> /data/as-stats/output.log &
+ daemon /data/as-stats/bin/$DAEMON -r $RRDDIR -k $KNOWNLINKS -p 9000 -a 0 -P 0 >> /data/as-stats/output.log &
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/as-stats
@@ -77,4 +77,3 @@ case "$1" in
esac
exit $RETVAL
-
diff --git a/disableSeLinux.sh b/disableSeLinux.sh
new file mode 100644
index 0000000..65b31f2
--- /dev/null
+++ b/disableSeLinux.sh
@@ -0,0 +1,3 @@
+sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
+yum update –y
+reboot
diff --git a/installAS-Stats.sh b/installAS-Stats.sh
new file mode 100644
index 0000000..afdabc2
--- /dev/null
+++ b/installAS-Stats.sh
@@ -0,0 +1,50 @@
+yum install -y httpd httpd-devel php php-gd phpimap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mcrypt curl curl-devel perl-libwwwperl libxml2 php-mbstring rrdtool perl-rrdtool
+yum install -y jwhois
+service iptables stop
+service iptables status
+chkconfig iptables off
+
+mkdir /data
+cd /data
+git clone git://github.com/datatecuk/AS-Stats
+mv /data/AS-Stats/ /data/as-stats
+mkdir /data/as-stats/rrd
+chmod 0777 /data/as-stats/rrd
+mkdir /data/as-stats/www/asset
+chmod 0777 /data/as-stats/www/asset
+cp /data/as-stats/contrib/centos/as-stats /etc/rc.d/init.d/as-stats
+chmod 0755 /etc/rc.d/init.d/as-stats
+chmod 0777 /data/as-stats/bin/asstatd.pl
+chmod 0777 /data/as-stats/bin/rrd-extractstats.pl
+cp /data/as-stats/tools/add_ds.sh /data/as-stats/rrd/add_ds.sh
+chmod 0777 /data/as-stats/rrd/add_ds.sh
+
+echo "Alias /as-stats /data/as-stats/www
+
+ DirectoryIndex index.php
+ Options -Indexes
+ AllowOverride all
+ order allow,deny
+ allow from all
+ AddType application/x-httpd-php .php
+ php_flag magic_quotes_gpc on
+ php_flag track_vars on
+
+" > /etc/httpd/conf.d/as-stats.conf
+
+echo "
+
+
+
+
+
+
+" > /var/www/html/index.html
+
+echo "*/5 * * * * root perl /data/as-stats/bin/rrd-extractstats.pl /data/as-stats/rrd /data/as-stats/conf/knownlinks /data/as-stats/asstats_day.txt > /dev/null 2>&1
+" > /etc/cron.d/as-stats
+
+chkconfig httpd on
+service httpd start
+chkconfig as-stats on
+service as-stats start
diff --git a/tools/add_ds.sh b/tools/add_ds.sh
index cb5a58c..e8bfb7f 100755
--- a/tools/add_ds.sh
+++ b/tools/add_ds.sh
@@ -11,7 +11,7 @@ for i in $A ; do
for f in *.rrd; do
echo "file: $f"
mv $f $f.old
- rrdtool dump $f.old | /path/to/add_ds_proc.pl | rrdtool restore - $f.new
+ rrdtool dump $f.old | /data/as-stats/tools/add_ds_proc.pl | rrdtool restore - $f.new
mv $f.new $f
rm -f $f.old
done
diff --git a/www/asset.php b/www/asset.php
index 608af52..c9cee46 100644
--- a/www/asset.php
+++ b/www/asset.php
@@ -35,10 +35,23 @@ if ( $action == "clearall" ) {
-
+
-History for AS-SET:
+History for AS-SET:
+
+
+
+
View history for an AS-SET
@@ -107,7 +120,12 @@ if ( $action == "clearall" ) {
$rrdfile = getRRDFileForAS($as);
if (file_exists($rrdfile)): ?>
-
+
+
" width="581" height="204" border="0" />
+
" width="581" height="204" border="0" />
+
+
" width="581" height="204" border="0" />
+
No data found for AS
diff --git a/www/config.inc b/www/config.inc
index 115bba4..ce91ac6 100644
--- a/www/config.inc
+++ b/www/config.inc
@@ -13,6 +13,8 @@ $show95th = true;
$ntop = 20;
$showv6 = true;
+$showtitledetail = true;
+$hidelinkusagename = true; # $showtitledetail will need to be true to allow this
$whois = "/usr/bin/whois";
$assetpath = "asset";
diff --git a/www/gengraph.php b/www/gengraph.php
index 24d7402..5df1d78 100644
--- a/www/gengraph.php
+++ b/www/gengraph.php
@@ -35,8 +35,11 @@ if($outispositive)
else
$cmd .= "--vertical-label '<- OUT | IN ->' ";
-if (isset($_GET['v']) && is_numeric($_GET['v']))
- $cmd .= "--title IPv" . $_GET['v'] . " ";
+if($showtitledetail && $_GET['dname'] != "")
+ $cmd .= "--title " . str_replace(' ','\ ',rawurldecode($_GET['dname'])) . " ";
+else
+ if (isset($_GET['v']) && is_numeric($_GET['v']))
+ $cmd .= "--title IPv" . $_GET['v'] . " ";
if (isset($_GET['nolegend']))
$cmd .= "--no-legend ";
diff --git a/www/headermenu.inc b/www/headermenu.inc
new file mode 100644
index 0000000..79d716e
--- /dev/null
+++ b/www/headermenu.inc
@@ -0,0 +1,45 @@
+Top AS | Top AS | 4 Hour | 4 Hour | 12 Hour | 12 Hour | View an AS | View an AS | View an AS-SET | View an AS-SET | Link usageLink usage
diff --git a/www/history.php b/www/history.php
index 31022c7..a85bcae 100644
--- a/www/history.php
+++ b/www/history.php
@@ -28,44 +28,65 @@ $rrdfile = getRRDFileForAS($as);
-
+
-History for AS:
+
No data found for AS
+4 Hourly
+
+
" alt="weekly graph" />
+
" alt="weekly graph" />
+
+
" alt="weekly graph" />
+
+
Daily
-
-
+
" alt="daily graph" />
+
" alt="daily graph" />
-
+
" alt="daily graph" />
Weekly
-
-
+
" alt="weekly graph" />
+
" alt="weekly graph" />
-
+
" alt="weekly graph" />
Monthly
-
-
+
" alt="monthly graph" />
+
" alt="monthly graph" />
-
+
" alt="monthly graph" />
Yearly
-
-
+
" alt="yearly graph" />
+
" alt="yearly graph" />
-
+
" alt="yearly graph" />
diff --git a/www/linkgraph.php b/www/linkgraph.php
index 510da85..2ba7337 100644
--- a/www/linkgraph.php
+++ b/www/linkgraph.php
@@ -71,8 +71,11 @@ $cmd = "$rrdtool graph - " .
"--slope-mode --alt-autoscale -u 0 -l 0 --imgformat=PNG --base=1000 --height=$height --width=$width " .
"--color BACK#ffffff00 --color SHADEA#ffffff00 --color SHADEB#ffffff00 ";
-if (isset($_GET['v']) && is_numeric($_GET['v']))
- $cmd .= "--title IPv" . $_GET['v'] . " ";
+if($showtitledetail && $_GET['dname'] != "")
+ $cmd .= "--title " . str_replace(' ','\ ',rawurldecode($_GET['dname'])) . " ";
+else
+ if (isset($_GET['v']) && is_numeric($_GET['v']))
+ $cmd .= "--title IPv" . $_GET['v'] . " ";
/* geneate RRD DEFs */
foreach ($topas as $as => $traffic) {
diff --git a/www/linkusage.php b/www/linkusage.php
index a5c0ecc..1f96105 100644
--- a/www/linkusage.php
+++ b/www/linkusage.php
@@ -22,7 +22,7 @@ $knownlinks = getknownlinks();
-
+
Link usage - top 10 AS per link
@@ -31,17 +31,19 @@ $knownlinks = getknownlinks();
$class = (($i % 2) == 0) ? "even" : "odd";
?>
+
|
+
-
-
+ " width="581" height="499" border="0" />
+ " width="581" height="499" border="0" />
-
+ " width="581" height="481" border="0" />
|
diff --git a/www/style.css b/www/style.css
index 6e7040b..6c49e64 100644
--- a/www/style.css
+++ b/www/style.css
@@ -113,7 +113,15 @@ div#legend {
#nav a, #nav a:visited {
text-decoration: none;
font-weight: bold;
- color: #0000ee;
+ font-size: 1.15em;
+ color: #0066CC;
+}
+
+#nav a.selected:link, #nav a.selected:visited {
+ font-size: 1.15em;
+ text-decoration: none;
+ font-weight: bold;
+ color: #000000;
}
#nav a:hover {
@@ -130,3 +138,8 @@ div#legend {
.customlinks a {
font-size: 0.85em;
}
+
+.customlinks a, .customlinks a:visited {
+ text-decoration: none;
+ color: #0066CC;
+}
diff --git a/www/top.php b/www/top.php
index a210ad6..e600786 100644
--- a/www/top.php
+++ b/www/top.php
@@ -32,7 +32,8 @@ $topas = getasstats_top($ntop);
Number of AS:
-Top AS | View an AS | View an AS-SET | Link usage
+
+
Top AS
@@ -80,10 +81,10 @@ echo join(" | ", $htmllinks);
-
-
+ " width="581" height="207" border="0" />
+ " width="581" height="207" border="0" />
-
+ " width="581" height="189" border="0" />
|
diff --git a/www/top12.php b/www/top12.php
new file mode 100644
index 0000000..b23e592
--- /dev/null
+++ b/www/top12.php
@@ -0,0 +1,116 @@
+ 200)
+ $ntop = 200;
+
+$topas = getasstats_top($ntop);
+
+?>
+
+
+
+
+
+ Top AS
+
+
+
+
+
+
+
+
+Top AS
+
+
+
+
+
+";
+
+ echo "";
+ echo " | ";
+ echo " | ";
+ echo " ";
+
+ echo " | " . $link['descr'] . " | \n";
+}
+?>
+
+
+
+
+
+
+
diff --git a/www/top4.php b/www/top4.php
new file mode 100644
index 0000000..a196471
--- /dev/null
+++ b/www/top4.php
@@ -0,0 +1,116 @@
+ 200)
+ $ntop = 200;
+
+$topas = getasstats_top($ntop);
+
+?>
+
+
+
+
+
+ Top AS
+
+
+
+
+
+
+
+
+Top AS
+
+
+
+
+
+";
+
+ echo "";
+ echo " | ";
+ echo " | ";
+ echo " ";
+
+ echo " | " . $link['descr'] . " | \n";
+}
+?>
+
+
+
+
+
+
+