Skip to content
Snippets Groups Projects
Select Git revision
  • 01c17f740d08503f4dc8d903796aa6cd7a0e0610
  • master default protected
  • 7771-harden-postgres-backup
  • pgsql-dump-with-snapshots
  • update-colors
  • update-docs-css
  • usb-repair-stick
  • desktop-notification
  • 7000-corrections
  • db-detector
10 results

ldap.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