Ad Widget

Collapse

One Template to monitor multiple drives

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Durwin
    Junior Member
    • Apr 2015
    • 19

    #1

    One Template to monitor multiple drives

    I am using smartctl to monitor a drive on a machine. Is it possible to create a template to use for multiple drives? For instance, I would like a template so I could just create an item based on this template to monitor different drives.

    Thank you
  • Colttt
    Senior Member
    Zabbix Certified Specialist
    • Mar 2009
    • 878

    #2
    yes its possible via userparameter like
    Userparameter=smartctl[*],/path/to/command $1
    where $1= first parmater from the item

    you also can create a discovery script/rule to get them automaticly
    Debian-User

    Sorry for my bad english

    Comment

    • Durwin
      Junior Member
      • Apr 2015
      • 19

      #3
      Thank your for your reply.

      I am already doing that, however I do not see how that helps creating a Zabbix template. If I want to monitor more then one smartd parameter like.

      smart.diskcheck[/dev/sdc,Current_Pending_Sector]

      I currently create an 'Item' for each. It would be great if I could create a template, and then define just the drive I wish for the template to use.

      Comment

      • Colttt
        Senior Member
        Zabbix Certified Specialist
        • Mar 2009
        • 878

        #4
        ok you can use usermacros like
        Code:
        smart.diskcheck[{$DISK},Current_Pending_Sector]
        but this is limited to only one drive per host (via template) otherwise you must create a discovery-rule to get all /dev/sd* and them put them automaticly into you item, ala
        Code:
        #!/bin/bash
        
        disks=/dev/$(lsblk |awk '/^sd/ {print $1}')
        echo "{"
        echo "\"data\":["
        for disk in $disks
        do
                    echo "    {\"{#DISKNAME}\":\"$disk\",\"{#SHORTDISKNAME}\":\"${disk:5}\"},"
        done
        
        echo "]"
        echo "}"
        Debian-User

        Sorry for my bad english

        Comment

        • Durwin
          Junior Member
          • Apr 2015
          • 19

          #5
          The user macro sounds very useful. I'll read up on it. As well as Discovery. Perhaps you might enlighten me as what to do with the output of the script. From what I have read so far Discovery uses #NAME like text, but you specifically formatted the output in brackets like it belongs in a file somewhere.

          Thank you.

          Comment

          • gospodin.horoshiy
            Senior Member
            • Sep 2008
            • 272

            #6
            Check share.zabbix.com before reinventing the wheel:

            1. https://share.zabbix.com/storage-dev...rtmontools-lld
            2. https://share.zabbix.com/storage-dev...ls-lld-trapper
            3. https://share.zabbix.com/storage-dev...-smartmontools

            Pick the one you like
            Zbx 2.0.4 on Debian and MYSQL5 on Ubuntu Server 64bit 8.04,
            200+ Win Agents, 50+ Linux Agents, 150+ Network Devices

            Comment

            • Durwin
              Junior Member
              • Apr 2015
              • 19

              #7
              Thank you for sharing these resources. I had not known about them. I now have precisely what I need.

              Comment

              • nobodysu
                Member
                • Sep 2016
                • 84

                #8
                I must tell that mine is the best (currently)
                The Zabbix Team has collected all official Zabbix monitoring templates and integrations.

                Comment

                Working...