Browse Source

PING_ENDPOINT in settings, fix terminology

pull/7/head
Pēteris Caune 10 years ago
parent
commit
3c2c71e907
7 changed files with 16 additions and 9 deletions
  1. +4
    -0
      hc/api/models.py
  2. +1
    -0
      hc/api/urls.py
  3. +2
    -1
      hc/front/views.py
  4. +1
    -0
      hc/settings.py
  5. +5
    -5
      templates/docs.html
  6. +1
    -1
      templates/front/index.html
  7. +2
    -2
      templates/pricing.html

+ 4
- 0
hc/api/models.py View File

@ -1,6 +1,7 @@
from datetime import timedelta as td from datetime import timedelta as td
import uuid import uuid
from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models from django.db import models
@ -17,3 +18,6 @@ class Check(models.Model):
last_ping = models.DateTimeField(null=True, blank=True) last_ping = models.DateTimeField(null=True, blank=True)
alert_after = models.DateTimeField(null=True, blank=True, editable=False) alert_after = models.DateTimeField(null=True, blank=True, editable=False)
status = models.CharField(max_length=6, choices=STATUSES, default="new") status = models.CharField(max_length=6, choices=STATUSES, default="new")
def url(self):
return settings.PING_ENDPOINT + str(self.code)

+ 1
- 0
hc/api/urls.py View File

@ -4,4 +4,5 @@ from hc.api import views
urlpatterns = [ urlpatterns = [
url(r'^ping/([\w-]+)/$', views.ping, name="hc-ping"), url(r'^ping/([\w-]+)/$', views.ping, name="hc-ping"),
url(r'^ping/([\w-]+)$', views.ping, name="hc-ping"),
] ]

+ 2
- 1
hc/front/views.py View File

@ -1,5 +1,6 @@
import json import json
from django.conf import settings
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.contrib.humanize.templatetags.humanize import naturaltime from django.contrib.humanize.templatetags.humanize import naturaltime
from django.http import HttpResponse, HttpResponseForbidden from django.http import HttpResponse, HttpResponseForbidden
@ -33,7 +34,7 @@ def index(request):
"check": check, "check": check,
"timer": timer, "timer": timer,
"timer_formatted": timer_formatted, "timer_formatted": timer_formatted,
"ping_url": "http://healthchecks.io/ping/%s/" % check.code
"ping_url": check.url()
} }
return render(request, "index.html", ctx) return render(request, "index.html", ctx)


+ 1
- 0
hc/settings.py View File

@ -87,6 +87,7 @@ USE_L10N = True
USE_TZ = True USE_TZ = True
SITE_ROOT = "http://localhost:8000" SITE_ROOT = "http://localhost:8000"
PING_ENDPOINT = SITE_ROOT + "/ping/"
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")] STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
STATIC_ROOT = os.path.join(BASE_DIR, 'static-collected') STATIC_ROOT = os.path.join(BASE_DIR, 'static-collected')


+ 5
- 5
templates/docs.html View File

@ -13,10 +13,10 @@
the "Last Ping" value of corresponding check is updated. the "Last Ping" value of corresponding check is updated.
</p> </p>
<p>When a certain amount of time passes since last received ping, the <p>When a certain amount of time passes since last received ping, the
check is considered "late", and Health Checks sends an email notification.
check is considered "late", and Health Checks sends an email alert.
It is all very simple, really.</p> It is all very simple, really.</p>
<h3>Executing a ping</h3>
<h3>Executing a Ping</h3>
<p> <p>
At the end of your batch job, add a bit of code to request At the end of your batch job, add a bit of code to request
one of your ping URLs. one of your ping URLs.
@ -35,16 +35,16 @@
In bash scripts, you can use <code>wget</code> or <code>curl</code> to run the requests: In bash scripts, you can use <code>wget</code> or <code>curl</code> to run the requests:
</p> </p>
<pre> <pre>
wget https://healthchecks.io/ping/b2012751-c542-4deb-b054-ff51322102b9/ -O /dev/null
curl http://healthchecks.io/ping/uuid-goes-here
</pre> </pre>
<h3>When notifications are sent</h3>
<h3>When Alerts Are Sent</h3>
<p> <p>
Each check has a configurable "Frequency" parameter, with default value of <strong>one day</strong>. Each check has a configurable "Frequency" parameter, with default value of <strong>one day</strong>.
</p> </p>
<p> <p>
When time since last ping exceeds the configured amount, the check is considered late. When time since last ping exceeds the configured amount, the check is considered late.
When a check is <strong>1 hour late</strong>, Health Checks sends you an email notification.
When a check is <strong>1 hour late</strong>, Health Checks sends you an email alert.
</p> </p>


+ 1
- 1
templates/front/index.html View File

@ -50,7 +50,7 @@
</form> </form>
</td> </td>
<td class="url-cell"> <td class="url-cell">
<code>http://healthchecks.io{% url 'hc-ping' check.code %}</code>
<code>{{ check.url }}</code>
</td> </td>
<td class="timeout-cell inactive"> <td class="timeout-cell inactive">
<div class="timeout-dialog popover bottom"> <div class="timeout-dialog popover bottom">


+ 2
- 2
templates/pricing.html View File

@ -22,8 +22,8 @@
</div> </div>
<ul class="list-group text-center"> <ul class="list-group text-center">
<li class="list-group-item"><i class="fa fa-check"></i> Personal or Commercial use</li> <li class="list-group-item"><i class="fa fa-check"></i> Personal or Commercial use</li>
<li class="list-group-item"><i class="fa fa-check"></i> Unlimited projects</li>
<li class="list-group-item"><i class="fa fa-check"></i> Unlimited notifications</li>
<li class="list-group-item"><i class="fa fa-check"></i> Unlimited Checks</li>
<li class="list-group-item"><i class="fa fa-check"></i> Unlimited Alerts</li>
</ul> </ul>
<div class="panel-footer"> <div class="panel-footer">
<a class="btn btn-lg btn-block btn-success" href="{% url 'hc-login' %}">Get Started</a> <a class="btn btn-lg btn-block btn-success" href="{% url 'hc-login' %}">Get Started</a>


Loading…
Cancel
Save