ajrbyers / mondroid

Simple monitoring system written in Python/Django using requests.
GNU General Public License v2.0
0 stars 0 forks source link

decouple the checking from Mondroid #9

Closed lsh-0 closed 9 years ago

lsh-0 commented 9 years ago

as an system admin running the monitor I need the logic that does the checking to fail rarely, if ever because the data being collected may be subject to auditing and intense scrutiny

I love how convenient things are once setup, but I made a dumb mistake while tweaking the configuration and didn't notice for about ten minutes when an expected state failed to appear in the list. I can't afford to have a 'droid with a faulty memory because we're building in features quickly. Rigorous unit testing might also help here before deploys, but there always seems to be edge cases with these larger, sophisticated frameworks.

This is slightly audacious, but I was thinking about having a Python script generate other, dead simple, scripts (one per monitor) whose sole purpose is to ping a website just once and output the result to a log file. This script would then be called repeatedly by cron and the log would accumulate. Mondroid then reads this log data in regularly with a management task and populates it's db.

Waddya think?

lsh-0 commented 9 years ago

I may have just described this better in an email:

_it's more like building a script to generate scripts. The smaller and less they know about the world the less likely they are to failure. Something like, "./manage.py installmonitors" which would then install cron jobs like

*/5 * * * * PATH=~/.virtualenvs/mondroid/bin/:$PATH python /path/to/fetcher.py elifesciences.org > /var/log/mondroid/elifesciences.org.log
*/5 * * * * PATH=~/.virtualenvs/mondroid/bin/:$PATH python /path/to/fetcher.py ubiquitypress.com > /var/log/mondroid/ubiquitypress.com.log
ajrbyers commented 9 years ago

Slight delay - but this is coming together. Like a good plan.

ajrbyers commented 9 years ago

Any ideas how we should determine where we are in the log file? Or should we parse it all the way through and just use the time to get_or_create a check record?

lsh-0 commented 9 years ago

dead simple is best - process the whole damn thing, no cleverness. just don't read the whole file in at once, read it line by until it's gone. I don't think we'll ever encounter files hundreds of megs big though.

As for the log file itself, I was thinking of simply having a naive output to file and leave log rotation to ... logrotate. Or, depending on how you're doing this, just output to a datestamped file ...

On Tue, Dec 9, 2014 at 9:28 PM, Andy Byers notifications@github.com wrote:

Any ideas how we should determine where we are in the log file? Or should we parse it all the way through and just use the time to get_or_create a check record?

— Reply to this email directly or view it on GitHub https://github.com/ajrbyers/mondroid/issues/9#issuecomment-66360952.

Luke Skibinski devops - eLife

eLife Sciences Publications, Ltd is a limited liability non-profit non-stock corporation incorporated in the State of Delaware, USA, with company number 5030732, and is registered in the UK with company number FC030576 and branch number BR015634 at the address First Floor, 24 Hills Road, Cambridge CB2 1JP.

ajrbyers commented 9 years ago

OKAY! I have a prototype up and running... It needs a bit more work so I'll look it over tomorrow and commit it :D

ajrbyers commented 9 years ago

This is done - seems pretty good too. The code needs a bit of tidying but I'll get round to that in review.