Ad Widget

Collapse

Issues with Zabbix LLD Item Key Format for SMART Monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • doctorbal82
    Member
    • Oct 2016
    • 39

    #1

    Issues with Zabbix LLD Item Key Format for SMART Monitoring

    Hello,

    I am looking into monitoring XenServer disk health. I am using concepts from zbx-smartctl Zabbix Share.

    I modified the script (attached below in txt output) and have the following JSON output on the "uHDD.discovery" discovery rule:

    Code:
    {
            "data":[
    
    
                    {
                            "{#DISKNAME}":"bus/0",
                            "{#ARGS}":"-d megaraid,0",
                            "{#SMART_ENABLED}":"1"
                    }
            ]
    }
    My userparameter_smart.conf file has the following:

    Code:
    UserParameter=uHDD.discovery,sudo /etc/zabbix/smartctl-disks-discovery.pl
    UserParameter=uHDD.health[*],sudo smartctl -H /dev/$1 $2
    and following Item prototype from the discovery list:

    Name: {#DISKNAME}: Test result
    Type: Zabbix agent
    Key: uHDD.health["{#DISKNAME}","{#ARGS}"]
    Type of information: Character
    Show value: As is

    I want to achieve the following:

    Code:
    sudo smartctl -H /dev/bus/0 -d megaraid,0
    When I try to test this with zabbix_get I get the following error response which results in no output.

    Code:
    zabbix_get -s 127.0.0.1 -k uHDD.health["bus/0","-d megaraid,6"]
    
    smartctl 6.2 2013-07-26 r3841 [x86_64-linux-4.4.0+10] (local build)
    Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
    
    /dev/bus/0 -d megaraid: Unable to detect device type
    Please specify device type with the -d option.
    
    Use smartctl -h to get a usage summary
    What is missing in the syntax to get the output to display correctly?
    Attached Files
    Last edited by doctorbal82; 10-01-2019, 02:09.
  • doctorbal82
    Member
    • Oct 2016
    • 39

    #2
    I resolved this with the following below.

    Note that I am running zabbix-agent version 3.4.15 on a XenServer 7.2 host which is based off of CentOS 7 OS Distro and this is installed on Dom0 ("Domain 0").

    install...

    Code:
     rpm -ivh https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
      yum install zabbix-agent zabbix_get
      firewall-cmd --zone=public --add-port=10050/tcp --permanent
      service iptables restart
      yum install smartmontools sg3_utils
    Configure...

    visudo

    Code:
     Defaults !requiretty
      # zabbix smartctl
      zabbix ALL= (ALL) NOPASSWD: /usr/sbin/smartctl,/etc/zabbix/smartctl-disks-discovery.pl
    zabbix_agentd.conf
    Code:
    Server=< Zabbix Proxy>,127.0.0.1
    ServerActive=< Zabbix Proxy>
    Hostname=<Hostname in Frontend>
    UnsafeUserParameters=1
    Timeout=10
    userparameter_smart.conf
    Code:
    UserParameter=uHDD.discovery,sudo /etc/zabbix/smartctl-disks-discovery.pl
    UserParameter=uHDD.A[*],sudo /usr/sbin/smartctl -A /dev/$1 $2
    UserParameter=uHDD.i[*],sudo /usr/sbin/smartctl -i /dev/$1 $2
    UserParameter=uHDD.health[*],sudo /usr/sbin/smartctl -H /dev/$1 $2
    zabbix_get

    Testing this; note the single quotes!

    Code:
    sudo -u zabbix zabbix_get -s 127.0.0.1 -k 'uHDD.health["bus/0","-d megaraid,7"]'
    Code:
     smartctl 6.2 2013-07-26 r3841 [x86_64-linux-4.4.0+10] (local build)
      Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
        === START OF READ SMART DATA SECTION ===
      SMART Health Status: OK
    Last edited by doctorbal82; 10-01-2019, 18:37.

    Comment

    • guillermo874
      Junior Member
      • Jan 2019
      • 2

      #3

      I'm also having problems with these formats

      Comment

      Working...