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.

158 lines
5.6 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. {% elif event.start %}
  43. <span class="label label-start">Started</span>
  44. {% else %}
  45. <span class="label label-success">OK</span>
  46. {% endif %}
  47. </td>
  48. <td class="details">
  49. {% if event.scheme == "email" %}
  50. {{ event.ua }}
  51. <span class="ua-body">
  52. {% if event.body %}
  53. - {{ event.body|truncatechars:150 }}
  54. {% endif %}
  55. </span>
  56. {% else %}
  57. {{ event.scheme|upper }}
  58. {{ event.method }}
  59. {% if event.remote_addr %}
  60. from {{ event.remote_addr }}
  61. {% endif %}
  62. <span class="ua-body">
  63. {% if event.ua %}
  64. - {{ event.ua }}
  65. {% endif %}
  66. {% if event.body %}
  67. - {{ event.body|truncatechars:150 }}
  68. {% endif %}
  69. </span>
  70. {% endif %}
  71. </td>
  72. </tr>
  73. {% endif %}
  74. {% if event.check_status %}
  75. <tr class="missing" data-dt="{{ event.created.isoformat }}">
  76. <td class="n-cell">
  77. <span class="icon-missing"></span>
  78. </td>
  79. <td class="date"></td>
  80. <td class="time"></td>
  81. <td class="alert-info" colspan="2">
  82. {% if event.channel.kind == "email" %}
  83. Sent email alert to {{ event.channel.value }}
  84. {% elif event.channel.kind == "slack" %}
  85. Sent Slack alert
  86. {% if event.channel.slack_channel %}
  87. to {{ event.channel.slack_channel }}
  88. {% endif %}
  89. {% elif event.channel.kind == "pd" %}
  90. Sent alert to PagerDuty
  91. {% elif event.channel.kind == "pagertree" %}
  92. Sent alert to PagerTree
  93. {% elif event.channel.kind == "opsgenie" %}
  94. Sent alert to OpsGenie
  95. {% elif event.channel.kind == "hipchat" %}
  96. Sent alert to HipChat
  97. {% elif event.channel.kind == "po" %}
  98. Sent a Pushover notification
  99. {% elif event.channel.kind == "webhook" %}
  100. Called webhook {{ event.channel.url_down }}
  101. {% else %}
  102. Sent alert to {{ event.channel.kind|capfirst }}
  103. {% endif %}
  104. {% if event.error %}
  105. <br />
  106. <strong>Error: {{ event.error }}</strong>
  107. {% endif %}
  108. </td>
  109. </tr>
  110. {% endif %}
  111. {% endfor %}
  112. </table>
  113. {% if show_limit_notice and limit < 1000 %}
  114. <p class="alert alert-info">
  115. <strong>Showing last {{ limit }} pings.</strong>
  116. Want to see more?
  117. <a href="{% url 'hc-pricing' %}">
  118. Upgrade your account!
  119. </a>
  120. </p>
  121. {% endif %}
  122. </div>
  123. {% else %}
  124. <div class="alert alert-info">Log is empty. This check has not received any pings yet.</div>
  125. {% endif %}
  126. </div>
  127. </div>
  128. <div id="ping-details-modal" class="modal">
  129. <div class="modal-dialog">
  130. <div class="modal-content">
  131. <div id="ping-details-body">Loading</div>
  132. <div class="modal-footer">
  133. <button type="button" class="btn btn-default" data-dismiss="modal">Got It!</button>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. {% endblock %}
  139. {% block scripts %}
  140. {% compress js %}
  141. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  142. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  143. <script src="{% static 'js/moment.min.js' %}"></script>
  144. <script src="{% static 'js/log.js' %}"></script>
  145. {% endcompress %}
  146. {% endblock %}