Last active
May 25, 2023 17:13
-
-
Save KokoseiJ/1837ba17c954465575364a606fcc8d11 to your computer and use it in GitHub Desktop.
Simple sensord setup with Lighttpd for CGI monitoring utilization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server.modules=("mod_cgi") | |
server.breakagelog="/var/log/cgi_error.log" | |
server.document-root="/tmp/www" | |
server.port=1727 | |
cgi.assign=(".cgi"=>"") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description="Lighttpd service" | |
Wants=sensord.service | |
[Service] | |
Type=simple | |
ExecStart=/etc/templogging/lighttpd/lighttpd -D -m /etc/templogging/lighttpd/libs -f /etc/templogging/lighttpd.conf | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mkdir -p /tmp/www/sensord | |
sensord -a -r /var/log/sensord.rrd -g /tmp/www/sensord | tee /tmp/www/sensord.cgi | |
chmod +x /tmp/www/sensord.cgi | |
ln -s /var/log/sensord.rrd /tmp/www/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description="Sensord Daemon for Temperature Logging" | |
[Service] | |
Type=forking | |
PIDFile=/var/run/sensord.pid | |
ExecStart=sensord -a -r /var/log/sensord.rrd | |
ExecStartPre=/etc/templogging/pre_start.sh | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p /etc/templogging | |
tee /etc/templogging/pre_start.sh <<EOF | |
#!/bin/sh | |
mkdir -p /tmp/www/sensord | |
sensord -a -r /var/log/sensord.rrd -g /tmp/www/sensord | tee /tmp/www/sensord.cgi | |
chmod +x /tmp/www/sensord.cgi | |
rm -rf /tmp/www/sensord.rrd | |
ln -s /var/log/sensord.rrd /tmp/www/sensord.rrd | |
EOF | |
chmod +x /etc/templogging/pre_start.sh | |
tee /etc/templogging/lighttpd.conf <<EOF | |
server.modules=("mod_cgi") | |
server.breakagelog="/var/log/cgi_error.log" | |
server.document-root="/tmp/www" | |
server.port=1727 | |
cgi.assign=(".cgi"=>"") | |
EOF | |
tee /etc/systemd/system/sensord.service <<EOF | |
[Unit] | |
Description="Sensord Daemon for Temperature Logging" | |
[Service] | |
Type=forking | |
PIDFile=/var/run/sensord.pid | |
ExecStart=sensord -a -t 5 -r /var/log/sensord.rrd | |
ExecStartPre=/etc/templogging/pre_start.sh | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
tee /etc/systemd/system/lighttpd.service <<EOF | |
[Unit] | |
Description="Lighttpd service" | |
Wants=sensord.service | |
[Service] | |
Type=simple | |
ExecStart=lighttpd -D -f /etc/templogging/lighttpd.conf | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
systemctl daemon-reload | |
systemctl enable --now sensord lighttpd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl https://gist.githubusercontent.com/KokoseiJ/1837ba17c954465575364a606fcc8d11/raw/setup.sh | bash