For use with mein sens0r graphing shit, this generates some stats for ein serbur [=[=[=[[=

Wazakindjes be66bbc093 AYOOOOOOOOOOOOO 3 months ago
conf e434d99677 Added supp0t for official speedtest client lel 3 months ago
include cfb0f76f5a Make compatibru w/ libmariadb instead of libmysqlclient =] 6 months ago
sql aaa03ecc35 Apparently adding a primary key w/ alter table no werks, even th0 it's literally exported that way -.- 1 year ago
src be66bbc093 AYOOOOOOOOOOOOO 3 months ago
.editorconfig c523343832 Added editorc0nfig =] 5 months ago
.gitignore 4a18a870c5 rep0 creation m9 1 year ago
LICENSE 4a18a870c5 rep0 creation m9 1 year ago
Makefile cfb0f76f5a Make compatibru w/ libmariadb instead of libmysqlclient =] 6 months ago
README.md e434d99677 Added supp0t for official speedtest client lel 3 months ago

README.md

The fuck is this

I have a bunch of graphed sens0r data for keks, now I also wanted some shit for mein main server. [=[==[=[

Doesn't work on Wind0ngs, obviously. ;]];;];];];];];];];];]

Requirements

Let's assume you're using Debian, then this should be enough:

  • apt-get install build-essential libbsd-dev libmysqlclient-dev lm-sensors smartmontools
  • A working speedtest-cli (or juse use the official client from 00kla =])
  • A server somewhere running MySQL/MariaDB, pr0lly at least v5.7

List of components

Shit should b p self-explanatory:

  • cputemps
  • drivetemps
  • fans
  • speedtest

Usage

First, set up an SQL database with its own user and shit. You'll prolly wanna enable SSL/TLS support if you're connecting to it over da interwebsz. The sql dir in dis rep0 contains examples for the schemas, you may wanna adjust e.g. the amount of fans or CPU cores. Don't forget the triggers m9. =]]

Second, make sure the server can actually read sens0r data by running sensors-detect and answering the questions. This should eventually make some shit available under /sys/class/hwmon for reading the CPU temps and fan speeds. For drive temps we use smartctl to get the value from SMART attributes 190 (Airflow_Temperature_Celsius) or 194 (Temperature_Celsius), preferring the latter. What we use for speedtests should be obvious y0.

For compilation, just copy conf/muhconf.c.example to conf/muhconf.c and edit that shit. Then run make and check for errors. If there are none simply try to run all the binaries in the created bin direct0ry. If all's gucci you can add a cronjob to run that shit continually. ;];];];];];]

Some n0tes

  • drivetemps should likely be run as rewt cuz it needs access to the special block device files, otherwise you'll pr0lly need to add a regular user to the disk group and it'll be able to fuck up em disks =]

Example cr0n

It's very crude and naive but it works for me. [=[[=[=[==[=[

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAILTO=''
*/2 * * * * kill -9 $(ps aux | grep '[s]erbur_stats/bin/cputemps' | grep -v '/bin/sh' | awk '{ print $2 }') 2>/dev/null; /home/hecks/serbur_stats/bin/cputemps >/dev/null
*/2 * * * * kill -9 $(ps aux | grep '[s]erbur_stats/bin/drivetemps' | grep -v '/bin/sh' | awk '{ print $2 }') 2>/dev/null; /home/hecks/serbur_stats/bin/drivetemps >/dev/null
*/2 * * * * kill -9 $(ps aux | grep '[s]erbur_stats/bin/fans' | grep -v '/bin/sh' | awk '{ print $2 }') 2>/dev/null; /home/hecks/serbur_stats/bin/fans >/dev/null
14 * * * * kill -9 $(ps aux | grep '[s]erbur_stats/bin/speedtest' | grep -v '/bin/sh' | awk '{ print $2 }') 2>/dev/null; /home/hecks/serbur_stats/bin/speedtest >/dev/null

I'm using kill to make sure any stalled previous instances are cleaned up. ;]