├── pistatus ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-37.pyc │ └── __main__.cpython-37.pyc ├── static │ └── style.css ├── templates │ └── index.html └── __main__.py ├── .gitignore ├── MANIFEST.in ├── images ├── cli.png ├── gui.png └── webserver.png ├── dist ├── pistatus-0.0.1.2.tar.gz ├── pistatus-0.0.1.3.tar.gz ├── pistatus-0.0.1.4.tar.gz ├── pistatus-1.0.0.1.tar.gz ├── pistatus-0.0.1.2-py3-none-any.whl ├── pistatus-0.0.1.3-py3-none-any.whl ├── pistatus-0.0.1.4-py3-none-any.whl └── pistatus-1.0.0.1-py3-none-any.whl ├── .github ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── PULL_REQUEST_TEMPLATE.md ├── CONTRIBUTING.md └── CODE_OF_CONDUCT.md ├── setup.py ├── LICENSE └── README.md /pistatus/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | /build/* 4 | /pistatus.egg-info/* 5 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include pistatus/static/* 2 | include pistatus/templates/* -------------------------------------------------------------------------------- /images/cli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/images/cli.png -------------------------------------------------------------------------------- /images/gui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/images/gui.png -------------------------------------------------------------------------------- /images/webserver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/images/webserver.png -------------------------------------------------------------------------------- /dist/pistatus-0.0.1.2.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/dist/pistatus-0.0.1.2.tar.gz -------------------------------------------------------------------------------- /dist/pistatus-0.0.1.3.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/dist/pistatus-0.0.1.3.tar.gz -------------------------------------------------------------------------------- /dist/pistatus-0.0.1.4.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/dist/pistatus-0.0.1.4.tar.gz -------------------------------------------------------------------------------- /dist/pistatus-1.0.0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/dist/pistatus-1.0.0.1.tar.gz -------------------------------------------------------------------------------- /dist/pistatus-0.0.1.2-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/dist/pistatus-0.0.1.2-py3-none-any.whl -------------------------------------------------------------------------------- /dist/pistatus-0.0.1.3-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/dist/pistatus-0.0.1.3-py3-none-any.whl -------------------------------------------------------------------------------- /dist/pistatus-0.0.1.4-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/dist/pistatus-0.0.1.4-py3-none-any.whl -------------------------------------------------------------------------------- /dist/pistatus-1.0.0.1-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/dist/pistatus-1.0.0.1-py3-none-any.whl -------------------------------------------------------------------------------- /pistatus/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/pistatus/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /pistatus/__pycache__/__main__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sampoder/pi-status/HEAD/pistatus/__pycache__/__main__.cpython-37.pyc -------------------------------------------------------------------------------- /pistatus/static/style.css: -------------------------------------------------------------------------------- 1 | h2{ 2 | margin-top: 0; 3 | font-size: 1.5em; 4 | color: #bc2d43; 5 | } 6 | 7 | #statsofpi{ 8 | font-size: 1em; 9 | } 10 | 11 | body{ 12 | background-color: #212121; 13 | color: white; 14 | font-family: 'Consolas', monospace; 15 | } 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Info (please complete the following information):** 27 | - Rapberry Pi Version: 28 | - OS: 29 | - Version [e.g. 22] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | import pistatus 3 | 4 | with open("README.md", "r") as fh: 5 | long_description = fh.read() 6 | 7 | setuptools.setup( 8 | name="pistatus", 9 | version="1.0.0.1", 10 | author="Sam Poder", 11 | author_email="23samuel.p@gwa.edu.sg", 12 | description= 13 | "An application that allows you to check the status of your Raspberry Pi", 14 | long_description=long_description, 15 | long_description_content_type="text/markdown", 16 | packages=setuptools.find_packages(), 17 | include_package_data=True, 18 | entry_points={'console_scripts': ['pistatus=pistatus.__main__:main']}, 19 | classifiers=[ 20 | "Programming Language :: Python", 21 | "License :: OSI Approved :: MIT License" 22 | ], 23 | python_requires='>=3.6', 24 | install_requires=[ 25 | 'psutil', 26 | 27 | ], 28 | ) 29 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Please prefix your pull request with one of the following: **[FEATURE]** **[FIX]** **[IMPROVEMENT]**. 2 | 3 | **In raising this pull request, I confirm the following (please check boxes):** 4 | 5 | - [ ] I have read and understood the [contributors guide](https://github.com/sampoder/pi-status/blob/master/.github/CONTRIBUTING.md). 6 | - [ ] I have checked that another pull request for this purpose does not exist. 7 | - [ ] I have considered, and confirmed that this submission will be valuable to others. 8 | - [ ] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. 9 | - [ ] I give this submission freely, and claim no ownership to its content. 10 | 11 | **My familiarity with the project is as follows (check one):** 12 | 13 | - [ ] I have never used the project. 14 | - [ ] I have used the project briefly. 15 | - [ ] I have used the project extensively, but have not contributed previously. 16 | - [ ] I am an active contributor to the project. 17 | 18 | --- 19 | 20 | {pull request content here} 21 | -------------------------------------------------------------------------------- /pistatus/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Pi Status - {{Title}} 9 | 10 | 11 |

Status of {{Title}}

12 |
13 | 14 | 📌 IP Address: {{ip}} 15 | 16 |

17 | 18 | 💭 Physical Memory: {{pmemory}} MB 19 | 20 |
21 | 22 | 🗯 Available Memory: {{amemory}} MB 23 | 24 |

25 | 26 | 🧠 CPU Usage: {{cpuusage}}% 27 | 28 |
29 | 30 | 🌡️ CPU Temperature: {{cputemp}}'C 31 | 32 |

33 | 34 | 💾 Disk Total Storage: {{tdisk}} GB 35 | 36 |
37 | 38 | 💽 Disk Available Storage: {{adisk}} GB 39 |
40 | 41 | 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Sam Poder 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 📈 pi-status 2 | 3 | 4 | 5 | [![Downloads](https://pepy.tech/badge/pistatus)](https://pepy.tech/project/pistatus) 6 | 7 | Pi-Status fetches basic statistics regarding your Raspberry Pi including network, CPU, RAM & storage stats it then displays the stats in the command-line, a GUI app or a browser tab. The program can be used for remote monitoring of headless deploys or simply to conveniently get stats on your Pi. The GUI app and browser tab refresh the stats on a timely basis. The lyrics are fetched from Genius. 8 | 9 | ## Installation 10 | Requires Python 3.6+. Use pip or pip3 depending on your installation. You might want to use the `--user` flag on Linux to avoid using pip as root. 11 | ``` 12 | pip install pistatus 13 | ``` 14 | 15 | ## Usage 16 | `usage: pistatus [-g] [-w]` 17 | 18 | To use the CLI output no arguments are required. 19 | 20 | Arguments: 21 | ``` 22 | -g, show the stats in the gui form 23 | -w, start the web server on the local network 24 | ``` 25 | You can quit the web server by pressing Ctrl+C and you will be able to see the IP address in the command line for reference. 26 | 27 | ## Compiling PiStatus for Development 28 | 29 | - Clone into this repo 30 | - `cd` into the cloned repo. 31 | - `pip install -e .` the -e flag installs it locally in editable mode. 32 | 33 | ## Screenshots 34 | 35 | **Web View** 36 | 37 | Web View 38 | 39 | **CLI View** 40 | 41 | CLI View 42 | 43 | **GUI View** 44 | 45 | GUI View 46 | 47 | ## License 48 | 49 | [MIT](https://choosealicense.com/licenses/mit/) 50 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributors Guide 2 | 3 | Please read and understand the contribution guide before creating an issue or pull request. 4 | 5 | ## Etiquette 6 | 7 | This project is open source, and as such, the maintainers give their free time to build and maintain the source code held within. They make the code freely available in the hope that it will be of use to other developers. It would be extremely unfair for them to suffer abuse or anger for their hard work. 8 | 9 | Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the world that developers are civilized and selfless people. 10 | 11 | It's the duty of the maintainer to ensure that all submissions to the project are of sufficient quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used. 12 | 13 | ## Viability 14 | 15 | When requesting or submitting new features, first consider whether it might be useful to others. Open source projects are used by many developers, who may have entirely different needs to your own. Think about whether or not your feature is likely to be used by other users of the project. 16 | 17 | ## Procedure 18 | 19 | Before filing an issue: 20 | 21 | - Attempt to replicate the problem, to ensure that it wasn't a coincidental incident. 22 | - Check to make sure your feature suggestion isn't already present within the project. 23 | - Check the pull requests tab to ensure that the bug doesn't have a fix in progress. 24 | - Check the pull requests tab to ensure that the feature isn't already in progress. 25 | 26 | Before submitting a pull request: 27 | 28 | - Ensure that your submission is [viable](#viability) for the project. 29 | - Check the codebase to ensure that your feature doesn't already exist. 30 | - Check the pull requests to ensure that another person hasn't already submitted the feature or fix. 31 | 32 | A restyler has been enabled. It will help style your PR. 33 | 34 | ## Credits 35 | 36 | This contributors guide is borrowed from https://github.com/SwagLyrics/SwagLyrics-For-Spotify/blob/master/.github/CONTRIBUTING.md, so thanks for that! 37 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at 23samuel.p@gwa.edu.sg. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /pistatus/__main__.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import sys 4 | import tkinter as tk 5 | 6 | import psutil 7 | from flask import Flask 8 | from flask import render_template 9 | 10 | 11 | def main(): 12 | 13 | if len(sys.argv) == 1: 14 | 15 | hostname = re.sub("\n", "", os.popen("hostname").read()) 16 | 17 | ip = re.sub( 18 | "\n", "", 19 | os.popen("ip addr show wlan0 | grep -Po 'inet \K[\d.]+'").read()) 20 | 21 | memory = psutil.virtual_memory() 22 | 23 | cpuusage = psutil.cpu_percent(interval=1) 24 | 25 | cputemp = re.sub( 26 | "temp=", "", 27 | re.sub("\n", "", 28 | os.popen("vcgencmd measure_temp").read())) 29 | 30 | disk = psutil.disk_usage("/") 31 | 32 | print("\n" + "Hostname: " + hostname) 33 | 34 | print("IP Address: " + ip + "\n") 35 | 36 | print("Physical Memory: " + str(round(memory.total / 1000000)) + " MB") 37 | 38 | print("Available Memory: " + str(round(memory.available / 1000000)) + 39 | " MB\n") 40 | 41 | print("CPU Usage: " + str(cpuusage) + "%") 42 | 43 | print("CPU Temperature: " + cputemp + "\n") 44 | 45 | print("Disk Total Storage: " + str(round(disk.total / 1000000000, 2)) + 46 | " GB") 47 | 48 | print("Disk Available Storage: " + 49 | str(round(disk.free / 1000000000, 2)) + " GB \n" + "\n") 50 | 51 | print( 52 | "No Command Line Arguments Specified. Use -g to launch GUI app. Use -w to launch Web Server" 53 | ) 54 | 55 | elif sys.argv[1] == "-g": 56 | 57 | # Create the main window 58 | root = tk.Tk() 59 | root.title("Pi Status") 60 | root.geometry("250x300+50+90") 61 | 62 | # Create label 63 | label = tk.Label(root, text="Loading") 64 | # Lay out label 65 | label.pack() 66 | 67 | def setText(): 68 | 69 | hostname = re.sub("\n", "", os.popen("hostname").read()) 70 | 71 | ip = re.sub( 72 | "\n", 73 | "", 74 | os.popen( 75 | "ip addr show wlan0 | grep -Po 'inet \K[\d.]+'").read(), 76 | ) 77 | 78 | memory = psutil.virtual_memory() 79 | 80 | cpuusage = psutil.cpu_percent(interval=1) 81 | 82 | cputemp = re.sub( 83 | "temp=", "", 84 | re.sub("\n", "", 85 | os.popen("vcgencmd measure_temp").read())) 86 | 87 | disk = psutil.disk_usage("/") 88 | 89 | label.configure( 90 | text="\n" + "Hostname: " + hostname + "\n" + "IP Address: " + 91 | ip + "\n" + "\n" + "Physical Memory: " + 92 | str(round(memory.total / 1000000)) + " MB" + "\n" + 93 | "Available Memory: " + str(round(memory.available / 1000000)) + 94 | " MB" + "\n" + "\n" + "CPU Usage: " + str(cpuusage) + "%" + 95 | "\n" + "CPU Temperature: " + cputemp + "\n" + "\n" + 96 | "Disk Total Storage: " + 97 | str(round(disk.total / 1000000000, 2)) + " GB" + "\n" + 98 | "Disk Available Storage: " + 99 | str(round(disk.free / 1000000000, 2)) + " GB \n") 100 | 101 | root.after(10000, setText) 102 | 103 | setText() 104 | 105 | # Run forever! 106 | root.mainloop() 107 | 108 | elif sys.argv[1] == "-w": 109 | 110 | app = Flask( 111 | __name__, 112 | template_folder=os.path.join( 113 | os.path.dirname(os.path.abspath(__file__)), "templates"), 114 | ) 115 | 116 | @app.route("/") 117 | @app.route("/index") 118 | def index(): 119 | 120 | hostname = re.sub("\n", "", os.popen("hostname").read()) 121 | 122 | ip = re.sub( 123 | "\n", 124 | "", 125 | os.popen( 126 | "ip addr show wlan0 | grep -Po 'inet \K[\d.]+'").read(), 127 | ) 128 | 129 | memory = psutil.virtual_memory() 130 | 131 | cpuusage = psutil.cpu_percent(interval=1) 132 | 133 | cputemp = re.sub( 134 | "temp=", "", 135 | re.sub("\n", "", 136 | os.popen("vcgencmd measure_temp").read())) 137 | 138 | disk = psutil.disk_usage("/") 139 | 140 | return render_template( 141 | "index.html", 142 | Title=hostname, 143 | ip=ip, 144 | pmemory=str(round(memory.total / 1000000)), 145 | amemory=str(round(memory.available / 1000000)), 146 | cpuusage=str(cpuusage), 147 | cputemp=cputemp, 148 | tdisk=str(round(disk.total / 1000000000)), 149 | adisk=str(round(disk.free / 1000000000, 2)), 150 | ) 151 | 152 | ip = re.sub( 153 | "\n", "", 154 | os.popen("ip addr show wlan0 | grep -Po 'inet \K[\d.]+'").read()) 155 | app.run(host=ip) 156 | --------------------------------------------------------------------------------