Ad Widget

Collapse

DRBD Status Monitoring Example

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • virer
    Junior Member
    • Aug 2011
    • 2

    #1

    DRBD Status Monitoring Example

    My example of DRBD Status Monitoring :

    /etc/zabbix/zabbix_agentd.conf:
    ...
    UserParameter=custom.vfs.drbd.status,sed '1,/.*/d;/^$/d' /proc/drbd | egrep -vc '(UpToDate/UpToDate|ns:.+nr:.+dw:.+dr:.+)'

    + attached xml file for the template to be import

    feedback are welcome

    Edit: Aaah thanks Frater for the optimization
    Attached Files
    Last edited by virer; 13-09-2011, 10:05.
  • frater
    Senior Member
    • Oct 2010
    • 340

    #2
    This does exactly the same.

    UserParameter=vfs.drbd.status, sed '1,/.*/d;/^$/d' /proc/drbd | egrep -vc '(UpToDate/UpToDate|ns:.+nr:.+dw:.+dr:.+)'

    It can probably be done better if I knew exactly how /proc/drbd behaves.
    1. 'cat' is almost always superfluous
    2. + means 1 or more, * means 0 or more (doesn't make much difference here, but is good practice)
    3. wc -l can often be avoided
    4. egrep can take an extended regular expression and can count as well
    5. sed expressions can be separated by a semicolon
    Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP

    Comment

    • frater
      Senior Member
      • Oct 2010
      • 340

      #3
      Originally posted by jennis
      I am so confused about it.
      Maybe because the OP edited his first post.... (which he shouldn't do, really).

      The OP had a different line there (I should have quoted him) and I gave feedback on it.

      I think it was (doing some 'reverse engineering'):

      Code:
      cat /proc/drbd | sed -e '1,/.*/d' -e '/^$/d' | egrep -v '(UpToDate/UpToDate|ns:.*nr:.*dw:.*dr:.*)' | wc -l
      I changed it into:
      Code:
      sed '1,/.*/d;/^$/d' /proc/drbd | egrep -vc '(UpToDate/UpToDate|ns:.+nr:.+dw:.+dr:.+)'
      Last edited by frater; 20-09-2011, 12:37.
      Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP

      Comment

      • lenkami15
        Junior Member
        • Sep 2011
        • 1

        #4
        wo..I am finding this code
        ----------------

        Watch Abduction Online for Free

        Comment

        Working...