First import of mon.

mon is a tool for monitoring the availability of services, and sending alerts
on prescribed events. Services are defined as anything tested by a "monitor"
program, which can be something as simple as pinging a system, or as complex
as analyzing the results of an application-level transaction. Alerts are
actions such as sending emails, making submissions to ticketing systems, or
triggering resource fail-over in a high-availability cluster.

ok jasper@
This commit is contained in:
pea 2009-11-10 14:33:50 +00:00
parent 806698c31d
commit 828c5c820c
18 changed files with 410 additions and 0 deletions

6
net/mon/Makefile Normal file
View File

@ -0,0 +1,6 @@
# $OpenBSD: Makefile,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
SUBDIR += server
SUBDIR += client
.include <bsd.port.subdir.mk>

17
net/mon/Makefile.inc Normal file
View File

@ -0,0 +1,17 @@
# $OpenBSD: Makefile.inc,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
V = 1.2.0
CATEGORIES = net
HOMEPAGE = http://mon.wiki.kernel.org
MAINTAINER = Pierre-Emmanuel Andre <pea@openbsd.org>
# GPLv2
PERMIT_PACKAGE_CDROM = Yes
PERMIT_DISTFILES_CDROM = Yes
PERMIT_PACKAGE_FTP = Yes
PERMIT_DISTFILES_FTP = Yes
MASTER_SITES = ftp://ftp.kernel.org/pub/software/admin/mon/

28
net/mon/client/Makefile Normal file
View File

@ -0,0 +1,28 @@
# $OpenBSD: Makefile,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
COMMENT = perl module for mon
DISTNAME = mon-client-${V}
# To avoid the name p5-mon-client-${V}
PKGNAME = ${DISTNAME}
MODULES = cpan
DISTFILES = mon-client-${V}.tar.gz \
mon-${V}.tar.gz
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/lib/mon/
${INSTALL_SCRIPT} ${WRKDIR}/mon-${V}/clients/mon.cgi \
${PREFIX}/lib/mon/mon.cgi
${INSTALL_SCRIPT} ${WRKDIR}/mon-${V}/clients/monshow \
${PREFIX}/bin/
${INSTALL_SCRIPT} ${WRKDIR}/mon-${V}/clients/moncmd \
${PREFIX}/bin/
${INSTALL_MAN} ${WRKDIR}/mon-${V}/doc/moncmd.1 \
${PREFIX}/man/man1/
${INSTALL_MAN} ${WRKDIR}/mon-${V}/doc/monshow.1 \
${PREFIX}/man/man1/
.include <bsd.port.mk>

10
net/mon/client/distinfo Normal file
View File

@ -0,0 +1,10 @@
MD5 (mon-1.2.0.tar.gz) = Zo587IyL6V6B33pIwsMiyw==
MD5 (mon-client-1.2.0.tar.gz) = DzNTftDjpKdFGJ6CbjYrrQ==
RMD160 (mon-1.2.0.tar.gz) = wPOZFbVRBB2N31KWS1j1YLPhjEw=
RMD160 (mon-client-1.2.0.tar.gz) = ZRAFE5mYhGZIoXYee0+UWvsaVfc=
SHA1 (mon-1.2.0.tar.gz) = 6AQKGkzFPs+YFnYUwGQRoeKdvYw=
SHA1 (mon-client-1.2.0.tar.gz) = Z8nDH+5M+1MJrtQ3zsG56JoGxKQ=
SHA256 (mon-1.2.0.tar.gz) = l/V6JhQYplIoIGEtRtqwCcTcQHW5Iz9a/YOpE2+edTU=
SHA256 (mon-client-1.2.0.tar.gz) = MntMEIb1vZRCGkzUZ5hA/e1oSSsD9xY6Cxc+E1tP8f4=
SIZE (mon-1.2.0.tar.gz) = 298884
SIZE (mon-client-1.2.0.tar.gz) = 31249

4
net/mon/client/pkg/DESCR Normal file
View File

@ -0,0 +1,4 @@
This is the Perl5 module for interfacing with the Mon system monitoring
package. It is intended to be used in conjuction with the mon 1.2.x server.
Currently only the client interface is implemented, but more things like
special logging routines and persistent monitors are being considered.

View File

@ -0,0 +1,3 @@
You must edit ${LOCALBASE}/lib/mon/mon.cgi to fit your installation.
Open it with your favorite editor, search the initialize_config_globals
function and change all the necessary parameters in it.

16
net/mon/client/pkg/PLIST Normal file
View File

@ -0,0 +1,16 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
bin/moncmd
bin/monshow
lib/mon/
lib/mon/mon.cgi
${P5SITE}/Mon/
${P5SITE}/Mon/Client.pm
${P5SITE}/Mon/Config.pm
${P5SITE}/Mon/Protocol.pm
${P5SITE}/Mon/SNMP.pm
@man man/man1/moncmd.1
@man man/man1/monshow.1
@man man/man3p/Mon::Client.3p
@man man/man3p/Mon::Config.3p
@man man/man3p/Mon::Protocol.3p
@man man/man3p/Mon::SNMP.3p

43
net/mon/server/Makefile Normal file
View File

@ -0,0 +1,43 @@
# $OpenBSD: Makefile,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
COMMENT = service monitoring daemon
DISTNAME = mon-${V}
WANTLIB = c
RUN_DEPENDS = ::devel/p5-Time-Period
NO_REGRESS = Yes
EG_DIR = ${PREFIX}/share/examples/mon/
post-configure:
${SUBST_CMD} ${WRKSRC}/etc/example.cf ${WRKSRC}/etc/very-simple.cf \
${WRKSRC}/mon.d/Makefile ${WRKSRC}/mon.d/fping.monitor
do-build:
@cd ${WRKSRC}/mon.d && env -i ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS}
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/mon ${PREFIX}/bin/mon
${INSTALL_MAN} ${WRKSRC}/doc/mon.8 ${PREFIX}/man/man8/
${INSTALL_DATA_DIR} ${PREFIX}/lib/mon
${INSTALL_DATA_DIR} ${PREFIX}/lib/mon/{mon.d,alert.d}
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/mon/
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/mon/
${INSTALL_DATA} ${WRKSRC}/etc/snmpvar.def ${EG_DIR}
${INSTALL_DATA} ${WRKSRC}/etc/syslog-monitor.conf ${EG_DIR}
${INSTALL_DATA} ${WRKSRC}/etc/*.cf ${EG_DIR}
${INSTALL_DATA} ${WRKSRC}/doc/README.* ${PREFIX}/share/doc/mon/
${INSTALL_SCRIPT} ${WRKSRC}/mon.d/*.monitor ${PREFIX}/lib/mon/mon.d/
${INSTALL_SCRIPT} ${WRKSRC}/alert.d/*.alert ${PREFIX}/lib/mon/alert.d/
@cd ${WRKSRC}/mon.d && env -i ${MAKE_ENV} \
${MAKE_PROGRAM} ${ALL_FAKE_FLAGS} -f ${MAKE_FILE} ${FAKE_TARGET}
post-install:
${SUBST_CMD} -c ${FILESDIR}/README.OpenBSD ${WRKBUILD}/README.OpenBSD
${INSTALL_DATA} ${WRKBUILD}/README.OpenBSD \
${PREFIX}/share/doc/mon/README.OpenBSD
.include <bsd.port.mk>

5
net/mon/server/distinfo Normal file
View File

@ -0,0 +1,5 @@
MD5 (mon-1.2.0.tar.gz) = Zo587IyL6V6B33pIwsMiyw==
RMD160 (mon-1.2.0.tar.gz) = wPOZFbVRBB2N31KWS1j1YLPhjEw=
SHA1 (mon-1.2.0.tar.gz) = 6AQKGkzFPs+YFnYUwGQRoeKdvYw=
SHA256 (mon-1.2.0.tar.gz) = l/V6JhQYplIoIGEtRtqwCcTcQHW5Iz9a/YOpE2+edTU=
SIZE (mon-1.2.0.tar.gz) = 298884

View File

@ -0,0 +1,31 @@
$OpenBSD: README.OpenBSD,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
mon is a tool for monitoring the availability of services and sending alerts
on prescribed events.
This is a small howto to get mon running in a basic setup.
1. Edit ${SYSCONFDIR}/mon/mon.cf to fit your needs.
2. You may need additional perl modules in order to use some monitors.
Check your monitor file with perl -c.
Example: perl -c ${TRUEPREFIX}/lib/mon/mon.d/dns.monitor
3. Launch mon in debug mode:
su -l _mon -c "${TRUEPREFIX}/bin/mon -c /etc/mon/mon.cf -d -P /var/run/mon.pid"
4. When everything is ok, launch mon as a daemon:
su -l _mon -c "${TRUEPREFIX}/bin/mon -c /etc/mon/mon.cf -f -P /var/run/mon.pid"
5. Add the following to your /etc/rc.local:
if [ -x ${TRUEPREFIX}/bin/mon ] ; then
su -l _mon -c "${TRUEPREFIX}/bin/mon -c /etc/mon/mon.cf -f -P /var/run/mon.pid"
fi
Random hints:
* To use fping.monitor you must install fping.
* If you need a graphical interface, please install mon-client which contains
a simple cgi.

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-alert_d_mail_alert,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
--- alert.d/mail.alert.orig Mon Oct 12 16:03:19 2009
+++ alert.d/mail.alert Mon Oct 12 16:03:30 2009
@@ -46,7 +46,7 @@ $ALERT = $opt_u ? "UPALERT" : "ALERT";
$t = localtime($opt_t);
($wday,$mon,$day,$tm) = split (/\s+/, $t);
-open (MAIL, "| /usr/lib/sendmail -oi -t $mailfrom") ||
+open (MAIL, "| /usr/sbin/sendmail -oi -t $mailfrom") ||
die "could not open pipe to mail: $!\n";
print MAIL <<EOF;
To: $mailaddrs

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-etc_example_cf,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
--- etc/example.cf.orig Mon Jun 25 15:10:08 2007
+++ etc/example.cf Mon Oct 12 14:10:36 2009
@@ -17,9 +17,11 @@
#
# global options
#
-cfbasedir = /usr/lib/mon/etc
-alertdir = /usr/lib/mon/alert.d
-mondir = /usr/lib/mon/mon.d
+cfbasedir = ${SYSCONFDIR}/mon/
+alertdir = ${PREFIX}/lib/mon/alert.d
+mondir = ${PREFIX}/lib/mon/mon.d
+statedir = /var/mon/state.d
+logdir = /var/mon/log.d
maxprocs = 20
histlength = 100
randstart = 60s

View File

@ -0,0 +1,53 @@
$OpenBSD: patch-etc_very-simple_cf,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
--- etc/very-simple.cf.orig Wed Jun 9 07:18:06 2004
+++ etc/very-simple.cf Wed Oct 14 13:26:22 2009
@@ -3,32 +3,42 @@
#
# $Id: patch-etc_very-simple_cf,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
#
-alertdir = /usr/lib/mon/alert.d
-mondir = /usr/lib/mon/mon.d
+alertdir = ${PREFIX}/lib/mon/alert.d
+mondir = ${PREFIX}/lib/mon/mon.d
+cfbasedir = ${SYSCONFDIR}/mon/
+statedir = /var/mon/state.d
+logdir = /var/mon/log.d
maxprocs = 20
histlength = 100
randstart = 60s
+dtlogging = yes
#
# define groups of hosts to monitor
#
hostgroup servers localhost
-hostgroup mail mailhost
-
watch servers
service ping
interval 5m
- monitor fping.monitor
+ monitor ping.monitor
period wd {Mon-Fri} hr {7am-10pm}
alert mail.alert root@localhost
alertevery 1h
period wd {Sat-Sun}
alert mail.alert root@localhost
- service telnet
+ service ssh
interval 10m
- monitor telnet.monitor
+ monitor tcp.monitor -p 22
period wd {Mon-Fri} hr {7am-10pm}
alertevery 1h
alertafter 2 30m
alert mail.alert root@localhost
+ service smtp
+ interval 10m
+ monitor smtp.monitor
+ period wd {Mon-Fri} hr {7am-10pm}
+ alertevery 1h
+ alertafter 2 30m
+ alert mail.alert root@localhost
+ upalert mail.alert root@localhost

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-mon_d_Makefile,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
--- mon.d/Makefile.orig Wed Jun 9 07:18:05 2004
+++ mon.d/Makefile Wed Dec 10 16:20:41 2008
@@ -3,14 +3,15 @@
#
# compiles on Linux, Solaris 2.5, Solaris 2.6, and AIX Version 4.2
#
-CC = gcc
-CFLAGS = -O2 -Wall -g
-LDFLAGS =
-LDLIBS =
+CC ?= gcc
+CFLAGS ?= -O2 -Wall -g
+LDFLAGS ?=
+LDLIBS ?=
+PREFIX ?= ${PREFIX}
# uncomment next line for Solaris
# LDLIBS = -lnsl -lsocket
-MONPATH=/usr/lib/mon
+MONPATH=$(PREFIX)/lib/mon
DIALIN_MONITOR_REAL=$(MONPATH)/mon.d/dialin.monitor
PROGS = rpc.monitor dialin.monitor.wrap
@@ -31,4 +32,4 @@ clean:
install:
install -d $(MONPATH)/mon.d
install rpc.monitor $(MONPATH)/mon.d/
- install -g uucp -m 02555 dialin.monitor.wrap $(MONPATH)/mon.d/
+ install dialin.monitor.wrap $(MONPATH)/mon.d/

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-mon_d_fping_monitor,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
--- mon.d/fping.monitor.orig Mon Oct 12 15:55:27 2009
+++ mon.d/fping.monitor Mon Oct 12 15:56:44 2009
@@ -50,7 +50,7 @@ usage if ($opt{"h"});
my $TIMEOUT = $opt{"t"} || 2000;
my $RETRIES = $opt{"r"} || 3;
-my $CMD = "fping -e -r $RETRIES -t $TIMEOUT";
+my $CMD = "${LOCALBASE}/sbin/fping -e -r $RETRIES -t $TIMEOUT";
my $START_TIME = time;
my $END_TIME;
my %details;
@@ -221,7 +221,7 @@ if ($opt{"T"} && @unreachable)
{
foreach my $host (@unreachable)
{
- system ("traceroute -w 3 $host 2>&1");
+ system ("/usr/sbin/traceroute -w 3 $host 2>&1");
}
print "\n";

15
net/mon/server/pkg/DESCR Normal file
View File

@ -0,0 +1,15 @@
mon is a tool for monitoring the availability of services, and sending alerts
on prescribed events. Services are defined as anything tested by a "monitor"
program, which can be something as simple as pinging a system, or as complex
as analyzing the results of an application-level transaction. Alerts are
actions such as sending emails, making submissions to ticketing systems, or
triggering resource fail-over in a high-availability cluster.
A design goal of mon is to maintain simplicity and provide the right
abstractions for monitoring so that the system can be scalable, easy to use,
and trivial to extend for the widest variety of applications. The learning
curve is very shallow for initial installation, configuration, and
customization. Monitors and alerts are simple to write using any language, and
simple to incorporate into a site configuration. Reporting and control
functionality is easily customized with the aid of a TCP-based protocol
interface.

View File

@ -0,0 +1,2 @@
Please see ${PREFIX}/share/doc/mon/README.OpenBSD for
a brief intro to using mon on OpenBSD.

96
net/mon/server/pkg/PLIST Normal file
View File

@ -0,0 +1,96 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2009/11/10 14:33:50 pea Exp $
@newgroup _mon:643
@newuser _mon:643:_mon:daemon:Mon Server:/var/empty:/bin/sh
bin/mon
lib/mon/
lib/mon/alert.d/
lib/mon/alert.d/file.alert
lib/mon/alert.d/irc.alert
lib/mon/alert.d/mail.alert
lib/mon/alert.d/netpage.alert
lib/mon/alert.d/qpage.alert
lib/mon/alert.d/snpp.alert
lib/mon/alert.d/test.alert
lib/mon/alert.d/trap.alert
lib/mon/mon.d/
lib/mon/mon.d/asyncreboot.monitor
lib/mon/mon.d/cpqhealth.monitor
lib/mon/mon.d/dialin.monitor
@bin lib/mon/mon.d/dialin.monitor.wrap
lib/mon/mon.d/dns-query.monitor
lib/mon/mon.d/dns.monitor
lib/mon/mon.d/file_change.monitor
lib/mon/mon.d/foundry-chassis.monitor
lib/mon/mon.d/fping.monitor
lib/mon/mon.d/freespace.monitor
lib/mon/mon.d/ftp.monitor
lib/mon/mon.d/hpnp.monitor
lib/mon/mon.d/http.monitor
lib/mon/mon.d/http_tppnp.monitor
lib/mon/mon.d/imap.monitor
lib/mon/mon.d/ldap.monitor
lib/mon/mon.d/local-syslog.monitor
lib/mon/mon.d/lpd.monitor
lib/mon/mon.d/mon.monitor
lib/mon/mon.d/msql-mysql.monitor
lib/mon/mon.d/na_quota.monitor
lib/mon/mon.d/netappfree.monitor
lib/mon/mon.d/nntp.monitor
lib/mon/mon.d/ntpdate.monitor
lib/mon/mon.d/phttp.monitor
lib/mon/mon.d/ping.monitor
lib/mon/mon.d/pop3.monitor
lib/mon/mon.d/process.monitor
lib/mon/mon.d/radius.monitor
lib/mon/mon.d/rd.monitor
lib/mon/mon.d/reboot.monitor
@bin lib/mon/mon.d/rpc.monitor
lib/mon/mon.d/seq.monitor
lib/mon/mon.d/silkworm.monitor
lib/mon/mon.d/smtp.monitor
lib/mon/mon.d/smtp3.monitor
lib/mon/mon.d/snmpdiskspace.monitor
lib/mon/mon.d/snmpvar.monitor
lib/mon/mon.d/tcp.monitor
lib/mon/mon.d/telnet.monitor
lib/mon/mon.d/trace.monitor
lib/mon/mon.d/traceroute.monitor
lib/mon/mon.d/up_rtt.monitor
lib/mon/mon.d/xedia-ipsec-tunnel.monitor
@man man/man8/mon.8
share/doc/mon/
share/doc/mon/README.OpenBSD
share/doc/mon/README.alerts
share/doc/mon/README.cgi-bin
share/doc/mon/README.hints
share/doc/mon/README.mon.cgi
share/doc/mon/README.monitors
share/doc/mon/README.msql-mysql.monitor
share/doc/mon/README.paging
share/doc/mon/README.protocol
share/doc/mon/README.rpc.monitor
share/doc/mon/README.snmpdiskspace.monitor
share/doc/mon/README.snmpvar.monitor
share/doc/mon/README.software
share/doc/mon/README.syslog.monitor
share/doc/mon/README.traps
share/doc/mon/README.variables
share/examples/mon/
@owner _mon
@group _mon
@sample ${SYSCONFDIR}/mon/
share/examples/mon/auth.cf
@sample ${SYSCONFDIR}/mon/auth.cf
share/examples/mon/example.cf
share/examples/mon/mon.cgi.cf
share/examples/mon/na_quota.cf
share/examples/mon/netappfree.cf
share/examples/mon/snmpdiskspace.cf
share/examples/mon/snmpopt.cf
share/examples/mon/snmpvar.cf
share/examples/mon/snmpvar.def
share/examples/mon/syslog-monitor.conf
share/examples/mon/very-simple.cf
@sample ${SYSCONFDIR}/mon/mon.cf
@sample /var/mon/state.d/
@sample /var/mon/log.d/