Check_form_submit plugin - Regular expression to expect in content in WATO

CMK version: - 2.0.0p22.cee
OS version:- Ubuntu 20.4

Error message:- not found

**Output of “cmk --debug -vvn hostname”:

OMD[nadzor]:~$ cmk --debug -vvn 10.115.6.75
Checkmk version 2.0.0p22
Try license usage history update.
Trying to acquire lock on /omd/sites/nadzor/var/check_mk/license_usage/next_run
Got lock on /omd/sites/nadzor/var/check_mk/license_usage/next_run
Trying to acquire lock on /omd/sites/nadzor/var/check_mk/license_usage/history.json
Got lock on /omd/sites/nadzor/var/check_mk/license_usage/history.json
Next run time has not been reached yet. Abort.
Releasing lock on /omd/sites/nadzor/var/check_mk/license_usage/history.json
Released lock on /omd/sites/nadzor/var/check_mk/license_usage/history.json
Releasing lock on /omd/sites/nadzor/var/check_mk/license_usage/next_run
Released lock on /omd/sites/nadzor/var/check_mk/license_usage/next_run
Updating IPv4 DNS cache for 10.115.6.75: 10.115.6.75
Trying to acquire lock on /omd/sites/nadzor/var/check_mk/ipaddresses.cache
Got lock on /omd/sites/nadzor/var/check_mk/ipaddresses.cache
Releasing lock on /omd/sites/nadzor/var/check_mk/ipaddresses.cache
Released lock on /omd/sites/nadzor/var/check_mk/ipaddresses.cache
+ FETCHING DATA
  Source: SourceType.HOST/FetcherType.PIGGYBACK
[cpu_tracking] Start [7f2de5779be0]
No piggyback files for '10.115.6.75'. Skip processing.
No piggyback files for '10.115.6.75'. Skip processing.
[PiggybackFetcher] Fetch with cache settings: NoCache(base_path=PosixPath('/omd/sites/nadzor/tmp/check_mk/data_source_cache/piggyback/10.115.6.75'), max_age=MaxAge(checking=0, discovery=120, inventory=120), disabled=False, use_outdated=False, simulation=False)
[PiggybackFetcher] Execute data source
[cpu_tracking] Stop [7f2de5779be0 - Snapshot(process=posix.times_result(user=0.0, system=0.0, children_user=0.0, children_system=0.0, elapsed=0.0))]
[cpu_tracking] Start [7f2de5779bb0]
+ PARSE FETCHER RESULTS
  Source: SourceType.HOST/FetcherType.PIGGYBACK
No persisted sections loaded
  -> Add sections: []
Received no piggyback data
Loading item states
Trying to acquire lock on /omd/sites/nadzor/tmp/check_mk/counters/10.115.6.75
Got lock on /omd/sites/nadzor/tmp/check_mk/counters/10.115.6.75
Releasing lock on /omd/sites/nadzor/tmp/check_mk/counters/10.115.6.75
Released lock on /omd/sites/nadzor/tmp/check_mk/counters/10.115.6.75
No piggyback files for '10.115.6.75'. Skip processing.
No piggyback files for '10.115.6.75'. Skip processing.
[cpu_tracking] Stop [7f2de5779bb0 - Snapshot(process=posix.times_result(user=0.010000000000000009, system=0.0, children_user=0.0, children_system=0.0, elapsed=0.019999999552965164))]
execution time 0.0 sec | execution_time=0.020 user_time=0.010 system_time=0.000 children_user_time=0.000 children_system_time=0.000 cmk_time_agent=0.000
OMD[nadzor]:~$

** (If it is a problem with checks or plugins)

I have completed Check_form_submit configuration in WATO and have the OK result there, BUT when asking for Regular expression to expect in content - I get OK only on expressions that occur on both pages - login and the one which is the response on LoginID submitted.

If I try to find expression that occurs only on the response page, after form submission - I get “not found” result.

Does the plugin (regex) check for the required expression on the first one (where the form is submitted) or on the response page (after the form submission)?

I wish to use it to make sure that the log-in process has completed successfully and that the response page has loaded in defined time.

If wrong credentials are entered - the result is still OK if the expression is present on both pages.
It is OK even when no expression is requested and wrong credentials are entered…

When trying it in CLI, with “-d” and direct output into the file “>>”

sudo /opt/omd/versions/2.0.0p22.cee/lib/nagios/plugins/check_form_submit -I 10.115.86.91 -u /da/DA/Login -f Loginform -q "username=nn@isp.nn.rs&password=nn" -e subscribers -d > /tmp/check_form_submit.txt

I get only the plugins report " Expected regex “subscribers” could not be found in form response". The rest of the output (which can not be scrolled back (too large)) - still gets on the screen, instead of into the file.

Looks like the page is loaded after the report has been issued and hence - that the regex searches through the form, where LoginID has been inserted - NOT the resulting page, after form submission.

I hope someone will have some suggestion as where to go from here, because I am out of ideas. :confused:

I have checked the check_http and have the same result with regex search.
If looking for an expression that occurs on the both pages (prior and post login) - the result is OK. If looking for the expression that is only on post login page - the result is “expression not found”.

Finaly, the solution has came through support and it is matter of syntax inside WATO.
What is a bit confusing for me is that with bad syntax - it appeared that it is working, but with wrong results :slight_smile:

The solution for syntax is:
‘Send HTTP POST data’ shall be set to ‘Login.LoginID=censored@isp.censored.rs&Login.Password=censored’

1 Like