How-to execute active checks manually
This article details how to run active checks manually by hand.
LAST TESTED ON CHECKMK 2.2.0P1
There are several ways to run an active check manually. The following are a few examples.
Using cmk -N
The first way is with cmk -N:
OMD[mysite]:~/lib/nagios/plugins$ cmk -N |grep http check_command check_mk_active-http!'-u' 'https://www.google.com/' '--ssl' '--onredirect=follow' '-j' 'CONNECT' '--sni' '-p' 'proxy_port' 'myproxyip' 'www.google.com' command_line /omd/sites/mysite/lib/nagios/plugins/check_http $ARG1$ command_name check_mk_active-http
cmk -N will show you the Nagios config. Active Checks in Checkmk are based on Nagios.
Using Livestatus
A second way to access the command is via livestatus:
OMD[mysite]:~/lib/nagios/plugins$ lq "GET services\nColumns:host_name description check_command_expanded\nFilter: host_name = mysite\nFilter: description = myservicename" localhost;HTTPS HTTPS;check_mk_active-http!'-u' 'https://www.google.com/' '--ssl' '--onredirect=follow' '-j' 'CONNECT' '--sni' '-p' 'proxy_port' 'myproxyip' 'www.google.com'
In both cases: Copy the parameters after the '!' for executing the command later.
Now you need to run the check_http and paste the copied parameters:
OMD[mysite]:~/lib/nagios/plugins$ ./check_http '-u' 'https://www.google.com/' '--ssl' '--onredirect=follow' '-j' 'CONNECT' '--sni' '-p' 'proxy_port' 'myproxyip' 'www.google.com'
For a detailed log, you can use --verbose at the end of the command:
OMD[mysite]:~/lib/nagios/plugins$ ./check_http '-u' 'https://www.google.com/' '--ssl' '--onredirect=follow' '-j' 'CONNECT' '--sni' '-p' 'proxy_port' 'myproxyip' 'www.google.com' --verbose
For more information, you can use --help command flag.
OMD[mysite]:~/lib/nagios/plugins$ ./check_http --help
Using Service Check Commands
For debugging reasons, it could be helpful to run the check manually. Therefore, you need to open the service site of the E-Mail service and search for 'Service check command'.
Now you can use the command for executing the check manually
OMD[mysite]:~/lib/nagios/plugins$ ./check_mail_loop--pwstore=4@16@provider1,10@17@provider2 '--smtp-server=smtp.provider1.com' '--smtp-tls' '--smtp-username=user@provider1.com' '--smtp-password=*************' '--fetch-protocol=IMAP' '--fetch-server=imap.provider2.com' '--fetch-ssl' '--fetch-port=993' '--fetch-username=mail@provider2.com' '--fetch-password=*************' '--mail-from=user@provider1.com' '--mail-to=mail@provider2.com' '--delete-messages' '--status-suffix=localhost-Email Delivery' '--warning=120' '--critical=300' '--subject=Check_MK-Mail-Loop for Strato'
For a detailed log, you can use --debug at the end of the command:
OMD[mysite]:~/lib/nagios/plugins$ ./check_mail_loop--pwstore=4@16@provider1,10@17@provider2 '--smtp-server=smtp.provider1.com' '--smtp-tls' '--smtp-username=user@provider1.com' '--smtp-password=*************' '--fetch-protocol=IMAP' '--fetch-server=imap.provider2.com' '--fetch-ssl' '--fetch-port=993' '--fetch-username=mail@provider2.com' '--fetch-password=*************' '--mail-from=user@provider1.com' '--mail-to=mail@provider2.com' '--delete-messages' '--status-suffix=localhost-Email Delivery' '--warning=120' '--critical=300' '--subject=Check_MK-Mail-Loop for Strato' --debug
For more information, you can use --help option:
~/lib/nagios/plugins/check_mail_loop -h
Related articles