aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--configure.ac2
-rw-r--r--etc/Makefile.am2
-rw-r--r--etc/logfilter.awk40
-rw-r--r--etc/tagr.tmpl12
-rw-r--r--etc/upgrade.awk16
-rw-r--r--etc/uptmpl.sed2
-rw-r--r--gnulib.modules1
-rw-r--r--src/graph.c9
-rw-r--r--src/grid.c5
-rw-r--r--src/html.gram.y181
-rw-r--r--src/html.lex.l27
-rw-r--r--src/output.c27
-rw-r--r--src/tagr.h23
14 files changed, 253 insertions, 96 deletions
diff --git a/NEWS b/NEWS
index 2f75f6b..07ed6b8 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,7 @@ See the end for copying conditions.
4 4
5Please send tagr bug reports to <gray@gnu.org.ua> 5Please send tagr bug reports to <gray@gnu.org.ua>
6 6
7Version 1.0.95 (Git) 7Version 1.9.90 (Git)
8 8
9^L 9^L
10Version 1.0 10Version 1.0
diff --git a/configure.ac b/configure.ac
index 1d4673b..a622998 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@
16# along with this program. If not, see <http://www.gnu.org/licenses/>. 16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18AC_PREREQ(2.59) 18AC_PREREQ(2.59)
19AC_INIT([tagr], 1.0.95, [gray@gnu.org.ua]) 19AC_INIT([tagr], 1.9.90, [gray@gnu.org.ua])
20AC_CONFIG_SRCDIR([src/main.c]) 20AC_CONFIG_SRCDIR([src/main.c])
21AC_CONFIG_AUX_DIR([build-aux]) 21AC_CONFIG_AUX_DIR([build-aux])
22AC_CONFIG_HEADER([config.h]) 22AC_CONFIG_HEADER([config.h])
diff --git a/etc/Makefile.am b/etc/Makefile.am
index e9e5fcc..ccd72c9 100644
--- a/etc/Makefile.am
+++ b/etc/Makefile.am
@@ -1 +1 @@
EXTRA_DIST = tagr.css tagr.tmpl upgrade.awk EXTRA_DIST = tagr.css tagr.tmpl upgrade.awk logfilter.awk uptmpl.sed
diff --git a/etc/logfilter.awk b/etc/logfilter.awk
new file mode 100644
index 0000000..88e1d98
--- /dev/null
+++ b/etc/logfilter.awk
@@ -0,0 +1,40 @@
1# Format ipacct log file for input to tagr --read
2# Copyright (C) 2009 Sergey Poznyakoff
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17BEGIN {
18 month["Jan"] = 1
19 month["Feb"] = 2
20 month["Mar"] = 3
21 month["Apr"] = 4
22 month["May"] = 5
23 month["Jun"] = 6
24 month["Jul"] = 7
25 month["Aug"] = 8
26 month["Sep"] = 9
27 month["Oct"] = 10
28 month["Nov"] = 11
29 month["Dec"] = 12
30}
31
32# mktime input format is:
33# YYYY MM DD HH MM SS
34# Log entry format is:
35# Sat Apr 25 00:25:00 2009 pirx 199004 4238901
36# $1 $2 $3 $4 $5 $6 $7 $8
37NF == 8 {
38 gsub(/:/, " ", $4)
39 print $6, mktime($5 " " month[$2] " " $3 " " $4), $8, $7
40}
diff --git a/etc/tagr.tmpl b/etc/tagr.tmpl
index 0663f57..e5a198e 100644
--- a/etc/tagr.tmpl
+++ b/etc/tagr.tmpl
@@ -4,7 +4,7 @@
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5 5
6<head> 6<head>
7 <title>Traffic Analysis for $ROUTERNAME</title> 7 <title>Traffic Analysis for $(MONITOR)</title>
8 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 8 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
9 <link rev="made" href="mailto:gray@gnu.org.ua" /> 9 <link rev="made" href="mailto:gray@gnu.org.ua" />
10 <link rel="stylesheet" type="text/css" href="/~ipacct/ipacct.css" /> 10 <link rel="stylesheet" type="text/css" href="/~ipacct/ipacct.css" />
@@ -13,7 +13,7 @@
13</head> 13</head>
14 14
15<body> 15<body>
16<h1>Stats for $ROUTERNAME ($ROUTERIP)</h1> 16<h1>Stats for $MONITOR ($ID)</h1>
17<p> 17<p>
18<span class="emph">Speed on port is $(SPEED:0)</span> 18<span class="emph">Speed on port is $(SPEED:0)</span>
19</p> 19</p>
@@ -23,7 +23,7 @@ The statistics were last updated <b>$NOW</b>
23 23
24<div class="graph"> 24<div class="graph">
25<h3>`Daily' Graph (5 Minute Average)</h3> 25<h3>`Daily' Graph (5 Minute Average)</h3>
26<img src="$(ROUTERNAME)-day.png" alt="[ daily graph ]" /> 26<img src="$(MONITOR)-day.png" alt="[ daily graph ]" />
27<table class="graph"> 27<table class="graph">
28<tr> 28<tr>
29 <td>Max <span class="input">&nbsp;In:</span></td> 29 <td>Max <span class="input">&nbsp;In:</span></td>
@@ -50,7 +50,7 @@ The statistics were last updated <b>$NOW</b>
50 50
51<div class="graph"> 51<div class="graph">
52<h3>`Weekly' Graph (30 Minute Average)</h3> 52<h3>`Weekly' Graph (30 Minute Average)</h3>
53<img src="$(ROUTERNAME)-week.png" alt="[ weekly graph ]" /> 53<img src="$(MONITOR)-week.png" alt="[ weekly graph ]" />
54<table class="graph"> 54<table class="graph">
55<tr> 55<tr>
56 <td>Max <span class="input">&nbsp;In:</span></td> 56 <td>Max <span class="input">&nbsp;In:</span></td>
@@ -77,7 +77,7 @@ The statistics were last updated <b>$NOW</b>
77 77
78<div class="graph"> 78<div class="graph">
79<h3>`Monthly' Graph (2 Hour Average)</h3> 79<h3>`Monthly' Graph (2 Hour Average)</h3>
80<img src="$(ROUTERNAME)-month.png" alt="[ monthly graph ]" /> 80<img src="$(MONITOR)-month.png" alt="[ monthly graph ]" />
81<table class="graph"> 81<table class="graph">
82<tr> 82<tr>
83 <td>Max <span class="input">&nbsp;In:</span></td> 83 <td>Max <span class="input">&nbsp;In:</span></td>
@@ -104,7 +104,7 @@ The statistics were last updated <b>$NOW</b>
104 104
105<div class="graph"> 105<div class="graph">
106<h3>`Yearly' Graph (1 Day Average)</h3> 106<h3>`Yearly' Graph (1 Day Average)</h3>
107<img src="$(ROUTERNAME)-year.png" alt="[ yearly graph ]" /> 107<img src="$(MONITOR)-year.png" alt="[ yearly graph ]" />
108<table class="graph"> 108<table class="graph">
109<tr> 109<tr>
110 <td>Max <span class="input">&nbsp;In:</span></td> 110 <td>Max <span class="input">&nbsp;In:</span></td>
diff --git a/etc/upgrade.awk b/etc/upgrade.awk
index 0479609..2278758 100644
--- a/etc/upgrade.awk
+++ b/etc/upgrade.awk
@@ -1,3 +1,19 @@
1# Upgrade 1.0-style Tagr configuration file.
2# Copyright (C) 2009 Sergey Poznyakoff
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
1NF == 0 || /[ \t]*#/ { print; next } 17NF == 0 || /[ \t]*#/ { print; next }
2$1 == "user" || $1 == "template" || $1 == "basedir" { 18$1 == "user" || $1 == "template" || $1 == "basedir" {
3 printf("%s;\n", $0) 19 printf("%s;\n", $0)
diff --git a/etc/uptmpl.sed b/etc/uptmpl.sed
new file mode 100644
index 0000000..1229984
--- /dev/null
+++ b/etc/uptmpl.sed
@@ -0,0 +1,2 @@
1s/\$ROUTERNAME/$MONITOR/g
2s/\$ROUTERIP/$ID/g \ No newline at end of file
diff --git a/gnulib.modules b/gnulib.modules
index f7631e3..7eecc00 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -2,6 +2,7 @@
2# A module name per line. Empty lines and comments are ignored. 2# A module name per line. Empty lines and comments are ignored.
3 3
4argp 4argp
5fprintftime
5getline 6getline
6gitlog-to-changelog 7gitlog-to-changelog
7glob 8glob
diff --git a/src/graph.c b/src/graph.c
index 16483bb..bfd00cb 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -54,11 +54,7 @@ int graph_ysize = 100;
54int graph_h_margin[2] = { 100, 14 }; 54int graph_h_margin[2] = { 100, 14 };
55int graph_v_margin[2] = { 14, 35 }; 55int graph_v_margin[2] = { 14, 35 };
56 56
57char *rate_unit = "Bits per Second"; 57char *rate_unit = "Bytes per Second";
58
59static char *short_suffix[] = {"", "k", "M", "G", "T"};
60char **number_suffix = short_suffix;
61size_t number_suffix_count = sizeof (short_suffix) / sizeof (short_suffix[0]);
62 58
63#define make_color_index(g, ar) \ 59#define make_color_index(g, ar) \
64 gdImageColorAllocate (g, (ar)[0], (ar)[1], (ar)[2]) 60 gdImageColorAllocate (g, (ar)[0], (ar)[1], (ar)[2])
@@ -98,7 +94,8 @@ draw_graph (FILE *fp,
98 xscale = (double) graph_xsize / xmax; 94 xscale = (double) graph_xsize / xmax;
99 95
100#define ytr(y) \ 96#define ytr(y) \
101 (unsigned long) ((ymax >= (y) ? (ymax - (y)) : ymax) * yscale + graph_h_margin[1]) 97 (unsigned long) ((ymax >= (y) ? (ymax - (y)) : ymax) * \
98 yscale + graph_h_margin[1])
102#define xtr(x) \ 99#define xtr(x) \
103 (unsigned long) (growright ? \ 100 (unsigned long) (growright ? \
104 ((full_xsize - (x)*xscale)) : \ 101 ((full_xsize - (x)*xscale)) : \
diff --git a/src/grid.c b/src/grid.c
index f4a75e1..1671753 100644
--- a/src/grid.c
+++ b/src/grid.c
@@ -80,6 +80,11 @@ grid_free_data (void *ptr)
80} 80}
81 81
82 82
83/* FIXME: Suffixes not yet used. */
84static char *short_suffix[] = {"", "k", "M", "G", "T"};
85char **number_suffix = short_suffix;
86size_t number_suffix_count = sizeof (short_suffix) / sizeof (short_suffix[0]);
87
83struct ygrid_data 88struct ygrid_data
84{ 89{
85 unsigned long step; 90 unsigned long step;
diff --git a/src/html.gram.y b/src/html.gram.y
index bce5e93..fae64ff 100644
--- a/src/html.gram.y
+++ b/src/html.gram.y
@@ -36,6 +36,8 @@ static FILE *tmp_file;
36 36