Skip to main content

A simple python http server to display basic system information.

Project description

https://raw.githubusercontent.com/walchko/hostinfo/master/pics/example.png https://travis-ci.org/walchko/hostinfo.svg?branch=master Latest Version License Codacy Badge

Why? I have several headless Raspberry Pi’s doing things and I wanted a simple cross platform way to see what they are up too.

Install

The preferred way is to use pip with pypi.org

pip install hostinfo

For development you can also do:

git clone https://github.com/walchko/hostinfo.git
cd hostinfo
pip install -e .

Usage

Now in order to determine your ip and mac address, you need to supply an interface. You can also supply a port to serve up the webpage. To speed up things, generating a QR code is off by default.

kevin@Logan hostinfo $ infoserver.py --help
usage: infoserver.py [-h] [-v] [-e ETHERNET] [-p PORT] [-q]

Launches a server that reports host information via a static web page. Example:

        infoserver.py -p 8800 -e en0 -q

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -e ETHERNET, --ethernet ETHERNET ethernet interface, default is eth0
  -p PORT, --port PORT  port, default is 5000

QR Reader

A sample view of a qr reader on my iPhone.

https://github.com/walchko/hostinfo/blob/master/pics/qr_reader.png?raw=true

Raspbian [Debian Jessie] Service

Now you can create a service that will always start up when the computer boots:

pi@bender hostinfo $ more /etc/systemd/system/hostinfo.service
[Service]
ExecStart=/usr/local/bin/infoserver.py -p 8080 -e eth0 -q
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=hostinfo
User=pi
Group=pi
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target

Change the port, ethernet interface, and desire to generate a QR code to your liking. Once you create this file, you need to do:

pi@bender hostinfo $ sudo systemctl enable hostinfo
Created symlink from /etc/systemd/system/multi-user.target.wants/hostinfo.service to /etc/systemd/system/hostinfo.service.

pi@bender hostinfo $ sudo service hostinfo start

pi@bender hostinfo $ sudo service hostinfo status
● hostinfo.service
   Loaded: loaded (/etc/systemd/system/hostinfo.service; enabled)
   Active: active (running) since Sun 2017-01-22 13:14:26 MST; 7s ago
 Main PID: 28533 (infoserver.py)
   CGroup: /system.slice/hostinfo.service
           └─28533 /usr/bin/python /usr/local/bin/infoserver.py -p 8080 -e et...

Jan 22 13:14:26 bender systemd[1]: Started hostinfo.service.

Now that the server is up and running, just launch a browser and connect to computer:port. For example, bender.local:8080 because that is what I set it too above.

Changes

Date Version Notes
2017-04-15 0.5.0 using flask and support python 3.6
2017-01-22 0.2.1 bug fixes, working on macOS and Raspbian.
2017-01-21 0.1.0 init

License

The MIT License (MIT)

Copyright (c) 2017 Kevin J. Walchko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
hostinfo-0.5.1-py2-none-any.whl (83.8 kB) Copy SHA256 hash SHA256 Wheel py2 Apr 16, 2017
hostinfo-0.5.1-py3-none-any.whl (83.8 kB) Copy SHA256 hash SHA256 Wheel py3 Apr 16, 2017
hostinfo-0.5.1.tar.gz (81.2 kB) Copy SHA256 hash SHA256 Source None Apr 16, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page