{"id":15020636,"url":"https://github.com/gavinlyonsrepo/raspberrypi_tempmon","last_synced_at":"2025-10-04T23:44:17.034Z","repository":{"id":98596989,"uuid":"95983561","full_name":"gavinlyonsrepo/raspberrypi_tempmon","owner":"gavinlyonsrepo","description":"System monitoring program for Raspberry pi single board computers written in Python 3.","archived":false,"fork":false,"pushed_at":"2024-10-04T17:19:26.000Z","size":1957,"stargazers_count":81,"open_issues_count":0,"forks_count":15,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-31T15:19:07.505Z","etag":null,"topics":["arm","cpu","cpu-monitoring","cpu-temperature","desktop-notifications","gpu-computing","graph-mode","logfile","logging","python","raspberry","raspberry-pi","raspberry-pi-3","raspberrypi","raspbian","rpi","ssmtp","stress","temperature-monitoring","tempertaure"],"latest_commit_sha":null,"homepage":"https://gavinlyonsrepo.github.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gavinlyonsrepo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-01T19:24:11.000Z","updated_at":"2025-03-07T15:15:00.000Z","dependencies_parsed_at":"2024-01-02T22:30:15.671Z","dependency_job_id":"9c26f7e3-b34d-4ff6-a220-a4398b676ac0","html_url":"https://github.com/gavinlyonsrepo/raspberrypi_tempmon","commit_stats":{"total_commits":67,"total_committers":1,"mean_commits":67.0,"dds":0.0,"last_synced_commit":"0aab47ac46a0640f5bd567998143da1b53cad90c"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinlyonsrepo%2Fraspberrypi_tempmon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinlyonsrepo%2Fraspberrypi_tempmon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinlyonsrepo%2Fraspberrypi_tempmon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinlyonsrepo%2Fraspberrypi_tempmon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gavinlyonsrepo","download_url":"https://codeload.github.com/gavinlyonsrepo/raspberrypi_tempmon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694876,"owners_count":20980733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arm","cpu","cpu-monitoring","cpu-temperature","desktop-notifications","gpu-computing","graph-mode","logfile","logging","python","raspberry","raspberry-pi","raspberry-pi-3","raspberrypi","raspbian","rpi","ssmtp","stress","temperature-monitoring","tempertaure"],"created_at":"2024-09-24T19:55:22.266Z","updated_at":"2025-10-04T23:44:16.950Z","avatar_url":"https://github.com/gavinlyonsrepo.png","language":"Python","readme":"[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/paypalme/whitelight976)\n\n## Overview\n\n* Name: rpi_tempmon \n* Title : Display the ARM CPU and GPU temperature of Raspberry Pi \n* Description: \n\nThis python program will display the ARM CPU and \nGPU temperature of a Raspberry Pi  \nfeatures include command line display, GPIO (LED) output, logging, alarm limit, \ngraphing, desktop notification, stress tests and e-mailing options. \nIt is run in terminal and uses matplotlib \nplots for graph modes.\n\n* Author: Gavin Lyons\n* URL: https://github.com/gavinlyonsrepo/raspeberrypi_tempmon\n* Tested on Toolchains: \n    1. RPI 3 model B. Raspbian 10 Buster, 32 bit. Python 3.7.3.\n    2. RPI 3 model B. Raspbian 12 Bookworm, 64 bit. Python 3.11.2.\n    3. RPI 5 Raspbian 12 Bookworm, 64 bit. Python 3.11.2.\n\n## Table of contents\n\n\n  * [Overview](#overview)\n  * [Table of contents](#table-of-contents)\n  * [Installation](#installation)\n  * [Usage](#usage)\n  * [Files and setup](#files-and-setup)\n  * [Output](#output)\n  * [Dependencies](#Dependencies)\n  * [Features](#features)\n\n\n## Installation\n\nLatest version 3.0 (07-2024)\n\n**PyPi \u0026 pip , pipx**\n\nThe program is present in python package index, Pypi.\nInstall using *pip* or *pipx* to the location or environment of your choice.\nPackage name = rpi-tempmon.py\n\n**Manually install from github**\n\nThe package is also archived on github and can be manually download and installed \nvia python and setup.py\n\n```sh\ncurl -sL https://github.com/gavinlyonsrepo/raspberrypi_tempmon/archive/3.0.tar.gz | tar xz\ncd raspberrypi_tempmon-3.0\npython3 setup.py build \npython3 setup.py install --user\n```\n\n## Usage\n\nProgram is a python 3 package. Run in a terminal \nby typing rpi_tempmon.py or python3 rpi_tempmon.py: \n\nrpi_tempmon.py -[options][arguments]\n\nOptions list *(Note: Options are stand alone, not designed to be combined)*:\n\n| Option          | Description     |\n| --------------- | --------------- |\n| -h  | Print help information and exit |\n| -v  | Print version information and exit |\n| -c  | Enters continuous mode, optional number of seconds as a argument eg (-c 5)|\n| -l  | Creates and/or appends to log file at output folder |\n| -L  | Creates a sub-folder at output folder with date/time stamp and puts a log file in it |\n| -m  | Sends the log file to an email account |\n| -g  | graph mode, Generate a menu where 12 types of graphs can be selected |\n| -a  | parse log file and produces a data report in terminal |\n| -n  | send notifications to desktop, Number argument to define behaviour |\n| -s  | CSV mode , parses log.txt and converts it to log.csv,  CSV file |\n| -ST | Stress test CPU and measures temperature output to graph and csv file , optional number of test runs as a argument eg (-ST 5)|\n\n## Files and setup\n\nrpi_tempmon files needed are listed below:\n\n| File Path | Description |\n| ------ | ------ |\n| rpi_tempmon.py | The main python script |\n| RpiTempmonWork.py| python module containing various utility functions used by main |\n| RpiTempmonGraph.py | python module dealing with graph output by matplotlib |\n| $HOME/.config/rpi_tempmon/rpi_tempmon.cfg | config file |\n| README.md | help file |\n\n\nConfig file: The config file with dummy values is created if missing.\nA dummy config file is available in documentation folder at repository\n, used  for -m mail option, GPIO/LED feature and the alarm function. \n\nThe setting \"RPI_AuthUser\" the is email address \ndestination of data from -m option. \n \nMail_Alert(one: mail alert enabled , zero: off)\n\nThe other settings are ALARM_MODE which should be set to one or zero(one: alarm on, zero: off)\n\nCPU_UPPERLIMIT is the temperature limit of CPU in Centigrade, should be a positive integer.\nIf alarm mode is on when CPU temperature  goes above this limit, the alarm function will activate. \n\nLED_MODE which should be set to one or zero(one: LED mode on, zero: off) if on \nan GPIO pin will switch on during an alarm state in continuous and normal mode.\nThe RPI GPIO pin as defined by GPIO_LED number. You can connect an LED or another\nelectronic component to this pin.\n\nMake sure to include the [MAIN] header and all settings just as below or \ncopy from the example file.\n\nSettings:\n\n[MAIN]\n\u003e\n\u003eRPI_AuthUser=examplemail@gmail.com\n\u003e\n\u003eMAIL_ALERT = 1\n\u003e\n\u003eALARM_MODE = 1\n\u003e\n\u003eCPU_UPPERLIMIT = 60\n\u003e\n\u003eLED_MODE = 0\n\u003e\n\u003eGPIO_LED = 26\n\u003e\n\nScreenshots, example config/log files are also available in documentation.\n\n## Output\n\nThe output folder for log files is currently fixed at: \n\n```sh\n$HOME/.cache/rpi_tempmon/\n```\n\n## Dependencies\n\n\n1. simple MSMTP - Version: 1.6.6-1- Program which delivers email from a computer to a mailhost.\n[MSMTP help](https://wiki.archlinux.org/index.php/Msmtp)\nOptional,  **ONLY**  used by mail functions.\nlight SMTP client with support for server profiles\nclient that can be used to send mails .\n(SMTP server), needed only for -m mail option. \nAlso needs to install another few small dependencies (mpack etc) in order to send attachment.\nSee mail mode in features for setup.\n\n```sh\n$ sudo apt install msmtp msmtp-mta mailutils mpack\n\n```\n\n2. sysbench - Version 0.4.12-1.1 - benchmarking tool.\n[sysbench](https://manpages.debian.org/testing/sysbench/sysbench.1.en.html)\nOptional, **ONLY** used by stress test option -ST.\n\n```sh\n$ sudo apt install sysbench.\n```\n\n3. libnotify-bin - Version 0.7.6-2 - sends desktop notifications to a notification daemon. \n[libnotify](http://manpages.ubuntu.com/manpages/artful/man1/notify-send.1.html)\nOptional, This is **ONLY** needed if using the -n option which uses the notify-send command. \n\n```sh\n$ sudo apt install libnotify-bin\n```\n\n4. matplotlib - Version: 2.2.2 - Python plotting package. \n[matplotlib help](https://matplotlib.org/)\nThe graph modules requires python module *matplotlib* to draw graphs,\nThis is for -g and -ST options.\nInstalled by rpi_tempmon setup.py during installation in theory.\n\n5. psutil  - Version (2.1.1) -  Library for retrieving info on PC.\n[psutil](https://psutil.readthedocs.io/en/latest/)\nUsed to retrieve some CPU and memory information.\nInstalled by setup.py during installation.\n\n6. gpiozero - version(2.0) - This package controls the GPIO on a Raspberry Pi.\n[gpiozero](https://github.com/gpiozero/gpiozero)\nGPIO Zero is installed by default in the Raspberry Pi OS desktop image, note before rpi_tempmon version 3.0 , \nrpi_tempmon used rpi.gpio.\n\n\n## Features\n\nFor a raspberry pi the official operating temperature limit is 85°C, \nand as a result the Raspberry Pi should start to thermally throttle \nperformance around 82°C. The GPU and CPU are closely correlated\nto within a degree usually.\n\nThe program calculates the ARM CPU and GPU temperature of \na Raspberry Pi and outputs them in Centigrade together with\ndatetime stamp. Also shows CPU, RAM memory usage .\n\nThe program has ten features\n1. Normal mode - output to screen with optional GPIO output, prompt for update.\n2. Continuous mode - output to screen with optional GPIO output, updates based on timer.\n3. Logfile mode   - output to single logfile(also mail mode if mail alert mode on and triggered).\n4. Logfolder mode - output to multiple logfile in separate folders.\n5. Mail mode  - output to email.\n6. Graph mode - Displays a graph of logfile created in mode 3\n7. CSV mode - parses log.txt and converts it to log.csv for external use\n8. Data mode - parses log file and produces a small report.\n9. Notify mode - send notifications to desktop, Number argument to define behaviour \n10. Stress test mode - Stresses the CPU with math and records results in csv file and graph.\n\n**1. normal mode**\n\nNormal mode is run by running program with no command line arguments.\nIn normal mode output, Data is sent to the terminal with prompt to repeat or quit. \nThe GPIO pin in config file will be turned on \nand Data in red is displayed in screen for an Alarm state, if setup in config file.\n\n**2. Continuous mode**\n\nSame as normal mode except in continuous mode. The program enters a delay between scan.\nThis delay is set by positive integer argument placed after -c. \nFor example \"-c 30\" will wait 30 seconds between scans. \nData is sent to terminal screen. \nThe GPIO pin in config file will be turned on \nand Data in red is displayed in screen for an Alarm state, if  setup in config file. \n \n![ScreenShot cont mode](https://raw.githubusercontent.com/gavinlyonsrepo/raspberrypi_tempmon/master/Documentation/screenshots/main_screen1.jpg)\n \n**3. \u0026 4. Log  modes**\n\nIn logfile mode the data is appended into a file log.txt at output folder. \nWith optional mail setup if alarm mode setup. For mode 3 an email\nis sent using mode 5 function, \nbut with warning in title.\n \n Sample output of logfile:\n \n```sh\nTS = 18-04-22 14:19:42\nEP = 1524403183.0\nGPU temperature = 48.3'C\nCPU temperature = 48.3\nCpu usage = 40.4\nRAM usage = 45.0\nSwap usage = 98.6\nRaspberry pi temperature monitor: raspberrypi\n```\n\nThe log file is appended with \"Warning:\" text message if alarm state entered.\n\nIn logfolder mode in the output folder, a new sub-folder is created each\ntime it is ran and a new log-file put in here. The sub-folder has following syntax\n1250-02Jul17_RPIT HHMM-DDMMMYY_XXXX. \nThis folder mode does not work with mail or graph mode at present.\n\nLogging modes are designed to be used with UNIX automation like crontab.\nFor example this crontab entry will run logfile mode once an hour, \nNote: The path to executable may differ on each users system.\n\n```sh\n0 * * * *  /usr/local/bin/rpi_tempmon.py -l \u003e/dev/null 2\u003e\u00261\n```\n\n**5. Mail mode**\n\nIn mail mode an email is sent using msmtp. \nThe mail contains the data from logfile mode only, it will NOT work with \nsub-folders from logfolder mode.\n\nmsmtp is used rather than than python inbuilt smtplib module \nas this program was originally a bash program and this a legacy of that,\nalso allows access to msmtp config file for greater portability \nand security. The program originally used ssmtp but this is now obsolete \nin latest raspbian software. \n\nIn order to get mail mode working you must complete 3-4 steps.\n\n1. Set settings in rpi_tempmon config file, see Files and setup section.\nThis file allows for user to set an email address without access to msmtp\nconfig file which should be set up just for root account.\n2. Install msmtp and dependencies as per installation section\n3. Configure msmtp configuration file [MSMTP help](https://wiki.archlinux.org/index.php/Msmtp)\nA working example msmtprc config file for gmail is in documentation folder, \"example_msmtprc\".\n4. Optional, It is also possible you may need to configure your email account to accept msmtp mails \nthis was the case for gmail and ssmtp. In 2024 in order to get gmail working with ssmtp mail ,you must first set up \n2 step verification on your google account then request a App password for an App from 'apppasswords' section. Google will then generate\na 16 character API password,\nlike 'aaaa bbbb cccc dddd' , use this in the password field of your msmtp configuration file.\n\n**6. graph mode**\n\nIn graph mode, the program using matplotlib (plotting library) \ncreates a plot of various data versus time.\nThe logfile.txt created by logfile mode 3 is used for data for graph 1-8.\ngraphs 1-4 use time-date stamp as yaxis value\ngraphs 5-8 use Unix Epoch stamp as yaxis value, this is better for irregular data\npoints across multiple dates.\nThe graphs 9-12 are live plots sampled every two seconds for 150 points,\nso five minutes of live data.\n\n![graph menu](https://raw.githubusercontent.com/gavinlyonsrepo/raspberrypi_tempmon/master/Documentation/screenshots/graphmenu.png)  \n\nSample graph screenshot, screenshots of all others are in [screenshot folder of repo](screenshots/).\n\n![graph mode 6](https://raw.githubusercontent.com/gavinlyonsrepo/raspberrypi_tempmon/master/Documentation/screenshots/graphmode2.jpg)\n\n![graph mode 12](https://raw.githubusercontent.com/gavinlyonsrepo/raspberrypi_tempmon/master/Documentation/screenshots/graphmode12.jpg)\n\n**7. CSV(comma-separated values)  convert**\n\nNew in Version 2.0. Run with -s on the CLI.\nParses log.txt and creates log.csv. \nThis csv file can be then used by user in another app.\nA comma-separated values (CSV) file is a delimited text file \nthat uses a comma to separate values. This file can then be loaded into libreoffice calc.\nfor further processing, for example.\n\nsample output = time-data, CPU temp, GPU temp, CPU usage , RAM usage , swap usage \n\n```sh\n18-04-04 09:46:51,61.5,60.7,25.8,33.9,11.6\n```\n\n**8. data mode**\n\nParses log file created by logfile mode 3 and produces a data report on console.\n\n**9. notify mode**\n\nSend notifications to desktop, Numbered argument to define behaviour \nAfter installing notify-send, Additional packages or steps \n**may** be required to get notify-send working,\ndepending on system. for example  \n[Jessie](https://raspberrypi.stackexchange.com/questions/75299/how-to-get-notify-send-working-on-raspbian-jessie)\n\n\n* -n 2 = argument 2 = If run always display CPU temperature , no warning.\n* -n 3 = argument 3 = If run only display if CPU temperature exceeds limit\n\n![notify mode](https://raw.githubusercontent.com/gavinlyonsrepo/raspberrypi_tempmon/master/Documentation/screenshots/nyalarm.jpg)\n\n\n**10. Stress test mode**\n\nThis mode uses the sysbench benchmarking tool.\nThe test request consists in calculation of prime numbers up to a value of 20000. \nAll calculations are performed using 64-bit integers. 4 worker threads are created.\nThe number of test runs is passed on command line as integer max 50 min 2.\nCPU temperature and freq are recorded for each test run and are outputed to a csv file,\ncalled stresslog.csv . sample output = test run num, CPU temp, CPU usage.\n\n```sh\n1,56.9,27.1\n2,61.3,99.7\n```\n\nAt the end of test, there is an option to display results in a graph.\nStress data carried out by rpi_tempmon can be found in repo [here](Documentation/stresstestdata/stresstest.md) \n","funding_links":["https://www.paypal.com/paypalme/whitelight976"],"categories":["Projects"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinlyonsrepo%2Fraspberrypi_tempmon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgavinlyonsrepo%2Fraspberrypi_tempmon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinlyonsrepo%2Fraspberrypi_tempmon/lists"}