g0v / api.ly

api.ly.g0v.tw - ly api endpoint
14 stars 6 forks source link

add monit for checking stalled lyapi service #48

Closed clkao closed 10 years ago

clkao commented 10 years ago

when bill-detail is running, memory usage can crash postgres worker progress, and currently lyapi service doesn't respond gracefully to that (pgrest/pgrest#54)

https://github.com/phlipper/chef-monit

kcliu commented 10 years ago

why not use runit ?

clkao commented 10 years ago

lyapi runs with runit. monit allows declaring what to monitor and what to do when failed

walkingice commented 10 years ago

This is the first try that including monit. if the total memory usage exceed 1024MB, it will restart lyapi.

It needs more love to specify proper threshold, any one?

clkao commented 10 years ago

@walkingice++ can we use http connection to /collections/bills for checking (error or timeout) instead of memory usage? (memory usage is by bill-details daemon)

walkingice commented 10 years ago

yeah, it is feasible by invoking exec "curl http://localhost/collections/bills". But I don't know how to trigger the crash to test. any idea?

clkao commented 10 years ago

can use connection testing instead of curl: http://mmonit.com/monit/documentation/monit.html#connection_testing_using_the_url_notation

for simulating the failure and trigger, perhaps just manually shutdown postgresql? ;)

walkingice commented 10 years ago

Good idea! I will do it later

walkingice commented 10 years ago

seems nobody complain the commits, close it.