Simple question, where I already spent hours searching for an answer:
The following HTTP check doesn't work, despite it's validity can be proven:
./check_http --sni -H www.wikimedia.de -u /ueber-uns/ -S -s "cli-privacy-readmore"
Verify this with a visit to the source code and search for it: https://www.wikimedia.de/ueber-uns/.
The verbose switch gives more insight, though that's where I'm at the end of my knowledge:
> ./check_http --sni -H www.wikimedia.de -u /ueber-uns/ -S -s "cli-privacy-readmore" -v | grep cli-privacy-rea -A2 -n
1348: <a class="cli-privacy-rea
1349-3000
1350-dmore" data-readmore-text="Zeig mehr" data-readless-text="Zeige weniger"></a> </div>
Why is there a 3000 (on line 1349) in it? I've already found out that it's HEX and somehow used for length estimation. But neither a look inside tcpdump (the value is somehow transmitted, or added afterwards to the packets), nor the test with other variables (other gateway, os, site) brings me closer to a solution.
Can anyone help me?
Edit:
Tested on:
Your issue is not reproducible.
# check_http --version
check_http v2.3.3 (nagios-plugins 2.3.3)
# check_http --sni -H www.wikimedia.de -u /ueber-uns/ -S -s "cli-privacy-readmore" -v | grep cli-privacy-rea -A2 -n
1340: <a class="cli-privacy-readmore" data-readmore-text="Zeig mehr" data-readless-text="Zeige weniger"></a> </div>
1341- </div>
1342- <div class="cli-col-12 cli-align-items-stretch cli-px-0 cli-tab-section-container">
# check_http --sni -H www.wikimedia.de -u /ueber-uns/ -S -s "cli-privacy-readmore"
HTTP OK: HTTP/1.1 200 OK - 95466 bytes in 0.375 second response time |time=0.375144s;;;0.000000 size=95466B;;;0
Try a newer version of the plugin.
edit: You also may not need to use a Nagios plugin for this as it's a pretty basic use case, unless you need the perfdata or similar you can just do this:
# curl --silent https://www.wikimedia.de/ueber-uns/ | grep -q "cli-privacy-readmore" ; echo $?
0
# curl --silent https://www.wikimedia.de/ueber-uns/ | grep -q "banana" ; echo $?
1