Monit http status locally - monit

I'm using the following monit code to alert if the specified page isn't answering with http 200 status code:
check host gateway with address 127.0.0.1
if failed
port 7778
protocol http
request "/mypage/"
status = 200
then alert
Anyway, on monit 5.20 (default on my debian 9) I'm getting: FAILED to [127.0.0.1]:7778/mypage/ type TCP/IP protocol HTTP, why?
Editing: it seems related to the status getting back, which is 301, but still haven't figured out the reason.

At the end I couldn't find the reason, but upgrading to latest monit version (5.26) the issue disappeared.

Related

When will monit actually start or restart a service

Can someone please let me know on what basis monit decides that its time to restart an application? For instance, if I want monit to monitor my web application, what information should I provide to monit based on which it will restart?
thanks
Update:
I was able to kind of make it work using the following monit config
check host altamides with address web.dev1.ams
if failed port 80 with protocol http
then alert
However, I was wondering if I can use any absolute URL of my application. Something like http://foo:5453/test/url/1.html/
Can someone help me on that please?
Monit by himself will not restart any service, but you can provide to it the rules you want to perform it, you can do something like
check process couchdb with pidfile /usr/local/var/run/couchdb/couchdb.pid
start program = "/etc/init.d/couchdb start"
stop program = "/etc/init.d/couchdb stop"
if cpu > 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if memory usage > 70% MB for 5 cycles then restart
check host mmonit.com with address mmonit.com
if failed port 80 protocol http then alert
if failed port 443 protocol https then alert
I figured the answer from monit help page
if failed
port 80
protocol http
request "/data/show?a=b&c=d"
then restart

coturn turn server error CREATE_PERMISSION 403: Forbidden IP

I deployed turn server using coturn with near-default configurations on ec2 instance. I was not able to connect with another peer using this turn server. It showed iceConnectionState changed to disconnected on the connection with error as peerjs logs on browser console and incoming packet CREATE_PERMISSION processed, error 403: Forbidden IP error on coturn server logs. How to fix this? (rhetorical)
In my case,This answer absolutely helped me( although, it was not my error). I was setting only public dns for external-ip in turnserver.conf. I set it as public-ip/private-ip and it worked. something like below:
external-ip=13.some.thing.229/172.some.thing.else and now even the error made sense.

200 ok followed by 400 Bad Request error page http://domainname:443

server is running Parallels Plesk Panel 11.5.30 and httpd-2.2.15-39 when any website is accessed using url http://website_domain_name:443 it show error page 400 Bad Request but with 200 OK header.
I already have read this question but can't find answer.
https works fine but *.com:443 gives a 400 error?
http://domainname:443
Not secure HTTP proto over secure port?
Maybe it should be
httpS://domainname:443 ?
or you have to sure that 443 port is actually not secure.

(103) Software caused connection abort: proxy: pass request body failed

The following errors are being logged in our proxy Apache logs while processing the request with Tomcat Server:
(103)Software caused connection abort: proxy: pass request body failed
proxy: pass request body failed
We've a Apache reverse proxy which serves the request for the client from our Tomcat Server. Sometimes, the request from the proxy returns 502 with the above error. There are no error logs in Tomcat Server Logs correlated with the above errors in Proxy. Also, the request didn't timeout since some of the requests response time is 1 sec and our default timeout is 120 sec.
We've added ProxyBadHeader Ignore to our httpd configuration [Ref: 502 Proxy Error / Uploading from Apache (mod_proxy) to Tomcat 7] and still didn't see any errors in our Tomcat logs.
Have anyone seen this issue earlier?
We recently had this issue after upgrading one of our machines from Tomcat 6 to 7. Someone forgot to change the default apache-tomcat/conf/tomcat-users.xml file from our standard one and so the wrong password was getting checked by the server. Interestingly this results in the 502 Error you saw above. This can be avoided with some decent logging to determine it is actually an auth problem.

Monit Syntax Error

I am using Monit v5.5 and trying to set a check for apache. Everything below is as per the documentation. However, when i say monit -t, i get /etc/monit.conf:155: Error: syntax error 'http' which points to the HTTP HEADERS line. Commenting it out works fine. Same issue with content = "WrongPath". Can anybody point me in the right direction?
check host mysite with address mysite.com
start program = "/usr/sbin/httpd start"
stop program = "/usr/sbin/httpd stop"
if failed port 80 protocol http
with http headers [Host: mysite.com, Cache-Control: no-cache]
and request "/pingtest.html" with content = "WrongPath"
then restart
if 5 restarts within 10 cycles then timeout
Your version is too old, HTTP HEADERS feature is in version 5.9. Please read this.