v-zhuravlev / zbx-smartctl

Templates and scripts for monitoring disks health with Zabbix and smartmontools
https://share.zabbix.com/storage-devices/smartmontools/smart-monitoring-with-smartmontools-lld
GNU General Public License v3.0
244 stars 127 forks source link

Zabbix 3.0 - Discovery rules problem #79

Open Snowmanko opened 5 years ago

Snowmanko commented 5 years ago

Hi,

I am experiencing error Cannot create item: Incorrect function 'last' expression. Check expression part starting from "uHDD[". in Discovery rule - Template_HDD_SMARTMONTOOLS_2_WITH_LLD: smartctl-disks-discovery, can you advice what could cause this problem ?

I suppose there is some problem with .last expressions in Triggers.

Thanks for any advice. BR!

v-zhuravlev commented 5 years ago

Hi! Which version of template do you use? What name of the disk that caused the error?

v-zhuravlev commented 5 years ago

Please reopen if still having this problem.

Snowmanko commented 5 years ago

Sorry, I didn't see that you replied. I'm running Zabbix 3.0.25. I can see only -> Cannot create item: Incorrect function 'last' expression. Check expression part starting from: "uHDD[". .. in hosts "discovery rules" on name "Template_HDD_SMARTMONTOOLS_2_WITH_LLD: smartctl-disks-discovery".

How can I see full error, its probably cut because of the length by zabbix.

v-zhuravlev commented 5 years ago

Check inside Tempalte -> Low level Discoveries -> Item prototypes. What is the expression of the item prototype with Type = calculated ? Actually, can you export the template and post it here?

Snowmanko commented 5 years ago

Only one with Type calculated in Item prototypes is : {#DISKNAME}: SMART critical errors total Formula is : last("uHDD["{#DISKCMD}",5 Reallocated]")+last("uHDD["{#DISKCMD}",Spin_Retry_Count]")+last("uHDD["{#DISKCMD}",Current_Pending_Sector]")+last("uHDD["{#DISKCMD}",Offline_Uncorrectable]")

Attaching exported XML, has to be zipped bcs of guthub. zbx_export_templates.xml.zip

Snowmanko commented 5 years ago

Error looks like this Screen Shot 2019-04-24 at 17 56 36

v-zhuravlev commented 5 years ago

Do you have any items actually created?

v-zhuravlev commented 5 years ago

Can you run discovery script manually and show me the output?

Snowmanko commented 5 years ago

Sure,

` { "data":[

    {
        "{#DISKMODEL}":"INTEL SSD",
        "{#DISKSN}":"XY",
        "{#DISKNAME}":"/dev/sda",
        "{#DISKCMD}":"/dev/sda -d sat",
        "{#SMART_ENABLED}":"1",
        "{#DISKTYPE}":"1"
    },
    {
        "{#DISKMODEL}":"INTEL SSD",
        "{#DISKSN}":"XY",
        "{#DISKNAME}":"/dev/sdb",
        "{#DISKCMD}":"/dev/sdb -d sat",
        "{#SMART_ENABLED}":"1",
        "{#DISKTYPE}":"1"
    },
    {
        "{#DISKMODEL}":"ST",
        "{#DISKSN}":"XY",
        "{#DISKNAME}":"/dev/sdc",
        "{#DISKCMD}":"/dev/sdc -d sat",
        "{#SMART_ENABLED}":"1",
        "{#DISKTYPE}":"0"
    },
    {
        "{#DISKMODEL}":"ST",
        "{#DISKSN}":"XY",
        "{#DISKNAME}":"/dev/sdd",
        "{#DISKCMD}":"/dev/sdd -d sat",
        "{#SMART_ENABLED}":"1",
        "{#DISKTYPE}":"0"
    },
    {
        "{#DISKMODEL}":"ST",
        "{#DISKSN}":"XY",
        "{#DISKNAME}":"/dev/sde",
        "{#DISKCMD}":"/dev/sde -d sat",
        "{#SMART_ENABLED}":"1",
        "{#DISKTYPE}":"0"
    },
    {
        "{#DISKMODEL}":"ST",
        "{#DISKSN}":"XY",
        "{#DISKNAME}":"/dev/sdf",
        "{#DISKCMD}":"/dev/sdf -d sat",
        "{#SMART_ENABLED}":"1",
        "{#DISKTYPE}":"0"
    },
    {
        "{#DISKMODEL}":"ST",
        "{#DISKSN}":"XY",
        "{#DISKNAME}":"/dev/sdg",
        "{#DISKCMD}":"/dev/sdg -d sat",
        "{#SMART_ENABLED}":"1",
        "{#DISKTYPE}":"0"
    },
    {
        "{#DISKMODEL}":"INTEL SSD",
        "{#DISKSN}":"XY",
        "{#DISKNAME}":"/dev/sdh",
        "{#DISKCMD}":"/dev/sdh -d sat",
        "{#SMART_ENABLED}":"1",
        "{#DISKTYPE}":"1"
    },
    {
        "{#DISKMODEL}":"INTEL SSD",
        "{#DISKSN}":"XY",
        "{#DISKNAME}":"/dev/sdi",
        "{#DISKCMD}":"/dev/sdi -d sat",
        "{#SMART_ENABLED}":"1",
        "{#DISKTYPE}":"1"
    }
]

} `

I've reddacted manually DISKSN and DISKMODEL.

Snowmanko commented 5 years ago

Do you have any items actually created? Screen Shot 2019-05-02 at 12 18 33

Yes, this is from template. There are also correct items.