Comments (38)
I'm not sure why it's not working for you. How are you running it?
If you're running through docker, could you please try this and send me the output?
$ docker exec -it container_id bash
# curl -v google.com
Otherwise, could you please send me the command you're using to run it?
from cachet-url-monitor.
I'm not running docker but debian.
I start cachet-url-monitor with:
$ source bin/activate
$ pip install -r requirements.txt
$ python cachet_url_monitor/scheduler.py config.yml
The script is running but got no positive result.
from cachet-url-monitor.
I know this is a stupid question, but what do you get when you run this?
$ curl -v google.com
Also could you please send me the output of the following:
$ source bin/activate
$ pip install -r requirements.txt
$ python -c 'import requests; print requests.get("http://www.google.com").status_code'
from cachet-url-monitor.
Here we go:
$ curl -v google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.de/?gfe_rd=cr&ei=qak2WPmbLKGh8wfJ_rrACg">here</A>.
</BODY></HTML>
$ source bin/activate:
No output
$ pip install -r requirements.txt:
Requirement already satisfied (use --upgrade to upgrade): PyYAML==3.11 in ./lib/python2.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): requests==2.9.1 in ./lib/python2.7/site-packages (from -r requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): schedule==0.3.2 in ./lib/python2.7/site-packages (from -r requirements.txt (line 3))
Cleaning up...
$ python -c 'import requests; print requests.get("http://www.google.com").status_code':
200
from cachet-url-monitor.
What do you have in your configuration file? It should be working as you can clearly hit google.
This library actually uses sorta the same code you just used.
from cachet-url-monitor.
@mtakaki I am also getting the same issue"The URL is unreachable".Any solution .Also how can we pass parameters along with POST request ?
from cachet-url-monitor.
@kirtiranjan not sure why it's failing for both of you. I just tested it and it's working fine. Could you please share your configuration file?
from cachet-url-monitor.
@mtakaki here is my config file
endpoint:
url: http://www.google.com
method: GET
timeout: 0.05
expectation:
- type: HTTP_STATUS
status: 200
- type: LATENCY
threshold: 1
- type: REGEX
regex: '.(<body).'
cachet:
api_url: http://status.example.com/api/v1
token: #################
component_id: 1
#metric_id: 1
create_incident: true
frequency: 30
from cachet-url-monitor.
@kirtiranjan I would start with a simple configuration and you add more criteria as you clear them off. For example, your timeout is 50ms. Is it enough? The HTTP status that google returns is 302 Found
and forwards it to another URL. So, I would remove the HTTP_STATUS criteria for now.
I'll update the sample configuration to something that works right away. It seems that it's confusing and that may be leading you guys to this problem.
from cachet-url-monitor.
Irrespective of what I do I am always getting "The URL is unreachable"
from cachet-url-monitor.
If you look at the source code, an ConnectionError
is what causes the log message "The URL is unreachable." For whatever reason you're being able to reach google's page. Did you follow the same steps I've asked to @Hfroese and you got the same results?
from cachet-url-monitor.
Howdy,
I am also getting this issue. I am running the container pulled from dockerhub. I also tried doing a docker compose from the github and am getting the same thing.
Config.yaml
url: http://www.google.com
method: GET
timeout: 0.01
expectation:
- type: HTTP_STATUS
status: 200
- type: LATENCY
threshold: 1
- type: REGEX
regex: '.*(<body).*'
cachet:
api_url: http://status/api/v1
token: #######################
component_id: 1
#metric_id: 1
create_incident: true
frequency: 10
If I docker exec into the container and curl -v www.google.com:
curl -v www.google.com
- Rebuilt URL to: www.google.com/
- Hostname was NOT found in DNS cache
- Trying 216.58.217.36...
- Connected to www.google.com (216.58.217.36) port 80 (#0)
GET / HTTP/1.1
User-Agent: curl/7.38.0
Host: www.google.com
Accept: /
< HTTP/1.1 200 OK (there is some more junk after this that is just the web page)
On the plus side, the container is correctly talking to the Cachet API and changing the status when I get the error: WARNING [2016-11-29 22:43:34,997] cachet_url_monitor.configuration.Configuration - The URL is unreachable: GET http://www.google.com
from cachet-url-monitor.
I'm really not sure what's going on for you guys. I just pulled the docker image and it's working fine for me. Lemme do more tests here.
from cachet-url-monitor.
Further information that might help, I have tested this both inside and outside of my companies VPN. Same results both ways.
Lemme know if you need anything else, this seems like a pretty rad tool that'll save me a whole lot of time.
from cachet-url-monitor.
Thanks, @waltrinehart! Could you please try removing the REGEX expectation? Also, could you please try going with a super simple configuration and then adding more things? For example, just HTTP status, then you add latency, etc.
from cachet-url-monitor.
This should help isolating what exactly is failing for you.
from cachet-url-monitor.
Here is the output when I just do HTTP_Status:
sh-3.2# docker run --rm -it -v /Users/wrinehart/cachet-url-monitor/my_config:/usr/src/app/config/ mtakaki/cachet-url-monitor
INFO [2016-12-01 17:30:22,319] cachet_url_monitor.configuration.Configuration - Monitoring URL: GET http://www.google.com
INFO [2016-12-01 17:30:22,320] cachet_url_monitor.configuration.Configuration - Registered expectation: 'HTTP status: 200'
INFO [2016-12-01 17:30:22,321] cachet_url_monitor.scheduler.Scheduler - Starting monitor agent...
WARNING [2016-12-01 17:30:37,378] cachet_url_monitor.configuration.Configuration - The URL is unreachable: GET http://www.google.com
INFO [2016-12-01 17:30:37,460] cachet_url_monitor.configuration.Configuration - Component update: status [3]
Here is the when I add latency:
sh-3.2# docker run --rm -it -v /Users/wrinehart/cachet-url-monitor/my_config:/usr/src/app/config/ mtakaki/cachet-url-monitor
INFO [2016-12-01 17:28:22,745] cachet_url_monitor.configuration.Configuration - Monitoring URL: GET http://www.google.com
INFO [2016-12-01 17:28:22,746] cachet_url_monitor.configuration.Configuration - Registered expectation: 'HTTP status: 200'
INFO [2016-12-01 17:28:22,747] cachet_url_monitor.configuration.Configuration - Registered expectation: 'Latency threshold: 1.0000'
INFO [2016-12-01 17:28:22,747] cachet_url_monitor.scheduler.Scheduler - Starting monitor agent...
WARNING [2016-12-01 17:28:37,832] cachet_url_monitor.configuration.Configuration - The URL is unreachable: GET http://www.google.com
INFO [2016-12-01 17:28:37,922] cachet_url_monitor.configuration.Configuration - Component update: status [3]
from cachet-url-monitor.
Maybe it might be a good idea to copy/pasta your config you are using? Maybe something is awry with the format of the config file I have.
from cachet-url-monitor.
Ok, my config looks like this:
endpoint:
url: http://www.google.com
method: GET
timeout: 10
expectation:
- type: HTTP_STATUS
status: 200
- type: LATENCY
threshold: 10
cachet:
api_url: http://localhost/api/v1
token: my_token
component_id: 1
create_incident: true
frequency: 15
And this is my output:
$ docker run --rm -it -v "$PWD":/usr/src/app/config/ mtakaki/cachet-url-monitor
INFO [2016-12-01 17:39:18,435] cachet_url_monitor.configuration.Configuration - Monitoring URL: GET http://www.google.com
INFO [2016-12-01 17:39:18,437] cachet_url_monitor.configuration.Configuration - Registered expectation: 'HTTP status: 200'
INFO [2016-12-01 17:39:18,437] cachet_url_monitor.configuration.Configuration - Registered expectation: 'Latency threshold: 10.0000'
INFO [2016-12-01 17:39:18,439] cachet_url_monitor.scheduler.Scheduler - Starting monitor agent...
INFO [2016-12-01 17:39:34,071] cachet_url_monitor.configuration.Configuration - Component update: status [1]
from cachet-url-monitor.
That worked! There must be a discrepancy between the config included and the config you posted here. Maybe a formatting issue or a variable that it just doesn't like.
Is there anyway to get a list of the possible Expectations the config will accept?
from cachet-url-monitor.
How are you creating your config file? Are you using the config.yml
included here or are you copying/pasting it from the README?
The possible expectations are:
- HTTP_STATUS
- LATENCY
- REGEX
from cachet-url-monitor.
The one I got working was the copy you posted above.
from cachet-url-monitor.
Sorry, I meant the original one, the one that didn't work.
from cachet-url-monitor.
Ah, I also posted that one in my first post. I -believe- I got that config from the README, but I also could have gotten it from the sample included in the git repo.
from cachet-url-monitor.
I noticed the indentation was incorrect, but I thought it was just a pasting issue. Would you mind editing it and putting it into a code block? You will need to wrap it with ```, on the top and on the bottom.
from cachet-url-monitor.
I just created #21 to have better validation and to list the available expectations.
from cachet-url-monitor.
endpoint:
url: http://www.google.com
method: GET
timeout: 0.01
expectation:
- type: HTTP_STATUS
status: 200
# - type: LATENCY
# threshold: 1
# - type: REGEX
# regex: '.*(<body).*'
cachet:
api_url: http://status.net/api/v1
token: token
component_id: 1
#metric_id: 1
create_incident: true
frequency: 10
from cachet-url-monitor.
I can't see anything wrong with it. Could you please try increasing the timeout? Maybe you're not getting a response in 10ms.
from cachet-url-monitor.
I took the above config and adjusted the timeout to 10 (like in your config). It is working correctly.
0.01 (which is in the sample) must be far too low.
I swear at one point when I was dicking with this I increased the timeout and got "the url is unreachable", I must not have adjusted it enough.
from cachet-url-monitor.
Well, the interesting thing is that you should get this message, instead:
WARNING [2016-12-02 17:32:55,637] cachet_url_monitor.configuration.Configuration - Request timed out
INFO [2016-12-02 17:32:55,815] cachet_url_monitor.configuration.Configuration - Component update: status [3]
So it still doesn't explain what's happening...
from cachet-url-monitor.
If this is not happening anymore for you guys @Hfroese @kirtiranjan @waltrinehart, I'll close this issue. But I'd like some action items to prevent it from happening to other people. Still not sure what's going on, to be honest.
from cachet-url-monitor.
@mtakaki I also had this issue, then had a "Regex did not match anything in the body".
I've since removed the regex, upp'ed the timeout and latency to 10 and now i don't receive any updates to the monitor, it's just stuck at "starting monitor agent" with no other logs for 5minutes. I'll assume this code isn't stable enough to use :(
from cachet-url-monitor.
What's in your frequency, @shaun-ba ? This code is stable enough to me, but nonetheless you should use it at your own risk.
from cachet-url-monitor.
30seconds, i've not managed to get it to work at all unfortunately, very strange and different results on each run as other above reported
from cachet-url-monitor.
after copying the config.yml from this thread, I no longer get the site unreachable error. Cool thanks for the code. Much appreciation from Austin, Tx
from cachet-url-monitor.
Glad to hear it, @moodhairboy!
from cachet-url-monitor.
I've changed the code to print out the parsed configuration yaml. @shaun-ba would you mind trying it again with the latest code? And could you please post here the output?
from cachet-url-monitor.
I'm closing this issue as there has not been any question popping up anymore. If anyone has still any question, please feel free to reopen this issue.
from cachet-url-monitor.
Related Issues (20)
- Error al actualizar un incidente HOT 4
- Url unreachable issue - question HOT 2
- Allowed_fails behaviour
- Add JSON body and verify option to webhook POST request
- Documentation needed?
- Component with id [1] does not exist. HOT 4
- Is there a way to customize the message set? HOT 5
- Url not reacheable and component status HOT 3
- ARM version of Docker image?
- Reset Status After Incident Resolved HOT 3
- scheduler.py issue HOT 2
- No Errorcode for wrong IP:Port
- Wrong api to push metric points HOT 1
- Allowed_fails does not work
- AttributeError: 'list' object has no attribute 'lower' HOT 1
- Failure #1 with threshold set to 0 HOT 1
- Cachet Status not updated if check fails HOT 1
- Supervising Database Status
- Sorting the endpoints based on status
- Regex doesn't match text on checked site page
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cachet-url-monitor.