From 6b3695f9d5c843fa23235a0e20e9093728a75717 Mon Sep 17 00:00:00 2001 From: Guido Falsi Date: Sat, 28 May 2016 14:46:43 +0000 Subject: New port: net/ntpa NTP Analyzer is a tool dedicated to analyze the operation of time servers. NTP Analyzer works by collecting data from the ntp daemon. Graphs and web pages can then be generated to visualize the activities of hosts and peers. WWW: https://bitbucket.org/anguist/ntpa PR: 208940 Submitted by: Carsten Larsen --- GIDs | 1 + UIDs | 1 + net/Makefile | 1 + net/ntpa/Makefile | 47 +++++++++++++++++++++ net/ntpa/distinfo | 3 ++ net/ntpa/files/ntpa.in | 109 +++++++++++++++++++++++++++++++++++++++++++++++++ net/ntpa/pkg-descr | 8 ++++ net/ntpa/pkg-message | 9 ++++ net/ntpa/pkg-plist | 77 ++++++++++++++++++++++++++++++++++ 9 files changed, 256 insertions(+) create mode 100644 net/ntpa/Makefile create mode 100644 net/ntpa/distinfo create mode 100644 net/ntpa/files/ntpa.in create mode 100644 net/ntpa/pkg-descr create mode 100644 net/ntpa/pkg-message create mode 100644 net/ntpa/pkg-plist diff --git a/GIDs b/GIDs index a5a6f0837800..c6970f7561fa 100644 --- a/GIDs +++ b/GIDs @@ -222,6 +222,7 @@ _xsi:*:600: _tss:*:601: _pkcs11:*:602: freeswitch:*:610: +ntpa:*:615: caldavd:*:639: monkeysphere:*:641: aox:*:666: diff --git a/UIDs b/UIDs index 0318eee5fd72..bc2b8a8a5115 100644 --- a/UIDs +++ b/UIDs @@ -227,6 +227,7 @@ _xsi:*:600:600::0:0:XMLSysInfo User:/nonexistent:/usr/sbin/nologin _tss:*:601:601:daemon:0:0:TrouSerS user:/var/empty:/usr/sbin/nologin _pkcs11:*:602:602:daemon:0:0:opencryptoki user:/var/empty:/usr/sbin/nologin freeswitch:*:610:610::0:0:Freeswitch user:/nonexistent:/usr/sbin/nologin +ntpa:*:615:615::0:0:NTPa user:/nonexistent:/usr/sbin/nologin _pla:*:636:80::0:0:phpLDAPAdmin Owner:/nonexistent:/usr/sbin/nologin caldavd:*:639:639::0:0:Caldavd user:/var/db/caldavd:/usr/sbin/nologin monkeysphere:*:641:641::0:0:Monkeysphere User:/var/monkeysphere:/usr/local/bin/bash diff --git a/net/Makefile b/net/Makefile index e531e07273c0..1e3c9a91c88a 100644 --- a/net/Makefile +++ b/net/Makefile @@ -461,6 +461,7 @@ SUBDIR += ntop SUBDIR += ntp SUBDIR += ntp-devel + SUBDIR += ntpa SUBDIR += ntraceroute SUBDIR += nusoap SUBDIR += nxproxy diff --git a/net/ntpa/Makefile b/net/ntpa/Makefile new file mode 100644 index 000000000000..892abab766db --- /dev/null +++ b/net/ntpa/Makefile @@ -0,0 +1,47 @@ +# $FreeBSD$ + +PORTNAME= ntpa +PORTVERSION= 0.6.1 +CATEGORIES= net +MASTER_SITES= http://suyai.innolan.net/ + +MAINTAINER= cs@innolan.dk +COMMENT= NTP data collection and charting + +LICENSE= MIT + +OPTIONS_DEFINE= GRAPH PGSQL MYSQL +OPTION_MULTI= PGSQL MYSQL +GRAPH_DESC= Graphs and HTML generation (requires Cairo) +PGSQL_DESC= PostgreSQL Connector +MYSQL_DESC= MySQL Connector (GPL) + +OPTIONS_DEFAULT= GRAPH PGSQL + +GRAPH_LIB_DEPENDS= libgdiplus.so:x11-toolkits/libgdiplus \ + libcairo.so:graphics/cairo \ + libpng.so:graphics/png +GRAPH_RUN_DEPENDS= ${LOCALBASE}/share/fonts/webfonts/arial.ttf:x11-fonts/webfonts +GRAPH_CONFIGURE_ON= GRAPH +MYSQL_CONFIGURE_ON= MYSQL +PGSQL_CONFIGURE_ON= PGSQL + +USES= mono +NO_ARCH= yes +HAS_CONFIGURE= yes +OPTIONS_SUB= yes +USE_RC_SUBR= ntpa + +USERS= ntpa +GROUPS= ntpa + +post-install: + ${MKDIR} ${STAGEDIR}${WWWDIR} + (cd ${WRKSRC}/html && ${COPYTREE_SHARE} . ${STAGEDIR}${WWWDIR}) + ${MKDIR} ${STAGEDIR}${EXAMPLESDIR} + (cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}) + ${INSTALL_MAN} ${WRKSRC}/docs/ntpa.8 ${STAGEDIR}${MAN8PREFIX}/man/man8 + ${MKDIR} ${STAGEDIR}/var/log/ntpa + ${MKDIR} ${STAGEDIR}/var/run/ntpa + +.include diff --git a/net/ntpa/distinfo b/net/ntpa/distinfo new file mode 100644 index 000000000000..74750bbbb73e --- /dev/null +++ b/net/ntpa/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1464440774 +SHA256 (ntpa-0.6.1.tar.gz) = 93f6494039d21698de2e512169327caf447ef1143a9e8cc6c1ae304525d7984b +SIZE (ntpa-0.6.1.tar.gz) = 1336869 diff --git a/net/ntpa/files/ntpa.in b/net/ntpa/files/ntpa.in new file mode 100644 index 000000000000..bce837346811 --- /dev/null +++ b/net/ntpa/files/ntpa.in @@ -0,0 +1,109 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: ntpa +# REQUIRE: networking +# KEYWORD: shutdown +# +# Add these lines to /etc/rc.conf to enable ntpa: +# +# ntpa_enable (bool): Set to NO by default. +# Set it to YES to enable ntpa. +# ntpa_config (path): Set to %%PREFIX%%/etc/ntpa/ntpa.conf +# by default. +# ntpa_tempdir (path): Set to /tmp by default. +# ntpa_user (user): Set to ntpa by default. +# +# Run additional instances of ntpa with: +# ln -s ntpa ntpa_name +# + +. /etc/rc.subr + +# taken from security/openvpn. +name="$file" ; + +case "$0" in +/etc/rc*) + # during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown), + # so get the name of the script from $_file + name="$_file" + ;; +*/service) + # do not use this as $0 + ;; +*) + name="$0" + ;; +esac + +# default name to "ntpa" if guessing failed +# Trailing semicolon for service(8)'s benefit: +name="${name:-ntpa}" ; +name="${name##*/}" +desc="Monitors NTP daemon" +rcvar=${name}_enable + +start_cmd=ntpa_start +stop_cmd=ntpa_stop +reload_cmd=ntpa_reload + +extra_commands=reload + +load_rc_config ${name} + +eval ": \${${name}_enable:=\"NO\"}" +eval ": \${${name}_config:=\"%%PREFIX%%/etc/ntpa/${name}.conf\"}" +eval ": \${${name}_tempdir:=\"/tmp/\"}" +eval ": \${${name}_user:=\"ntpa\"}" + +config="$(eval echo \${${name}_config})" +tempdir="$(eval echo \${${name}_tempdir})" +ntpauser="$(eval echo \${${name}_user})" + +pid_dir=/var/run/ntpa +pidfile="$pid_dir/${name}.pid" + +ntpa_start() +{ + if [ ! -d "$pid_dir" ]; then + install -m 0775 -g $ntpauser -o $ntpauser -d "$pid_dir" + fi + + if [ -f ${pidfile} ]; then + rc_pid=`cat ${pidfile}` + echo 1>&2 "${name} already running? (pid=$rc_pid)." + return 1 + else + echo "Starting ${name}." + su -m ${ntpauser} -c "sh -c '%%PREFIX%%/sbin/ntpa --config ${config} --writepid ${pidfile} --temp ${tempdir} --daemon ${name} &'" + fi +} + +ntpa_reload() +{ + if [ ! -f ${pidfile} ]; then + _run_rc_notrunning + return 1 + else + echo "Reloading ${name}." + rc_pid=`cat ${pidfile}` + kill -USR1 $rc_pid + fi +} + +ntpa_stop() +{ + if [ ! -f ${pidfile} ]; then + _run_rc_notrunning + return 1 + else + echo "Stopping ${name}." + rc_pid=`cat ${pidfile}` + kill -TERM $rc_pid + wait_for_pids ${rc_pid} + fi +} + +run_rc_command "$1" diff --git a/net/ntpa/pkg-descr b/net/ntpa/pkg-descr new file mode 100644 index 000000000000..aac73979659a --- /dev/null +++ b/net/ntpa/pkg-descr @@ -0,0 +1,8 @@ +NTP Analyzer is a tool dedicated to analyze the operation of time +servers. + +NTP Analyzer works by collecting data from the ntp daemon. Graphs +and web pages can then be generated to visualize the activities of +hosts and peers. + +WWW: https://bitbucket.org/anguist/ntpa diff --git a/net/ntpa/pkg-message b/net/ntpa/pkg-message new file mode 100644 index 000000000000..125c9ba8449b --- /dev/null +++ b/net/ntpa/pkg-message @@ -0,0 +1,9 @@ +ntpa has been installed. +It requires a MySQL or PostgreeSQL user and database configured for it. + +You can do this with the following MySQL commands: + +CREATE DATABASE ntpa; +CREATE USER 'ntpau'@'localhost' IDENTIFIED BY 'password'; +GRANT ALL PRIVILEGES ON ntpa.* TO 'ntpau'@'localhost'; +FLUSH PRIVILEGES; diff --git a/net/ntpa/pkg-plist b/net/ntpa/pkg-plist new file mode 100644 index 000000000000..9a9671bc3693 --- /dev/null +++ b/net/ntpa/pkg-plist @@ -0,0 +1,77 @@ +sbin/ntpa +sbin/ntpac +sbin/ntpav +libexec/ntpa/NPlot.dll +libexec/ntpa/Ntp.Analyzer.Cli.exe +libexec/ntpa/Ntp.Analyzer.Data.dll +libexec/ntpa/Ntp.Analyzer.dll +libexec/ntpa/Ntp.Analyzer.Import.dll +libexec/ntpa/Ntp.Analyzer.Localize.dll +libexec/ntpa/Ntp.Analyzer.Log.dll +libexec/ntpa/Ntp.Analyzer.Objects.dll +libexec/ntpa/Ntp.Analyzer.Process.dll +libexec/ntpa/Ntp.Analyzer.Validate.Cli.exe +libexec/ntpa/Ntp.Common.dll +libexec/ntpa/Ntp.Config.dll +libexec/ntpa/Ntp.Data.dll +libexec/ntpa/Ntp.Data.Provider.dll +libexec/ntpa/Ntp.Interop.dll +libexec/ntpa/Ntp.Monitor.Client.dll +libexec/ntpa/Ntp.Monitor.Cli.exe +libexec/ntpa/Ntp.Monitor.Server.dll +libexec/ntpa/Ntp.Process.dll +%%MYSQL%%libexec/ntpa/MySql.Data.dll +%%PGSQL%%libexec/ntpa/Npgsql.dll +%%PGSQL%%libexec/ntpa/de/Npgsql.resources.dll +%%PGSQL%%libexec/ntpa/es/Npgsql.resources.dll +%%PGSQL%%libexec/ntpa/fi/Npgsql.resources.dll +%%PGSQL%%libexec/ntpa/fr/Npgsql.resources.dll +%%PGSQL%%libexec/ntpa/ja/Npgsql.resources.dll +%%PGSQL%%libexec/ntpa/zh-CN/Npgsql.resources.dll +man/man8/ntpa.8.gz +@sample(,ntpa,640) %%ETCDIR%%/ntpa.conf.sample +@owner www +@group www +%%WWWDIR%%/index.html +%%WWWDIR%%/css/bootstrap.css +%%WWWDIR%%/css/bootstrap.css.map +%%WWWDIR%%/css/bootstrap.min.css +%%WWWDIR%%/css/bootstrap.min.css.map +%%WWWDIR%%/css/bootstrap-theme.css +%%WWWDIR%%/css/bootstrap-theme.css.map +%%WWWDIR%%/css/bootstrap-theme.min.css +%%WWWDIR%%/css/bootstrap-theme.min.css.map +%%WWWDIR%%/css/graph.css +%%WWWDIR%%/css/host.css +%%WWWDIR%%/css/peer.css +%%WWWDIR%%/fonts/glyphicons-halflings-regular.eot +%%WWWDIR%%/fonts/glyphicons-halflings-regular.svg +%%WWWDIR%%/fonts/glyphicons-halflings-regular.ttf +%%WWWDIR%%/fonts/glyphicons-halflings-regular.woff +%%WWWDIR%%/fonts/glyphicons-halflings-regular.woff2 +%%WWWDIR%%/js/bootstrap.js +%%WWWDIR%%/js/bootstrap.min.js +%%WWWDIR%%/js/jquery.js +%%WWWDIR%%/js/jquery.min.js +%%WWWDIR%%/js/jquery.min.map +%%WWWDIR%%/js/npm.js +@owner +@group +%%EXAMPLESDIR%%/ntpa.conf +%%EXAMPLESDIR%%/ntpa.graph.conf +%%EXAMPLESDIR%%/ntpa.inc.conf +%%EXAMPLESDIR%%/ntpa.inc.graphs1 +%%EXAMPLESDIR%%/ntpa.inc.graphs2 +%%EXAMPLESDIR%%/ntpa.inc.menu +%%EXAMPLESDIR%%/ntpa.inc.pages1 +%%EXAMPLESDIR%%/ntpa.inc.pages2 +%%EXAMPLESDIR%%/ntpa.stat2.conf +%%EXAMPLESDIR%%/ntpa.stat.conf +%%EXAMPLESDIR%%/ntpa.web.conf +%%EXAMPLESDIR%%/ntpa.web.small.conf +@dir(www,ntpa,775) %%WWWDIR%% +@dir(www,www,) %%WWWDIR%%/css +@dir(www,www,) %%WWWDIR%%/fonts +@dir(www,www,) %%WWWDIR%%/js +@dir(ntpa,ntpa,750) /var/log/ntpa +@dir(ntpa,ntpa,755) /var/run/ntpa -- cgit v1.2.3