add the interface name to the title and report header. this is quite

useful when you're running darkstat on a box with 3 network feeds...
This commit is contained in:
ckuethe 2008-05-17 22:33:31 +00:00
parent 2cc7aa96d8
commit 2a04a4f2bd
3 changed files with 52 additions and 1 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.8 2007/09/30 22:08:54 ckuethe Exp $
# $OpenBSD: Makefile,v 1.9 2008/05/17 22:33:31 ckuethe Exp $
COMMENT= network statistics gatherer with graphs
DISTNAME= darkstat-3.0.707
PKGNAME= ${DISTNAME}p0
CATEGORIES= net www
HOMEPAGE= http://dmr.ath.cx/net/darkstat/

View File

@ -0,0 +1,27 @@
$OpenBSD: patch-graph_db_c,v 1.1 2008/05/17 22:33:31 ckuethe Exp $
--- graph_db.c.orig Fri May 16 13:23:14 2008
+++ graph_db.c Fri May 16 13:41:43 2008
@@ -27,6 +27,8 @@
#define GRAPH_WIDTH "320"
#define GRAPH_HEIGHT "200"
+extern const char *interface;
+
struct graph {
uint64_t *in, *out;
unsigned int offset; /* i.e. seconds start at 0, days start at 1 */
@@ -348,11 +350,12 @@ html_front_page(void)
buf = str_make();
str_append(buf, html_header_1);
- str_append(buf, "<title>" PACKAGE_STRING " : graphs</title>\n");
+ str_appendf(buf, "<title>" PACKAGE_STRING " : graphs (%s)</title>\n",
+ interface);
str_append(buf, "<script src=\"graph.js\" type=\"text/javascript\">"
"</script>\n");
str_append(buf, html_header_2);
- str_append(buf, "<h2 class=\"pageheader\">Graphs</h2>\n");
+ str_appendf(buf, "<h2 class=\"pageheader\">Graphs (%s)</h2>\n", interface);
str_append(buf, "<p>\n");

View File

@ -0,0 +1,23 @@
$OpenBSD: patch-hosts_db_c,v 1.1 2008/05/17 22:33:31 ckuethe Exp $
--- hosts_db.c.orig Fri May 16 13:23:50 2008
+++ hosts_db.c Fri May 16 13:36:21 2008
@@ -26,6 +26,7 @@
#include <unistd.h>
int show_mac_addrs = 0;
+extern const char *interface;
/* FIXME: specify somewhere more sane/tunable */
#define MAX_ENTRIES 30 /* in an HTML table rendered from a hashtable */
@@ -887,9 +888,9 @@ html_hosts_main(const char *qs)
#define FULL "full table"
str_append(buf, html_header_1);
- str_append(buf, "<title>darkstat3: Hosts</title>\n");
+ str_appendf(buf, "<title>darkstat3: Hosts (%s)</title>\n", interface);
str_append(buf, html_header_2);
- str_append(buf, "<h2 class=\"pageheader\">Hosts</h2>\n");
+ str_appendf(buf, "<h2 class=\"pageheader\">Hosts (%s)</h2>\n", interface);
format_table(buf, hosts_db, start, sort, full);
/* <prev | full | stats | next> */