Add collectd
Some checks are pending
continuous-integration/laminar-eldarion Build failed with exit code 123 after 4 seconds

This commit is contained in:
Starbeamrainbowlabs 2021-12-26 14:48:57 +00:00
parent 3deacee46a
commit d11506c302
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
4 changed files with 123 additions and 18 deletions

View file

@ -1,22 +1,23 @@
git collectd
net-tools curl
ddrescue
dnsutils dnsutils
uptimed f3
software-properties-common ffmpeg
git
iftop iftop
iotop iotop
jpegoptim
jq
less
lnav
lsof
netcat
net-tools
openssh-client
optipng
pv pv
screen screen
netcat software-properties-common
f3
less
optipng
jpegoptim
lsof
strace strace
ddrescue uptimed
ffmpeg
lnav
jq
openssh-client
curl

59
src/configs/collectd.conf Normal file
View file

@ -0,0 +1,59 @@
Interval 300
LoadPlugin load
LoadPlugin thermal
LoadPlugin memory
LoadPlugin disk
LoadPlugin swap
LoadPlugin uptime
#LoadPlugin smart
LoadPlugin df
LoadPlugin irq
LoadPlugin contextswitch
LoadPlugin interface
LoadPlugin ping
#LoadPlugin nginx
#LoadPlugin ntpd
LoadPlugin exec
LoadPlugin processes
LoadPlugin network
<Plugin df>
MountPoint "/"
MountPoint "/boot"
</Plugin>
<Plugin interface>
Interface "eth0"
IgnoreSelected false
</Plugin>
<Plugin ping>
Host "elessar.mooncarrot.space"
Host "wopplefox.mooncarrot.space"
Host "ubuntu.mirrors.ovh.net"
#Host "s3-eu-west-1.amazonaws.com"
#Host "github.com"
#Host "api.backblazeb2.com"
</Plugin>
#<Plugin ntpd>
# Host "localhost"
# Port "123"
#</Plugin>
<Plugin processes>
CollectMemoryMaps false
</Plugin>
<Plugin "network">
<Server "5.198.44.45">
SecurityLevel "Encrypt"
Username "|||USERNAME|||"
Password "|||PASSWORD|||"
</Server>
</Plugin>

View file

@ -32,6 +32,10 @@ source "/etc/os-release";
############################################################################### ###############################################################################
rainbow="cat";
if command_exists lolcat; then
rainbow="lolcat";
fi
############################################################################### ###############################################################################
@ -42,6 +46,21 @@ ask_yesno() {
return "$?"; # Not actually needed, but best to be explicit return "$?"; # Not actually needed, but best to be explicit
} }
ask_text() {
local title="$1";
local question="$2";
local default_text="$3";
whiptail --title "${title}" --inputbox "${question}" 10 40 "${default_text}" 3>&1 1>&2 2>&3;
return "$?"; # Not actually needed, but best to be explicit
}
ask_password() {
local title="$1";
local question="$2";
local default_text="$3";
whiptail --title "${title}" --passwordbox "${question}" 10 40 "${default_text}" 3>&1 1>&2 2>&3;
return "$?"; # Not actually needed, but best to be explicit
}
queue_postinstall_step() { queue_postinstall_step() {
local stepname="$1"; local stepname="$1";
@ -124,6 +143,10 @@ if ask_yesno "Add Laminar CI SSH public key to root authorized_keys?"; then
source ./steps-config/80-laminar-ssh.sh; source ./steps-config/80-laminar-ssh.sh;
fi fi
#shellcheck disable=2034
collectd_username="$(ask_text "collectd", "Enter collectd username")";
#shellcheck disable=2034
collectd_password="$(ask_password "collectd" "Enter collectd password")";
### ###
# Autonomous config tasks # Autonomous config tasks
@ -193,5 +216,5 @@ echo "
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██████ ██ ██ ██ ███████ ███████ ██ ███████ ██ ██████ ██████ ██ ██ ██ ███████ ███████ ██ ███████ ██
$(cat /etc/hostname) is now ready for use (you might want to reboot it though) $(cat /etc/hostname) is now ready for use! Please reboot me to ensure everything is working as intended.
"; " | "${rainbow}";

View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
task_begin "Configurating collectd";
subtask_begin "Stopping collectd";
systemctl stop collectd;
subtask_end "$?";
if [[ -r "/etc/collectd/collectd.conf" ]]; then
subtask_begin "Moving existing config file aside";
mv "/etc/collectd/collectd.conf" "/etc/collectd/collectd.conf.bak-$(date +%Y-%m-%d)";
subtask_end "$?";
fi
subtask_begin "Installing configuration file";
#shellcheck disable=SC2154
cat configs/collectd.conf | awk -v "user=${collectd_username}" -v "pass=${collectd_password}" '{ gsub("|||USERNAME|||", user); gsub("|||PASSWORD|||", pass); print }' >/etc/collectd/collectd.conf;
subtask-end "$?";
subtask_begin "Starting collectd & enabling on boot";
systemctl enable --now collectd;
subtask_end "$?";