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

check_packages2install

Blame
  • check_mailq 1.28 KiB
    #!/bin/bash
    # ======================================================================
    #
    # Check mailq size
    #
    # requirements:
    # - mailq
    #
    # ----------------------------------------------------------------------
    # 2022-10-21  v1.0  <andrea.gottsponer@unibe.ch>
    # ======================================================================
    
    
    . `dirname $0`/inc_pluginfunctions
    
    # ----------------------------------------------------------------------
    # MAIN
    # ----------------------------------------------------------------------
    
    # --- check required tools
    ph.require mailq
    
    # --- check param -h
    if [ "$1" = "-h" ]; then
        echo "
        usage: $0 [ -w value -c value -h ]
    
            -w  Warning level
            -c  Critical level
            -h  this help
        "
        exit 0
    fi
    
    # set default / override from command line params
    typeset -i iWarnLimit=`     ph.getValueWithParam 5  w "$@"`
    typeset -i iCriticalLimit=` ph.getValueWithParam 20 c "$@"`
    
    # get mailq count
    iMailqCount=`mailq | grep -c "^[A-F0-9]"`
    
    ph.setStatusByLimit ${iMailqCount} ${iWarnLimit} ${iCriticalLimit}
    
    # --- status output
    ph.status "${iMailqCount} Queue Count"
    
    # --- performance data usage
    ph.perfadd "mailq"  "${iMailqCount}" $iWarnLimit $iCriticalLimit 0
    
    # --- Bye
    ph.exit
    
    # ----------------------------------------------------------------------