View | Details | Raw Unified | Return to bug 145924
Collapse All | Expand All

(-)/usr/ports/net/rtg.new/Makefile (-3 / +4 lines)
Lines 7-24 Link Here
7
7
8
PORTNAME=	rtg
8
PORTNAME=	rtg
9
PORTVERSION=	0.7.4
9
PORTVERSION=	0.7.4
10
PORTREVISION=	4
10
PORTREVISION=	5
11
CATEGORIES=	net
11
CATEGORIES=	net
12
MASTER_SITES=	SF
12
MASTER_SITES=	SF
13
13
14
MAINTAINER=	ports@FreeBSD.org
14
MAINTAINER=	freebsd-ports@dan.me.uk
15
COMMENT=	A flexible, high-performance SNMP statistics monitoring system
15
COMMENT=	A flexible, high-performance SNMP statistics monitoring system
16
16
17
LIB_DEPENDS=	netsnmp.16:${PORTSDIR}/net-mgmt/net-snmp
17
LIB_DEPENDS=	netsnmp.16:${PORTSDIR}/net-mgmt/net-snmp
18
18
19
MAN1=	rtgplot.1 rtgpoll.1
19
MAN1=	rtgplot.1 rtgpoll.1
20
20
21
USE_MYSQL=      yes
21
USE_RC_SUBR=	rtgpoll
22
USE_MYSQL=	yes
22
GNU_CONFIGURE=	yes
23
GNU_CONFIGURE=	yes
23
CONFIGURE_ARGS+=	--sysconfdir=${PREFIX}/etc/${PORTNAME} \
24
CONFIGURE_ARGS+=	--sysconfdir=${PREFIX}/etc/${PORTNAME} \
24
			--with-mysql=${LOCALBASE} \
25
			--with-mysql=${LOCALBASE} \
(-)/usr/ports/net/rtg.new/files/patch-etc-rtgtargmkr.pl.in (+11 lines)
Line 0 Link Here
1
--- etc/rtgtargmkr.pl.in.orig	2010-04-21 20:55:58.903081619 +0100
2
+++ etc/rtgtargmkr.pl.in	2010-04-21 20:56:15.567832088 +0100
3
@@ -126,7 +126,7 @@
4
         &sql_insert($sql);
5
         $rid = &find_router_id($router);
6
         foreach $mib ( keys %mibs_of_interest ) {
7
-          $sql = "CREATE TABLE $mib"."_$rid (id INT NOT NULL, dtime DATETIME NOT NULL, counter BIGINT NOT NULL, KEY $mib"."_$rid". "_idx (dtime))";
8
+          $sql = "CREATE TABLE $mib"."_$rid (id INT NOT NULL, dtime DATETIME NOT NULL, counter BIGINT NOT NULL, KEY $mib"."_$rid". "_idx (dtime), KEY id_dtime_idx (id,dtime))";
9
           &sql_insert($sql);
10
         }
11
     }
(-)/usr/ports/net/rtg.new/files/patch-src-rtg.h (+13 lines)
Line 0 Link Here
1
--- src/rtg.h.orig	2010-04-21 21:26:38.587554904 +0100
2
+++ src/rtg.h	2010-04-21 21:31:40.436052227 +0100
3
@@ -42,9 +42,7 @@
4
 #define DEFAULT_DB_PASS "rtgdefault"
5
 #define DEFAULT_SNMP_VER 1
6
 #define DEFAULT_SNMP_PORT 161
7
-
8
-/* PID File */
9
-#define PIDFILE "/tmp/rtgpoll.pid"
10
+#define DEFAULT_PIDFILE "/tmp/rtgpoll.pid"
11
 
12
 #define STAT_DESCRIP_ERROR 99
13
 #define HASHSIZE 5000
(-)/usr/ports/net/rtg.new/files/patch-src-rtgpoll.c (+65 lines)
Line 0 Link Here
1
--- src/rtgpoll.c.orig	2010-04-21 21:24:13.686718318 +0100
2
+++ src/rtgpoll.c	2010-04-21 21:33:53.755065067 +0100
3
@@ -13,6 +13,7 @@
4
 stats_t stats =
5
 {PTHREAD_MUTEX_INITIALIZER, 0, 0, 0, 0, 0, 0, 0, 0, 0.0};
6
 char *target_file = NULL;
7
+char *pidfile = NULL;
8
 target_t *current = NULL;
9
 MYSQL mysql;
10
 int entries = 0;
11
@@ -41,7 +42,7 @@
12
     config_defaults(&set);
13
 
14
     /* Parse the command-line. */
15
-    while ((ch = getopt(argc, argv, "c:dhmt:vz")) != EOF)
16
+    while ((ch = getopt(argc, argv, "c:dhmp:t:vz")) != EOF)
17
 	switch ((char) ch) {
18
 	case 'c':
19
 	    conf_file = optarg;
20
@@ -55,6 +56,9 @@
21
 	case 'm':
22
 	    set.multiple++;
23
 	    break;
24
+	case 'p':
25
+	    pidfile = optarg;
26
+	    break;
27
 	case 't':
28
 	    target_file = optarg;
29
 	    break;
30
@@ -66,6 +70,9 @@
31
 	    break;
32
 	}
33
 
34
+    if (!pidfile)
35
+        pidfile = DEFAULT_PIDFILE;
36
+
37
     if (set.verbose >= LOW)
38
 	printf("RTG version %s starting.\n", VERSION);
39
 
40
@@ -78,7 +85,7 @@
41
     sigaddset(&signal_set, SIGINT);
42
     sigaddset(&signal_set, SIGQUIT);
43
 	if (!set.multiple) 
44
-    	checkPID(PIDFILE);
45
+    	checkPID(pidfile);
46
 
47
     if (pthread_sigmask(SIG_BLOCK, &signal_set, NULL) != 0)
48
 	printf("pthread_sigmask error\n");
49
@@ -244,7 +251,7 @@
50
                 if (set.verbose >= LOW)
51
                    printf("Quiting: received signal %d.\n", sig_number);
52
                 rtg_dbdisconnect(&mysql);
53
-                unlink(PIDFILE);
54
+                unlink(pidfile);
55
                 exit(1);
56
                 break;
57
         }
58
@@ -259,6 +266,7 @@
59
     printf("\nOptions:\n");
60
     printf("  -c <file>   Specify configuration file\n");
61
     printf("  -d          Disable database inserts\n");
62
+    printf("  -p <file>   Specify pid file (defaults to /tmp/rtgpoll.pid)\n");
63
     printf("  -t <file>   Specify target file\n");
64
     printf("  -v          Increase verbosity\n");
65
 	printf("  -m          Allow multiple instances\n");
(-)/usr/ports/net/rtg.new/files/rtgpoll.in (+36 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
# $FreeBSD$
4
#
5
# PROVIDE: rtgpoll
6
# REQUIRE: LOGIN
7
# KEYWORD: shutdown
8
#
9
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
10
# to enable this service:
11
#
12
# rtgpoll_enable (bool):   Set to NO by default.
13
#                          Set it to YES to enable rtgpoll.
14
# rtgpoll_config (path):   Set to %%PREFIX%%/etc/rtg/rtg.conf by default.
15
# rtgpoll_targets (path):  Set to %%PREFIX%%/etc/rtg/targets.cfg by default.
16
# rtgpoll_pidfile (path):  Set to /var/run/rtgpoll.pid by default.
17
#
18
19
. /etc/rc.subr
20
21
name="rtgpoll"
22
rcvar=${name}_enable
23
24
command=%%PREFIX%%/bin/${name}
25
26
load_rc_config $name
27
28
: ${rtgpoll_enable="NO"}
29
: ${rtgpoll_config="%%PREFIX%%/etc/rtg/rtg.conf"}
30
: ${rtgpoll_targets="%%PREFIX%%/etc/rtg/targets.cfg"}
31
: ${rtgpoll_pidfile="/var/run/${name}.pid"}
32
33
command_args="-p $rtgpoll_pidfile -c $rtgpoll_config -t $rtgpoll_targets &"
34
35
run_rc_command "$1"
36

Return to bug 145924