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.

405 lines
15 KiB

8 years ago
  1. {% extends "base.html" %}
  2. {% load compress humanize staticfiles hc_extras %}
  3. {% block title %}Integrations - {% site_name %}{% endblock %}
  4. {% block content %}
  5. <div class="row">
  6. {% if messages %}
  7. <div class="col-sm-12">
  8. {% for message in messages %}
  9. <p class="alert alert-{{ message.tags }}">{{ message }}</p>
  10. {% endfor %}
  11. </div>
  12. {% endif %}
  13. <div class="col-sm-12">
  14. <table class="table channels-table">
  15. {% if channels %}
  16. <tr>
  17. <th>Type</th>
  18. <th>Value</th>
  19. <th>Assigned Checks</th>
  20. <th>Last Notification</th>
  21. <th></th>
  22. </tr>
  23. {% for ch in channels %}
  24. <tr class="channel-row">
  25. <td>{{ ch.get_kind_display }}</td>
  26. <td class="value-cell">
  27. {% if ch.kind == "email" %}
  28. <span class="preposition">to</span>
  29. {{ ch.value }}
  30. {% if not ch.email_verified %}
  31. {% if ch.latest_notification and ch.latest_notification.error %}
  32. <span class="channel-disabled">
  33. (bounced, disabled)
  34. </span>
  35. {% else %}
  36. <span class="channel-unconfirmed">
  37. (unconfirmed)
  38. </span>
  39. {% endif %}
  40. </span>
  41. {% endif %}
  42. {% elif ch.kind == "pd" %}
  43. {% if ch.pd_account %}
  44. <span class="preposition">account</span>
  45. {{ ch.pd_account}},
  46. {% endif %}
  47. <span class="preposition">service key</span>
  48. {{ ch.pd_service_key }}
  49. {% elif ch.kind == "pagertree" %}
  50. <span class="preposition">URL</span>
  51. {{ ch.value }}
  52. {% elif ch.kind == "opsgenie" %}
  53. <span class="preposition">API key</span>
  54. {{ ch.value }}
  55. {% elif ch.kind == "victorops" %}
  56. <span class="preposition">Post URL</span>
  57. {{ ch.value }}
  58. {% elif ch.kind == "po" %}
  59. <span class="preposition">user key</span>
  60. {{ ch.po_value|first }}
  61. ({{ ch.po_value|last }} priority)
  62. {% elif ch.kind == "slack" %}
  63. {% if ch.slack_team %}
  64. <span class="preposition">team</span>
  65. {{ ch.slack_team }},
  66. <span class="preposition">channel</span>
  67. {{ ch.slack_channel }}
  68. {% else %}
  69. {{ ch.value }}
  70. {% endif %}
  71. {% elif ch.kind == "webhook" %}
  72. {% if ch.url_down %}
  73. <span class="preposition">down</span> {{ ch.url_down }}
  74. {% endif %}
  75. {% if ch.url_up and not ch.url_down %}
  76. <span class="preposition">up</span> {{ ch.url_up }}
  77. {% endif %}
  78. {% if ch.url_up or ch.post_data or ch.headers %}
  79. <a href="#"
  80. data-toggle="modal"
  81. data-target="#channel-details-{{ ch.code }}">(details)</a>
  82. {% endif %}
  83. {% elif ch.kind == "pushbullet" %}
  84. <span class="preposition">API key</span>
  85. {{ ch.value }}
  86. {% elif ch.kind == "discord" %}
  87. {{ ch.discord_webhook_id }}
  88. {% elif ch.kind == "telegram" %}
  89. {% if ch.telegram_type == "group" %}
  90. <span class="preposition">chat</span>
  91. {% elif ch.telegram_type == "private" %}
  92. <span class="preposition">user</span>
  93. {% endif %}
  94. {{ ch.telegram_name }}
  95. {% elif ch.kind == "hipchat" %}
  96. {{ ch.hipchat_webhook_url }}
  97. {% else %}
  98. {{ ch.value }}
  99. {% endif %}
  100. </td>
  101. <td class="channels-num-checks">
  102. <a
  103. class="edit-checks"
  104. href="{% url 'hc-channel-checks' ch.code %}">
  105. {{ ch.n_checks }} of {{ num_checks }}
  106. </a>
  107. </td>
  108. <td>
  109. {% with n=ch.latest_notification %}
  110. {% if n %}
  111. {% if n.error %}
  112. <span class="text-danger" data-toggle="tooltip" title="{{ n.error }}">
  113. <strong>Failed</strong>, {{ n.created|naturaltime }}
  114. </span>
  115. {% else %}
  116. Delivered, {{ n.created|naturaltime }}
  117. {% endif %}
  118. {% else %}
  119. Never
  120. {% endif %}
  121. {% if ch.kind == "sms" %}
  122. <p>Used {{ profile.sms_sent_this_month }} of {{ profile.sms_limit }} sends this month.</p>
  123. {% endif %}
  124. {% endwith %}
  125. </td>
  126. <td>
  127. <button
  128. data-kind="{{ ch.get_kind_display }}"
  129. data-url="{% url 'hc-remove-channel' ch.code %}"
  130. class="btn btn-sm btn-default channel-remove"
  131. type="button">
  132. <span class="icon-delete"></span>
  133. </button>
  134. </td>
  135. <td>
  136. </td>
  137. </tr>
  138. {% endfor %}
  139. {% endif %}
  140. </table>
  141. <h1 class="ai-title">Add More</h1>
  142. <ul class="add-integration">
  143. <li>
  144. <img src="{% static 'img/integrations/slack.png' %}"
  145. class="icon" alt="Slack icon" />
  146. <h2>Slack</h2>
  147. <p>A messaging app for teams.</p>
  148. <a href="{% url 'hc-add-slack' %}" class="btn btn-primary">Add Integration</a>
  149. </li>
  150. <li>
  151. <img src="{% static 'img/integrations/email.png' %}"
  152. class="icon" alt="Email icon" />
  153. <h2>Email</h2>
  154. <p>Get an email message when a check goes up or down.</p>
  155. <a href="{% url 'hc-add-email' %}" class="btn btn-primary">Add Integration</a>
  156. </li>
  157. {% if enable_sms %}
  158. <li>
  159. <img src="{% static 'img/integrations/sms.png' %}"
  160. class="icon" alt="SMS icon" />
  161. <h2>SMS {% if use_payments %}<small>(paid plans)</small>{% endif %}</h2>
  162. <p>Get a text message to your phone when a check goes down.</p>
  163. <a href="{% url 'hc-add-sms' %}" class="btn btn-primary">Add Integration</a>
  164. </li>
  165. {% endif %}
  166. <li>
  167. <img src="{% static 'img/integrations/webhook.png' %}"
  168. class="icon" alt="Webhook icon" />
  169. <h2>Webhook</h2>
  170. <p>Receive a HTTP callback when a check goes down.</p>
  171. <a href="{% url 'hc-add-webhook' %}" class="btn btn-primary">Add Integration</a>
  172. </li>
  173. {% if enable_pushover %}
  174. <li>
  175. <img src="{% static 'img/integrations/pushover.png' %}"
  176. class="icon" alt="Pushover icon" />
  177. <h2>Pushover</h2>
  178. <p>Receive instant push notifications on your phone or tablet.</p>
  179. <a href="{% url 'hc-add-pushover' %}" class="btn btn-primary">Add Integration</a>
  180. </li>
  181. {% endif %}
  182. {% if enable_pushbullet %}
  183. <li>
  184. <img src="{% static 'img/integrations/pushbullet.png' %}"
  185. class="icon" alt="Pushbullet icon" />
  186. <h2>Pushbullet</h2>
  187. <p>Pushbullet connects your devices, making them feel like one.</p>
  188. <a href="{% url 'hc-add-pushbullet' %}" class="btn btn-primary">Add Integration</a>
  189. </li>
  190. {% endif %}
  191. {% if enable_telegram %}
  192. <li>
  193. <img src="{% static 'img/integrations/telegram.png' %}"
  194. class="icon" alt="Telegram icon" />
  195. <h2>Telegram</h2>
  196. <p>A messaging app with a focus on speed and security.</p>
  197. <a href="{% url 'hc-add-telegram' %}" class="btn btn-primary">Add Integration</a>
  198. </li>
  199. {% endif %}
  200. {% if enable_pd %}
  201. <li>
  202. <img src="{% static 'img/integrations/pd.png' %}"
  203. class="icon" alt="PagerDuty icon" />
  204. <h2>PagerDuty</h2>
  205. <p>On-call scheduling, alerting, and incident tracking.</p>
  206. <a href="{% url 'hc-add-pd' %}" class="btn btn-primary">Add Integration</a>
  207. </li>
  208. {% endif %}
  209. <li>
  210. <img src="{% static 'img/integrations/pagertree.png' %}"
  211. class="icon" alt="PagerTree icon" />
  212. <h2>PagerTree</h2>
  213. <p>DevOps Incident Management - On-Call Schedules, Alerts, &amp; Notifications</p>
  214. <a href="{% url 'hc-add-pagertree' %}" class="btn btn-primary">Add Integration</a>
  215. </li>
  216. <li>
  217. <img src="{% static 'img/integrations/hipchat.png' %}"
  218. class="icon" alt="HipChat icon" />
  219. <h2>HipChat</h2>
  220. <p>Group and private chat, file sharing, and integrations.</p>
  221. <a href="{% url 'hc-add-hipchat' %}" class="btn btn-primary">Add Integration</a>
  222. </li>
  223. <li>
  224. <img src="{% static 'img/integrations/victorops.png' %}"
  225. class="icon" alt="VictorOps icon" />
  226. <h2>VictorOps</h2>
  227. <p>On-call scheduling, alerting, and incident tracking.</p>
  228. <a href="{% url 'hc-add-victorops' %}" class="btn btn-primary">Add Integration</a>
  229. </li>
  230. {% if enable_discord %}
  231. <li>
  232. <img src="{% static 'img/integrations/discord.png' %}"
  233. class="icon" alt="Discord icon" />
  234. <h2>Discord</h2>
  235. <p>Cross-platform voice and text chat app designed for gamers.</p>
  236. <a href="{% url 'hc-add-discord' %}" class="btn btn-primary">Add Integration</a>
  237. </li>
  238. {% endif %}
  239. <li>
  240. <img src="{% static 'img/integrations/opsgenie.png' %}"
  241. class="icon" alt="OpsGenie icon" />
  242. <h2>OpsGenie</h2>
  243. <p> Alerting &amp; Incident Management Solution for Dev &amp; Ops.</p>
  244. <a href="{% url 'hc-add-opsgenie' %}" class="btn btn-primary">Add Integration</a>
  245. </li>
  246. <li class="link-to-github">
  247. <img src="{% static 'img/integrations/missing.png' %}"
  248. class="icon" alt="Suggest New Integration" />
  249. <p>
  250. Your favorite service or notification method not listed? <br />
  251. Please <a href="https://github.com/healthchecks/healthchecks/issues">file an issue on GitHub</a>!
  252. </p>
  253. </li>
  254. </ul>
  255. </div>
  256. </div>
  257. <div id="checks-modal" class="modal">
  258. <div class="modal-dialog">
  259. <div class="modal-content">
  260. </div>
  261. </div>
  262. </div>
  263. <div id="remove-channel-modal" class="modal">
  264. <div class="modal-dialog">
  265. <form id="remove-channel-form" method="post">
  266. {% csrf_token %}
  267. <div class="modal-content">
  268. <div class="modal-header">
  269. <button type="button" class="close" data-dismiss="modal">&times;</button>
  270. <h4 class="remove-check-title">
  271. Remove this
  272. <span class="remove-channel-kind">---</span>
  273. Integration?
  274. </h4>
  275. </div>
  276. <div class="modal-body">
  277. <p>You are about to remove this
  278. <span class="remove-channel-kind">---</span>
  279. integration.
  280. </p>
  281. <p>Once it's gone it's gone. But, if you change your
  282. mind later, you can create a similar channel again.
  283. Do you want to continue?</p>
  284. </div>
  285. <div class="modal-footer">
  286. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  287. <button type="submit" class="btn btn-danger">Remove</button>
  288. </div>
  289. </div>
  290. </form>
  291. </div>
  292. </div>
  293. {% for ch in channels %}
  294. {% if ch.kind == "webhook" %}
  295. <div id="channel-details-{{ ch.code }}" class="modal channel-details">
  296. <div class="modal-dialog">
  297. <div class="modal-content">
  298. <div class="modal-header">
  299. <button type="button" class="close" data-dismiss="modal">&times;</button>
  300. <h4>Integration Details</h4>
  301. </div>
  302. <div class="modal-body">
  303. <table>
  304. <tr>
  305. <th>Request Method</th>
  306. <td>
  307. {% if ch.post_data %}
  308. POST
  309. {% else %}
  310. GET
  311. {% endif %}
  312. </td>
  313. </tr>
  314. <tr>
  315. <th>URL for "down" events</th>
  316. <td>
  317. {% if ch.url_down %}
  318. <code>{{ ch.url_down }}</code>
  319. {% else %}
  320. <span class="missing">(not set)</span>
  321. {% endif %}
  322. </td>
  323. </tr>
  324. {% if ch.url_up %}
  325. <tr>
  326. <th>URL for "up" events</th>
  327. <td>
  328. {% if ch.url_up %}
  329. <code>{{ ch.url_up }}</code>
  330. {% else %}
  331. <span class="missing">(not set)</span>
  332. {% endif %}
  333. </td>
  334. </tr>
  335. {% endif %}
  336. {% if ch.post_data %}
  337. <tr>
  338. <th>POST data</th>
  339. <td><code>{{ ch.post_data }}</code></td>
  340. </tr>
  341. {% endif %}
  342. {% for k, v in ch.headers.items %}
  343. <tr>
  344. <th>Header <code>{{ k }}</code></th>
  345. <td><code>{{ v }}</code></td>
  346. </tr>
  347. {% endfor %}
  348. </table>
  349. </div>
  350. <div class="modal-footer">
  351. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  352. </div>
  353. </div>
  354. </div>
  355. </div>
  356. {% endif %}
  357. {% endfor %}
  358. {% endblock %}
  359. {% block scripts %}
  360. {% compress js %}
  361. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  362. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  363. <script src="{% static 'js/channels.js' %}"></script>
  364. {% endcompress %}
  365. {% endblock %}