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.

157 lines
5.5 KiB

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