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

inc_haproxy_cfg.sh

Blame
  • check_snmp_printer 1.39 KiB
    #!/bin/env bash
    # ============================================================
    #
    # Wrapper for check_snmp_printer plugin
    #
    # ------------------------------------------------------------
    # 2021-03-22  <axel.hahn@iml.unibe.ch>  v0.1
    # ============================================================
    
    # ------------------------------------------------------------
    # CONFIG
    # ------------------------------------------------------------
    
    check='/usr/lib64/nagios/plugins/check_snmp_printer'
    debug=0
    
    # ------------------------------------------------------------
    # MAIN
    # ------------------------------------------------------------
    sParams="$*"
    
    # find host behind param -H
    snmphost=$( echo $sParams | sed -Ee 's#.*\-H\ ([0-9a-z\.\-]*).*#\1#' )
    
    
    what=$( echo $sParams | sed -Ee 's#.*\-\-([a-z]*).*#\1#' )
    case "$what" in
            consum)
                    what="Consumables"
                    ;;
            messages)
                    what="Messages of the printer"
                    ;;
            pagecount)
                    what="Number of printed pages"
                    ;;
            trays)
                    what="Status of trays for paper"
                    sParams="$sParams --nofeeder"
                    ;;
    esac
    
    
    if [ "$debug" = "1" ]; then
            echo COMMAND @ `date`
            echo $0 $*
            echo "$what - `$check --model -H $snmphost` - IP $snmphost"
            echo ---
            echo calling $check $sParams
            echo ---
    fi
    
    $check $sParams