Hi All,
I couldnt find any examples or doco on this.
I have disks in a NAS, which have a SNMP state, GOOD, BAD, FAILED. I’ve managed to record these into items. I want to create a group, and have the state of the group either be one of the three states or anyone 1 of the 8 disks in the group. I didnt have any success. The state is defined as UNDEF, despite the individual string item showing correct.
Is a Group:String value and how would I define it to one of the 3 states?
Thanks!
CDriver
(CDriver)
April 26, 2019, 11:38pm
2
Map them to a number, 1-3 and min / max that in a group. Map the number back to a text state.
rossko57
(Rossko57)
April 26, 2019, 11:41pm
3
Group:String
is certainly a valid type. The trouble is I do not think there is any useful way to calculate its state. You cannot postUpdate Group states from rules, and I doubt any of the available aggregation functions work on String members.
You could try
Group:String:AND("GOOD". "Notgood") etc.
which might give a group that is “GOOD” when all members are good - but I doubt it.
Interesting Crispin! nice approach.
MAP:
UNDEF=UNDEF
GOOD=1
BAD=2
FAILED=3
NULL=NULL
ITEMS
/*SNNP Devices */
Group gSNMP
Group:Number:MAX gDisksState "[MAP(snmp.map):%s]"
String QNAP_UpTime "QNAP UpTime" (gSNMP) { snmp="<[192.168.0.9:LAN:1.3.6.1.2.1.25.1.1.0:500000]" }
String QNAP_CPUTemp (gSNMP) { snmp="<[192.168.0.9:LAN:1.3.6.1.4.1.24681.1.2.5.0:250000]" }
String QNAP_SystemTemp (gSNMP) { snmp="<[192.168.0.9:LAN:1.3.6.1.4.1.24681.1.2.6.0:250000]" }
Number QNAP_CPULoad (gNSMP,gInfluxDB) { snmp="<[192.168.0.9:LAN:1.3.6.1.4.1.24681.1.3.1.0:250000]" }
String QNAP_Disk1State "[MAP(snmp.map):%s]" (gSNMP,gDisksState) { snmp="<[192.168.0.9:LAN:1.3.6.1.4.1.24681.1.2.11.1.7.1:28800000]" }
String QNAP_Disk2State "[MAP(snmp.map):%s]" (gSNMP,gDisksState) { snmp="<[192.168.0.9:LAN:1.3.6.1.4.1.24681.1.2.11.1.7.2:28800000]" }
String QNAP_Disk3State "[MAP(snmp.map):%s]" (gSNMP,gDisksState) { snmp="<[192.168.0.9:LAN:1.3.6.1.4.1.24681.1.2.11.1.7.3:28800000]" }
String QNAP_Disk4State "[MAP(snmp.map):%s]" (gSNMP,gDisksState) { snmp="<[192.168.0.9:LAN:1.3.6.1.4.1.24681.1.2.11.1.7.4:28800000]" }
String QNAP_Disk5State "[MAP(snmp.map):%s]" (gSNMP,gDisksState) { snmp="<[192.168.0.9:LAN:1.3.6.1.4.1.24681.1.2.11.1.7.5:28800000]" }
String QNAP_Disk6State "[MAP(snmp.map):%s]" (gSNMP,gDisksState) { snmp="<[192.168.0.9:LAN:1.3.6.1.4.1.24681.1.2.11.1.7.6:28800000]" }
String QNAP_Disk7State "[MAP(snmp.map):%s]" (gSNMP,gDisksState) { snmp="<[192.168.0.9:LAN:1.3.6.1.4.1.24681.1.2.11.1.7.7:28800000]" }
String QNAP_Disk8State "[MAP(snmp.map):%s]" (gSNMP,gDisksState) { snmp="<[192.168.0.9:LAN:1.3.6.1.4.1.24681.1.2.11.1.7.8:28800000]" }
"
Ill see if this indeed works!
Unless I’m doing something wrong, REST still shows the individual disk item status, as GOOD, rather than 1.
rossko57
(Rossko57)
April 27, 2019, 12:41am
6
Well, yes. MAP in Item labels only affect the displayed state of an Item.
Some bindings will allow you to do a transform on the incoming data, I don’t know about snmp.
dastrix80:
Group:String:MAX
MAX makes no sense for strings, and I’m sure will result in UNDEF
I removed the MAX strings, legacy stuff not used/doesnt work.
Hmmm… So I guess Crispin’s idea won’t work.
CDriver
(CDriver)
April 27, 2019, 6:40am
8
Bugger. Of course
Transform then not work?
A simple rule would do the job too just not implicit.
Another option is map - undef=Something Bad!
If they’re all good then it’ll be good. Else bad