PRTG監控系統配合樹莓派採集企業內部無線網絡質量

本文介紹了一種,如何通過樹莓派採集企業內部無線網絡質量,將樹莓派變成無線探針,並在PRTG網絡監控平臺上進行顯示的方法。

可以監控我們感興趣的無線網絡的各項指標,包括

無線丟包
ping測試最大、最小,平均,抖動
設備溫度
無線信道
無線協商速率
無線連接質量
射頻信號功率

通過這個監控機制,企業網絡管理者可以直觀的獲取無線探針所在區域的無線質量。及時發現諸如無線信道跳頻,延遲增大,丟包,信號衰減等事件。
在這裏插入圖片描述
在這裏插入圖片描述

實現原理

樹莓派運行了基於Debian的Linux系統。通過iwconfig,ping,ifconfig,iproute等linux常見命令獲取設備當前的網絡連接情況,並通過Python格式化數據後,轉換成PRTG系統可以識別的XML格式的數據文件。

部署方法

一、樹莓派無線網絡連接

目前的樹莓派常見的有Raspberry Pi 4,3+,3三個主要流行的版本。具體支持的無線情況如下:

型號 支持的無線頻段
Raspberry Pi 4B 5Ghz+2.4GHz
Raspberry Pi 3B+ 5Ghz+2.4GHz
Raspberry Pi 3B Only 2.4GHz

由於4B的各版本目前剛剛發佈,大批量部署性價比不合適。3B版本不支持5G。
這樣看來的話,使用3B+版本+POE模塊其實剛剛好。
樹莓派無線網絡連接比較簡單,編輯

/etc/wpa_supplicant/wpa_supplicant.conf 

該文件記錄了樹莓派WIFI的相關配置

network={
    ssid="無線網絡名字"
    psk="無線密碼"
    key_mgmt=WPA-PSK
}

配置完成之後重啓網絡服務

service networking restart

由於我們的目標是這個樹莓派不管插在任何一個網口上,甚至是不連接有線直接通過無線連接上報採集的數據,因此需要同時啓用eth和wlan網口,並配置缺省路由的優先級,eth缺省路由優先級較高。編輯文件

cat /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
metric 10
#eth0的metric爲10 ,如果存在eth0爲下一跳的缺省路由,優選此條缺省路由。

allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp  
metric 100
#wlan的metric跳數配置比eth0高
pre-up wpa_supplicant -B w -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf 
post-down killall -q wpa_supplicant
#關聯WPA_Supplicat文件

配置完成後,重啓網絡服務,重啓無線網卡接口。嫌麻煩的的可以直接重啓設備。

service networking restart
ifdown wlan0
ifup eth0

正常聯網的情況下,我們檢查一下設備的路由表和網卡地址,確認是否正常。
在這裏插入圖片描述
在這裏插入圖片描述

二、編寫shell腳本

#!/bin/bash
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

cd /home/pi

if [ -f checkresult.txt ]; then
   #echo "remove old checkresult.txt file ... "
    rm -f checkresult.txt
fi

if [ -f $HOSTNAME-WIFI_Check_result.txt ]; then
   #echo "$HOSTNAME-WIFI_Check_result.txt file ... "
    rm -f $HOSTNAME-WIFI_Check_result.txt
fi

if [ -f IP-WIFI-Check-$HOSTNAME.txt ]; then
   #echo IP-WIFI-Check-$HOSTNAME.txt file ... "
    rm -f IP-WIFI-Check-$HOSTNAME.txt
fi
#刪除可能存在的歷史文件
wlangwip=$(route | grep wlan0 | grep default)
wlangwip=${wlangwip##*default} 
wlangwip=${wlangwip%%0.0.0.0*}
#這一頓騷操作,是爲了獲取目前無線網絡的網關IP地址
#我們儘可能的保證這個腳本的普適性,因此需要自動獲取當前無線網絡的網關IP

# route | grep wlan0 | grep default like this:
#default         10.0.192.1      0.0.0.0         UG    100    0        0 wlan0
#                ↑就是爲了獲取這個字段
#-------------------------------------------------------------------
ping -c 200 -i 0.1 $wlangwip >> checkresult.txt
#100ms間隔快速ping網關IP,結果寫入checkresult.txt文件
iwconfig wlan0 >> checkresult.txt
#iwconfig命令是無線網卡的狀態,將狀態寫入checkresult.txt文件
#-------------------------------------------------------------------
echo '<device_temp>' >> checkresult.txt
cat /sys/class/thermal/thermal_zone0/temp >> checkresult.txt
echo '</device_temp>' >> checkresult.txt
#將樹莓派當前溫度寫入checkresult.txt文件
#-------------------------------------------------------------------
echo '<device_eth0ip>' >> checkresult.txt
ifconfig eth0 | grep "inet " | awk '{print $2}' >> checkresult.txt
echo '</device_eth0ip>' >> checkresult.txt
#-------------------------------------------------------------------
echo '<device_wlanip>' >> checkresult.txt
ifconfig wlan0 | grep "inet " | awk '{print $2}' >> checkresult.txt
echo '</device_wlanip>' >> checkresult.txt
#將有線網卡,無線網卡當前獲取的IP地址寫入checkresult.txt文件

NIC=$(route -n | grep UG | awk '{print $8}'| awk 'NR==1')
ifconfig $NIC | grep "inet " | awk '{print $2}' >> IP-WIFI-Check-$HOSTNAME.txt
#這兩句詳細解釋一下
#第一句,獲取當年設備缺省路由表第一行的記錄,並提取其中的網卡設備名
#第二句,獲取此網卡目前的IP地址
#這個地址是目前樹莓派與服務器通信的主地址。僅連接無線的情況爲wlan0 IP地址,同時連接有線無線的時候爲eth0 IP地址
#這個地址,之後集中下發腳本的時候用得到
#-------------------------------------------------------------------
python checknetwork.py checkresult.txt $HOSTNAME-WIFI_Check_result.txt $HOSTNAME
#通過Python,格式化checkresult.txt的內容,並輸出一個已HOSTNAME命名的XML文件
#-------------------------------------------------------------------
tftp 10.0.20.178 << !
put $HOSTNAME-WIFI_Check_result.txt
put IP-WIFI-Check-$HOSTNAME.txt
quit
!
tftp 10.0.20.20 << !
put IP-WIFI-Check-$HOSTNAME.txt
quit
!
#通過TFTP上傳前面生成的文件,直接傳遞到PRTG服務器上是最方便的,也可選擇使用scp,FTP或者其他的方式,自選。
#-------------------------------------------------------------------
rm -f checkresult.txt
rm -f $HOSTNAME-WIFI_Check_result.txt
rm -f IP-WIFI-Check-$HOSTNAME.txt
刪除剛纔生成的一堆臨時文件
#-------------------------------------------------------------------

每行代碼的功能我都註釋好了,夠貼心了吧,0基礎保證你能看得懂。
我們現在來看一下checkresult.txt文件,這裏面基本包含了我們關心的各項數據。下一步,我們通過Python對這些數據進行簡單的處理。
在這裏插入圖片描述

三、編寫Python

encoding=utf-8
import re
import os
import sys
import datetime
#-------------------------------------------------------------------
#定義一個讀文件的函數,讀取之前shell腳本生成的checkresult文件
def read_file_as_str(file_path):
    # 判斷路徑文件存在
    if not os.path.isfile(file_path):
        raise TypeError(file_path + " does not exist")

    all_the_text = open(file_path).read()
    # print type(all_the_text)
    return all_the_text

#-------------------------------------------------------------------
#定義一個按照關鍵字查找關鍵字前後固定長度的函數
def find_str_as_keyword(str_all,keyword,start,end):
        start=int(start)
        end=int(end)
        len_start=str_all.find(keyword)+start
        len_end=str_all.find(keyword)+end
        #print len_start
        #print len_end
        echo_str=str_all[len_start:len_end]
        return echo_str
#-------------------------------------------------------------------
#定義一個按照兩個關鍵字查找關鍵字之間內容的函數
def between_str_as_keyword(str_all,keyword1,keyword2,keyword1_start=0,keyword2_end=0):
        keyword1_start=int(keyword1_start)
        keyword2_end=int(keyword2_end)
        len_start=str_all.find(keyword1)+keyword1_start
        len_end=str_all.find(keyword2)+keyword2_end
        #print len_start
        #print len_end
        echo_str=str_all[len_start:len_end]
        return echo_str
#-------------------------------------------------------------------
def main(input_file_path,output_file_path,hostname):
        checkresult=read_file_as_str(input_file_path)
        #注意:
        #搜索結果=find_str_as_keyword(待搜索字符串,關鍵字,搜索結果起始長度,搜索結束長度)
        #搜索keyword保證不能重複,儘可能搜索長的關鍵字
        #起始和結束長度從keyword第一個字符串算起,且包含keyword本身長度
        #packetloss=find_str_as_keyword(checkresult,"packet loss",-3,11)
        packetloss=between_str_as_keyword(checkresult,"received,","% packet loss",10)
        #注意丟包率長度會變-使用between函數查找區間
        minavgmaxmdev=between_str_as_keyword(checkresult,"min/avg/max/mdev","wlan0",19,-1)
        PingMin=minavgmaxmdev[0:minavgmaxmdev.find("/")]
        minavgmaxmdev=minavgmaxmdev[minavgmaxmdev.find("/")+1:]
        PingAvg=minavgmaxmdev[0:minavgmaxmdev.find("/")]
        minavgmaxmdev=minavgmaxmdev[minavgmaxmdev.find("/")+1:]
        PingMax=minavgmaxmdev[0:minavgmaxmdev.find("/")]
        minavgmaxmdev=minavgmaxmdev[minavgmaxmdev.find("/")+1:]
        PingMdev=minavgmaxmdev[0:minavgmaxmdev.find(" ms")]
        #抖動值字符串多次截取/與/之間的內容,原文格式類似於:2.103/9.325/29.067/8.392 ms
        totaltime=between_str_as_keyword(checkresult,"loss, time","rtt min/",11,-3)
        #注意總時間字符串長度會變-使用between函數查找區間
        AccessPoint=find_str_as_keyword(checkresult,"Access Point:",14,31)
        Frequency=between_str_as_keyword(checkresult,"Frequency:"," GHz",10)
        #注意信道選擇字符串長度會變-使用between函數查找區間
        BitRate=between_str_as_keyword(checkresult,"Bit Rate="," Mb/s   Tx-Power",9)
        #注意連接速率長度會變
        LinkQuality=between_str_as_keyword(checkresult,"Link Quality=","/70  Signal level",13)
        #注意連接質量長度--可能--會變
        Signallevel=between_str_as_keyword(checkresult,"Signal level=","Rx invalid",13,-17)
        WlanGWIP=between_str_as_keyword(checkresult,"--- "," ping statistics ---",4)
        DeviceTemp=between_str_as_keyword(checkresult,"<device_temp>","</device_temp>",14,-1)
        DeviceTemp=float(DeviceTemp)/1000
        Eth0_IP=between_str_as_keyword(checkresult,"<device_eth0ip>","</device_eth0ip>",16,-1)
        WLAN_IP=between_str_as_keyword(checkresult,"<device_wlanip>","</device_wlanip>",16,-1)
     write_file_as_path(output_file_path,packetloss,PingMin,PingAvg,PingMax,PingMdev,totaltime,AccessPoint,Frequency,BitRate,LinkQuality,Signallevel,hostname,WlanGWIP,DeviceTemp,Eth0_IP,WLAN_IP)




if __name__ == '__main__':
    main(sys.argv[1],sys.argv[2],sys.argv[3])

下面是XML文檔生成的代碼,先看一下,之後我們詳細講解PRTG的XML文件字段屆時

#-------------------------------------------------------------------
#下面這一大段是生成xml文件的函數
def write_file_as_path(file_path,write_packetloss,write_PingMin,write_PingAvg,write_PingMax,write_PingMdev,write_totaltime,write_AccessPoint,write_Frequency,write_BitRate,write_LinkQuality,write_Signallevel,write_hostname,write_WlanGWIP,write_DeviceTemp,write_Eth0_IP,write_WLAN_IP):
        f=open(file_path,'w')
        #with open(file_path,'w',encoding='gbk') as f:
        f.write('<?xml version="1.0" encoding="Windows-1252" ?>\n')
        f.write('<prtg>\n')
        f.write('   <result>\n')
        f.write('       <channel>Packet loss</channel>\n')
        f.write('       <unit>Percent</unit>\n')
        f.write('       <mode>Absolute</mode>\n')
        f.write('       <LimitMaxError>20</LimitMaxError>\n')
        f.write('       <LimitMaxWarning>10</LimitMaxWarning>\n')
        f.write('       <value>'+write_packetloss+'</value>\n')
        f.write('   </result>\n')
        f.write('   <result>\n')
        f.write('       <channel>Ping Min Time</channel>\n')
        f.write('       <CustomUnit>ms</CustomUnit>\n')
        f.write('       <mode>Absolute</mode>\n')
        f.write('       <float>1</float>\n')
        f.write('       <value>'+write_PingMin+'</value>\n')
        f.write('   </result>\n')
        f.write('   <result>\n')
        f.write('       <channel>Ping Max Time</channel>\n')
        f.write('       <CustomUnit>ms</CustomUnit>\n')
        f.write('       <mode>Absolute</mode>\n')
        f.write('       <float>1</float>\n')
        f.write('       <LimitMaxError>500</LimitMaxError>\n')
        f.write('       <LimitMaxWarning>200</LimitMaxWarning>\n')
        f.write('       <value>'+write_PingMax+'</value>\n')
        f.write('   </result>\n')
        f.write('   <result>\n')
        f.write('       <channel>Ping Avg Time</channel>\n')
        f.write('       <CustomUnit>ms</CustomUnit>\n')
        f.write('       <mode>Absolute</mode>\n')
        f.write('       <float>1</float>\n')
        f.write('       <LimitMaxError>100</LimitMaxError>\n')
        f.write('       <LimitMaxWarning>50</LimitMaxWarning>\n')
        f.write('       <value>'+write_PingAvg+'</value>\n')
        f.write('   </result>\n')
        f.write('   <result>\n')
        f.write('       <channel>Ping Mean Deviation Time</channel>\n')
        f.write('       <CustomUnit>ms</CustomUnit>\n')
        f.write('       <mode>Absolute</mode>\n')
        f.write('       <float>1</float>\n')
        f.write('       <value>'+write_PingMdev+'</value>\n')
        f.write('   </result>\n')
        f.write('   <result>\n')
        f.write('       <channel>Ping Total Time</channel>\n')
        f.write('       <CustomUnit>ms</CustomUnit>\n')
        f.write('       <mode>Absolute</mode>\n')
        f.write('       <float>1</float>\n')
        f.write('       <value>'+write_totaltime+'</value>\n')
        f.write('   </result>\n')
        f.write('   <result>\n')
        f.write('       <channel>Radio Frequency</channel>\n')
        f.write('       <CustomUnit>GHz</CustomUnit>\n')
        f.write('       <mode>Absolute</mode>\n')
        f.write('       <float>1</float>\n')
        f.write('       <value>'+write_Frequency+'</value>\n')
        f.write('   </result>\n')
        f.write('   <result>\n')
        f.write('       <channel>Radio BitRate</channel>\n')
        f.write('       <CustomUnit>Mb/s</CustomUnit>\n')
        f.write('       <mode>Absolute</mode>\n')
        f.write('       <float>1</float>\n')
        f.write('       <LimitMinError>50</LimitMinError>\n')
        f.write('       <LimitMinWarning>70</LimitMinWarning>\n')
        f.write('       <value>'+write_BitRate+'</value>\n')
        f.write('   </result>\n')
        f.write('   <result>\n')
        f.write('       <channel>Radio LinkQuality</channel>\n')
        f.write('       <CustomUnit>/70</CustomUnit>\n')
        f.write('       <mode>Absolute</mode>\n')
        f.write('       <value>'+write_LinkQuality+'</value>\n')
        f.write('   </result>\n')
        f.write('   <result>\n')
        f.write('       <channel>Radio Signallevel</channel>\n')
        f.write('       <CustomUnit>dBm</CustomUnit>\n')
        f.write('       <mode>Absolute</mode>\n')
        f.write('       <value>'+write_Signallevel+'</value>\n')
        f.write('   </result>\n')
        f.write('   <result>\n')
        f.write('       <channel>Probe Temperature</channel>\n')
        f.write('       <Unit>Temperature</Unit>\n')
        f.write('       <mode>Absolute</mode>\n')
        f.write('       <float>1</float>\n')
        f.write('       <LimitMaxError>60</LimitMaxError>\n')
        f.write('       <LimitMaxWarning>55</LimitMaxWarning>\n')
        f.write('       <value>'+str(write_DeviceTemp)+'</value>\n')
        f.write('   </result>\n')
        f.write('   <text>Updatetime:'+datetime.datetime.now().strftime('%H:%M:%S')+' Eth0_IP:'+write_Eth0_IP+' Wlan_IP:'+write_WLAN_IP+' WLAN Gateway IP:'+write_WlanGWIP+' AccessPoint:'+write_AccessPoint+'</text>\n')
        f.write('</prtg>\n')
        f.close()

四、PRTG系統配置

在PRTG探針所在的操作系統裏編寫如下腳本。
由於樹莓派送過來的XML文件的命名格式都是:主機名-WIFI_Check_result.txt
所以我們的BAT腳本可以通過%1傳入的參數來打印對應主機名設備的上報信息

@echo off
chcp 65001
type "C:\00-tftp\%1-WIFI_Check_result.txt"

保存到

C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML

然後,在PRTG系統裏面,添加傳感器,搜索“EXE”,選擇“高級EXE/腳本”
在這裏插入圖片描述
EXE/腳本選擇剛纔保存的bat文件
參數填入樹莓派的主機名,這樣本地的腳本帶入參數後,會獲取你指定的樹莓派的上報信息
互斥名稱儘量跟參數保持一致。PRTG將逐一執行 (並非同時執行)擁有相同互斥名稱的所有 EXE/腳本傳感器。如果您擁有大量傳感器並想要避免由同時運行進程所引起的資源高度使用,這十分有用。
在這裏插入圖片描述
到這基本就搞定了,你可以在這個傳感器內看到剛纔樹莓派收集到的各種信息。
在這裏插入圖片描述

五、樹莓派shell腳本配置定時執行

定時執行配置很簡單

crontab -e

打開定時任務執行列表,在最後添加上一句

*/1 * * * * sh /home/pi/checknetwork.sh

腳本地址就是我們剛纔寫好的shell腳本。
注意,crontab運行腳本的時候是不帶系統變量的,所以我們之前的腳本里已經提前寫了PATH變量。

PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

當然還有一種辦法,你再寫個腳本,來調這個腳本。比如隨便在root目錄下寫個腳本,就寫一句話,調用checknetwork.sh。這樣也可以避免PATH不同步的情況。

#!/bin/bash
/home/pi/checknetwork.sh

進階提高

看到這裏,基本功能都實現了,但是接下來我們還有一些高階的應用

一、多個樹莓派自動更新腳本

對於網內所有的樹莓派,如果shell腳本或者python程序出現迭代更新,我們設計了一個辦法統一下發新版本的shell腳本和python到所有的樹莓派。這對於網內有幾十個樹莓派的時候,非常有用。
找一臺linux主機做版本服務器,寫個下面的腳本

#!/bin/bash

TFTPPATH="/root/tftp_file"
IPLISTPATH="/root/PRTG_WIFI_Probe/IPlist"

rm -f $IPLISTPATH/*
mv $TFTPPATH/IP-WIFI* $IPLISTPATH/

find $IPLISTPATH/ -mmin +2 -name "IP-WIFI*" -exec rm {} \;
#保留最近2分鐘內更新過的IP-WIFI-*****.txt文件,之前的刪除掉
cat $IPLISTPATH/IP-WIFI* > /root/PRTG_WIFI_Probe/IPlist_all.txt
#合併所有的IP-WIFI-*****.txt
for ip in `cat /root/PRTG_WIFI_Probe/IPlist_all.txt | tr -d "\r" `
do
        echo "sent file to "$ip
        scp /root/PRTG_WIFI_Probe/programfile/checknetwork.py $ip:/home/pi 
        scp /root/PRTG_WIFI_Probe/programfile/checknetwork.sh $ip:/home/pi 

done
#全部下發一遍文件

這裏面,就涉及到了之前在樹莓派上的一段騷操作。

NIC=$(route -n | grep UG | awk '{print $8}'| awk 'NR==1')
ifconfig $NIC | grep "inet " | awk '{print $2}' >> IP-WIFI-Check-$HOSTNAME.txt
#這兩句詳細解釋一下
#第一句,獲取當年設備缺省路由表第一行的記錄,並提取其中的網卡設備名
#第二句,獲取此網卡目前的IP地址
#這個地址是目前樹莓派與服務器通信的主地址。僅連接無線的情況爲wlan0 IP地址,同時連接有線無線的時候爲eth0 IP地址
#這個地址,之後集中下發腳本的時候用得到

是不是突然想發出~ 哦~的一聲讚歎,讚歎這個設計的精妙。
爲了更方便,可以提前把這臺服務器的SSH-Keygen公鑰發送到所有樹莓派上,這樣scp完全無密碼下發文件
在這裏插入圖片描述

二、樹莓派保活探測

本例中,PRTG系統會讀取生成的XML文件,只要這個文件存在,系統就不會告警。
因此,如果某個樹莓派出現異常,不繼續更新上報信息的時候。我們需要一個機制來探測,XML文件是否一直在正常更新
在PRTG探針所在的服務器上,編寫以下BAT腳本

@echo off&setlocal enabledelayedexpansion

for /f "tokens=1 delims=" %%i in ('dir C:\00-tftp /tw ^| find /i "%1-WIFI_Check_result.txt"  ') do set timeresult=%%i

set ma=%timeresult:~15,2%
set mb=%time:~3,2%

set /a ma=1%ma%-100
set /a mb=1%mb%-100
#以上兩句是去除分鐘爲08時的異常。BAT腳本對於08xxx的數字會認爲是8進制
set /a mc=%mb%-%ma%

if %mc% gtr 2 (echo %mc%:Error Time Out) else (echo %mc%:Active)

然後,放到如下的路徑下

C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXE

好了,去PRTG添加一個自定義傳感器,使用這個腳本,傳參爲設備名。XML文件超過2分鐘沒更新就告警咯。

三、PRTG XML格式自定義傳感器XML解釋

來個示例

XML Return Format: Minimum Example:

<prtg>
	<result>
	 <channel>通道1名稱</channel>
	 <value>通道值</value>
</result>
<result>
	<channel>通道2名稱</channel>
	<value>通道值</value>
</result>
<text>自定義文本傳遞</text>
<error>自定義錯誤消息</error>
</prtg>

result 字段內可選的標籤如下:

TAG MANDATORY DESCRIPTION POSSIBLE CONTENT
《Channel》 Yes Name of the channel as displayed in user interfaces./ This parameter is required and must be unique for the sensor. Any string
《Value》 Yes The value as integer or float./ Make sure the 《Float》 setting matches the kind of value provided. Otherwise PRTG shows 0 values. Integer or float value
《Unit》 No The unit of the value. The default is Custom. This is useful for PRTG to be able to convert volumes and times. BytesBandwidth/BytesDisk/Temperature/Percent/TimeResponse/TimeSeconds/Custom/Count/CPU: This is a % unit that is accounted to the CPU load in index graphs./BytesFile/SpeedDisk/SpeedNet/TimeHours
《CustomUnit》 No If Custom is used as unit, this is the text displayed behind the value. Any string (keep it short
《SpeedSize》《VolumeSize》 No Size used for the display value. For example, if you have a value of 50000 and use Kilo as size, the display is 50 kilo #./The default is One (value used as returned). For the Bytes and Speed units, this is overridden by the setting in the user interface. One/Kilo/Mega/Giga/Tera/Byte/KiloByte/MegaByte/GigaByte/TeraByte/Bit/KiloBit/MegaBit/GigaBit/TeraBit
《SpeedTime》 No See above, used when displaying the speed. The default is Second. Second/Minute/Hour/Day
《Mode》 No Select if the value is an absolute value or counter. The default is Absolute. Absolute/Difference
《Float》 No Define if the value is a float. The default is 0 (no). If set to 1 (yes), use a dot as decimal separator in values./ Define decimal places with the 《DecimalMode》 element. 0 (= no, integer)/1 (= yes, float)
《DecimalMode》 No Init value for the Decimal Places option. If 0 is used in the 《Float》 element (use integer), the default is Auto. Otherwise (for float) the default is All./ You can change this initial setting later in the sensor’s channel settings. Auto/All
《Warning》 No If enabled for at least one channel, the entire sensor is set to “Warning” status. The default is 0 (no). 0 (= no)/1 (= yes)
《ShowChart》 No Init value for the Show in graphs option. The default is 1 (yes)./ The values defined with this element are only considered during the first sensor scan when the channel is newly created. They are ignored on all further sensor scans (and may be omitted). You can change this initial setting later in the sensor’s channel settings. 0 (= no)/1 (= yes)
《ShowTable》 No Init value for the Show in tables option. The default is 1 (yes)./ The values defined with this element are only considered during the first sensor scan when the channel is newly created. They are ignored on all further sensor scans (and may be omitted). You can change this initial setting later in the sensor’s channel settings. 0 (= no)/1 (= yes)
《LimitMaxError》 No Define an upper error limit for the channel. If enabled, the sensor is set to a Down status if this value is overrun and the LimitMode is activated./ Provide the limit value in the unit of the base data type, just as used in the 《Value》 element of this section. While a sensor shows a Down status triggered by a limit, it still receives data in its channels./ The values defined with this element are only considered during the first sensor scan when the channel is newly created. They are ignored on all further sensor scans (and may be omitted). You can change this initial setting later in the sensor’s channel settings. String with numbers, surrounded by quotation marks (")
《LimitMaxWarning》 No Define an upper warning limit for the channel. If enabled, the sensor is set to a Warning status if this value is overrun and the LimitMode is activated./ Provide the limit value in the unit of the base data type, just as used in the 《Value》 element of this section. While a sensor shows a Down status triggered by a limit, it still receives data in its channels./ The values defined with this element are only considered during the first sensor scan when the channel is newly created. They are ignored on all further sensor scans (and may be omitted). You can change this initial setting later in the sensor’s channel settings. String with numbers, surrounded by quotation marks (")
《LimitMinWarning》 No Define a lower warning limit for the channel. If enabled, the sensor is set to a Warning status if this value is undercut and the LimitMode is activated./ Provide the limit value in the unit of the base data type, just as used in the 《Value》 element of this section. While a sensor shows a Down status triggered by a limit, it still receives data in its channels./ The values defined with this element are only considered during the first sensor scan when the channel is newly created. They are ignored on all further sensor scans (and may be omitted). You can change this initial setting later in the sensor’s channel settings. String with numbers, surrounded by quotation marks (")
《LimitMinError》 No Define a lower error limit for the channel. If enabled, the sensor is set to a Down status if this value is undercut and the LimitMode is activated./ Provide the limit value in the unit of the base data type, just as used in the 《Value》 element of this section. While a sensor shows a Down status triggered by a limit, it still receives data in its channels./ The values defined with this element are only considered during the first sensor scan when the channel is newly created. They are ignored on all further sensor scans (and may be omitted). You can change this initial setting later in the sensor’s channel settings. String with numbers, surrounded by quotation marks (")
《LimitErrorMsg》 No Define an additional message. It is added to the sensor’s message when entering a Down status that is triggered by a limit./ The values defined with this element are only considered during the first sensor scan when the channel is newly created. They are ignored on all further sensor scans (and may be omitted). You can change this initial setting later in the sensor’s channel settings. Any string
《LimitWarningMsg》 No Define an additional message. It is added to the sensor’s message when entering a Warning status that is triggered by a limit./ The values defined with this element are only considered during the first sensor scan when the channel is newly created. They are ignored on all further sensor scans (and may be omitted). You can change this initial setting later in the sensor’s channel settings. Any string
《LimitMode》 No Define if the limit settings defined above are active. The default is 0 (no; limits inactive). If 0 is used, the limits are written to the sensor channel settings as predefined values, but limits are disabled./ The values defined with this element are only considered during the first sensor scan when the channel is newly created. They are ignored on all further sensor scans (and may be omitted). You can change this initial setting later in the sensor’s channel settings. 0 (= no)/1 (= yes)
《ValueLookup》 No Define if you want to use a lookup file (for example, to view integer values as status texts). Enter the ID of the lookup file that you want to use, or omit this element to not use lookups./ The values defined with this element are only considered during the first sensor scan when the channel is newly created. They are ignored on all further sensor scans (and may be omitted). You can change this initial setting later in the sensor’s channel settings. Any string
《NotifyChanged》 No If a returned channel contains this tag, it triggers a change notification that you can use with the Change Trigger to send a notification. No content requir

/

搞定!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章