diff options
-rwxr-xr-x | INSTALL.sh | 14 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | bin-src/httpd.go | 35 | ||||
-rw-r--r-- | cfg/domains.txt | 5 | ||||
-rw-r--r-- | cfg/jarmon-mav.js | 83 | ||||
-rw-r--r-- | cfg/jarmon-proton.js | 143 | ||||
-rw-r--r-- | cfg/jarmon-winston.js | 58 | ||||
-rw-r--r-- | cfg/sockets.txt | 3 | ||||
-rw-r--r-- | public-src/3rd-party/yarn.lock | 2 | ||||
-rw-r--r-- | public-src/main.js | 9 | ||||
-rw-r--r-- | public-src/require.config.js | 2 | ||||
-rw-r--r-- | systemd/dashboard-httpd.service | 6 | ||||
-rw-r--r-- | systemd/dashboard-httpd.socket | 8 |
13 files changed, 178 insertions, 191 deletions
@@ -1,4 +1,14 @@ #!/bin/sh +# 1. Git clone to ~/dashboard (`INSTALL.sh` and `systemd/*.service` assume that path) +# 2. Run `./INSTALL.sh` +# 3. Run `make` +# 4. Go to http://localhost:41198 +# +# 5. (Optional) I set by Firefox homepage to that (configured at +# about:preferences#home), and use +# https://addons.mozilla.org/en-US/firefox/addon/new-tab-override/ +# to have the new-tab-page be my homepage. + set -ex sudo pacman -S --needed -- \ @@ -7,3 +17,7 @@ sudo pacman -S --needed -- \ ruby-sass \ yarn \ wget + +mkdir -p -- ~/.config/systemd/user/ +ln -srf -- ~/dashboard/systemd/* ~/.config/systemd/user/ +systemctl --user enable --now dashboard-daily.timer dashboard-httpd.socket @@ -5,6 +5,7 @@ outs = $(patsubst public-src/%,public/%,\ $(srcs)))) all: $(outs) all: public/3rd-party +all: bin/cron-daily bin/httpd .PHONY: all NET-%: diff --git a/bin-src/httpd.go b/bin-src/httpd.go new file mode 100644 index 0000000..6b653bd --- /dev/null +++ b/bin-src/httpd.go @@ -0,0 +1,35 @@ +package main + +import ( + "errors" + "fmt" + "net" + "net/http" + "os" + "path/filepath" +) + +func mainWithError() error { + listenerFile := os.NewFile(uintptr(3), "listener") + if listenerFile == nil { + return errors.New("FD3 is not open") + } + + listener, err := net.FileListener(listenerFile) + if err != nil { + return err + } + + if err := os.Chdir(filepath.Dir(filepath.Dir(os.Args[0]))); err != nil { + return err + } + + return http.Serve(listener, http.FileServer(http.Dir("public"))) +} + +func main() { + if err := mainWithError(); err != nil { + fmt.Fprintf(os.Stderr, "%s: error: %v\n", os.Args[0], err) + os.Exit(1) + } +} diff --git a/cfg/domains.txt b/cfg/domains.txt index 6d97aac..433fa5e 100644 --- a/cfg/domains.txt +++ b/cfg/domains.txt @@ -3,7 +3,6 @@ parabolagnulinux.org lukeshu.com -andrewdm.me +umorpha.io +mothstuff.lol -getambassador.io -telepresence.io diff --git a/cfg/jarmon-mav.js b/cfg/jarmon-mav.js new file mode 100644 index 0000000..d028753 --- /dev/null +++ b/cfg/jarmon-mav.js @@ -0,0 +1,83 @@ +define(['jarmon'], function(jarmon) { + var srv = 'https://mav.lukeshu.com/collectd/mav.lukeshu.com/' + + var tabRecipes = [ + ['Overview', ['load', 'memory']], + + ['CPU', ['load', 'cpu-0']], + ['Net', ['interface-ens3', 'interface-lo', 'interface-lvpn']], + ]; + + var cpu = function(title, baseUrl) { + return { + title: title, + data: [ + [baseUrl+'cpu-steal.rrd', 0, 'Steal', 'jiffy'], + [baseUrl+'cpu-interrupt.rrd', 0, 'IRQ', 'jiffy'], + [baseUrl+'cpu-softirq.rrd', 0, 'SoftIRQ', 'jiffy'], + [baseUrl+'cpu-system.rrd', 0, 'System', 'jiffy'], + [baseUrl+'cpu-wait.rrd', 0, 'IO', 'jiffy'], + [baseUrl+'cpu-user.rrd', 0, 'User', 'jiffy'], + //[baseUrl+'cpu-nice.rrd', 0, 'Nice', 'jiffy'], + [baseUrl+'cpu-idle.rrd', 0, 'Idle', 'jiffy'], + ], + options: jQuery.extend(true, {}, + jarmon.Chart.BASE_OPTIONS, + jarmon.Chart.STACKED_OPTIONS, + {yaxis: {min: 0, max: 110}}) + }; + }; + + var netIface = function(title, baseUrl) { + return { + title: title, + data: [ + [baseUrl+'if_octets.rrd', 'tx', 'Transmit', 'bit/s', function (v) { return -v*8; }], + [baseUrl+'if_octets.rrd', 'rx', 'Receive', 'bit/s', function (v) { return v*8; }] + ], + options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS) + }; + }; + + var chartRecipes = { + 'cpu-0': cpu("CPU-0 Usage", srv+'cpu-0/'), + + 'interface-ens3': netIface('ens3 Throughput', srv+'interface-ens3/'), + 'interface-lo': netIface('lo Throughput', srv+'interface-lo/'), + 'interface-lvpn': netIface('lvpn Throughput', srv+'interface-lvpn/'), + + 'load': { + title: 'Load Average', + data: [ + [srv+'load/load.rrd', 'shortterm', 'Short Term (1m)', ''], + [srv+'load/load.rrd', 'midterm', 'Medium Term (5m)', ''], + [srv+'load/load.rrd', 'longterm', 'Long Term (15m)', ''] + ], + options: jQuery.extend(true, {}, + jarmon.Chart.BASE_OPTIONS, + {yaxis: {min: 0}}) + }, + + 'memory': { + title: 'Memory', + data: [ + [srv+'memory/memory-used.rrd', 0, 'Used', 'B'], + [srv+'memory/memory-slab_unrecl.rrd', 0, 'Slab', 'B'], + [srv+'memory/memory-slab_recl.rrd', 0, 'Slab (Recl)', 'B'], + [srv+'memory/memory-cached.rrd', 0, 'Cached', 'B'], + [srv+'memory/memory-buffered.rrd', 0, 'Buffered', 'B'], + [srv+'memory/memory-free.rrd', 0, 'Free', 'B'] + ], + options: jQuery.extend(true, {}, + jarmon.Chart.BASE_OPTIONS, + jarmon.Chart.STACKED_OPTIONS) + }, + + }; + + return { + name: 'mav', + chartRecipes, + tabRecipes + }; +}); diff --git a/cfg/jarmon-proton.js b/cfg/jarmon-proton.js deleted file mode 100644 index 28afef2..0000000 --- a/cfg/jarmon-proton.js +++ /dev/null @@ -1,143 +0,0 @@ -/* Copyright (c) Richard Wall - * See LICENSE for details. - * - * Some example recipes for Collectd RRD data - you *will* need to modify this - * based on the RRD data available on your system. - */ -define(['jarmon'], function(jarmon) { - var srv = 'https://proton.parabola.nu/collectd/proton.parabola.nu/' - - var tabRecipes = [ - ['Overview', ['cpu', 'memory', 'swap-use']], - ['Iface', ['interface-inet', 'interface-lvpn', 'interface-lo']], - ['Other', ['load', 'swap-use', 'swap-io', 'users', 'entropy', 'uptime']], - ]; - - var chartRecipes = { - 'cpu': { - title: 'CPU Usage', - data: [ - [srv+'cpu-0/cpu-steal.rrd', 0, 'Steal', 'jiffy'], - [srv+'cpu-0/cpu-interrupt.rrd', 0, 'IRQ', 'jiffy'], - [srv+'cpu-0/cpu-softirq.rrd', 0, 'SoftIRQ', 'jiffy'], - [srv+'cpu-0/cpu-system.rrd', 0, 'System', 'jiffy'], - [srv+'cpu-0/cpu-wait.rrd', 0, 'IO', 'jiffy'], - [srv+'cpu-0/cpu-user.rrd', 0, 'User', 'jiffy'], - //[srv+'cpu-0/cpu-nice.rrd', 0, 'Nice', 'jiffy'], - [srv+'cpu-0/cpu-idle.rrd', 0, 'Idle', 'jiffy'], - ], - options: jQuery.extend(true, {}, - jarmon.Chart.BASE_OPTIONS, - jarmon.Chart.STACKED_OPTIONS, - {yaxis: {min: 0, max: 110}}) - }, - - 'memory': { - title: 'Memory', - data: [ - [srv+'memory/memory-used.rrd', 0, 'Used', 'B'], - [srv+'memory/memory-slab_unrecl.rrd', 0, 'Slab', 'B'], - [srv+'memory/memory-slab_recl.rrd', 0, 'Slab (Recl)', 'B'], - [srv+'memory/memory-cached.rrd', 0, 'Cached', 'B'], - [srv+'memory/memory-buffered.rrd', 0, 'Buffered', 'B'], - [srv+'memory/memory-free.rrd', 0, 'Free', 'B'] - ], - options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS, - jarmon.Chart.STACKED_OPTIONS) - }, - - 'load': { - title: 'Load Average', - data: [ - [srv+'load/load.rrd', 'shortterm', 'Short Term (1m)', ''], - [srv+'load/load.rrd', 'midterm', 'Medium Term (5m)', ''], - [srv+'load/load.rrd', 'longterm', 'Long Term (15m)', ''] - ], - options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS) - }, - - 'interface-inet': { - title: 'ens18 Throughput', - data: [ - [srv+'interface-ens18/if_octets.rrd', 'tx', 'Transmit', 'bit/s', function (v) { return -v*8; }], - [srv+'interface-ens18/if_octets.rrd', 'rx', 'Receive', 'bit/s', function (v) { return v*8; }] - ], - options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS) - }, - - 'interface-lvpn': { - title: 'lvpn Throughput', - data: [ - [srv+'interface-lvpn/if_octets.rrd', 'tx', 'Transmit', 'bit/s', function (v) { return -v*8; }], - [srv+'interface-lvpn/if_octets.rrd', 'rx', 'Receive', 'bit/s', function (v) { return v*8; }] - ], - options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS) - }, - - 'interface-lo': { - title: 'lo Throughput', - data: [ - [srv+'interface-lo/if_octets.rrd', 'tx', 'Transmit', 'bit/s', function (v) { return -v*8; }], - [srv+'interface-lo/if_octets.rrd', 'rx', 'Receive', 'bit/s', function (v) { return v*8; }] - ], - options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS) - }, - - 'entropy': { - title: 'Entropy', - data: [ - [srv+'entropy/entropy.rrd', 0, 'Entropy', 'b'] - ], - options: jQuery.extend(true, {}, - jarmon.Chart.BASE_OPTIONS, - {series: {lines: {fill: 0.5}}}) - }, - - 'users': { - title: 'Users', - data: [ - [srv+'users/users.rrd', 0, 'Users', 'users'] - ], - options: jQuery.extend(true, {}, - jarmon.Chart.BASE_OPTIONS, - {series: {lines: {fill: 0.5}}}) - }, - - 'uptime': { - title: 'Uptime', - data: [ - [srv+'uptime/uptime.rrd', 0, 'Uptime', 'days', function(v) { return v/(60*60*24); }] - ], - options: jQuery.extend(true, {}, - jarmon.Chart.BASE_OPTIONS, - {series: {lines: {fill: 0.5}}}) - }, - - 'swap-use': { - title: 'Swap Usage', - data: [ - [srv+'swap/swap-used.rrd', 0, 'Used', 'B'], - [srv+'swap/swap-cached.rrd', 0, 'Cached', 'B'], - [srv+'swap/swap-free.rrd', 0, 'Free', 'B'] - ], - options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS, - jarmon.Chart.STACKED_OPTIONS) - }, - - 'swap-io': { - title: 'Swap IO', - data: [ - // In pages unless the Swap.ReportBytes option is set - [srv+'swap/swap_io-in.rrd', 0, 'In', 'page'], - [srv+'swap/swap_io-out.rrd', 0, 'Out', 'page'] - ], - options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS) - } - }; - - return { - name: 'proton', - chartRecipes, - tabRecipes, - }; -}); diff --git a/cfg/jarmon-winston.js b/cfg/jarmon-winston.js index 13f7c64..0d36940 100644 --- a/cfg/jarmon-winston.js +++ b/cfg/jarmon-winston.js @@ -1,19 +1,13 @@ -/* Copyright (c) Richard Wall - * See LICENSE for details. - * - * Some example recipes for Collectd RRD data - you *will* need to modify this - * based on the RRD data available on your system. - */ define(['jarmon'], function(jarmon) { var srv = 'https://winston.parabola.nu/collectd/winston.parabola.nu/' var tabRecipes = [ ['Overview', ['load', 'memory', 'swap-use', 'df-vda3', 'df-vda4', 'systemd-units', 'systemd-jobs', 'uptime']], - ['CPU', ['load', 'cpu-0', 'cpu-1', 'cpu-2', 'cpu-3', 'cpu-4', 'cpu-5', 'cpu-6', 'cpu-7', 'uptime']], + ['CPU', ['load', 'cpu-0', 'cpu-1', 'uptime']], ['Disk', ['df-vda3', 'df-vda4', 'uptime']], ['Memory', ['memory', 'swap-use', 'swap-io', 'uptime']], - ['Net', ['interface-eth0', 'interface-lo', 'interface-lvpn', 'uptime']], + ['Net', ['interface-eth0', 'interface-lo', 'interface-lvpn', 'interface-sit0', 'interface-tunnelipv6', 'uptime']], ['Other', ['entropy', 'uptime', 'users', 'uptime']], ]; @@ -38,15 +32,20 @@ define(['jarmon'], function(jarmon) { }; }; + var netIface = function(title, baseUrl) { + return { + title: title, + data: [ + [baseUrl+'if_octets.rrd', 'tx', 'Transmit', 'bit/s', function (v) { return -v*8; }], + [baseUrl+'if_octets.rrd', 'rx', 'Receive', 'bit/s', function (v) { return v*8; }] + ], + options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS) + }; + }; + var chartRecipes = { 'cpu-0': cpu("CPU-0 Usage", srv+'cpu-0/'), 'cpu-1': cpu("CPU-1 Usage", srv+'cpu-1/'), - 'cpu-2': cpu("CPU-2 Usage", srv+'cpu-2/'), - 'cpu-3': cpu("CPU-3 Usage", srv+'cpu-3/'), - 'cpu-4': cpu("CPU-4 Usage", srv+'cpu-4/'), - 'cpu-5': cpu("CPU-5 Usage", srv+'cpu-5/'), - 'cpu-6': cpu("CPU-6 Usage", srv+'cpu-6/'), - 'cpu-7': cpu("CPU-7 Usage", srv+'cpu-7/'), 'df-vda3': { title: "df /dev/vda3", @@ -82,32 +81,11 @@ define(['jarmon'], function(jarmon) { {series: {lines: {fill: 0.5}}}) }, - 'interface-eth0': { - title: 'eth0 Throughput', - data: [ - [srv+'interface-eth0/if_octets.rrd', 'tx', 'Transmit', 'bit/s', function (v) { return -v*8; }], - [srv+'interface-eth0/if_octets.rrd', 'rx', 'Receive', 'bit/s', function (v) { return v*8; }] - ], - options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS) - }, - - 'interface-lo': { - title: 'lo Throughput', - data: [ - [srv+'interface-lo/if_octets.rrd', 'tx', 'Transmit', 'bit/s', function (v) { return -v*8; }], - [srv+'interface-lo/if_octets.rrd', 'rx', 'Receive', 'bit/s', function (v) { return v*8; }] - ], - options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS) - }, - - 'interface-lvpn': { - title: 'lvpn Throughput', - data: [ - [srv+'interface-lvpn/if_octets.rrd', 'tx', 'Transmit', 'bit/s', function (v) { return -v*8; }], - [srv+'interface-lvpn/if_octets.rrd', 'rx', 'Receive', 'bit/s', function (v) { return v*8; }] - ], - options: jQuery.extend(true, {}, jarmon.Chart.BASE_OPTIONS) - }, + 'interface-eth0': netIface('eth0 Throughput', srv+'interface-eth0/'), + 'interface-lo': netIface('lo Throughput', srv+'interface-lo/'), + 'interface-lvpn': netIface('lvpn Throughput', srv+'interface-lvpn/'), + 'interface-sit0': netIface('sit0 Throughput', srv+'interface-sit0/'), + 'interface-tunnelipv6': netIface('tunnelipv6 Throughput', srv+'interface-tunnelipv6/'), 'load': { title: 'Load Average', diff --git a/cfg/sockets.txt b/cfg/sockets.txt index 9e785c1..07dc9d1 100644 --- a/cfg/sockets.txt +++ b/cfg/sockets.txt @@ -1,4 +1,3 @@ -tcp://parabola.nu:5222/xmpp tcp://parabola.nu:587/smtp tcp://winston.parabola.nu:443 @@ -8,5 +7,3 @@ tcp://mav.lukeshu.com:443 #tcp://mav.lukeshu.com:25/smtp tcp://mav.lukeshu.com:587/smtp tcp://mav.lukeshu.com:993 - -tcp://neo.andrewdm.me:443 diff --git a/public-src/3rd-party/yarn.lock b/public-src/3rd-party/yarn.lock index 00f0295..bd3011f 100644 --- a/public-src/3rd-party/yarn.lock +++ b/public-src/3rd-party/yarn.lock @@ -14,7 +14,7 @@ golden-layout@^1.5.9: "jarmon@git://git.lukeshu.com/2git/jarmon#lukeshu/master": version "0.0.0" - resolved "git://git.lukeshu.com/2git/jarmon#2836159a6a67e659e6634cc8d4505829596fc614" + resolved "git://git.lukeshu.com/2git/jarmon#1f15793cd594f533715f96ba90310dbc4a502c51" "javascriptrrd@git://git.lukeshu.com/2git/javascriptrrd#v1.1.1": version "0.0.0" diff --git a/public-src/main.js b/public-src/main.js index a86a815..f084d0b 100644 --- a/public-src/main.js +++ b/public-src/main.js @@ -2,12 +2,14 @@ define([ 'golden-layout', 'jarmon', './cfg/jarmon-winston.js', + './cfg/jarmon-mav.js', './components/gl/jarmon-tabbed-chart-ui.js', './components/gl/html.js', ], function( GoldenLayout, jarmon, cfgWinston, + cfgMav, glJarmon, glHTML, ) { @@ -35,6 +37,13 @@ define([ componentState: cfgWinston, }, { + title: 'mav', + isClosable: false, + type: 'component', + componentName: 'jarmon:tabbed-chart-ui', + componentState: cfgMav, + }, + { title: 'TLS', isClosable: false, type: 'component', diff --git a/public-src/require.config.js b/public-src/require.config.js index ca9cca8..db3a0db 100644 --- a/public-src/require.config.js +++ b/public-src/require.config.js @@ -25,7 +25,7 @@ var require = { "flot/jquery.flot.stack" : { deps: ["flot/jquery.flot"] }, // Jarmon configs "cfg/jarmon-winston": { deps: ["jquery", "jarmon"] }, - "cfg/jarmon-proton": { deps: ["jquery", "jarmon"] }, + "cfg/jarmon-mav": { deps: ["jquery", "jarmon"] }, }, paths: { "flot" : "/3rd-party/yarn/flot", diff --git a/systemd/dashboard-httpd.service b/systemd/dashboard-httpd.service new file mode 100644 index 0000000..17d45fa --- /dev/null +++ b/systemd/dashboard-httpd.service @@ -0,0 +1,6 @@ +[Unit] +Description=Dashboard HTTP server +Requires=dashboard-httpd.socket + +[Service] +ExecStart=/bin/sh -c '~/dashboard/bin/httpd' diff --git a/systemd/dashboard-httpd.socket b/systemd/dashboard-httpd.socket new file mode 100644 index 0000000..e49aac4 --- /dev/null +++ b/systemd/dashboard-httpd.socket @@ -0,0 +1,8 @@ +[Unit] +Description=Dashboard HTTP server + +[Socket] +ListenStream=41198 + +[Install] +WantedBy=sockets.target |