Giter Club home page Giter Club logo

snmpd-mdraid-connector's Introduction

snmpd-mdraid-connector

shellcheck tests coverage

Unfortunately, neither the net-analyzer/net-snmp or sys-fs/mdadm packages provide a suitable SNMPD extension script to enable the SNMP daemon to access MD-RAID array state data.

The snmp-agents/snmpd-mdraid-connector package aims to rectify this by providing an SNMPD extension script and a helper script which together enable the SNMP daemon to be used to remotely monitor the health and sate of MD-RAID devices. Available information includes Array Path, Metadata Version, Array UUID, RAID Level, RAID Layout, and Chunk Size. Boolean indicators allowing the monitoring of Health State, Has Failed Components and Has Available Spares are also included. Finally, gauges representing Total Components, Active Components, Failed Components and Spare Components are provided.

More information may be found at:

http://www.mad-hacking.net/software/linux/agnostic/snmpd-mdraid-connector/index.xml

snmpd-mdraid-connector's People

Contributors

brain2000 avatar hackingm avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

snmpd-mdraid-connector's Issues

Error in snmpwalk when raid is degraded

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 persistent

Update Time : Mon Sep 11 22:11:20 2017
      State : active.

Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0

       Name : 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 persistent

Update Time : Mon Sep 11 20:05:24 2017
      State : active, degraded

Active Devices : 1 Working Devices : 1
Failed Devices : 1
Spare Devices : 0

       Name : 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

/usr/sbin/snmpd-mdraid-connector: line 121: 2: unbound variable

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.