...
- Setup → General → Global Settings → User Interface → Profile Request
. Modify the URL to profile by adding '&_profile=1' and fire the request in your browser
Code Block language bash theme RDark http://localhost/nagnis_master/check_mk/view.py?view_name=allhosts&_profile=
.
Now two files are created in ~/var/check_mk/
Code Block theme RDark root@mylinuxhost:/opt/omd/sites/mysite/var/check_mk# ll |grep multisite -rw-rw---- 1 mysite mysite 100246 Nov 6 13:35 multisite.profile -rwxr-xr-x 1 mysite mysite 155 Nov 6 13:35 multisite.py*
.
By executing 'multisite.py', you can get runtime statistics about the last processed page.
Code Block language bash theme RDark root@mylinuxhost:/opt/omd/sites/mysite/var/check_mk# ./multisite.py |more Fri Nov 6 13:35:33 2020 /omd/sites/nagnis_master/var/check_mk/multisite.profile 9585 function calls (9480 primitive calls) in 0.007 seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 1 0.001 0.001 0.002 0.002 /omd/sites/mysite/lib/python/cmk/gui/modules.py:140(_cmk_gui_top_level_modules) 4652 0.000 0.000 0.000 0.000 {method 'startswith' of 'str' objects} ... ...
.
For viewing multisite. Profile with snakeviz, move the file to another directory (e.g., /tmp), and change the owner to the owner of your Internet Browser.
Code Block language bash theme RDark linuxuser@mylinuxhost:/omd/sites/mysite/var/check_mk$ sudo cp multisite.profile /tmp/ linuxuser@mylinuxhost:/tmp$ sudo chown linuxuser:linuxuser multisite.profile
.
Install the Python module (for Python 2 or Python 3, respectively)
Code Block language bash theme RDark root@mylinuxhost:~# pip install snakeviz root@mylinuxhost:~# pip3 install snakeviz
.
Now you can use snakeviz to view the profiling file.
Code Block language bash theme RDark linuxuser@mylinuxhost:/tmp$ snakeviz multisite.profile
.Now you can analyze at which point of the request your view needs the most time!
...
The logging is disabled by default. The default threshold is set to 60 seconds.
If enabled, one log entry per view rendering that exceeds the configured threshold is logged to var/log/web.log.
...