Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserParameter=custom.md.discovery do not parse raid0 #95

Open
denisgolius opened this issue Oct 7, 2020 · 1 comment
Open

UserParameter=custom.md.discovery do not parse raid0 #95

denisgolius opened this issue Oct 7, 2020 · 1 comment

Comments

@denisgolius
Copy link

So I have ubuntu 20.04 with raid0


 mdadm -D /dev/md0
/dev/md0:
           Version : 1.2
     Creation Time : Mon Sep 28 21:34:49 2020
        Raid Level : raid0
        Array Size : 7813520384 (7451.55 GiB 8001.04 GB)
      Raid Devices : 4
     Total Devices : 4
       Persistence : Superblock is persistent

       Update Time : Mon Sep 28 21:34:49 2020
             State : clean 
    Active Devices : 4
   Working Devices : 4
    Failed Devices : 0
     Spare Devices : 0

            Layout : original
        Chunk Size : 512K

Consistency Policy : none

              Name : ubuntu-server:0
              UUID : b14fa1a1:96da7eba:8fd8a81c:36258895
            Events : 0

    Number   Major   Minor   RaidDevice State
       0       8       34        0      active sync   /dev/sdc2
       1       8       17        1      active sync   /dev/sdb1
       2       8        1        2      active sync   /dev/sda1
       3       8       49        3      active sync   /dev/sdd1

I copied your userparameter_md.conf file into /etc/zabbix/zabbix_agentd.d folder . For the servers that have configured raid1 - this parameter works well:
UserParameter=custom.md.discovery,cat /proc/mdstat | grep -B 1 -E "(U+|_+)" | awk 'BEGIN { printf "{\"data\":["}; /^md/ { printf c"{\"{#MDNAME}\":\""$1"\"}";c=","}; END{ print "]}" }'

But I have raid0 and this grep cat /proc/mdstat | grep -B 1 -E "(U+|_+)" not parsed it. It returned NULL, because it parse UU that is not used for raid0.
And if you try to use this user parameter:
UserParameter=custom.md.discovery,cat /proc/mdstat | awk 'BEGIN { printf "{\"data\":["}; /^md/ { printf c"{\"{#MDNAME}\":\""$1"\"}";c=","}; END{ print "]}" }' - zabbix will parse raid0 devices.

@paraenggu
Copy link
Member

Hi @denisgolius,

where does the user parameter custom.md.discovery originates from?

The user parameters included in MD-RAID are using the sysfs interface and not /proc/mdstat for array discovery: UserParameter=rabe.raid.md.raid-device.discovery,/usr/bin/find -L /sys/block/ [...].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants