Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
723 views
in Technique[技术] by (71.8m points)

https - Nagios plugin: why does check_http -v add odd numbers between html output?

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:

  • Archlinux check_http v2.3 (monitoring-plugins 2.3)
  • Ubuntu 18.04 check_http v2.2 (monitoring-plugins 2.2)
question from:https://stackoverflow.com/questions/66050254/nagios-plugin-why-does-check-http-v-add-odd-numbers-between-html-output

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...