Skip to content
Snippets Groups Projects
Select Git revision
  • a24ba0fcce0a4c898321b1b36d1aa8215524da5f
  • master default protected
  • simple-task/7248-eol-check-add-node-22
  • 6877_check_iml_deployment
4 results

check_clientbackup

Blame
  • user avatar
    Hahn Axel (hahn) authored
    a24ba0fc
    History
    check_clientbackup 1.49 KiB
    #!/bin/bash
    # ======================================================================
    #
    # NAGIOS CLIENT CHECK :: check client backup
    #
    # ----------------------------------------------------------------------
    # 2016-12-09  v1.0  first lines
    # 2016-12-23  v1.1  added readable exitcode from shared functions file
    # 2020-03-05  v1.2  <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
    # 2020-04-04  v1.3  <axel.hahn@iml.unibe.ch> set status unknown if never executed
    # 2022-02-17  v1.4  <axel.hahn@iml.unibe.ch> no tmpfile; show more output to see backed up dirs
    # 2022-03-07  v1.5  <axel.hahn@iml.unibe.ch> update scan for results in transfer
    # ======================================================================
    
    . $( dirname $0 )/inc_pluginfunctions
    
    sInstalldir=/opt/imlbackup/client/
    sChecker=$sInstalldir/check_clientbackup.sh
    
    
    if [ ! -x $sChecker ]; then
      ph.abort "$sChecker not found - maybe clientbackup is not installed."
    fi
    
    result=$( $sChecker | sed "s#\[[0-9][0-9]*m# #g" )
    rc=$?
    
    if [ $rc -eq 0 ]; then
      ph.setStatus "ok"
    else
      if echo "$result" | grep "Backup was never executed" 2>/dev/null  
      then
        ph.setStatus "unknown"
      else
        ph.setStatus "critical"
      fi
    fi
    
    ph.status
    echo "$result" | grep -F "MONITORINFO:" | cut -f 2- -d ':'
    
    echo
    echo "--- localdump:"
    echo "$result" | grep -v "STATUS" | cut -f 2- -d ":" | grep "\ backup\ \["
    echo
    echo "--- transfer:"
    echo "$result" | grep "__[A-Z][A-Z]*__\ "
    
    
    ph.exit
    
    # ----------------------------------------------------------------------