diff options
author | lwhsu <lwhsu@FreeBSD.org> | 2010-08-04 18:30:14 +0800 |
---|---|---|
committer | lwhsu <lwhsu@FreeBSD.org> | 2010-08-04 18:30:14 +0800 |
commit | c2589fd7c413e55cd41da2e55cdb763c1431dd5a (patch) | |
tree | 370e72e88ad1d90aa92c092f9193c926a1747ece /net/rtg | |
parent | a647eb50b7907e9630969ace1892eae94179bae4 (diff) | |
download | freebsd-ports-gnome-c2589fd7c413e55cd41da2e55cdb763c1431dd5a.tar.gz freebsd-ports-gnome-c2589fd7c413e55cd41da2e55cdb763c1431dd5a.tar.zst freebsd-ports-gnome-c2589fd7c413e55cd41da2e55cdb763c1431dd5a.zip |
- Use .sample for sample config so that upgrades dont overwrite
user-modified config files
- Added note to explain where/how to use rtgplot
- Added graph titles and friendly legend tags
- Modified rc script to load after mysql
PR: ports/148363
Submitted by: Daniel Austin MBCS <freebsd-ports AT dan.me.uk> (maintainer)
Diffstat (limited to 'net/rtg')
-rw-r--r-- | net/rtg/Makefile | 11 | ||||
-rw-r--r-- | net/rtg/files/patch-etc-Makefile.in | 22 | ||||
-rw-r--r-- | net/rtg/files/patch-etc-rtg.php | 41 | ||||
-rw-r--r-- | net/rtg/files/patch-etc-view.php | 40 | ||||
-rw-r--r-- | net/rtg/files/patch-man-rtgplot.1 | 43 | ||||
-rw-r--r-- | net/rtg/files/patch-man-rtgpoll.1 | 12 | ||||
-rw-r--r-- | net/rtg/files/patch-src-rtgplot.c | 74 | ||||
-rw-r--r-- | net/rtg/files/patch-src-rtgplot.h | 26 | ||||
-rw-r--r-- | net/rtg/files/rtgpoll.in | 4 | ||||
-rw-r--r-- | net/rtg/pkg-plist | 4 |
10 files changed, 268 insertions, 9 deletions
diff --git a/net/rtg/Makefile b/net/rtg/Makefile index 27eb83e6486e..dcf06af303f2 100644 --- a/net/rtg/Makefile +++ b/net/rtg/Makefile @@ -7,7 +7,7 @@ PORTNAME= rtg PORTVERSION= 0.7.4 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= net MASTER_SITES= SF @@ -27,7 +27,7 @@ CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc/${PORTNAME} \ .include <bsd.port.pre.mk> -.if ${OSVERSION} >= 800040 +.if ( ${OSVERSION} >= 800040 ) CFLAGS+= -fstack-protector LDFLAGS+= -fstack-protector .endif @@ -35,4 +35,11 @@ LDFLAGS+= -fstack-protector pre-configure: @${REINPLACE_CMD} -e 's,-pthread,${PTHREAD_LIBS},g' ${WRKSRC}/configure +post-patch: + @${MV} ${WRKSRC}/etc/rtg.conf ${WRKSRC}/etc/rtg.conf.sample + @${MV} ${WRKSRC}/etc/routers ${WRKSRC}/etc/routers.sample + +post-install: + @${ECHO} "To enable the web interface, copy ${PREFIX}/bin/rtgplot to your site cgi-bin as rtgplot.cgi" + .include <bsd.port.post.mk> diff --git a/net/rtg/files/patch-etc-Makefile.in b/net/rtg/files/patch-etc-Makefile.in index 70e6a26a9fd1..970d31eac6f5 100644 --- a/net/rtg/files/patch-etc-Makefile.in +++ b/net/rtg/files/patch-etc-Makefile.in @@ -1,6 +1,6 @@ ---- etc/Makefile.in.orig Thu Oct 2 09:59:32 2003 -+++ etc/Makefile.in Tue Jan 6 22:58:25 2004 -@@ -84,8 +84,8 @@ +--- etc/Makefile.in.orig 2003-10-02 16:59:32.000000000 +0100 ++++ etc/Makefile.in 2010-07-04 03:34:26.379748720 +0100 +@@ -84,19 +84,19 @@ install_sh = @install_sh@ top_builddir = .. @@ -10,7 +10,21 @@ +webdir = @webdir@ reportsdir = /bin - ETC = rtg.conf rtgtargmkr.pl routers createdb BER.pm \ +-ETC = rtg.conf rtgtargmkr.pl routers createdb BER.pm \ ++ETC = rtg.conf.sample rtgtargmkr.pl routers.sample createdb BER.pm \ + SNMP_Session.pm SNMP_util.pm + + WEB = rtg.php 95.php view.php common.php rtg.png rtgback.png + REPORTS = report.pl 95.pl + + EXTRA_DIST = rtgtargmkr.pl.in report.pl 95.pl createdb.in \ +- BER.pm SNMP_Session.pm SNMP_util.pm rtg.conf \ +- routers rtg.php 95.php view.php common.php.in rtg.png rtgback.png ++ BER.pm SNMP_Session.pm SNMP_util.pm rtg.conf.sample \ ++ routers.sample rtg.php 95.php view.php common.php.in rtg.png rtgback.png + + subdir = etc + mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs @@ -220,13 +220,13 @@ all: diff --git a/net/rtg/files/patch-etc-rtg.php b/net/rtg/files/patch-etc-rtg.php new file mode 100644 index 000000000000..1e9edaffb9ef --- /dev/null +++ b/net/rtg/files/patch-etc-rtg.php @@ -0,0 +1,41 @@ +--- etc/rtg.php.orig 2010-07-04 03:49:22.836351752 +0100 ++++ etc/rtg.php 2010-07-04 03:54:55.955519331 +0100 +@@ -171,6 +171,9 @@ + #} + #else { + $args = "t1=ifInOctets_$rid&t2=ifOutOctets_$rid&begin=$bt&end=$et&units=bits/s&factor=8"; ++ $args .= "&title=" . urlencode($selectRow->description); ++ $args .= "&t1_name=" . urlencode("Input Octets"); ++ $args .= "&t2_name=" . urlencode("Output Octets"); + foreach ($iid as $value) { + $args="$args&iid=$value"; + } +@@ -181,8 +184,11 @@ + if ($borderb) $args = "$args&borderb=$borderb"; + if ($aggr) $args = "$args&aggr=yes"; + if ($percentile) $args = "$args&percentile=$nth"; +- print "<IMG SRC=rtgplot.cgi?$args><BR>\n"; ++ print "<IMG SRC=/cgi-bin/rtgplot.cgi?$args><BR>\n"; + $args = "t1=ifInUcastPkts_$rid&t2=ifOutUcastPkts_$rid&begin=$bt&end=$et&units=pkts/s"; ++ $args .= "&title=" . urlencode($selectRow->description); ++ $args .= "&t1_name=" . urlencode("Input Packets"); ++ $args .= "&t2_name=" . urlencode("Output Packets"); + foreach ($iid as $value) { + $args="$args&iid=$value"; + } +@@ -192,9 +198,13 @@ + if ($borderb) $args = "$args&borderb=$borderb"; + if ($aggr) $args = "$args&aggr=yes"; + if ($percentile) $args = "$args&percentile=$nth"; +- print "<IMG SRC=rtgplot.cgi?$args><BR>\n"; ++ print "<IMG SRC=/cgi-bin/rtgplot.cgi?$args><BR>\n"; + if ($errors) +- print "<IMG SRC=rtgplot.cgi?t1=ifInErrors_$rid&begin=$bt&end=$et&units=errors&impulses=yes>\n"; ++ { ++ print "<IMG SRC=/cgi-bin/rtgplot.cgi?t1=ifInErrors_$rid&begin=$bt&end=$et&units=errors&impulses=yes"; ++ print "&title=" . urlencode($selectRow->description); ++ print "&t1_name=" . urlencode("Errors") . ">\n"; ++ } + # } + } + diff --git a/net/rtg/files/patch-etc-view.php b/net/rtg/files/patch-etc-view.php new file mode 100644 index 000000000000..b7f99bff3e25 --- /dev/null +++ b/net/rtg/files/patch-etc-view.php @@ -0,0 +1,40 @@ +--- etc/view.php.orig 2010-07-04 03:55:12.757175355 +0100 ++++ etc/view.php 2010-07-04 03:59:40.479683639 +0100 +@@ -95,19 +95,22 @@ + + $bt = $et - (60*60*24); + print "<B>Day View:</B><BR>\n"; +- print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n"; ++ print "<IMG SRC=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes"; ++ print "&title=" . urlencode("$router: $name ($description)") . "&t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets") . "\">\n"; + print "<BR><B>$router: $name ($description)</B>\n"; + print "<BR><HR>\n"; + + $bt = $et - (60*60*24*7); + print "<B>Week View:</B><BR>\n"; +- print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n"; ++ print "<IMG SRC=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes"; ++ print "&title=" . urlencode("$router: $name ($description)") . "&t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets") . "\">\n"; + print "<BR><B>$router: $name ($description)</B>\n"; + print "<BR><HR>\n"; + + $bt = $et - (60*60*24*30); + print "<B>Month View:</B><BR>\n"; +- print "<IMG SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\">\n"; ++ print "<IMG SRC=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes"; ++ print "&title=" . urlencode("$router: $name ($description)") . "&t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets") . "\">\n"; + print "<BR><B>$router: $name ($description)</B>\n"; + print "<BR><BR>\n"; + } +@@ -134,7 +137,10 @@ + $desc[$selectRow->id] = $selectRow->description; + $iid = $selectRow->id; + print "<TD><A HREF=\"$PHP_SELF?rid=$rid&iid=$iid\">\n"; +- print "<IMG HEIGHT=\"135\" WIDTH=\"500\" SRC=\"rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid."&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\" BORDER=\"0\">\n"; ++ print "<IMG HEIGHT=\"135\" WIDTH=\"500\" SRC=\"/cgi-bin/rtgplot.cgi?t1=ifInOctets_".$rid."&t2=ifOutOctets_".$rid; ++ print "&title=" . urlencode("$router: " . $selectRow->name . " (" . $selectRow->description . ")"); ++ print "&t1_name=" . urlencode("Input Octets") . "&t2_name=" . urlencode("Output Octets"); ++ print "&iid=$iid&begin=$bt&end=$et&units=bits/s&factor=8&filled=yes\" BORDER=\"0\">\n"; + print "</A><BR>\n"; + print "<B>$selectRow->name ($selectRow->description)</B>\n"; + if ($even) { diff --git a/net/rtg/files/patch-man-rtgplot.1 b/net/rtg/files/patch-man-rtgplot.1 new file mode 100644 index 000000000000..bc7c82204893 --- /dev/null +++ b/net/rtg/files/patch-man-rtgplot.1 @@ -0,0 +1,43 @@ +--- man/rtgplot.1.orig 2010-04-21 09:04:22.473988200 +0100 ++++ man/rtgplot.1 2010-04-21 09:08:22.862400825 +0100 +@@ -10,7 +10,8 @@ + -t tablename(s) -i interface(s) [options] begin end + .br + .B rtgplot.cgi +-?t1=tablename &t2=tablename &iid=interface &begin=unixtime &end=unixtime &[options] ++?t1=tablename &t`_name=descname &t2=tablename &t2_name=descname &iid=interface ++&begin=unixtime &end=unixtime &[options] + .SH DESCRIPTION + .I rtgplot + generates traffic plots of RTG data in PNG format. It operates in +@@ -82,14 +83,19 @@ + Set plot bottom border to + .RI <size> + pixels. ++.TP ++.IR "title=<title>" ++Set graph title to ++.RI <title> + .PP + .SH "EXAMPLES" + .PP + .br + Example HTML IMG TAG: + .PP +-<IMG SRC="rtgplot.cgi? t1=ifInOctets_2& t2=ifOutOctets_2& iid=4& +-begin=1046754000& end=1046840399& units=bits/s& factor=8& scalex=yes"> ++<IMG SRC="rtgplot.cgi? t1=ifInOctets_2& t1_name=Input& t2=ifOutOctets_2& ++t2_name=Output& iid=4& begin=1046754000& end=1046840399& units=bits/s& ++factor=8& scalex=yes& title=Bandwidth+Graph"> + .PP + will plot two lines from the MySQL tables ifInOctets_2 and ifOutOctets_2 + corresponding to interface 4 on router 2 for the time span 1046754000 to +@@ -97,6 +103,8 @@ + second; the units argument is displayed as the Y-axis label on the plot. + The scalex argument auto-adjusts the X time axis according to the available + data samples rather than according to the actual time span given. ++It will have a graph title of "Bandwidth Graph" and legend tags of "Input" ++and "Output" for t1 and t2 respectively. + .PP + Draw a 95th percentile line: + .PP diff --git a/net/rtg/files/patch-man-rtgpoll.1 b/net/rtg/files/patch-man-rtgpoll.1 new file mode 100644 index 000000000000..d3c466ec4114 --- /dev/null +++ b/net/rtg/files/patch-man-rtgpoll.1 @@ -0,0 +1,12 @@ +--- man/rtgpoll.1.orig 2010-07-04 03:46:36.586762545 +0100 ++++ man/rtgpoll.1 2010-07-04 03:48:19.872644629 +0100 +@@ -31,6 +31,9 @@ + .IR "\-m" + Skip checking for multiple instances. + .TP ++.IR "\-p file" ++PID file. Process ID file. ++.TP + .IR "\-z" + Force database insertion of zero deltas. + .TP diff --git a/net/rtg/files/patch-src-rtgplot.c b/net/rtg/files/patch-src-rtgplot.c new file mode 100644 index 000000000000..791d81967f37 --- /dev/null +++ b/net/rtg/files/patch-src-rtgplot.c @@ -0,0 +1,74 @@ +--- src/rtgplot.c.orig 2003-10-02 16:27:52.000000000 +0100 ++++ src/rtgplot.c 2010-07-04 03:45:21.927295776 +0100 +@@ -221,7 +221,10 @@ + plot_line(data[i][j], &img, &graph, colors->shade, TRUE); + else + plot_line(data[i][j], &img, &graph, colors->shade, FALSE); +- snprintf(intname, sizeof(intname), "%s%d", arguments.table[i], arguments.iid[j]); ++ if (arguments.tablename[i]) ++ snprintf(intname, sizeof(intname), "%s", arguments.tablename[i]); ++ else ++ snprintf(intname, sizeof(intname), "%s%d", arguments.table[i], arguments.iid[j]); + plot_legend(&img, rate[i][j], &graph, colors->shade, intname, offset); + offset++; + } +@@ -629,15 +632,15 @@ + if (set.verbose >= HIGH) + fprintf(dfp, "Plotting legend (%s).\n", __FUNCTION__); + +- gdImageFilledRectangle(*img, BORDER_L, ++ gdImageFilledRectangle(*img, BORDER_L - 10, + BORDER_T + graph->image.yplot_area + 37 + 10 * offset, +- BORDER_L + 7, BORDER_T + graph->image.yplot_area + 44 + 10 * offset, color); +- gdImageRectangle(*img, BORDER_L, BORDER_T + graph->image.yplot_area + 37 + 10 * offset, +- BORDER_L + 7, BORDER_T + graph->image.yplot_area + 44 + 10 * offset, ++ BORDER_L - 3, BORDER_T + graph->image.yplot_area + 44 + 10 * offset, color); ++ gdImageRectangle(*img, BORDER_L - 10, BORDER_T + graph->image.yplot_area + 37 + 10 * offset, ++ BORDER_L - 3, BORDER_T + graph->image.yplot_area + 44 + 10 * offset, + std_colors[black]); + +- if (strlen(interface) > 17) { +- interface[17] = '\0'; ++ if (strlen(interface) > 15) { ++ interface[15] = '\0'; + } + snprintf(string, sizeof(string), "%s", interface); + for (i = 0; i < (17 - strlen(interface)); i++) { +@@ -662,7 +665,7 @@ + units(rate.cur, cur), graph->units, + units((float)rate.total, total)); + } +- gdImageString(*img, gdFontSmall, BORDER_L + 10, ++ gdImageString(*img, gdFontSmall, BORDER_L, + BORDER_T + graph->image.yplot_area + 33 + (10 * offset), string, std_colors[black]); + } + +@@ -866,6 +869,13 @@ + title_offset = 1 - (0.01 * (strlen(VERSION) + strlen(COPYRIGHT) + 2)); + snprintf(string, sizeof(string), "%s %s", COPYRIGHT, VERSION); + gdImageString(*img, gdFontSmall, BORDER_L + (graph->image.xplot_area * title_offset), BORDER_T - 15, string, std_colors[black]); ++ ++ /* title */ ++ if (graph->titlestr) ++ { ++ snprintf(string, sizeof(string), "%s", graph->titlestr); ++ gdImageString(*img, gdFontMediumBold, BORDER_L + 5, BORDER_T - 16, string, std_colors[black]); ++ } + } + + +@@ -1342,10 +1352,14 @@ + } + } + /* XXX REB - Warning: Deprecated, tN argument will go away in RTG 0.8 XXX */ ++ snprintf(var, sizeof(var), "title"); ++ graph->titlestr = cgiGetValue(cgiArg, var); + for (i = 0; i < MAXTABLES; i++) { + snprintf(var, sizeof(var), "t%d", i + 1); + if ((arguments->table[i] = cgiGetValue(cgiArg, var))) + arguments->tables_to_plot++; ++ snprintf(var, sizeof(var), "t%d_name", i + 1); ++ arguments->tablename[i] = cgiGetValue(cgiArg, var); + } + if ((graph->units = cgiGetValue(cgiArg, "units")) == NULL) { + graph->units = malloc(sizeof(DEFAULT_UNITS)); diff --git a/net/rtg/files/patch-src-rtgplot.h b/net/rtg/files/patch-src-rtgplot.h new file mode 100644 index 000000000000..a71f64b8ace1 --- /dev/null +++ b/net/rtg/files/patch-src-rtgplot.h @@ -0,0 +1,26 @@ +--- src/rtgplot.h 2003-09-24 15:43:39.000000000 +0100 ++++ src/rtgplot.h.new 2010-04-20 21:41:37.131774833 +0100 +@@ -11,6 +11,7 @@ + + #include <gd.h> + #include <gdfonts.h> ++#include <gdfontmb.h> + #include <strings.h> + + #define XPLOT_AREA 500 +@@ -95,6 +96,7 @@ + int scaley; + range_t range; + image_t image; ++ char *titlestr; + } graph_t; + + /* A linked list of colors that we iterate through each line */ +@@ -106,6 +108,7 @@ + + typedef struct arguments_struct { + char *table[MAXTABLES]; ++ char *tablename[MAXTABLES]; + int iid[MAXIIDS]; + int tables_to_plot; + int iids_to_plot; diff --git a/net/rtg/files/rtgpoll.in b/net/rtg/files/rtgpoll.in index 04c073266ffc..555b9cb133f5 100644 --- a/net/rtg/files/rtgpoll.in +++ b/net/rtg/files/rtgpoll.in @@ -3,7 +3,7 @@ # $FreeBSD$ # # PROVIDE: rtgpoll -# REQUIRE: LOGIN +# REQUIRE: LOGIN mysql # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf @@ -30,6 +30,8 @@ load_rc_config $name : ${rtgpoll_targets="%%PREFIX%%/etc/rtg/targets.cfg"} : ${rtgpoll_pidfile="/var/run/${name}.pid"} +required_files="$rtgpoll_targets" + command_args="-p $rtgpoll_pidfile -c $rtgpoll_config -t $rtgpoll_targets &" run_rc_command "$1" diff --git a/net/rtg/pkg-plist b/net/rtg/pkg-plist index dccff1b8f81b..942998b26b6f 100644 --- a/net/rtg/pkg-plist +++ b/net/rtg/pkg-plist @@ -4,9 +4,9 @@ bin/rtgplot bin/rtgpoll contrib/README contrib/rtgtargmkr-with-modules-0.2.tar.gz -etc/rtg/rtg.conf +etc/rtg/rtg.conf.sample etc/rtg/rtgtargmkr.pl -etc/rtg/routers +etc/rtg/routers.sample etc/rtg/createdb etc/rtg/BER.pm etc/rtg/SNMP_Session.pm |