• Upswift

Best Practice Guide - App Monitor


This guide goes over the best practice to monitor your device software application and any other data value using Upswift platform. The best practice guidelines are thought about how to set App monitor parameters, send parameters value from the edge device to the platform, and set dedicated logic alerts.

App Monitor approach

Upswift provides an easy-to-use way to monitor each and every device important data while receiving platform and email alerts in accordance. This method can help you monitor your product application as well as learning your device's behavior by watching and monitoring the received value of each parameter.


Guidelines

There are 3 main things we need to set up with the App Monitor tool to get the best from our devices.


Dashboard - Configure App Monitor parameters

1. Under the App Monitor category, click on the 'New Parameter' green button.

2. Enter the parameter name and the value type you would like to send - string, number (integer), or boolean.

3. Save the parameter and make sure you can see it under the Parameters section.




Device Side - Send parameters value

1. On the device side, we need to create a script that is responsible for sending the parameter value. To do so, each request has to include the device token and the user token (both can be found under /etc/upswift/settings.json), for more information check the App Monitor section in Upswift docs.

2. Here is a quick python script that pulls the Upswift tokens and makes an App Monitor request with 1 APP Monitor parameter - USB:


import json
import requests

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']

#Value of the USB parameter
number_of_connected_usb = 2

#Build a request including the App parameter and the parameter value
json_content = {'device_token': device_token,
                'user_token': user_token,
                'app_parameters': [{'app_parameter_name': number_of_connected_usb}]}
    
#Send a request to Upswift servers
    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)

*This script can be written in any other language with HTTP request capability.


By running this script, the device will send the parameter 'USB' with the value '2' to Upswift server, App Monitor tool.


In a few seconds, you will be able to view the sent value in Upswift App Monitor 'Stats' section:



Dashboard - Set App Monitor alerts logics

1. The final step here is to set an alert logic on one of our App Monitor parameters. Using alerts logics you can receive an alert based on the parameter value changes.

2. Click on your parameter, and under the Alerts Logics section, click on the 'New Alert Logics' green button to add a new alert logic system, fill in the rules as needed.


3. After saving the new logic, you will be able to start receiving alerts based on the specific parameter values and their logics.

Industries

Platform

Company

imgFlasher

Upswift©2020

Let's Talk.

  • Upswift Twitter
  • Facebook