Scripts used on my home systems, possibly useful to others.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
sshalerts.py
summertimeblues.py

README.md

Things from my home systems

I'm going to drop some scripts in this repository that other people might find useful. Might be slow going as I have to adapt some of them to work with different circumstances for others. I've written these mostly static for my own needs.

Python 3.6+ is typically required. I like the new string literals and I don't really care about writing backwards compatible code.

summertimeblues.py


Moving back to Sacramento, albeit temporary, is one of the dumbest things I've ever done in my life. We've hit temperatures of around 109 this summer. I started worrying about my desktop and server potentially running hot while I'm not home, so I needed email alerts to let me know. This way I can ssh in and shut things down.

Note that everything up to line 23 of this script needs to be filled in by the user. If you don't know Python, that's fine, the only thing quirky is the device list. First things first, install the needed dependency:

pip3 install psutil

The devices will be the first value of each, in this case, radeon and k10temp:

% python3
Python 3.6.2 (default, Jul 30 2017, 10:56:17) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.sensors_temperatures()
{'radeon': [shwtemp(label='', current=24.0, high=120.0, critical=120.0)], 'k10temp': [shwtemp(label='', current=24.0, high=70.0, critical=70.0)]}

Thus, you would fill in the value in the script like so, specifying device first, then the percentage of the "high" heat that you want it to warn you at:

percentages = {'k10temp': 85,'radeon': 85}

I did this per device in the event that some may be more of a risk.

Example systemd service code. Set permissions to 700 if your email server requires a password.

[Unit]
Description=Temperature monitor

[Service]
Restart=always
ExecStart=/usr/bin/python3 /root/scripts/summertimeblues.py
KillMode=process

[Install]
WantedBy=default.target

Sacramento is a horrible place. Don't ever come here.