Versions Compared

Key

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

...

  1. The cmk commands have the option to profile them.

    Code Block
    languagebash
    themeRDark
    OMD[mysite]:~$ cmk |grep profile
       --profile           Enable profiling mode

    .

  2. The profile file will be created in the current directory. Let's go to tmp and run the cmk command with the profile option.

    Code Block
    languagebash
    themeRDark
    ➜  ~ su - at                                        
    OMD[mysite]:~$ cd tmp
    OMD[mysite]:~$ cmk -Afv --profile


    Note

    cmk -Afv --profile is only one example. This command will trigger the agent baking via the CLI. You may need to profile a different command.

    .

      1. Now we will see two files:

        Code Block
        languagebash
        themeRDark
        OMD[mysite]:~/tmp$ ls |grep profile
        profile.out*
        show_profile.py*

        .

      2. To work with these files, we need to copy them outside the site.

        Code Block
        languagebash
        themeRDark
        OMD[mysite]:~/tmp$ cp show_profile.py profile.out /tmp/

        .

      3. Now there are two ways to analyze these files:

        1. Open the profile file via the command line:

          Code Block
          languagebash
          themeRDark
          ➜  /tmp ./show_profile.py 


        2. Analyze via snakevize as described here: 9473249 Checkmk profiling#GUIProfiling

Profile a Checkmk function

...