Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Info
There is no switch to

...

enable the debug mode in the check_mk_agent for Linux permanently.

The problem with that is, that the output has to

Status
colourGreen
titleLAST TESTED ON CHECKMK 2.1.0P1


Panel
borderColorblack
bgColor#f8f8f8
titleTable of Contents

Table of Contents


The problem is that the output must be written to a file. Sending it to the CMK Server would lead to a CRIT "Check_MK" service.

Enabling the Debug Mode

To write the debug output to a file on one monitored host, you have to do the following:

1. Create a backup of your check_mk_agent script

Code Block
languagebash
themeRDark
root@mylinuxhost:~# cp /usr/bin/check_mk_agent /usr/bin/check_mk_agent.bak


2. Edit the script and add the following lines in the main_setup() routine, after the line set_up_process_commandline_arguments "$@":

Code Block
languagebash
themeRDark
title/usr/bin/check_mk_agent
     #############################################
    # Permamently enable debug mode

    # log rotation
    logfile=/var/log/agent.out
    max_logs=10  # Adjust the maximum number of stored log files to your needs.
    i=$max_logs

    while [ $i -gt 1 ]; do
        ((j=i-1))
        if [ -f $logfile.$j ]; then
            mv $logfile.$j $logfile.$i
        fi
        i=$j
    done

    if [ -f $logfile ]; then
        mv $logfile $logfile.1
    fi

    # write stderr to log
    set -xv
    exec 2>$logfile

    # Enabling debug END
    ############################################# 

Disabling the Debug Mode

To disable the debug mode, simply copy your original script:

Code Block
languagebash
themeRDark
root@mylinuxhost:~# cp /usr/bin/check_mk_agent.bak /usr/bin/check_mk_agent

Limitations

When you're using the Automatic Agent Updater, it might happen that your modified script will be overwritten.

Filter by label (Content by label)
showLabelsfalse
max5
spacesKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ( "kb-how-to-article" , "howto" ) and type = "page" and space = "KB"
labelskb-how-to-article

Page Properties
hiddentrue


Related issues