system/smokeping: Added (Network Monitoring).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
a15a7d581d
commit
f6f8b9eca8
|
@ -0,0 +1,92 @@
|
|||
SmokePing is a deluxe latency measurement tool.
|
||||
|
||||
It can measure, store and display latency, latency distribution and
|
||||
packet loss. SmokePing uses RRDtool to maintain a longterm data-store
|
||||
and to draw pretty graphs, giving up to the minute information on the
|
||||
state of each network connection.
|
||||
|
||||
1. Measures latency as well as latency variation.
|
||||
2. Wide variety of probes, ranging from simple ping to web requests and
|
||||
custom protocols.
|
||||
3. Advanced alarm system, triggering on configurable 'latency patterns'.
|
||||
4. Master/slave deployment model to run measurments from multiple
|
||||
sources in parallel.
|
||||
5. Ajax based graph navigation.
|
||||
6. Chart mode, to show the most interesting graphs first
|
||||
7. Plug-able probes, alarms (matchers) and charting function.
|
||||
|
||||
As Smokeping is a web application, installing it is more involved
|
||||
than ordinary slackbuilds.
|
||||
|
||||
0. smokeping needs to run under its own user/group. This has been
|
||||
assigned to
|
||||
the following by SlackBuilds.org, but feel free to change it on your
|
||||
system for consistency with local assignments.
|
||||
User: smokeping UID: 383 GID: 383
|
||||
group: smokeping GID: 383
|
||||
You can change pass alternate values for the user and group using
|
||||
SB_USER, SB_GROUP, SB_UID, SB_GID variables when running the build
|
||||
script.
|
||||
|
||||
1. Most of smokeping is installed into normal system directories.
|
||||
2. The web part is installed into /var/www/htdocs/smokeping/
|
||||
3. You need to configure a web server to serve the web part. This is
|
||||
a reference nginx setup:
|
||||
location /smokeping/ {
|
||||
client_max_body_size 200M;
|
||||
index smokeping.fcgi;
|
||||
chunked_transfer_encoding off;
|
||||
gzip off;
|
||||
location ~ \.fcgi$ {
|
||||
client_max_body_size 200M;
|
||||
fastcgi_intercept_errors on;
|
||||
include /etc/nginx/fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME /srv/http/smokeping/smokeping.fcgi;
|
||||
gzip off;
|
||||
fastcgi_buffering off;
|
||||
chunked_transfer_encoding off;
|
||||
fastcgi_pass unix:/run/smokeping-fcgi.sock;
|
||||
|
||||
}
|
||||
}
|
||||
4. The above setup relies on the fact that smokeping.fcgi is started as
|
||||
a fastcgi service by spawn-fcgi, rc.smokeping does this for you.
|
||||
Nginx, or whatever webserver you are using, must be in the
|
||||
"smokeping" group to
|
||||
access the /run/smokeping-fcgi.sock socket.
|
||||
|
||||
5. Smokeping uses /ect/smokeping/config" as its
|
||||
configuration file.
|
||||
|
||||
6. This build ships a Slackware-style init file /etc/rc.d/rc.smokeping
|
||||
, which
|
||||
is not coming from the package itself. So patches welcome. It is,
|
||||
therefore,
|
||||
shipped as a .new file, because you might want to adjust it.
|
||||
|
||||
7. This build does not ship a slave init file for distributed setups.
|
||||
Patches welcome.
|
||||
|
||||
8. Smokeping has a lot of configuration files, which might tweak its
|
||||
behaviour. Most of these files are installed as .dist, and will be
|
||||
overwritten on update. Ready-to use .conf files are not provided, the
|
||||
user is expected to copy them as needed.
|
||||
|
||||
The list is:
|
||||
/etc/smokeping/basepage.html.dist -- webpage template
|
||||
/etc/smokeping/tmail.dist -- mail report template
|
||||
/etc/smokeping/smokemail.dist -- some other mail template
|
||||
/etc/smokeping/config.dist -- main configuration file
|
||||
/var/www/htdocs/smokeping/smokeping.fcgi.dist -- fcgi template
|
||||
|
||||
9. Smokeping service, _and_ smokeping fcgi service both need access to
|
||||
data files, which are by default in /var/lib/smokeping/.
|
||||
So they both run as the user smokeping.
|
||||
Your webserver should be able to read images from
|
||||
/var/lib/smokeping/images,
|
||||
so you might want to add apache (or whichever user your webserver
|
||||
uses) to the group smokeping.
|
||||
|
||||
10. Verify that fcgi works by
|
||||
/usr/bin/spawn-fcgi -n -u smokeping -s /run/smokeping-fcgi.sock -M 660\
|
||||
-U smokeping -- /var/www/htdocs/smokeping/smokeping.fcgi
|
|
@ -0,0 +1,145 @@
|
|||
#!/bin/bash
|
||||
|
||||
#SMOKEPING_VERSION="2.8.3"
|
||||
SMOKEPING_PIDFILE="/run/smokeping/smokeping.pid"
|
||||
SMOKEPING_USER=@SMOKEPING_USER@
|
||||
SMOKEPING_PATH=@SMOKEPING_PATH@
|
||||
SMOKEPING_CONFIG_PATH=@SMOKEPING_CONFIG_PATH@
|
||||
SMOKEPING_LOG_PATH="/var/log/smokeping.nosyslog.log"
|
||||
|
||||
get_child_pids() {
|
||||
if [[ -z "$1" ]]; then echo "get_child_pids:error: \$1 is empty " 1>&2 ; exit 1 ; fi
|
||||
local parent_pid=$1
|
||||
ps -o pid --no-headers --ppid $parent_pid
|
||||
}
|
||||
|
||||
# Function to recursively get all descendant PIDs
|
||||
get_descendant_pids() {
|
||||
if [[ -z "$1" ]]; then echo "get_descendant_pids:error: \$1 is empty " 1>&2 ; exit 1 ; fi
|
||||
local parent_pid=$1
|
||||
local child_pids=$(get_child_pids $parent_pid)
|
||||
for pid in $child_pids; do
|
||||
echo $pid
|
||||
get_descendant_pids $pid
|
||||
done
|
||||
}
|
||||
|
||||
function start
|
||||
{
|
||||
export LC_ALL=C
|
||||
# no idea why this is required
|
||||
# https://github.com/oetiker/SmokePing/issues/29
|
||||
cd /var/lib/smokeping
|
||||
|
||||
mkdir -p /run/smokeping/
|
||||
chown $SMOKEPING_USER /run/smokeping/
|
||||
|
||||
touch "$SMOKEPING_LOG_PATH"
|
||||
chown $SMOKEPING_USER "$SMOKEPING_LOG_PATH"
|
||||
|
||||
if [[ -e $SMOKEPING_PIDFILE && ( "" == "$(cat $SMOKEPING_PIDFILE)" ) ]]
|
||||
then
|
||||
printf "Pid file is empty: %s\n" "$SMOKEPING_PIDFILE" 1>&2
|
||||
elif [[ -e $SMOKEPING_PIDFILE && ( "" != "$(cat $SMOKEPING_PIDFILE)" ) ]]
|
||||
then
|
||||
PID=$(cat "$SMOKEPING_PIDFILE")
|
||||
printf "PID=%s\n" "$PID"
|
||||
if ps --pid "$PID"
|
||||
then
|
||||
printf "Smokeping already running with pid %d.\n" "$PID" 1>&2
|
||||
return 1
|
||||
else
|
||||
printf "You have bogus pid file!\n" 1>&2
|
||||
rm "$SMOKEPING_PIDFILE"
|
||||
fi
|
||||
fi
|
||||
|
||||
/sbin/setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/sbin/fping
|
||||
if ! su smokeping -s/bin/sh -c "$SMOKEPING_PATH --config=$SMOKEPING_CONFIG_PATH --logfile=$SMOKEPING_LOG_PATH"
|
||||
then
|
||||
printf "Smokeping failed to start!\n" 1>&2
|
||||
return 2
|
||||
fi
|
||||
|
||||
if [[ ! -e $SMOKEPING_PIDFILE ]]
|
||||
then
|
||||
printf "Smokeping pidfile missing!\n" 1>&2
|
||||
return 3
|
||||
elif [[ "" == $(cat $SMOKEPING_PIDFILE | tr -d '\n' ) ]]
|
||||
then
|
||||
printf "Pid file %s empty.\n" $(cat $SMOKEPING_PIDFILE) 1>&2
|
||||
else
|
||||
PID=$(cat "$SMOKEPING_PIDFILE")
|
||||
if ps --pid "$PID"
|
||||
then
|
||||
:
|
||||
else
|
||||
printf "Smokeping created pidfile, but is not running!\n" 1>&2
|
||||
return 4
|
||||
fi
|
||||
fi
|
||||
rm -f /run/smokeping-fcgi.sock
|
||||
/usr/bin/spawn-fcgi -u $SMOKEPING_USER -s /run/smokeping-fcgi.sock -M 660 -U $SMOKEPING_USER -- /var/www/htdocs/smokeping/smokeping.fcgi
|
||||
return 0
|
||||
}
|
||||
|
||||
function stop()
|
||||
{
|
||||
if [[ ! -e "$SMOKEPING_PIDFILE" ]]; then
|
||||
printf "Pid file %s does not exist!\n" "$SMOKEPING_PIDFILE"
|
||||
return 6
|
||||
elif [[ "" == "$(cat "$SMOKEPING_PIDFILE")" ]] ; then
|
||||
printf "Pid file %s empty!\n" "$SMOKEPING_PIDFILE"
|
||||
return 6
|
||||
fi
|
||||
child_pids=$(get_descendant_pids $(cat "$SMOKEPING_PIDFILE"))
|
||||
printf "Full pid list (smokeping+children):%s\n" "$(cat "$SMOKEPING_PIDFILE") $child_pids"
|
||||
/bin/kill --timeout 3000 TERM --timeout 1000 KILL --signal QUIT $(cat "$SMOKEPING_PIDFILE") $child_pids
|
||||
|
||||
rm -f "$SMOKEPING_PIDFILE"
|
||||
|
||||
if pgrep -f 'bin/smokeping ' -la >/dev/null 2>&1 # the space is important
|
||||
then
|
||||
printf "Killing smokeping failed!\n" 1>&2
|
||||
pgrep -f 'bin/smokeping' -la
|
||||
fi
|
||||
/bin/kill --timeout 3000 TERM --timeout 1000 KILL --signal QUIT $(/usr/sbin/ss -f unix -l -p | grep /run/smokeping-fcgi.sock | sed -E 's/.*pid=([[:digit:]]+),.*/\1/g')
|
||||
rm /run/smokeping-fcgi.sock
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
printf "case up\n"
|
||||
start
|
||||
exit "$?"
|
||||
;;
|
||||
stop)
|
||||
printf "case down\n"
|
||||
stop
|
||||
exit "$?"
|
||||
;;
|
||||
status)
|
||||
if [[ -e "$SMOKEPING_PIDFILE" && "" != $(cat "$SMOKEPING_PIDFILE") ]] ; then
|
||||
pstree -s -p $(cat "$SMOKEPING_PIDFILE")
|
||||
else
|
||||
printf "smokeping is not running or not running from this service.\n"
|
||||
fi
|
||||
cgi_pid=$(/usr/sbin/ss -f unix -l -p | grep /run/smokeping-fcgi.sock | sed -E 's/.*pid=([[:digit:]]+),.*/\1/g' 2>/dev/null)
|
||||
if [[ "" == "$cgi_pid" ]] ; then
|
||||
printf "smokeping_cgi is not running or not running from this service.\n"
|
||||
else
|
||||
pstree -s -p "$cgi_pid"
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
if ! stop
|
||||
then
|
||||
exit "$?"
|
||||
fi
|
||||
if ! start
|
||||
then
|
||||
exit "$?"
|
||||
fi
|
||||
;;
|
||||
*) printf "usage: {up,down,restart,status}\n"
|
||||
esac
|
|
@ -0,0 +1,125 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
get_child_pids() {
|
||||
if [[ -z "$1" ]]; then echo "get_child_pids:error: \$1 is empty " 1>&2 ; exit 1 ; fi
|
||||
local parent_pid=$1
|
||||
ps -o pid --no-headers --ppid $parent_pid
|
||||
}
|
||||
|
||||
# Function to recursively get all descendant PIDs
|
||||
get_descendant_pids() {
|
||||
if [[ -z "$1" ]]; then echo "get_descendant_pids:error: \$1 is empty " 1>&2 ; exit 1 ; fi
|
||||
local parent_pid=$1
|
||||
local child_pids=$(get_child_pids $parent_pid)
|
||||
for pid in $child_pids; do
|
||||
echo $pid
|
||||
get_descendant_pids $pid
|
||||
done
|
||||
}
|
||||
|
||||
export LC_ALL=C
|
||||
function qnd_waitpid()
|
||||
(
|
||||
while ps -p $1 &> /dev/null
|
||||
do
|
||||
sleep 5
|
||||
done
|
||||
)
|
||||
cd /tmp
|
||||
|
||||
source /etc/smokeping/slave_config.conf || { printf "/etc/smokeping/slave_config.conf not found\n" ; exit 1; }
|
||||
LOGFILE=${LOGFILE:-/var/log/smokeping-slave.log}
|
||||
CACHEDIR=${CACHEDIR:-/var/lib/smokeping/slave-cache}
|
||||
SLAVE_SECRET_PATH=${SLAVE_SECRET_PATH:-/etc/smokeping/slave_secret.conf}
|
||||
SMOKEPING_USER=${SMOKEPING_USER:-smokeping}
|
||||
if [[ "$MASTER_URL" == "" ]] ; then
|
||||
printf "Set MASTER_URL= in /etc/smokeping/slave_config.conf\n"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -e "$SLAVE_SECRET_PATH" ]] ; then
|
||||
printf "set SLAVE_SECRET_PATH in /etc/smokeping/slave_config.conf\n"
|
||||
fi
|
||||
chmod a-rwx "$SLAVE_SECRET_PATH"
|
||||
SMOKEPING_PIDFILE=/run/smokeping-slave.pid
|
||||
|
||||
|
||||
start()
|
||||
{
|
||||
cd /var/lib/smokeping/
|
||||
|
||||
mkdir -p "$CACHEDIR"
|
||||
chown $SMOKEPING_USER $CACHEDIR
|
||||
|
||||
touch "$LOGFILE"
|
||||
chown $SMOKEPING_USER "$LOGFILE"
|
||||
|
||||
while true
|
||||
do
|
||||
/sbin/setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/sbin/fping
|
||||
printf "\nStarting smokeping: %s\n" "$(date +'%Y-%m-%dT%H:%M:%S')" >> "$LOGFILE"
|
||||
unset LC_ALL
|
||||
unset LC_COLLATE
|
||||
rm -rf "$CACHEDIR"/*.cache
|
||||
printf '\nMONITOR:%s New process\n' $(date +'%Y-%m-%dT%H:%M:%S') >> $LOGFILE
|
||||
|
||||
/bin/su $SMOKEPING_USER -s/bin/bash -c "\
|
||||
/usr/bin/smokeping \
|
||||
--nodaemon \
|
||||
--master-url=$MASTER_URL\
|
||||
--cache-dir=$CACHEDIR \
|
||||
--shared-secret=$SLAVE_SECRET_PATH \
|
||||
--logfile=$LOGFILE &>> $LOGFILE"
|
||||
sync
|
||||
sleep 1
|
||||
# qnd_waitpid $(cat "$CACHEDIR"/smokeping.pid)
|
||||
printf "MONITOR:Smokeping died: %s\n" "$(date +'%Y-%m-%dT%H:%M:%S')" | tee "$LOGFILE"
|
||||
sleep 5
|
||||
done & >/dev/null 2>&1
|
||||
WRAPPER_PID=$!
|
||||
echo "$WRAPPER_PID" > /run/smokeping-slave.pid
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
printf "Killing smokeping slave.\n"
|
||||
|
||||
child_pids=$(get_descendant_pids $(cat "$SMOKEPING_PIDFILE"))
|
||||
|
||||
printf "PIDS=%s" "$(cat "$SMOKEPING_PIDFILE") $child_pids"
|
||||
/bin/kill --timeout 3000 TERM --timeout 1000 KILL --signal QUIT $(cat "$SMOKEPING_PIDFILE") $child_pids
|
||||
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
printf "case up\n"
|
||||
start
|
||||
exit "$?"
|
||||
;;
|
||||
stop)
|
||||
printf "case down\n"
|
||||
stop
|
||||
exit "$?"
|
||||
;;
|
||||
status)
|
||||
if [[ -e "$SMOKEPING_PIDFILE" && "" != $(cat "$SMOKEPING_PIDFILE") ]] ; then
|
||||
pstree -s -p $(cat "$SMOKEPING_PIDFILE")
|
||||
else
|
||||
printf "smokeping slave is not running or not running from this service.\n"
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
if ! stop
|
||||
then
|
||||
exit "$?"
|
||||
fi
|
||||
if ! start
|
||||
then
|
||||
exit "$?"
|
||||
fi
|
||||
;;
|
||||
*) printf "usage: {up,down,restart,status}\n"
|
||||
esac
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description. Line
|
||||
# up the first '|' above the ':' following the base package name, and the '|'
|
||||
# on the right side marks the last column you can put a character in. You must
|
||||
# make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':'.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
smokeping: smokeping (the father of all monitoring systems)
|
||||
smokeping:
|
||||
smokeping: Smokeping is the first available systems and network monitoring
|
||||
smokeping: system. Its logic is very simple: ping a machine from the list, and
|
||||
smokeping: record response time into a database. Display the graphs on a
|
||||
smokeping: webpage.
|
||||
smokeping: Most modern monitoring systems, such as Prometheus, learned from
|
||||
smokeping: smokeping's experience, and many reuse its components, such as fping
|
||||
smokeping: and rrdtool.
|
||||
smokeping:
|
||||
smokeping:
|
|
@ -0,0 +1,26 @@
|
|||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 1dc34c7..8c00ec5 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
-SUBDIRS = lib thirdparty bin doc etc htdocs
|
||||
+SUBDIRS = lib bin doc etc htdocs
|
||||
|
||||
EXTRA_DIST = COPYRIGHT CHANGES CONTRIBUTORS LICENSE cpanfile VERSION README.md
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 33b75c5..4ce4a12 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -140,7 +140,7 @@ NOTES
|
||||
exit 1
|
||||
fi
|
||||
|
||||
-AC_CONFIG_FILES([Makefile bin/Makefile doc/Makefile htdocs/Makefile etc/Makefile lib/Makefile thirdparty/Makefile etc/config.dist])
|
||||
+AC_CONFIG_FILES([Makefile bin/Makefile doc/Makefile htdocs/Makefile etc/Makefile lib/Makefile etc/config.dist])
|
||||
|
||||
AC_SUBST(VERSION)
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
diff --git a/bin/smokeinfo b/bin/smokeinfo
|
||||
index 2b38b86..ff96674 100755
|
||||
--- a/bin/smokeinfo
|
||||
+++ b/bin/smokeinfo
|
||||
@@ -2,8 +2,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
-use lib (split /:/, q{}); # PERL5LIB
|
||||
-use FindBin;use lib "$FindBin::RealBin/../lib";use lib "$FindBin::RealBin/../thirdparty/lib/perl5"; # LIBDIR
|
||||
+use lib qw(/usr/share/perl5);
|
||||
|
||||
use Smokeping::Info;
|
||||
use Getopt::Long 2.25 qw(:config no_ignore_case);
|
||||
diff --git a/bin/smokeping b/bin/smokeping
|
||||
index 1dae42a..550beb5 100755
|
||||
--- a/bin/smokeping
|
||||
+++ b/bin/smokeping
|
||||
@@ -4,13 +4,10 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
-use FindBin;
|
||||
-use lib (split /:/, q{}); # PERL5LIB
|
||||
-use lib "$FindBin::RealBin/../lib";use lib "$FindBin::RealBin/../thirdparty/lib/perl5"; # LIBDIR
|
||||
-
|
||||
+use lib qw(/usr/share/perl5);
|
||||
use Smokeping;
|
||||
|
||||
-Smokeping::main("$FindBin::RealBin/../etc/config");
|
||||
+Smokeping::main("/etc/smokeping/config");
|
||||
|
||||
=head1 NAME
|
||||
|
||||
diff --git a/bin/smokeping_cgi b/bin/smokeping_cgi
|
||||
index 610118c..9a995c1 100755
|
||||
--- a/bin/smokeping_cgi
|
||||
+++ b/bin/smokeping_cgi
|
||||
@@ -4,9 +4,7 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
-use FindBin;
|
||||
-use lib (split /:/, q{}); # PERL5LIB
|
||||
-use lib "$FindBin::RealBin/../lib";use lib "$FindBin::RealBin/../thirdparty/lib/perl5"; # LIBDIR
|
||||
+use lib qw(/usr/share/perl5);
|
||||
|
||||
# don't bother with zombies
|
||||
$SIG{CHLD} = 'IGNORE';
|
||||
@@ -17,7 +15,7 @@ use Smokeping;
|
||||
|
||||
use CGI::Fast;
|
||||
|
||||
-my $cfg = (shift @ARGV) || "$FindBin::Bin/../etc/config";
|
||||
+my $cfg = (shift @ARGV) || "/etc/smokeping/config";
|
||||
|
||||
|
||||
while (my $q = new CGI::Fast) {
|
||||
diff --git a/bin/tSmoke b/bin/tSmoke
|
||||
index 6b56479..db9ef92 100755
|
||||
--- a/bin/tSmoke
|
||||
+++ b/bin/tSmoke
|
||||
@@ -52,9 +52,7 @@ use warnings;
|
||||
#
|
||||
# Point the lib variables to your implementation
|
||||
|
||||
-use lib (split /:/, q{}); # PERL5LIB
|
||||
-use FindBin;use lib "$FindBin::RealBin/../lib";use lib "$FindBin::RealBin/../thirdparty/lib/perl5"; # LIBDIR
|
||||
-
|
||||
+use lib qw(/usr/share/perl5);
|
||||
|
||||
use Smokeping;
|
||||
use Net::SMTP;
|
||||
@@ -63,7 +61,7 @@ use Pod::Usage;
|
||||
use RRDs;
|
||||
|
||||
# Point to your Smokeping config file
|
||||
-my $cfgfile = (shift @ARGV) || "$FindBin::Bin/../etc/config";
|
||||
+my $cfgfile = "/etc/smokeping/config";
|
||||
|
||||
# global variables
|
||||
my $cfg;
|
||||
diff --git a/lib/Makefile.am b/lib/Makefile.am
|
||||
index 2209134..ab09330 100644
|
||||
--- a/lib/Makefile.am
|
||||
+++ b/lib/Makefile.am
|
||||
@@ -31,5 +31,5 @@ MATCH := $(wildcard Smokeping/matchers/*.pm)
|
||||
|
||||
EXTRA_DIST = $(PM) $(SP) $(SORT) $(PROBE) $(MATCH)
|
||||
|
||||
-perllibdir = $(prefix)/lib
|
||||
+perllibdir = $(prefix)/share/perl5
|
||||
nobase_perllib_DATA = $(EXTRA_DIST)
|
|
@ -0,0 +1,135 @@
|
|||
diff --git a/etc/config.dist.in b/etc/config.dist.in
|
||||
index 8b9fdf3..b6f6180 100644
|
||||
--- a/etc/config.dist.in
|
||||
+++ b/etc/config.dist.in
|
||||
@@ -1,19 +1,19 @@
|
||||
*** General ***
|
||||
|
||||
-owner = Peter Random
|
||||
-contact = some@address.nowhere
|
||||
+owner = Super User
|
||||
+contact = root@localhost
|
||||
mailhost = my.mail.host
|
||||
-sendmail = @SENDMAIL@
|
||||
+sendmail = /usr/sbin/sendmail
|
||||
# NOTE: do not put the Image Cache below cgi-bin
|
||||
# since all files under cgi-bin will be executed ... this is not
|
||||
# good for images.
|
||||
-imgcache = @prefix@/cache
|
||||
-imgurl = cache
|
||||
-datadir = @prefix@/data
|
||||
-piddir = @prefix@/var
|
||||
-cgiurl = http://some.url/smokeping.cgi
|
||||
-smokemail = @prefix@/etc/smokemail.dist
|
||||
-tmail = @prefix@/etc/tmail.dist
|
||||
+imgcache = /var/lib/smokeping/imgcache
|
||||
+imgurl = /smokeping/images
|
||||
+datadir = /var/lib/smokeping
|
||||
+piddir = /run/smokeping/
|
||||
+cgiurl = http://localhost/smokeping/sm.cgi
|
||||
+smokemail = /etc/smokeping/smokemail
|
||||
+tmail = /etc/smokeping/tmail
|
||||
# specify this to get syslog logging
|
||||
syslogfacility = local0
|
||||
# each probe is now run in its own process
|
||||
@@ -21,8 +21,8 @@ syslogfacility = local0
|
||||
# concurrentprobes = no
|
||||
|
||||
*** Alerts ***
|
||||
-to = alertee@address.somewhere
|
||||
-from = smokealert@company.xy
|
||||
+to = root@localhost
|
||||
+from = root@localhost
|
||||
|
||||
+someloss
|
||||
type = loss
|
||||
@@ -47,7 +47,7 @@ AVERAGE 0.5 144 720
|
||||
|
||||
*** Presentation ***
|
||||
|
||||
-template = @prefix@/etc/basepage.html.dist
|
||||
+template = /etc/smokeping/basepage.html
|
||||
htmltitle = yes
|
||||
graphborders = no
|
||||
|
||||
@@ -110,7 +110,7 @@ unison_tolerance = 2
|
||||
binary = /usr/sbin/fping
|
||||
|
||||
*** Slaves ***
|
||||
-secrets=@prefix@/etc/smokeping_secrets.dist
|
||||
+secrets=/etc/smokeping/smokeping_secrets
|
||||
+boomer
|
||||
display_name=boomer
|
||||
color=0000ff
|
||||
@@ -121,28 +121,57 @@ color=00ff00
|
||||
|
||||
*** Targets ***
|
||||
|
||||
+#menuextra = <a target='_blank' href='/smokeping/tr.html{HOST}' class='{CLASS}' \
|
||||
+# onclick="window.open(this.href,this.target, \
|
||||
+# 'width=800,height=500,toolbar=no,location=no,status=no,scrollbars=no'); \
|
||||
+# return false;">*</a>
|
||||
+#
|
||||
probe = FPing
|
||||
|
||||
menu = Top
|
||||
title = Network Latency Grapher
|
||||
-remark = Welcome to the SmokePing website of xxx Company. \
|
||||
+remark = Welcome to the SmokePing website of <b>Insert Company Name Here</b>. \
|
||||
Here you will learn all about the latency of our network.
|
||||
|
||||
-+ Test
|
||||
-menu= Targets
|
||||
-#parents = owner:/Test/James location:/
|
||||
++ Ping
|
||||
|
||||
-++ James
|
||||
+menu = Alpine
|
||||
+title = Alpine Pings
|
||||
|
||||
-menu = James
|
||||
-title =James
|
||||
-alerts = someloss
|
||||
-slaves = boomer slave2
|
||||
-host = james.address
|
||||
+++ AlpinelinuxOrg
|
||||
|
||||
-++ MultiHost
|
||||
+menu = alpinelinux.org
|
||||
+title = Alpine Linux Webserver
|
||||
+host = alpinelinux.org
|
||||
|
||||
-menu = Multihost
|
||||
-title = James and James as seen from Boomer
|
||||
-host = /Test/James /Test/James~boomer
|
||||
+++ DocsAlpinelinuxOrg
|
||||
+
|
||||
+menu = docs.alpinelinux.org
|
||||
+title = Alpine Linux Docs Webserver
|
||||
+host = docs.alpinelinux.org
|
||||
+
|
||||
+++ PkgsAlpinelinuxOrg
|
||||
+
|
||||
+menu = pkgs.alpinelinux.org
|
||||
+title = Alpine Linux Packages
|
||||
+host = pkgs.alpinelinux.org
|
||||
+
|
||||
+#
|
||||
+# Lots of more options are available, please have a look in the included documentation.
|
||||
+#
|
||||
+
|
||||
+
|
||||
+#++ James
|
||||
+
|
||||
+#menu = James
|
||||
+#title =James
|
||||
+#alerts = someloss
|
||||
+#slaves = boomer slave2
|
||||
+#host = james.address
|
||||
+
|
||||
+#++ MultiHost
|
||||
+
|
||||
+#menu = Multihost
|
||||
+#title = James and James as seen from Boomer
|
||||
+#host = /Test/James /Test/James~boomer
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright Lockywolf, lockywolf gmail.com
|
||||
# Based on the work of Patrick J. Volkerding
|
||||
#
|
||||
# Redistribution and use of this script, with or without modification, is
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of this script must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
cd $(dirname $0) ; CWD=$(pwd)
|
||||
|
||||
PRGNAM=smokeping
|
||||
VERSION=${VERSION:-2.8.2}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
PKGTYPE=${PKGTYPE:-tgz}
|
||||
|
||||
ARCH=${ARCH:-}
|
||||
if [ -z "$ARCH" ]; then
|
||||
case "$( uname -m )" in
|
||||
i?86) export ARCH=i586 ;;
|
||||
arm*) export ARCH=arm ;;
|
||||
*) export ARCH=$( uname -m ) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
PRINT_PACKAGE_NAME=${PRINT_PACKAGE_NAME:-}
|
||||
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
||||
echo "$PRGNAM-$VERSION-$ARCH-$BUILD.txz"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
if [ "$ARCH" = "i586" ]; then
|
||||
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "i686" ]; then
|
||||
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
SLKCFLAGS="-O0 -fPIC -ggdb"
|
||||
LIBDIRSUFFIX="64"
|
||||
else
|
||||
SLKCFLAGS="-O2"
|
||||
LIBDIRSUFFIX=""
|
||||
fi
|
||||
|
||||
SB_UID=${MUID:-383}
|
||||
SB_GID=${MGID:-383}
|
||||
SB_USER=${NTOPUSER:-smokeping}
|
||||
SB_GROUP=${NTOPGROUP:-smokeping}
|
||||
|
||||
if ! getent group $SB_GROUP 2>&1 > /dev/null; then
|
||||
echo " You must have an $SB_GROUP group to run this script."
|
||||
echo " # groupadd -g $SB_GID $PRGNAM"
|
||||
exit 1
|
||||
elif ! getent passwd $SB_USER 2>&1 > /dev/null; then
|
||||
echo " You must have a $SB_USER user to run this script."
|
||||
echo " # useradd -u $SB_UID -g $SB_GID -d /var/lib/$PRGNAM $SB_USER"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf $PKG
|
||||
mkdir -p $TMP $PKG $OUTPUT
|
||||
|
||||
cd $TMP
|
||||
rm -rf $PRGNAM-$VERSION
|
||||
tar xvf $CWD/$PRGNAM-$VERSION.tar.?z* || exit 1
|
||||
cd $PRGNAM-$VERSION || exit 1
|
||||
|
||||
|
||||
chown -R root:root .
|
||||
find . \
|
||||
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
||||
-exec chmod 755 {} \; -o \
|
||||
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
||||
-exec chmod 644 {} \;
|
||||
|
||||
|
||||
|
||||
mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}
|
||||
|
||||
|
||||
patch -p1 < $CWD/smokeping-2.8.2-no-3rd-party.patch
|
||||
patch -p1 < $CWD/smokeping-2.8.2-paths.patch
|
||||
patch -p1 < $CWD/smokeping-config.patch
|
||||
|
||||
rm -rf configure
|
||||
sed -i "s|\$(distdir)/lib|\$(distdir)/lib${LIBDIRSUFFIX}|g" Makefile.am
|
||||
sed -i "s|perllibdir = \$(prefix)/lib|perllibdir = \$(prefix)/share/perl5|g" ./lib/Makefile.am
|
||||
autoreconf -i
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
#PERL5LIB=/usr/share/perl5/ \
|
||||
CFLAGS="$SLKCFLAGS" \
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--with-htdocs-dir=/var/www/htdocs/smokeping \
|
||||
--mandir=/usr/man \
|
||||
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
||||
--sysconfdir=/etc/$PRGNAM \
|
||||
--localstatedir=/var/ \
|
||||
--docdir=/usr/doc/$PRGNAM-$VERSION
|
||||
#mkdir -p thirdparty/lib/perl5/removeme
|
||||
rm -rf thirdparty/CPAN
|
||||
mkdir thirdparty/CPAN
|
||||
touch cpanfile "thirdparty/cpanfile-$(perl -MConfig -e 'my $v =$Config{version}; $v =~ s/.\d+$//;print $v;').snapshot"
|
||||
touch thirdparty/touch thirdparty/CPAN/touch
|
||||
|
||||
DESTDIR=$PKG gmake || exit 1
|
||||
gmake DESTDIR=$PKG install || exit 1
|
||||
|
||||
#rmdir $PKG/usr/lib${LIBDIRSUFFIX}/removeme/
|
||||
|
||||
mkdir -p $PKG/etc/rc.d/
|
||||
|
||||
cat $CWD/rc.smokeping > $PKG/etc/rc.d/rc.smokeping.template
|
||||
sed -i "s/@SMOKEPING_USER@/$SB_USER/g" $PKG/etc/rc.d/rc.smokeping.template
|
||||
sed -i "s|@SMOKEPING_PATH@|/usr/bin/smokeping|g" $PKG/etc/rc.d/rc.smokeping.template
|
||||
sed -i "s|@SMOKEPING_GROUP@|$SB_GROUP|g" $PKG/etc/rc.d/rc.smokeping.template
|
||||
sed -i "s|@SMOKEPING_CONFIG_PATH@|/etc/smokeping/config|g" $PKG/etc/rc.d/rc.smokeping.template
|
||||
#mv $CWD/rc.smokeping.template > $PKG/etc/rc.d/rc.smokeping.new
|
||||
mv $PKG/etc/rc.d/rc.smokeping.template $PKG/etc/rc.d/rc.smokeping
|
||||
chmod +x $PKG/etc/rc.d/rc.smokeping
|
||||
cat $CWD/rc.smokeping-slave > $PKG/etc/rc.d/rc.smokeping-slave
|
||||
chmod +x $PKG/etc/rc.d/rc.smokeping-slave
|
||||
|
||||
install -d -m 755 -o smokeping -g smokeping $PKG/var/lib/$PRGNAM
|
||||
install -d -m 755 -o smokeping -g smokeping $PKG/var/lib/$PRGNAM/data
|
||||
install -d -m 755 -o smokeping -g smokeping $PKG/var/lib/$PRGNAM/imgcache
|
||||
ln -sf /var/lib/$PRGNAM/imgcache ${PKG}/var/www/htdocs/${PRGNAM}/images
|
||||
|
||||
|
||||
#mkdir -p $PKG/opt/${PRGNAM}-${VERSION}/data
|
||||
#mkdir -p $PKG/opt/${PRGNAM}-${VERSION}/var
|
||||
#mkdir -p $PKG/opt/${PRGNAM}-${VERSION}/imgcache
|
||||
|
||||
#chown -R apache:apache $PKG/opt/${PRGNAM}-${VERSION}/{data,var,imgcache}
|
||||
|
||||
#ln -s smokeping.fcgi.dist ${PKG}/var/www/htdocs/${PRGNAM}/smokeping.fcgi
|
||||
#ln -s /opt/${PRGNAM}-${VERSION}/imgcache ${PKG}/var/www/htdocs/${PRGNAM}/imgcache
|
||||
|
||||
find $PKG/usr/man -type f -exec gzip -9 {} \;
|
||||
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
||||
|
||||
mkdir -p $PKG/usr/doc/${PRGNAM}-$VERSION
|
||||
cp -a \
|
||||
CHANGES COPYRIGHT README.md VERSION \
|
||||
CONTRIBUTORS LICENSE TODO \
|
||||
$PKG/usr/doc/${PRGNAM}-$VERSION
|
||||
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
||||
cat "$CWD"/README > $PKG/usr/doc/$PRGNAM-$VERSION/README.sbo
|
||||
|
||||
cat > $PKG/usr/doc/${PRGNAM}-$VERSION/dothtaccess <<"END"
|
||||
Options +ExecCGI
|
||||
Options +FollowSymlinks
|
||||
AddHandler cgi-script .fcgi
|
||||
AddHandler cgi-script .dist
|
||||
DirectoryIndex smokeping.fcgi
|
||||
END
|
||||
mkdir -p $PKG/install
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|
|
@ -0,0 +1,10 @@
|
|||
PRGNAM="smokeping"
|
||||
VERSION="2.8.2"
|
||||
HOMEPAGE="https://oss.oetiker.ch/smokeping/"
|
||||
DOWNLOAD="https://oss.oetiker.ch/smokeping/pub/smokeping-2.8.2.tar.gz"
|
||||
MD5SUM="cce2bf3f59736ecf77e59d64db60e3fb"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES="rrdtool fping spawn-fcgi perl-CGI perl-CGI-Fast perl-Config-Grammar perl-digest-hmac libwww-perl"
|
||||
MAINTAINER="Lockywolf"
|
||||
EMAIL="for_sbo.smokeping_2023-11-24@lockywolf.net"
|
Loading…
Reference in New Issue