Skip to content
Snippets Groups Projects
Select Git revision
  • 69369c3b2a874dd0263b2230f4d21acc41277368
  • master default protected
  • pymilter-1.0.4
  • pymilter-1.0.3
  • pymilter-1.0.2
  • pymilter-1.0.1
  • pymilter-1_0
  • milter-0_8_18
  • pymilter-0_9_8
  • pymilter-0_9_7
  • pymilter-0_9_6
  • pymilter-0_9_5
  • pymilter-0_9_4
  • pymilter-0_9_2
  • pymilter-0_9_1
  • pymilter-0_9_0
  • pymilter-0_8_12
  • pymilter-0_8_11
  • pymilter-0_8_10
  • pymilter-0_8_9
  • milter-0_8_8
  • milter-0_8_7
22 results

miltermodule.c

Blame
  • gluster 2.09 KiB
    #!/bin/bash
    # we parse the output of gluster volume heal [vol] info summary
    # which looks like that:
    #
    #Brick t3backend-00.it.hs-hannover.de:/srv/gluster/fileadmin
    #Status: Connected
    #Total Number of entries: 0
    #Number of entries in heal pending: 0
    #Number of entries in split-brain: 0
    #Number of entries possibly healing: 0
    #
    #Brick t3backend-01.it.hs-hannover.de:/srv/gluster/fileadmin
    #Status: Connected
    #Total Number of entries: 0
    #Number of entries in heal pending: 0
    #Number of entries in split-brain: 0
    #Number of entries possibly healing: 0
    # [...]
    
    hostname=$(hostname)
    
    # iterate over all available volumns
    for volume in $(gluster volume list)
    do
      # check /tmp/gluster_heal_summary for the last parsed output.
      gluster volume heal $volume info summary > /tmp/gluster_heal_summary
      # check heal info summary  ->   below you see sample lines
      while read -r brickline; do  # 'Brick [hostname]:[path_on_the_host]'
        read -r statusline         # 'Status: Connected'
        read -r entriesline        # 'Total Number of entries: [num]'
        # we do not use the 3 lines below - may use them for more detailed metrics
        read -r entriespendingline
        read -r entriessplitbrainline
        read -r entrieshealingline
        # bricks are separated by empty line
        read -r emptyline
        # skip those that are not located on our host (others are monitored on their corresponding host)
        if [[ "$brickline" != *"$hostname"* ]]
        then
          continue
        fi
        # parse lines of the last brick, since it is located on this gluster cluster node
        brick=$(echo "$brickline" | cut -f2 -d' ')
        heal_status=$(echo "$statusline" | cut -d ':' -f2 | tr -d '[:space:]')
        entries=$(echo "$entriesline" | cut -d ':' -f2 | tr -d '[:space:]')
        case "$heal_status" in
         Connected) chmk_status=0 ;; # Online means OK
                 *) chmk_status=3 ;; # everything else we don't know...
        esac
        metrics="healing_entries=$entries"
        msg="Online status of volume '$volume' brick '$brick' is: '$heal_status'"
        # echo chmk local check output
        echo "$chmk_status gluster_volume:$volume $metrics $msg"
      done < /tmp/gluster_heal_summary
    done