Skip to content

Commit

Permalink
Update READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
David Parker committed Jul 12, 2014
1 parent 831f941 commit d97ab58
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 28 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ Dependencies
* [iso8601](https://bitbucket.org/micktwomey/pyiso8601/)


Installation
------------
This module is not yet available in PyPi, however you can download the latest release and use pip's ability to install from a file.
```
[root@localhost ~]# pip install ibmiotc-version.zip
```

Uninstall
---------
Uninstalling the module is simple.
```
[root@localhost ~]# pip uninstall ibmiotc
```

Documentation
-------------

Expand Down
95 changes: 67 additions & 28 deletions samples/psutil/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Python PSUtil IoT Adapter

Sample code for sending system utilization data to the IBM Internet of Things QuickStart service from a Python 2.7 runtime environment.
Sample code for sending system utilization data to the IBM Internet of Things

The following data points are supported:
* CPU utilization (%)
Expand All @@ -9,24 +9,24 @@ The following data points are supported:
* Inbound network utilization across all network interfaces (KB/s)


## Raspbian (Raspberry Pi)
## Setup

### Raspbian (Raspberry Pi)
```
pi@raspberrypi ~ $ sudo apt-get update
pi@raspberrypi ~ $ sudo apt-get install python-dev
pi@raspberrypi ~ $ sudo apt-get install python-pip
pi@raspberrypi ~ $ sudo pip install paho-mqtt
pi@raspberrypi ~ $ sudo pip install psutil
pi@raspberrypi ~ $ wget https://raw.githubusercontent.com/ibm-messaging/iot-python/master/samples/psutil/src/iot-psutil.py
pi@raspberrypi ~ $ python iot-psutil.py
Connected successfully - Your device ID is ca51af86af39
* http://quickstart.internetofthings.ibmcloud.com/?deviceId=ca51af86af39
Visit the QuickStart portal to see this device's data visualized in real time and learn more about the IBM Internet of Things Cloud
pi@raspberrypi ~ $ wget https://github.com/ibm-messaging/iot-python/archive/master.zip
pi@raspberrypi ~ $ unzip master.zip
pi@raspberrypi ~ $ cd iot-python-master/samples/psutil
pi@raspberrypi ~ $ python iotpsutil.py
(Press Ctrl+C to disconnect)
```

## CentOS / RHEL 6
### CentOS / RHEL 6
See: [Setting up Django and Python 2.7 on Red Hat Enterprise 6 the easy way](http://developerblog.redhat.com/2013/02/14/setting-up-django-and-python-2-7-on-red-hat-enterprise-6-the-easy-way/)
```
[me@localhost ~]$ sudo su -
Expand All @@ -36,41 +36,80 @@ See: [Setting up Django and Python 2.7 on Red Hat Enterprise 6 the easy way](htt
[root@localhost ~]# pip install paho-mqtt
[root@localhost ~]# pip install psutil
[root@localhost ~]# exit
[me@localhost ~]$ wget https://raw.githubusercontent.com/ibm-messaging/iot-python/master/samples/psutil/src/iot-psutil.py
[me@localhost ~]$ wget https://github.com/ibm-messaging/iot-python/archive/master.zip
[me@localhost ~]$ unzip master.zip
[me@localhost ~]$ cd iot-python-master/samples/psutil
[me@localhost ~]$ scl enable python27 bash
[me@localhost ~]$ python iot-psutil.py
Connected successfully - Your device ID is ca51af86af39
* http://quickstart.internetofthings.ibmcloud.com/?deviceId=ca51af86af39
Visit the QuickStart portal to see this device's data visualized in real time and learn more about the IBM Internet of Things Cloud
[me@localhost ~]$ python iotpsutil.py
(Press Ctrl+C to disconnect)
```


## Microsoft Windows
### Microsoft Windows
[Install Python 2.7](https://www.python.org/download/releases/2.7)

[Install pip-Win](https://sites.google.com/site/pydatalog/python/pip-for-windows) and use this to install the paho-mqtt Python package. Windows 7 users should note that there is a [bug in paho-mqtt](https://bugs.eclipse.org/bugs/show_bug.cgi?id=431698), you may need to update with the latest version from the [repository](http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.python.git/tree/src/paho/mqtt/client.py) until this bug fix makes it into a release.
[Install pip-Win](https://sites.google.com/site/pydatalog/python/pip-for-windows) and use this to install the paho-mqtt Python package.

Download and install [psutil](https://pypi.python.org/pypi?:action=display&name=psutil#downloads) using the appropriate Windows installer:
* [psutil-2.1.0.win32-py2.7.exe](https://pypi.python.org/packages/2.7/p/psutil/psutil-2.1.0.win32-py2.7.exe#md5=cfe1b146fc38176e4e63290fa15029a1)
* [psutil-2.1.0.win-amd64-py2.7.exe](https://pypi.python.org/packages/2.7/p/psutil/psutil-2.1.0.win-amd64-py2.7.exe#md5=db0ee08adb7f00386ee419dcf414d451)

Download [iot-psutil.py](https://raw.githubusercontent.com/ibm-messaging/iot-python/master/samples/psutil/src/iot-psutil.py) from GitHub
Download and extract [master.zip](https://github.com/ibm-messaging/iot-python/archive/master.zip) from GitHub

```
C:\Users\Me> python iot-psutil.py
Connected successfully - Your device ID is ca51af86af39
* http://quickstart.internetofthings.ibmcloud.com/?deviceId=ca51af86af39
Visit the QuickStart portal to see this device's data visualized in real time and learn more about the IBM Internet of Things Cloud
C:\Users\Me> python iotpsutil.py
(Press Ctrl+C to disconnect)
```

## QuickStart Usage
With no command line options the device code will connect to [QuickStart](http://quickstart.internetofthings.ibmcloud.com)
```
[me@localhost ~]$ python iotpsutil.py
```

## Registered Usage
The device sample supports using either a device configuration file or command line arguments to connect to your [private organization](https://internetofthings.ibmcloud.com/dashboard/)
```
[me@localhost ~]$ python iotpsutil.py -c device.cfg
```

```
[me@localhost ~]$ python iotpsutil.py -o organization -t type -i id -T authToken
```

##Visualize
Visit the [IBM Internet of Things QuickStart Portal](http://quickstart.internetofthings.ibmcloud.com) and enter your device ID to see real time visualizations of
the data sent from your device.

## Support Application
A sample application is provided that allows commands to be sent to the device when used in registered mode only. This application requires a [configuration file](https://github.com/ibm-messaging/iot-python#using-a-configuration-file).

The application provides two functions:
* Adjust the publish rate of the psutil device sample
* Print a debug message to the console on the device

```
[me@localhost ~]$ python psutilApp.py -c application.cfg
Command List:
1. Change target device
(Ctrl+C to disconnect)
None:None>1
0. Manually enter type and ID
1. 001:psutil
Choose Device >1
Command List:
1. Change target device
2. Set publish rate of psutil:001
3. Send message to console of psutil:001
(Ctrl+C to disconnect)
psutil:001>2
Enter Interval (seconds) >10
Command List:
1. Change target device
2. Set publish rate of psutil:001
3. Send message to console of psutil:001
(Ctrl+C to disconnect)
psutil:001>
```

0 comments on commit d97ab58

Please sign in to comment.