Table of Contents:

1.  Introduction

This introduction shows how to use a script to monitor the gateway. The video link for this instruction is: https://youtu.be/8PieIwfSF_g

 

image-20220527111742-1.png

Monitor Gateway

2.  Steps

1. Create account in ThingsSpeak and creat channel.

 

2. Download script from dragino site and move it to properly directory

root@dragino-1baf44:~# wget http://www.dragino.com/downloads/downloads/LoRa_Gateway/LPS8/Firmware/customized_script/monitor_gateway.sh
Downloading 'http://www.dragino.com/downloads/downloads/LoRa_Gateway/LPS8/Firmware/customized_script/monitor_gateway.sh'
Connecting to 162.241.22.11:80
Writing to 'monitor_gateway.sh'
monitor_gateway.sh   100% |*******************************|  1860   0:00:00 ETA
Download completed (1860 bytes)
root@dragino-1baf44:~# chmod +x monitor_gateway.sh;mv monitor_gateway.sh /usr/bin/
root@dragino-1baf44:~#
root@dragino-1baf44:~#

3. change the script monitor_gateway.sh with properly users setting:

USER='xxxxx'     # user name in your thinkspeak         --> Profile
PASS='xxxxx'     # MQTT_API_KEY in your thinkspeak --> Profile

CHAN_ID='xxxx'        # Channel ID   of the channel for this gateway
CHAN_KEY='xxxxx'   # Channel Write API  of the channel for this gateway

1).  run /usr/bin/monitor_gateway.sh to test if upload is good.

2).  Add monitor_gateway.sh to cron work /etc/crontabs/root to make this script runs perdiocally, below is an example to update every 20 minutes

# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
#*/10 * * * *  checklog
* 23 * * *  /etc/init.d/auto_update start
*/20 * * * *  /usr/bin/monitor_gateway.sh  

3). Reboot device.

3.  Monitor Public IP

The monitor_gateway.sh has been updated to upload the public ip of the device as well.

User can find the public ip in field7, the chart is not able to show the complete public ip, user can check that in the export.

image-20220527111850-2.png

Find Public IP

 

Tags:
    
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0