mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-29 01:13:08 +00:00
- Add rc.d script.
- Optimise db table creation with indexes. - Add PID file option. - Fix a few warnings in the Makefile. - Assign maintainership to submitter. PR: 145924 Submitted by: Daniel Austin <freebsd-ports@dan.me.uk> Feature safe: yes
This commit is contained in:
parent
d6de5eda74
commit
a43ffc48e2
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=257226
@ -7,24 +7,32 @@
|
||||
|
||||
PORTNAME= rtg
|
||||
PORTVERSION= 0.7.4
|
||||
PORTREVISION= 5
|
||||
PORTREVISION= 6
|
||||
CATEGORIES= net
|
||||
MASTER_SITES= SF
|
||||
|
||||
MAINTAINER= ports@FreeBSD.org
|
||||
MAINTAINER= freebsd-ports@dan.me.uk
|
||||
COMMENT= A flexible, high-performance SNMP statistics monitoring system
|
||||
|
||||
LIB_DEPENDS= netsnmp.20:${PORTSDIR}/net-mgmt/net-snmp
|
||||
LIB_DEPENDS= netsnmp:${PORTSDIR}/net-mgmt/net-snmp
|
||||
|
||||
MAN1= rtgplot.1 rtgpoll.1
|
||||
|
||||
USE_MYSQL= yes
|
||||
USE_RC_SUBR= rtgpoll
|
||||
USE_MYSQL= yes
|
||||
GNU_CONFIGURE= yes
|
||||
CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc/${PORTNAME} \
|
||||
--with-mysql=${LOCALBASE} \
|
||||
--with-snmp=${LOCALBASE}
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${OSVERSION} >= 800040
|
||||
CFLAGS+= -fstack-protector
|
||||
LDFLAGS+= -fstack-protector
|
||||
.endif
|
||||
|
||||
pre-configure:
|
||||
@${REINPLACE_CMD} -e 's,-pthread,${PTHREAD_LIBS},g' ${WRKSRC}/configure
|
||||
|
||||
.include <bsd.port.mk>
|
||||
.include <bsd.port.post.mk>
|
||||
|
11
net/rtg/files/patch-etc-rtgtargmkr.pl.in
Normal file
11
net/rtg/files/patch-etc-rtgtargmkr.pl.in
Normal file
@ -0,0 +1,11 @@
|
||||
--- etc/rtgtargmkr.pl.in.orig 2010-04-21 20:55:58.903081619 +0100
|
||||
+++ etc/rtgtargmkr.pl.in 2010-04-21 20:56:15.567832088 +0100
|
||||
@@ -126,7 +126,7 @@
|
||||
&sql_insert($sql);
|
||||
$rid = &find_router_id($router);
|
||||
foreach $mib ( keys %mibs_of_interest ) {
|
||||
- $sql = "CREATE TABLE $mib"."_$rid (id INT NOT NULL, dtime DATETIME NOT NULL, counter BIGINT NOT NULL, KEY $mib"."_$rid". "_idx (dtime))";
|
||||
+ $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))";
|
||||
&sql_insert($sql);
|
||||
}
|
||||
}
|
13
net/rtg/files/patch-src-rtg.h
Normal file
13
net/rtg/files/patch-src-rtg.h
Normal file
@ -0,0 +1,13 @@
|
||||
--- src/rtg.h.orig 2010-04-21 21:26:38.587554904 +0100
|
||||
+++ src/rtg.h 2010-04-21 21:31:40.436052227 +0100
|
||||
@@ -42,9 +42,7 @@
|
||||
#define DEFAULT_DB_PASS "rtgdefault"
|
||||
#define DEFAULT_SNMP_VER 1
|
||||
#define DEFAULT_SNMP_PORT 161
|
||||
-
|
||||
-/* PID File */
|
||||
-#define PIDFILE "/tmp/rtgpoll.pid"
|
||||
+#define DEFAULT_PIDFILE "/tmp/rtgpoll.pid"
|
||||
|
||||
#define STAT_DESCRIP_ERROR 99
|
||||
#define HASHSIZE 5000
|
65
net/rtg/files/patch-src-rtgpoll.c
Normal file
65
net/rtg/files/patch-src-rtgpoll.c
Normal file
@ -0,0 +1,65 @@
|
||||
--- src/rtgpoll.c.orig 2010-04-21 21:24:13.686718318 +0100
|
||||
+++ src/rtgpoll.c 2010-04-21 21:33:53.755065067 +0100
|
||||
@@ -13,6 +13,7 @@
|
||||
stats_t stats =
|
||||
{PTHREAD_MUTEX_INITIALIZER, 0, 0, 0, 0, 0, 0, 0, 0, 0.0};
|
||||
char *target_file = NULL;
|
||||
+char *pidfile = NULL;
|
||||
target_t *current = NULL;
|
||||
MYSQL mysql;
|
||||
int entries = 0;
|
||||
@@ -41,7 +42,7 @@
|
||||
config_defaults(&set);
|
||||
|
||||
/* Parse the command-line. */
|
||||
- while ((ch = getopt(argc, argv, "c:dhmt:vz")) != EOF)
|
||||
+ while ((ch = getopt(argc, argv, "c:dhmp:t:vz")) != EOF)
|
||||
switch ((char) ch) {
|
||||
case 'c':
|
||||
conf_file = optarg;
|
||||
@@ -55,6 +56,9 @@
|
||||
case 'm':
|
||||
set.multiple++;
|
||||
break;
|
||||
+ case 'p':
|
||||
+ pidfile = optarg;
|
||||
+ break;
|
||||
case 't':
|
||||
target_file = optarg;
|
||||
break;
|
||||
@@ -66,6 +70,9 @@
|
||||
break;
|
||||
}
|
||||
|
||||
+ if (!pidfile)
|
||||
+ pidfile = DEFAULT_PIDFILE;
|
||||
+
|
||||
if (set.verbose >= LOW)
|
||||
printf("RTG version %s starting.\n", VERSION);
|
||||
|
||||
@@ -78,7 +85,7 @@
|
||||
sigaddset(&signal_set, SIGINT);
|
||||
sigaddset(&signal_set, SIGQUIT);
|
||||
if (!set.multiple)
|
||||
- checkPID(PIDFILE);
|
||||
+ checkPID(pidfile);
|
||||
|
||||
if (pthread_sigmask(SIG_BLOCK, &signal_set, NULL) != 0)
|
||||
printf("pthread_sigmask error\n");
|
||||
@@ -244,7 +251,7 @@
|
||||
if (set.verbose >= LOW)
|
||||
printf("Quiting: received signal %d.\n", sig_number);
|
||||
rtg_dbdisconnect(&mysql);
|
||||
- unlink(PIDFILE);
|
||||
+ unlink(pidfile);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
@@ -259,6 +266,7 @@
|
||||
printf("\nOptions:\n");
|
||||
printf(" -c <file> Specify configuration file\n");
|
||||
printf(" -d Disable database inserts\n");
|
||||
+ printf(" -p <file> Specify pid file (defaults to /tmp/rtgpoll.pid)\n");
|
||||
printf(" -t <file> Specify target file\n");
|
||||
printf(" -v Increase verbosity\n");
|
||||
printf(" -m Allow multiple instances\n");
|
36
net/rtg/files/rtgpoll.in
Normal file
36
net/rtg/files/rtgpoll.in
Normal file
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
# $FreeBSD$
|
||||
#
|
||||
# PROVIDE: rtgpoll
|
||||
# REQUIRE: LOGIN
|
||||
# KEYWORD: shutdown
|
||||
#
|
||||
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
||||
# to enable this service:
|
||||
#
|
||||
# rtgpoll_enable (bool): Set to NO by default.
|
||||
# Set it to YES to enable rtgpoll.
|
||||
# rtgpoll_config (path): Set to %%PREFIX%%/etc/rtg/rtg.conf by default.
|
||||
# rtgpoll_targets (path): Set to %%PREFIX%%/etc/rtg/targets.cfg by default.
|
||||
# rtgpoll_pidfile (path): Set to /var/run/rtgpoll.pid by default.
|
||||
#
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="rtgpoll"
|
||||
rcvar=${name}_enable
|
||||
|
||||
command=%%PREFIX%%/bin/${name}
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${rtgpoll_enable="NO"}
|
||||
: ${rtgpoll_config="%%PREFIX%%/etc/rtg/rtg.conf"}
|
||||
: ${rtgpoll_targets="%%PREFIX%%/etc/rtg/targets.cfg"}
|
||||
: ${rtgpoll_pidfile="/var/run/${name}.pid"}
|
||||
|
||||
command_args="-p $rtgpoll_pidfile -c $rtgpoll_config -t $rtgpoll_targets &"
|
||||
|
||||
run_rc_command "$1"
|
||||
|
Loading…
Reference in New Issue
Block a user