Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-26349

Support running dmesg -T on platforms that require sudo

    • Fully Compatible
    • ALL
    • TIG 2017-03-06

      We run dmesg -T > /dev/null 2>&1 instead of $sudo dmesg -T > /dev/null 2>&1 to see if human readable timestamps are supported.

      # Print out any Out of Memory killed process messages.
      - command: shell.exec
        params: 
          system_log: true
          working_dir: src # Temporary files created in src will be cleaned up in "pre".
          script: |
            ${set_sudo}
            # Use dmesg -T option, if supported, to display timestamps.
            dmesg=dmesg
            dmesg -T > /dev/null 2>&1
            if [ $? -eq 0 ]; then
              dmesg="dmesg -T"
            fi
            $sudo $dmesg 2> /dev/null > dmesg.txt
            if [ $? -ne 0 ]; then
              echo "Cannot check for OOM (Out of memory) killed processes on this platform"
              exit 0
            fi
            egrep -i '(Out of memory|OOM[- ]killer|Killed process)' dmesg.txt > oom.txt
            if [ -s oom.txt ]; then
              echo "OOM (Out of memory) killed processes detected"
              cat oom.txt
            else
              echo "No OOM (Out of memory) killed processes detected"
            fi
      

            Assignee:
            yves.duhem Yves Duhem
            Reporter:
            robert.guo@mongodb.com Robert Guo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: