This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
sdk:connection-statistics [2017/10/10 15:01] fachet |
sdk:connection-statistics [2021/08/04 09:20] (current) |
||
---|---|---|---|
Line 6: | Line 6: | ||
A second script will upload the log files in the working directory from time to time to a FTP server. | A second script will upload the log files in the working directory from time to time to a FTP server. | ||
Once having the data on the server, it can be evaluated, e.g. by drawing it onto a map or analyse it with Excel or NI DIAdem. | Once having the data on the server, it can be evaluated, e.g. by drawing it onto a map or analyse it with Excel or NI DIAdem. | ||
+ | |||
+ | |||
+ | ===== Logging Skript ===== | ||
+ | |||
<code c logger.are> | <code c logger.are> | ||
/* DESC: A script that can be used for a longtime logging of a NetModule Router. | /* DESC: A script that can be used for a longtime logging of a NetModule Router. | ||
Line 131: | Line 135: | ||
int logNow() { | int logNow() { | ||
//get current status output | //get current status output | ||
- | sections=mkarray("system","wan","wwan","wlan","gnss","lan","openvpn","ipsec","dio","license"); | + | sections=mkarray("system","wan","wwan","wlan","gnss","lan","openvpn","ipsec","dio","license", "hotspot"); |
status=mkstruct(); | status=mkstruct(); | ||
for (i=0;i<length(sections);i++) { | for (i=0;i<length(sections);i++) { | ||
Line 182: | Line 186: | ||
nb_syslog("Current Logsize: %i byte",this.currentLogSize); | nb_syslog("Current Logsize: %i byte",this.currentLogSize); | ||
//if we don't have enough space delete enough old ones to have enough space | //if we don't have enough space delete enough old ones to have enough space | ||
- | for(i=0;i<length(files);i++) { | ||
- | if (this.currentLogSize < (this.maxLogSize-this.freespace)) break; | ||
- | if(remove(sprintf("%s%s",this.path,files[i]))) { | ||
- | this.currentLogSize=this.currentLogSize-size[i]; | ||
- | nb_syslog("Removed %s%s",this.path,files[i]); | ||
- | } else { | ||
- | nb_syslog("could not remove %s%s",this.path,files[i]); | ||
- | } | ||
- | } | ||
- | nb_syslog("new logsize: %i", this.currentLogSize); | ||
return 0; | return 0; | ||
} | } | ||
Line 293: | Line 287: | ||
+ | ===== Skript to periodcly upload the csv Files ===== | ||
<code c uploader.are> | <code c uploader.are> | ||
Line 363: | Line 358: | ||
u = new uploader("/logger/"); | u = new uploader("/logger/"); | ||
- | u.server="ftp://share.netmodule.com/router/public"; | + | u.server="https://share.netmodule.com/router/public"; |
u.serverpath="/logger/"; | u.serverpath="/logger/"; | ||
u.user="*******"; | u.user="*******"; | ||
Line 370: | Line 365: | ||
u.uploadfiles(); | u.uploadfiles(); | ||
</code> | </code> | ||
+ | |||
+ | |||
+ | |||
+ | Example Python script to visualize the Data: | ||
+ | |||
+ | |||
<code python scatter.py> | <code python scatter.py> |