This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
sdk:status-values-via-snmp [2015/07/06 09:18] fachet [Access via SNMP] |
sdk:status-values-via-snmp [2020/07/21 08:31] (current) fachet [Access via SNMP] |
||
---|---|---|---|
Line 54: | Line 54: | ||
*if you use SNMP v1/2c with the MibBrowser please set either the "Community" (=read only) or the "Write Commuinity" (=read-write), but not both at the same time. | *if you use SNMP v1/2c with the MibBrowser please set either the "Community" (=read only) or the "Write Commuinity" (=read-write), but not both at the same time. | ||
+ | For easier use please copy the NetModule private MIB (NETMODULE-VENDOR-MIB.mib into the MIB directory (e.g. C:\Program Files\MibBrowser Free Tool\mibs) and load it File->Load MIB . | ||
===== Useful ===== | ===== Useful ===== | ||
Line 104: | Line 105: | ||
<code c status_snmp2.are> | <code c status_snmp2.are> | ||
/* DESC: This script extends MIB entries of the SNMP agent | /* DESC: This script extends MIB entries of the SNMP agent | ||
- | * with values from nb_status for temperature, signal level | + | * with values from nb_status for temperature, signal level, |
- | * and transferred data on mobile network | + | * transferred data on mobile network and |
+ | * reset of transferred data counter | ||
* Copyright (coffee) 2014 NetModule AG, Switzerland | * Copyright (coffee) 2014 NetModule AG, Switzerland | ||
*/ | */ | ||
Line 112: | Line 114: | ||
if (nb_snmp_register("DOWNLOADED", 3, "s", "ro") == -1)exit(3); | if (nb_snmp_register("DOWNLOADED", 3, "s", "ro") == -1)exit(3); | ||
if (nb_snmp_register("UPLOADED", 4, "s", "ro") == -1)exit(4); | if (nb_snmp_register("UPLOADED", 4, "s", "ro") == -1)exit(4); | ||
+ | if (nb_snmp_register("RESET_DATA", 5, "s", "rw") == -1)exit(5); | ||
if (nb_snmp_link() == -1)exit(6); | if (nb_snmp_link() == -1)exit(6); | ||
Line 123: | Line 125: | ||
if (nb_snmp_update("DOWNLOADED", struct_get(wan, "WANLINK1_DATA_DOWNLOADED")) == -1) exit(9); | if (nb_snmp_update("DOWNLOADED", struct_get(wan, "WANLINK1_DATA_DOWNLOADED")) == -1) exit(9); | ||
if (nb_snmp_update("UPLOADED", struct_get(wan, "WANLINK1_DATA_UPLOADED")) == -1) exit(10); | if (nb_snmp_update("UPLOADED", struct_get(wan, "WANLINK1_DATA_UPLOADED")) == -1) exit(10); | ||
- | sleep(5); | + | |
- | } | + | if (s = nb_snmp_listen(5)) |
+ | if (s.name == "RESET_DATA" && s.value == "reset") { | ||
+ | nb_reset_statistics("wanlink0"); | ||
+ | if (nb_snmp_update("RESET_DATA", strftime("%d.%m.%Y %H:%M:%S", localtime(time()))) == -1) exit(11); | ||
+ | } | ||
+ | } </code> | ||
+ | |||
+ | Please extend the NetModule router MIB (VENODR-MIB.txt before "trap objects" with: | ||
+ | <code> | ||
+ | -- **************************************************************************** | ||
+ | -- NBSdkTable | ||
+ | -- **************************************************************************** | ||
+ | sdkTemperature OBJECT-TYPE | ||
+ | SYNTAX DisplayString | ||
+ | MAX-ACCESS read-only | ||
+ | STATUS current | ||
+ | DESCRIPTION | ||
+ | "The temperature of the WWAN Module 1" | ||
+ | ::= { sdk 1 } | ||
+ | |||
+ | sdkRSRQ OBJECT-TYPE | ||
+ | SYNTAX DisplayString | ||
+ | MAX-ACCESS read-only | ||
+ | STATUS current | ||
+ | DESCRIPTION | ||
+ | "The RSRQ of the WWAN Module 1" | ||
+ | ::= { sdk 2 } | ||
+ | |||
+ | sdkDataDownloaded OBJECT-TYPE | ||
+ | SYNTAX DisplayString | ||
+ | MAX-ACCESS read-only | ||
+ | STATUS current | ||
+ | DESCRIPTION | ||
+ | "The data downloaded on the WAN interface" | ||
+ | ::= { sdk 3 } | ||
+ | |||
+ | sdkDataUploaded OBJECT-TYPE | ||
+ | SYNTAX DisplayString | ||
+ | MAX-ACCESS read-only | ||
+ | STATUS current | ||
+ | DESCRIPTION | ||
+ | "The data uploaded on the WAN interface" | ||
+ | ::= { sdk 4 } | ||
+ | |||
+ | sdkDataReset OBJECT-TYPE | ||
+ | SYNTAX DisplayString | ||
+ | MAX-ACCESS read-write | ||
+ | STATUS current | ||
+ | DESCRIPTION | ||
+ | "Write 'reset' to reset the up- and download counters for the WAN interface." | ||
+ | ::= { sdk 5 } | ||
</code> | </code> | ||
+ | {{:sdk:mibbrowser_status_snmp2.jpg|}} |