fzaninotto / uptime

A remote monitoring application using Node.js, MongoDB, and Twitter Bootstrap.
http://fzaninotto.github.com/uptime/
MIT License
3.62k stars 704 forks source link

Feature request: check result content for containing a string #143

Closed liluxdev closed 11 years ago

liluxdev commented 11 years ago

It's possible to develop a plugin who makes you able to set a string/regexp for each check entry to match against the response html text?

Eg. a site is ok if contains a footer string or an html comment used to tracking that all is ok

This feature request is inspirated by the availablity of such feature in pingdom checks (advanced settings)

fzaninotto commented 11 years ago

It's not possible as of now, but it is doable via a plugin and a custom check type.

TexRx commented 11 years ago

I implemented this by subclassing the base class that the http and https types implement, and then having the http and https types proto off my new subclass. I check for content contains and content does not contain. Works well, as I didn't need full phantom.js support.

liluxdev commented 11 years ago

@askesian will your share your "fork" or your plugin here on github? I'm not yet a node.js programmer so I don't know how to code your hint!

brettswift commented 11 years ago

@askesian interested in your solution, as I am working on something similar with a similar implementation. I'm looking to extract information from the polled http web service. This is an api that can supply information, and I'm looking to add that information to the check object. It's buggy right now but I think I'm close.. maybe I could learn something from your approach as well.. I'd be interested in seeing your fork ;)

My fork isn't up to date yet, but when I have time to fix the bug I'm facing I will push up my changes.

brettswift commented 11 years ago

It works, but it's not really where I want to be just yet so no pull request possible until it's a feature you can turn off, or make into a plugin. (See todo's in my last commit). If you are interested in taking a look at this branch, it's on my fork: https://github.com/brettswift/uptime/tree/statusCheck

It is currently hard-coded to expect xml coming back from the http plugin to look like this:

1.0.1

I want to make the xpath / JSONPath configurable, and create a custom poller. Both of which I plan to do shortly.

@fzaninotto Thoughts? Is this something you would want eventually, if I get around to doing it right?

jimyhuang commented 11 years ago

Seems duplicated after I post at #150 . Maybe my work may help you: https://github.com/jimyhuang/uptime/commit/e00e3ca2a17fc3c9c1a124763067a7de9cd373da

TexRx commented 11 years ago

Sorry - just saw all of these messages. My bad. Ill post my code tomorrow. I didn't fork, I just made changes locally. Either way, I'll get it posted.