The case is to collect SNMP information on the Supermicro server. I get value in Hex-string instead of string.
I try to make the result right, using Javascript preprocessing on LLD.
This article helps me a lot, but the script can't work for me:
The data I want to parse():
the result I wish for:
I want to use {#SENSOR} as a part of my item name.
I use this scripts:
when test item preprocessing on zabbix page, it looks like successful:

But I still get the {#SENSOR} with Hex-string.
How can I check the real return on LLD, in the zabbix official sites, it seems like:
{ "data": [ { "{#SNMPINDEX}": "1", "{#IFDESCR}": "WAN", "{#IFPHYSADDRESS}": "8:0:27:90:7a:75" }, { "{#SNMPINDEX}": "2", "{#IFDESCR}": "LAN1", "{#IFPHYSADDRESS}": "8:0:27:90:7a:76" }, { "{#SNMPINDEX}": "3", "{#IFDESCR}": "LAN2", "{#IFPHYSADDRESS}": "8:0:27:2b:af:9e" } ] }
Code:
#snmpwalk -v2c -c zabbix 10.110.55.23 1.3.6.1.4.1.25506.13.1.2.1.2.2.1.1.3.1 iso.3.6.1.4.1.25506.13.1.2.1.2.2.1.1.3.1 = Hex-STRING: 30 31 2D 49 6E 6C 65 74 20 54 65 6D 70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 #snmpwalk -Oa -v2c -c zabbix 10.110.55.23 1.3.6.1.4.1.25506.13.1.2.1.2.2.1.1.3.1 iso.3.6.1.4.1.25506.13.1.2.1.2.2.1.1.3.1 = STRING: "01-Inlet Temp..................................................."
This article helps me a lot, but the script can't work for me:
The data I want to parse():
Code:
{
"data": [
{
"{#SNMPINDEX}": "1",
"{#SENSOR}": "30 33 2D 43 50 55 20 32 00 00 00 00 00 00"
},
{
"{#SNMPINDEX}": "2",
"{#SENSOR}": "30 35 2D 43 50 55 20 32 20 44 54 53 00 00"
},
{
"{#SNMPINDEX}": "3",
"{#SENSOR}": "30 38 2D 50 32 20 44 49 4D 4D 20 43 68 31"
}
]
}
Code:
{
"data": [
{
"{#SNMPINDEX}": "1",
"{#SENSOR}": "03-CPU 2"
},
{
"{#SNMPINDEX}": "2",
"{#SENSOR}": "05-CPU 2 DTS"
},
{
"{#SNMPINDEX}": "3",
"{#SENSOR}": "08-P2 DIMM Ch1"
}
]
}
I use this scripts:
Code:
tmp = eval('('+value+')');
for(var p in tmp["data"]){
str = "";
for(var i = 0, nums = tmp["data"][p]["{#SENSOR}"].split(" "); i < nums.length; i++)
str += String.fromCharCode(parseInt(nums[i], 16))
tmp["data"][p]["{#SENSOR}"] = str;
}
return JSON.stringify(tmp)
[URL="https://support.zabbix.com/browse/ZBXNEXT-505"][/URL]
when test item preprocessing on zabbix page, it looks like successful:
But I still get the {#SENSOR} with Hex-string.
How can I check the real return on LLD, in the zabbix official sites, it seems like:
{ "data": [ { "{#SNMPINDEX}": "1", "{#IFDESCR}": "WAN", "{#IFPHYSADDRESS}": "8:0:27:90:7a:75" }, { "{#SNMPINDEX}": "2", "{#IFDESCR}": "LAN1", "{#IFPHYSADDRESS}": "8:0:27:90:7a:76" }, { "{#SNMPINDEX}": "3", "{#IFDESCR}": "LAN2", "{#IFPHYSADDRESS}": "8:0:27:2b:af:9e" } ] }