models for hpc healthcheck
diff --git a/xos/hpc/admin.py b/xos/hpc/admin.py
index 74902ad..5f665b1 100644
--- a/xos/hpc/admin.py
+++ b/xos/hpc/admin.py
@@ -134,6 +134,15 @@
user_readonly_fields = ('backend_status_text', "name", "contentProvider", "description", "map")
readonly_fields = ('backend_status_text', )
+class HpcHealthCheckAdmin(HPCAdmin):
+ model = HpcHealthCheck
+ verbose_name = "Health Check"
+ verbose_name = "Health Checks"
+ list_display = ["backend_status_icon", "resource_name", "kind"]
+ list_display_links = ["backend_status_icon", "resource_name"]
+ fields = ["backend_status_text", "hpcService", "resource_name", "kind", "result_contains", "result_min_size", "result_max_size"]
+ readonly_fields = ["backend_status_text",]
+
admin.site.register(ServiceProvider, ServiceProviderAdmin)
admin.site.register(ContentProvider, ContentProviderAdmin)
admin.site.register(CDNPrefix, CDNPrefixAdmin)
@@ -141,4 +150,5 @@
admin.site.register(HpcService, HpcServiceAdmin)
admin.site.register(SiteMap, SiteMapAdmin)
admin.site.register(AccessMap, AccessMapAdmin)
+admin.site.register(HpcHealthCheck, HpcHealthCheckAdmin)
diff --git a/xos/hpc/models.py b/xos/hpc/models.py
index 30bbd49..9b00a00 100644
--- a/xos/hpc/models.py
+++ b/xos/hpc/models.py
@@ -1,5 +1,6 @@
from django.db import models
from core.models import User, Service, SingletonModel, PlCoreBase
+from core.models.plcorebase import StrippedCharField
import os
from django.db import models
from django.forms.models import model_to_dict
@@ -117,3 +118,19 @@
raise ValueError("You may only set one of contentProvider, serviceProvider, cdnPrefix, or hpcService")
super(SiteMap, self).save(*args, **kwds)
+
+class HpcHealthCheck(PlCoreBase):
+ class Meta:
+ app_label = "hpc"
+
+ KIND_CHOICES = (('dns', 'DNS'), ('http', 'HTTP'))
+
+ hpcService = models.ForeignKey(HpcService, blank = True, null=True)
+ kind = models.CharField(max_length=30, choices=KIND_CHOICES, default="dns")
+ resource_name = StrippedCharField(max_length=1024, blank=False, null=False)
+ result_contains = StrippedCharField(max_length=1024, blank=True, null=True)
+ result_min_size = models.IntegerField(null=True, blank=True)
+ result_max_size = models.IntegerField(null=True, blank=True)
+
+ def __unicode__(self): return self.resource_name
+