Raspberry Pi monitor outputs remotely

This guide explains how you can monitor Raspberry Pi outputs like temperature, GPIOs, network usage and more easily and remotely using Upswi

Time to read:



This guide explains how you can monitor Raspberry Pi outputs like temperature, GPIOs, network usage and more easily and remotely using Upswift.io platform.

Our goal is to monitor those outputs at any time automatically. In this guide, we will use python for programing, crontab for running the monitor script every minute and Upswift IoT platform to receive the information from the Raspberry Pi. You can also use this guide to monitor other important parameters of your application as you wish!


Open account at Upswift IoT device management platform - it is completely free for prototyping purposes.


Create a new project and connect your Raspberry Pis by copying & running the installation command from the 'register device' window in your device terminal. In a few seconds, you will see your Raspberry Pi under the 'Devices' category. Go ahead and change the device name and set the correct location (if you would like).


Go to 'App Monitor' category, here we can set the names of the parameters we would like to receive their values from the Raspberry Pi, it can be anything, for example- Pi_temperature, network_usage, is_app_in_work, is_screen_conncted, etc..


Let's create a simple script that sends data from the Raspberry Pi to Upswift App Monitor. To do so, we will use Upswift General API.

Here are the basics of our python script design:

1. To send data to Upswift platform, we need to pull Upswift user_token & device_token from upswift settings file in '/etc/upswift/service/settings.json'.

2. Next, we want to have the relevant data ready to send. In this example, we would check the device temperature and GPIO status.

3. Send the data to Upswift servers.

Here is the full python script of this example:

import json import requests #third-party imports from gpiozero import CPUTemperature import RPi.GPIO as GPIO UPSWIFT_SETTINGS_FILE = '/etc/upswift/service/settings.json' #Pull Upswift tokens with open(UPSWIFT_SETTINGS_FILE) as json_file: data = json.load(json_file) #Upswift tokens user_token = data['user_token'] device_token = data['device_token'] #Pull parameters data value cpu_temp_output = string(CPUTemperature()) gpio_18_output = string(GPIO.input(18)) #Send data to Upswift json_content = {'device_token': device_token, 'user_token': user_token, 'app_parameters': [{'app_parameter_name': "Temperature", 'app_parameter_value': cpu_temp_output}, {'app_parameter_name': "GPIO_18", 'app_parameter_value': gpio_18_output}]} call_request = requests.post("https://api.upswift.io/v1/send_app_monitor", json=json_content) call_response = json.loads(call_request.text) if call_request.status_code != 200: if call_request.status_code == 429: error = "API limit reached" else: error = call_response["error_message"] print(error) else: response_message = call_response["message"]


Run the script once and make sure you don't get any error output.

Now, all we need to do is to run the script every minute, automatically.

Here is how we can do it:

1. run the command: crontab -e

2. If this is your first time here you will be asked to choose your favorite editor tool.

3. add a new line that includes the full path to your python script, here is how it should look like:

* * * * * python /home/my_script.py

The five asterisks mean means that your python script will run once in every minute.

Save the file and let's leave the Raspberry to do the job!


Go to Upswift App Monitor tool, in a few seconds, you will see a new line from your device, including the values you have just sent! congratulations!

Upswift IoT platform by default monitors device resources like RAM, CPU, DISK, and current status, all available under the 'Devices' category. This guide works perfectly with any other embedded Linux based device and can help you monitor and manage thousands of edge devices all over the world in one place.