Skip to content
Snippets Groups Projects
Select Git revision
  • 28e45a933ab3f4b65050fed29a8cdd41b6d517b3
  • 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

transfer.sh

Blame
  • check_uptime 1.47 KiB
    #!/bin/bash
    # ======================================================================
    #
    # NAGIOS CLIENT CHECK :: show uptime and if automatic update is ON
    #
    # REQUIREMENTS
    # - client uses a cronjob with cronwrapper (it creates parsable logs)
    #
    # It returns
    # - OK in all cases
    #
    # ----------------------------------------------------------------------
    #
    # ah=axel.hahn@iml.unibe.ch
    # ds=daniel.schueler@iml.unibe.ch
    #
    # 2018-12-17  v1.0  ah,ds
    # 2020-03-05  v1.1  <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
    # 2020-03-10  v1.2  <axel.hahn@iml.unibe.ch> add performance data
    # 2020-07-02  v1.3  <axel.hahn@iml.unibe.ch> use sec for performance data
    # ======================================================================
    
    
    . `dirname $0`/inc_pluginfunctions
    cronfile=/etc/cron.d/system-updater
    
    # ----------------------------------------------------------------------
    # MAIN
    # ----------------------------------------------------------------------
    
    iSecUp=`cat /proc/uptime | awk '{print $1}'`
    echo "Uptime: `uptime | awk '{ print $3 " days " $5 " h"}' | tr -d ","` ... $iSecUp sec"
    
    # --- status of auto update (IML specific)
    ls ${cronfile} >/dev/null 2>&1
    if [ $? -eq 0 ]; then
      echo Autoupdate ON
      grep "\ \-r" ${cronfile} >/dev/null 2>&1 
      if [ $? -eq 0 ]; then
        echo Autoreboot ON
      else
        echo Autoreboot OFF
      fi
    else
      echo Autoupdate OFF
    fi
    
    # --- add performance data
    ph.perfadd uptime $iSecUp
    
    ph.exit
    
    # ----------------------------------------------------------------------