README.md 2.6 KB

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
  • 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 }'); /home/hecks/serbur_stats/bin/cputemps
*/2 * * * * kill -9 $(ps aux | grep '[s]erbur_stats/bin/drivetemps' | grep -v '/bin/sh' | awk '{ print $2 }'); /home/hecks/serbur_stats/bin/drivetemps
*/2 * * * * kill -9 $(ps aux | grep '[s]erbur_stats/bin/fans' | grep -v '/bin/sh' | awk '{ print $2 }'); /home/hecks/serbur_stats/bin/fans
14 * * * * kill -9 $(ps aux | grep '[s]erbur_stats/bin/speedtest' | grep -v '/bin/sh' | awk '{ print $2 }'); /home/hecks/serbur_stats/bin/speedtest

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