Changes for page Monitor Gateway

Last modified by Xiaoling on 2022/07/14 15:37

From version 1.2
edited by Xiaoling
on 2022/05/12 15:13
Change comment: There is no comment for this version
To version 1.8
edited by Xiaoling
on 2022/05/12 15:32
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -5,67 +5,89 @@
5 5  
6 6  = 1. Introduction =
7 7  
8 +(((
8 8  This introduction shows how to use a script to monitor the gateway. The video link for this instruction is: [[https:~~/~~/youtu.be/8PieIwfSF_g>>url:https://youtu.be/8PieIwfSF_g]]
10 +)))
9 9  
10 10  [[image:https://wiki.dragino.com/images/thumb/d/dc/Monitor_gateway.png/600px-Monitor_gateway.png||height="456" width="600"]]
11 11  
12 12  Monitor Gateway
13 13  
16 +
14 14  = 2. Steps =
15 15  
16 -* Create account in ThingsSpeak and creat channel.
17 -* Download script from dragino site and move it to properly directory
19 +(((
20 +~1. Create account in ThingsSpeak and creat channel.
21 +)))
18 18  
19 -{{{root@dragino-1baf44:~# wget
20 -Downloading '
23 +(((
24 +2. Download script from dragino site and move it to properly directory
25 +)))
26 +
27 +(% class="box" %)
28 +(((
29 +root@dragino-1baf44:~~# wget [[http:~~/~~/www.dragino.com/downloads/downloads/LoRa_Gateway/LPS8/Firmware/customized_script/monitor_gateway.sh>>url:http://www.dragino.com/downloads/downloads/LoRa_Gateway/LPS8/Firmware/customized_script/monitor_gateway.sh]]
30 +Downloading '[[http:~~/~~/www.dragino.com/downloads/downloads/LoRa_Gateway/LPS8/Firmware/customized_script/monitor_gateway.sh'>>url:http://www.dragino.com/downloads/downloads/LoRa_Gateway/LPS8/Firmware/customized_script/monitor_gateway.sh']]
21 21  Connecting to 162.241.22.11:80
22 22  Writing to 'monitor_gateway.sh'
23 -monitor_gateway.sh 100% |*******************************| 1860 0:00:00 ETA
33 +monitor_gateway.sh   100% |~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~**|  1860   0:00:00 ETA
24 24  Download completed (1860 bytes)
25 -root@dragino-1baf44:~# chmod +x monitor_gateway.sh;mv monitor_gateway.sh /usr/bin/
26 -root@dragino-1baf44:~#
27 -root@dragino-1baf44:~#
28 -}}}
35 +root@dragino-1baf44:~~# chmod +x monitor_gateway.sh;mv monitor_gateway.sh /usr/bin/
36 +root@dragino-1baf44:~~#
37 +root@dragino-1baf44:~~#
38 +)))
29 29  
30 -* change the script monitor_gateway.sh with properly users setting:
40 +(((
41 +3. change the script monitor_gateway.sh with properly users setting:
42 +)))
31 31  
32 -{{{USER='xxxxx' # user name in your thinkspeak --> Profile
33 -PASS='xxxxx' #MQTT_API_KEY in your thinkspeak --> Profile
34 -}}}
44 +(% class="box" %)
45 +(((
46 +USER='xxxxx'             # user name in your thinkspeak ~-~-> Profile
47 +PASS='xxxxx'     #MQTT_API_KEY in your thinkspeak ~-~-> Profile
48 +)))
35 35  
36 -{{{CHAN_ID='xxxx' #Channel ID of the channel for this gateway
37 -CHAN_KEY='xxxxx' #Channel Write API of the channel for this gateway
38 -}}}
50 +(% class="box" %)
51 +(((
52 +CHAN_ID='xxxx'    #Channel ID   of the channel for this gateway
53 +CHAN_KEY='xxxxx'   #Channel Write API  of the channel for this gateway
54 +)))
39 39  
40 -* run **/usr/bin/monitor_gateway.sh** to test if upload is good.
56 +(((
57 +~1. run **/usr/bin/monitor_gateway.sh** to test if upload is good.
58 +)))
41 41  
42 -* 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
60 +(((
61 +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
62 +)))
43 43  
44 -{{{ # For details see man 4 crontabs
45 -
64 +(% class="box" %)
65 +(((
66 +# For details see man 4 crontabs
46 46  # Example of job definition:
47 -# .---------------- minute (0 - 59)
48 -# | .------------- hour (0 - 23)
49 -# | | .---------- day of month (1 - 31)
50 -# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
51 -# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
68 +# .~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~- minute (0 - 59)
69 +# | .~-~-~-~-~-~-~-~-~-~-~-~-- hour (0 - 23)
70 +# | | .~-~-~-~-~-~-~-~-~-~- day of month (1 - 31)
71 +# | | | .~-~-~-~-~-~-- month (1 - 12) OR jan,feb,mar,apr ...
72 +# | | | | .~-~-~-~- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
52 52  # | | | | |
53 53  # * * * * * user-name command to be executed
75 +#*/10 * * * *  checklog
76 +~* 23 * * *  /etc/init.d/auto_update start
77 +*/20 * * * *  /usr/bin/monitor_gateway.sh 
78 +)))
54 54  
55 -#*/10 * * * * checklog
80 +(((
81 +3. Reboot device.
82 +)))
56 56  
57 -* 23 * * * /etc/init.d/auto_update start
58 -*/20 * * * * /usr/bin/monitor_gateway.sh
59 -}}}
60 -
61 -* Reboot device.
62 -
63 -
64 64  = 3. Monitor Public IP =
65 65  
66 66  The monitor_gateway.sh has been updated to upload the public ip of the device as well.
67 67  
88 +(((
68 68  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.
90 +)))
69 69  
70 70  [[image:https://wiki.dragino.com/images/thumb/8/8f/Monitor_gateway_1.png/600px-Monitor_gateway_1.png||height="340" width="600"]]
71 71