amonapp / amon

Amon is a modern server monitoring platform.
https://docs.amon.cx
GNU Affero General Public License v3.0
1.33k stars 108 forks source link

Healthcheck api #154

Open beardedeagle opened 7 years ago

beardedeagle commented 7 years ago

According to the docs: https://docs.amon.cx/api/#health-checks there are healthcheck api endpoints. When I try to do a curl to the list endpoint for healthchecks as per the documentation I get the following:

curl https://redacted.com/api/v1/healthchecks/list/?api_key=redactedapikey
<h1>Not Found</h1><p>The requested URL /api/v1/healthchecks/list/ was not found on this server.</p>

Digging through the code, I am not seeing the endpoints listed in the docs in the api urls. Was this just prematurely added to the docs?

martinrusev commented 7 years ago

@beardedeagle In this case the opposite - there was a health check API in Amon 5.X and I did a big refactoring for 6.0 and most of the functionality got moved to alerts. Will restore list though, because it still makes sense.

healthchecks_urls = patterns('',
    url(r'^v1/healthchecks/list/$', HealthChecksListView.as_view(), name='api_healthchecks_list'),
    url(r'^v1/healthchecks/pause/all/$', HealthChecksPauseAllView.as_view(), name='api_healthchecks_pause_all'),
    url(r'^v1/healthchecks/resume/all/$', HealthChecksResumeAllView.as_view(), name='api_healthchecks_resume_all'),
    url(r'^v1/healthchecks/pause/(?P<check_id>\w+)/$', HealthChecksPauseView.as_view(), name='api_healthchecks_pause'),
    url(r'^v1/healthchecks/resume/(?P<check_id>\w+)/$', HealthChecksResumeView.as_view(), name='api_healthchecks_resume'),
    url(r'^v1/healthchecks/delete/(?P<check_id>\w+)/$', HealthChecksDeleteView.as_view(), name='api_healthchecks_delete'),
)
beardedeagle commented 7 years ago

@martinrusev I would think it would make sense to restore list AND delete. For instance, I have some healthchecks that I no longer run still sitting in my dashboard because I am unable to remove them either via api call or via a button click. So I basically have to wait for the retention policy to kick in and remove the stale data as far as I am understanding it (I could be wrong, I just started using this monitoring solution). And you should be able to cascade the delete to alerts as well so you don't end up with orphaned alerts.

martinrusev commented 7 years ago

@beardedeagle list and delete will be restored. Not sure about alerts, because they are quite complicated with the groups and tagging