madhacking / snmpd-mdraid-connector Goto Github PK
View Code? Open in Web Editor NEWAn SNMP extension script to provide access to MD-RAID array state data
License: GNU General Public License v3.0
An SNMP extension script to provide access to MD-RAID array state data
License: GNU General Public License v3.0
I tested snmpd-mdraid-connector and when raid is active state data was sent corectly.
The output command
snmpwalk -c public -v2c -m MD-RAID-MIB localhost mdRaidTable
was return
MD-RAID-MIB::mdRaidArrayIndex.1 = INTEGER: 1
MD-RAID-MIB::mdRaidArrayDev.1 = STRING: /dev/md0
MD-RAID-MIB::mdRaidArrayVersion.1 = STRING: 1.2
MD-RAID-MIB::mdRaidArrayUUID.1 = STRING: 859e995e:5018b66e:fca8b02c:42b62bf1
MD-RAID-MIB::mdRaidArrayLevel.1 = STRING: raid1
MD-RAID-MIB::mdRaidArrayLayout.1 = STRING: N/A
MD-RAID-MIB::mdRaidArrayChunkSize.1 = STRING: N/A
MD-RAID-MIB::mdRaidArraySize.1 = STRING: 1047552
MD-RAID-MIB::mdRaidArrayDeviceSize.1 = STRING: 1047552
MD-RAID-MIB::mdRaidArrayHealthOK.1 = INTEGER: true(1)
MD-RAID-MIB::mdRaidArrayHasFailedComponents.1 = INTEGER: false(2)
MD-RAID-MIB::mdRaidArrayHasAvailableSpares.1 = INTEGER: false(2)
MD-RAID-MIB::mdRaidArrayTotalComponents.1 = Gauge32: 2
MD-RAID-MIB::mdRaidArrayActiveComponents.1 = Gauge32: 2
MD-RAID-MIB::mdRaidArrayWorkingComponents.1 = Gauge32: 2
MD-RAID-MIB::mdRaidArrayFailedComponents.1 = Gauge32: 0
MD-RAID-MIB::mdRaidArraySpareComponents.1 = Gauge32: 0
MD-RAID-MIB::mdRaidArrayRaidComponents.1 = Gauge32: 2
/dev/md0:
Version : 1.2
Creation Time : Mon Sep 11 19:53:08 2017
Raid Level : raid1
Array Size : 1047552 (1023.00 MiB 1072.69 MB)
Used Dev Size : 1047552 (1023.00 MiB 1072.69 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistentUpdate Time : Mon Sep 11 22:11:20 2017 State : active.
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0Name : debian:0 (local to host debian) UUID : 859e995e:5018b66e:fca8b02c:42b62bf1 Events : 40 Number Major Minor RaidDevice State 0 7 0 0 active sync /dev/loop0 2 7 1 1 active sync /dev/loop1
When I degrade raid matrix with command mdadm -f
and mdadm -r
the data was incorrect (not full)
MD-RAID-MIB::mdRaidArrayIndex.1 = INTEGER: 1
MD-RAID-MIB::mdRaidArrayDev.1 = STRING: /dev/md0
MD-RAID-MIB::mdRaidArrayVersion.1 = STRING: 1.2
MD-RAID-MIB::mdRaidArrayUUID.1 = STRING: 859e995e:5018b66e:fca8b02c:42b62bf1
MD-RAID-MIB::mdRaidArrayLevel.1 = STRING: raid1
MD-RAID-MIB::mdRaidArrayLayout.1 = STRING: N/A
MD-RAID-MIB::mdRaidArrayChunkSize.1 = STRING: N/A
MD-RAID-MIB::mdRaidArraySize.1 = STRING: 1047552
MD-RAID-MIB::mdRaidArrayDeviceSize.1 = STRING: 1047552
/dev/md0:
Version : 1.2
Creation Time : Mon Sep 11 19:53:08 2017
Raid Level : raid1
Array Size : 1047552 (1023.00 MiB 1072.69 MB)
Used Dev Size : 1047552 (1023.00 MiB 1072.69 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistentUpdate Time : Mon Sep 11 20:05:24 2017 State : active, degraded
Active Devices : 1 Working Devices : 1
Failed Devices : 1
Spare Devices : 0Name : debian:0 (local to host debian) UUID : 859e995e:5018b66e:fca8b02c:42b62bf1 Events : 20 Number Major Minor RaidDevice State 0 7 0 0 active sync /dev/loop0 ‐ 0 0 1 removed 1 7 1 ‐ faulty /dev/loop1
It was not sending data MD-RAID-MIB::mdRaidArrayHealthOK
What is going on? How to fix it?
Testing system (with the same results):
Debian 9.1 (armv7l SMP), kernel 4.4.79, bash 4.4.12(1)-release
Slackware 14.2 (x86_64 SMP), kernel 4.4.75, bash 4.3.46(1)-release
Slackware 12.2 (x86 SMP), kernel 2.6.38.4, bash 4.2.50(2)-release
snmp request:
$ snmpwalk -v2c -c public hostname .1.3.6.1.4.1.38696.2.2.2.1.2
MD-RAID-MIB::mdRaidArrayDev = No Such Instance currently exists at this OID
snmpd debug:
snmpd/select: select( numfds=10, ..., tvp=0x7ffc70765d60)
snmpd/select: returned, count = 1
ucd-snmp/pass_persist: open_persist_pipe(2,'/usr/sbin/snmpd-mdraid-connector') recurse=0
ucd-snmp/pass_persist: open_persist_pipe: opened the pipes
ucd-snmp/pass_persist: persistpass-sending:
getnext
.1.3.6.1.4.1.38696.2.2.2.1.2
snmpd/select: select( numfds=10, ..., tvp=0x7ffc70765d60)
snmpd/select: returned, count = 1
ucd-snmp/pass_persist: open_persist_pipe(2,'/usr/sbin/snmpd-mdraid-connector') recurse=0
ucd-snmp/pass_persist: open_persist_pipe: opened the pipes
ucd-snmp/pass_persist: persistpass-sending:
get
.1.3.6.1.4.1.38696.2.2.2.1.2
snmpd/select: select( numfds=10, ..., tvp=0x7ffc70765d60)
snmpd/select: returned, count = 1
snmpd/select: select( numfds=10, ..., tvp=0x7ffc70765d60)
snmpd/select: returned, count = 0
snmpd/select: select( numfds=10, ..., tvp=0x7ffc70765d60)
snmpd/select: returned, count = 0
snmpd/select: select( numfds=10, ..., tvp=0x7ffc70765d60)
snmpd/select: returned, count = 0
snmpd/select: select( numfds=10, ..., tvp=0x7ffc70765d60)
snmpd/select: returned, count = 1
snmpd/select: select( numfds=10, ..., tvp=0x7ffc70765d60)
snmpd/select: returned, count = 0
snmpd/select: select( numfds=10, ..., tvp=0x7ffc70765d60)
snmpd/select: returned, count = 1
snmpd/select: select( numfds=10, ..., tvp=0x7ffc70765d60)
snmpd/select: returned, count = 0
This happens if I run snmpd-mdraid-connector:
# LC_ALL=C /usr/sbin/snmpd-mdraid-connector
ping
PONG
getnext
.1.3.6.1.4.1.38696.2.2.2.1.2
debug: got addressed request
debug: passed index [2]
debug: calculated table variable: RTABLE[2]
debug: found a redirect to a table: #ETABLE
debug: got addressed request
debug: passed index [1]
debug: calculated table variable: ETABLE[1]
debug: found a redirect to a table: #FTABLE
debug: got addressed request
debug: passed index [2]
debug: calculated table variable: FTABLE[2]
debug: found a command
debug: found an index function: get_next_index
debug: no index supplied, returning first index
debug: got next table index: 1
debug: calculated OID: .1.3.6.1.4.1.38696.2.2.2.1.2.1
debug: got new OID: .1.3.6.1.4.1.38696.2.2.2.1.2.1
debug: got new OID: .1.3.6.1.4.1.38696.2.2.2.1.2.1
debug: got NEXTOID = .1.3.6.1.4.1.38696.2.2.2.1.2.1
debug: calculated table variable: RTABLE[2]
debug: calculated table variable: ETABLE[1]
debug: calculated table variable: FTABLE[2]
debug: found command in table: "send_device_path .1.3.6.1.4.1.38696.2.2.2.1.2.1 1"
debug: Sent .1.3.6.1.4.1.38696.2.2.2.1.2.1 STRING /dev/md0
.1.3.6.1.4.1.38696.2.2.2.1.2.1
string
/dev/md0
get
.1.3.6.1.4.1.38696.2.2.2.1.2
debug: calculated table variable: RTABLE[2]
debug: calculated table variable: ETABLE[1]
debug: calculated table variable: FTABLE[2]
debug: found command in table: "send_device_path .1.3.6.1.4.1.38696.2.2.2.1.2 "
/usr/sbin/snmpd-mdraid-connector: line 121: 2: unbound variable
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.