Lsi Logical Drives Discovery and Lsi Physical Drives Discovery issue
DilyanIvanov opened this issue · 7 comments
Hello, I'm trying to use Template Lsi RAID Controller with lsi-raid.sh script, but discovery rules return the following errors:
Invalid discovery rule value: cannot parse as a valid JSON object: invalid array format, expected closing character ']' at: '{"{#3WAREDEVICENAME}":"sda","{#HD_SERIAL_NUM}":"","{#3WARE_PORT_NUM}":"8"},
]
}'
This error is for both Lsi Logical Drives Discovery and Lsi Physical Drives Discovery. I'm using Zabbix 4.4.8 on Slackware 14.2
Any ideas?
Hello
Do you use a modified script?
Because I don't have such variables in my script.
Strange, I don't use modified script, just copy script as is.
...
ld_json=${ld_json}"{"{#CTRL.ID}":"${ctrl_id}","{#LD.ID}":"${ld_id}","{#LD.NAME}":"${ld_name}","{#LD.RAID}":"${ld_raid}"},"
...
LLDPhysicalDrives() {
ctrl_count=$(CheckCtrlCount)
pd_json=""
for ctrl_id in $(seq 0 $((${ctrl_count} - 1))); do
pd_list=$($CLI -PDList -a${ctrl_id} -NoLog | grep -i "Slot Number" | cut -f2 -d":" | sed -e 's/^\s*//')
ed_list=$($CLI -EncInfo -a${ctrl_id} -NoLog | grep -Eo "\s*Device ID\s*:\s*\w+$" | head -n1 | cut -f2 -d":" | tr -d '\r\n' | sed -e 's/^\s*//')
for ed_id in ${ed_list}; do
for pd_id in ${pd_list}; do
pd_sn=$($CLI -PDInfo -PhysDrv[${ed_id}:${pd_id}] -a${ctrl_id} -NoLog | grep -i "Inquiry Data" | cut -f2 -d":" | sed "s/ \{2,10\}/ /g" | grep -Eo "(\d+|\w+)\s?$" | tr -d '\r\n' | sed -e 's/ $//')
pd_json=${pd_json}"{\"{#CTRL.ID}\":\"${ctrl_id}\",\"{#ED.ID}\":\"${ed_id}\",\"{#PD.ID}\":\"${pd_id}\",\"{#PD.SN}\":\"${pd_sn}\"},"
done
done
done
echo "{\"data\":[$(echo ${pd_json} | sed -e 's/,$//')]}"
}
LLDLogicalDrives() {
ctrl_count=$(CheckCtrlCount)
ld_json=""
for ctrl_id in $(seq 0 $((${ctrl_count} - 1))); do
ld_ids=$($CLI -LDInfo -LAll -a${ctrl_id} -NoLog | grep -i "(Target Id" | cut -f2 -d"(" | cut -f2 -d":" | sed -e 's/^\s*//' -e 's/)$//')
for ld_id in $ld_ids; do
ld_name=$($CLI -LDInfo -L${ld_id} -a${ctrl_id} -NoLog | grep -i "Name" | cut -f2 -d":" | sed -e 's/^\s*//')
ld_raid=$($CLI -LDInfo -L${ld_id} -a${ctrl_id} -NoLog | grep -i "RAID Level" | cut -f2 -d":" | cut -f1 -d"," | sed -e 's/^\s*//')
if [ -z "${ld_name}" ]; then
ld_name=${ld_id}
fi
ld_json=${ld_json}"{\"{#CTRL.ID}\":\"${ctrl_id}\",\"{#LD.ID}\":\"${ld_id}\",\"{#LD.NAME}\":\"${ld_name}\",\"{#LD.RAID}\":\"${ld_raid}\"},"
done
done
echo "{\"data\":[$(echo ${ld_json} | sed -e 's/,$//')]}"
}
This is the code from file, nothing was changed. Do I need to change something?
I found that it was permission problem. Now everything works perfect. Thank you very much for your support!
Best regards!
Good.
Thank.