You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
5.5 KiB

8 years ago
9 years ago
  1. {% extends "base.html" %}
  2. {% load compress humanize staticfiles hc_extras %}
  3. {% block title %}My Checks - {% site_name %}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <ol class="breadcrumb">
  8. <li><a href="{% url 'hc-checks' %}">Checks</a></li>
  9. <li>
  10. <a href="{% url 'hc-details' check.code %}">
  11. {{ check.name_then_code }}
  12. </a>
  13. </li>
  14. <li class="active">Log</li>
  15. <li id="format-switcher-container" class="pull-right">
  16. <div id="format-switcher" class="btn-group" data-toggle="buttons">
  17. <label class="btn btn-default btn-xs" data-format="utc">
  18. <input type="radio" name="date-format" checked>
  19. UTC
  20. </label>
  21. <label class="btn btn-default btn-xs active" data-format="local">
  22. <input type="radio" name="date-format">
  23. Local Time
  24. </label>
  25. </div>
  26. </li>
  27. </ol>
  28. {% if events %}
  29. <div class="table-responsive">
  30. <table class="table" id="log">
  31. {% for event in events %}
  32. {% if event.n %}
  33. <tr class="ok" data-dt="{{ event.created.isoformat }}" data-url="{% url 'hc-ping-details' check.code event.n %}">
  34. <td class="n-cell">
  35. <span class="hash">#</span>{{ event.n }}
  36. </td>
  37. <td class="date"></td>
  38. <td class="time"></td>
  39. <td class="text-right">
  40. {% if event.fail %}
  41. <span class="label label-danger">Failure</span>
  42. {% else %}
  43. <span class="label label-success">OK</span>
  44. {% endif %}
  45. </td>
  46. <td class="details">
  47. {% if event.scheme == "email" %}
  48. {{ event.ua }}
  49. <span class="ua-body">
  50. {% if event.body %}
  51. - {{ event.body|truncatechars:150 }}
  52. {% endif %}
  53. </span>
  54. {% else %}
  55. {{ event.scheme|upper }}
  56. {{ event.method }}
  57. {% if event.remote_addr %}
  58. from {{ event.remote_addr }}
  59. {% endif %}
  60. <span class="ua-body">
  61. {% if event.ua %}
  62. - {{ event.ua }}
  63. {% endif %}
  64. {% if event.body %}
  65. - {{ event.body|truncatechars:150 }}
  66. {% endif %}
  67. </span>
  68. {% endif %}
  69. </td>
  70. </tr>
  71. {% endif %}
  72. {% if event.check_status %}
  73. <tr class="missing" data-dt="{{ event.created.isoformat }}">
  74. <td class="n-cell">
  75. <span class="icon-missing"></span>
  76. </td>
  77. <td class="date"></td>
  78. <td class="time"></td>
  79. <td class="alert-info" colspan="2">
  80. {% if event.channel.kind == "email" %}
  81. Sent email alert to {{ event.channel.value }}
  82. {% elif event.channel.kind == "slack" %}
  83. Sent Slack alert
  84. {% if event.channel.slack_channel %}
  85. to {{ event.channel.slack_channel }}
  86. {% endif %}
  87. {% elif event.channel.kind == "pd" %}
  88. Sent alert to PagerDuty
  89. {% elif event.channel.kind == "pagertree" %}
  90. Sent alert to PagerTree
  91. {% elif event.channel.kind == "opsgenie" %}
  92. Sent alert to OpsGenie
  93. {% elif event.channel.kind == "hipchat" %}
  94. Sent alert to HipChat
  95. {% elif event.channel.kind == "po" %}
  96. Sent a Pushover notification
  97. {% elif event.channel.kind == "webhook" %}
  98. Called webhook {{ event.channel.url_down }}
  99. {% else %}
  100. Sent alert to {{ event.channel.kind|capfirst }}
  101. {% endif %}
  102. {% if event.error %}
  103. <br />
  104. <strong>Error: {{ event.error }}</strong>
  105. {% endif %}
  106. </td>
  107. </tr>
  108. {% endif %}
  109. {% endfor %}
  110. </table>
  111. {% if show_limit_notice and limit < 1000 %}
  112. <p class="alert alert-info">
  113. <strong>Showing last {{ limit }} pings.</strong>
  114. Want to see more?
  115. <a href="{% url 'hc-pricing' %}">
  116. Upgrade your account!
  117. </a>
  118. </p>
  119. {% endif %}
  120. </div>
  121. {% else %}
  122. <div class="alert alert-info">Log is empty. This check has not received any pings yet.</div>
  123. {% endif %}
  124. </div>
  125. </div>
  126. <div id="ping-details-modal" class="modal">
  127. <div class="modal-dialog">
  128. <div class="modal-content">
  129. <div id="ping-details-body">Loading</div>
  130. <div class="modal-footer">
  131. <button type="button" class="btn btn-default" data-dismiss="modal">Got It!</button>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. {% endblock %}
  137. {% block scripts %}
  138. {% compress js %}
  139. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  140. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  141. <script src="{% static 'js/moment.min.js' %}"></script>
  142. <script src="{% static 'js/log.js' %}"></script>
  143. {% endcompress %}
  144. {% endblock %}