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.

440 lines
16 KiB

8 years ago
  1. {% extends "base.html" %}
  2. {% load compress humanize static 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. {% elif ch.kind == "zendesk" %}
  98. {{ ch.zendesk_subdomain }}.zendesk.com
  99. {% elif ch.kind == "sms" %}
  100. {% if ch.sms_label %}
  101. {{ ch.sms_label }} ({{ ch.sms_number }})
  102. {% else %}
  103. {{ ch.sms_number }}
  104. {% endif %}
  105. {% elif ch.kind == "trello" %}
  106. <span class="preposition">board</span>
  107. {{ ch.trello_board_list|first }},
  108. <span class="preposition">list</span>
  109. {{ ch.trello_board_list|last }}
  110. {% else %}
  111. {{ ch.value }}
  112. {% endif %}
  113. </td>
  114. <td class="channels-num-checks">
  115. <a
  116. class="edit-checks"
  117. href="{% url 'hc-channel-checks' ch.code %}">
  118. {{ ch.n_checks }} of {{ num_checks }}
  119. </a>
  120. </td>
  121. <td>
  122. {% with n=ch.latest_notification %}
  123. {% if n %}
  124. {% if n.error %}
  125. <span class="text-danger" data-toggle="tooltip" title="{{ n.error }}">
  126. <strong>Failed</strong>, {{ n.created|naturaltime }}
  127. </span>
  128. {% else %}
  129. Delivered, {{ n.created|naturaltime }}
  130. {% endif %}
  131. {% else %}
  132. Never
  133. {% endif %}
  134. {% if ch.kind == "sms" %}
  135. <p>Used {{ profile.sms_sent_this_month }} of {{ profile.sms_limit }} sends this month.</p>
  136. {% endif %}
  137. {% endwith %}
  138. </td>
  139. <td>
  140. <button
  141. data-kind="{{ ch.get_kind_display }}"
  142. data-url="{% url 'hc-remove-channel' ch.code %}"
  143. class="btn btn-sm btn-default channel-remove"
  144. type="button">
  145. <span class="icon-delete"></span>
  146. </button>
  147. </td>
  148. <td>
  149. </td>
  150. </tr>
  151. {% endfor %}
  152. {% endif %}
  153. </table>
  154. <h1 class="ai-title">Add More</h1>
  155. <ul class="add-integration">
  156. <li>
  157. <img src="{% static 'img/integrations/slack.png' %}"
  158. class="icon" alt="Slack icon" />
  159. <h2>Slack</h2>
  160. <p>A messaging app for teams.</p>
  161. <a href="{% url 'hc-add-slack' %}" class="btn btn-primary">Add Integration</a>
  162. </li>
  163. <li>
  164. <img src="{% static 'img/integrations/email.png' %}"
  165. class="icon" alt="Email icon" />
  166. <h2>Email</h2>
  167. <p>Get an email message when a check goes up or down.</p>
  168. <a href="{% url 'hc-add-email' %}" class="btn btn-primary">Add Integration</a>
  169. </li>
  170. {% if enable_sms %}
  171. <li>
  172. <img src="{% static 'img/integrations/sms.png' %}"
  173. class="icon" alt="SMS icon" />
  174. <h2>SMS {% if use_payments %}<small>(paid plans)</small>{% endif %}</h2>
  175. <p>Get a text message to your phone when a check goes down.</p>
  176. <a href="{% url 'hc-add-sms' %}" class="btn btn-primary">Add Integration</a>
  177. </li>
  178. {% endif %}
  179. <li>
  180. <img src="{% static 'img/integrations/webhook.png' %}"
  181. class="icon" alt="Webhook icon" />
  182. <h2>Webhook</h2>
  183. <p>Receive a HTTP callback when a check goes down.</p>
  184. <a href="{% url 'hc-add-webhook' %}" class="btn btn-primary">Add Integration</a>
  185. </li>
  186. {% if enable_pushover %}
  187. <li>
  188. <img src="{% static 'img/integrations/po.png' %}"
  189. class="icon" alt="Pushover icon" />
  190. <h2>Pushover</h2>
  191. <p>Receive instant push notifications on your phone or tablet.</p>
  192. <a href="{% url 'hc-add-pushover' %}" class="btn btn-primary">Add Integration</a>
  193. </li>
  194. {% endif %}
  195. {% if enable_pushbullet %}
  196. <li>
  197. <img src="{% static 'img/integrations/pushbullet.png' %}"
  198. class="icon" alt="Pushbullet icon" />
  199. <h2>Pushbullet</h2>
  200. <p>Pushbullet connects your devices, making them feel like one.</p>
  201. <a href="{% url 'hc-add-pushbullet' %}" class="btn btn-primary">Add Integration</a>
  202. </li>
  203. {% endif %}
  204. {% if enable_telegram %}
  205. <li>
  206. <img src="{% static 'img/integrations/telegram.png' %}"
  207. class="icon" alt="Telegram icon" />
  208. <h2>Telegram</h2>
  209. <p>A messaging app with a focus on speed and security.</p>
  210. <a href="{% url 'hc-add-telegram' %}" class="btn btn-primary">Add Integration</a>
  211. </li>
  212. {% endif %}
  213. {% if enable_pd %}
  214. <li>
  215. <img src="{% static 'img/integrations/pd.png' %}"
  216. class="icon" alt="PagerDuty icon" />
  217. <h2>PagerDuty</h2>
  218. <p>On-call scheduling, alerting, and incident tracking.</p>
  219. <a href="{% url 'hc-add-pd' %}" class="btn btn-primary">Add Integration</a>
  220. </li>
  221. {% endif %}
  222. <li>
  223. <img src="{% static 'img/integrations/pagertree.png' %}"
  224. class="icon" alt="PagerTree icon" />
  225. <h2>PagerTree</h2>
  226. <p>DevOps Incident Management - On-Call Schedules, Alerts, &amp; Notifications</p>
  227. <a href="{% url 'hc-add-pagertree' %}" class="btn btn-primary">Add Integration</a>
  228. </li>
  229. <li>
  230. <img src="{% static 'img/integrations/hipchat.png' %}"
  231. class="icon" alt="HipChat icon" />
  232. <h2>HipChat</h2>
  233. <p>Group and private chat, file sharing, and integrations.</p>
  234. <a href="{% url 'hc-add-hipchat' %}" class="btn btn-primary">Add Integration</a>
  235. </li>
  236. <li>
  237. <img src="{% static 'img/integrations/victorops.png' %}"
  238. class="icon" alt="VictorOps icon" />
  239. <h2>VictorOps</h2>
  240. <p>On-call scheduling, alerting, and incident tracking.</p>
  241. <a href="{% url 'hc-add-victorops' %}" class="btn btn-primary">Add Integration</a>
  242. </li>
  243. {% if enable_discord %}
  244. <li>
  245. <img src="{% static 'img/integrations/discord.png' %}"
  246. class="icon" alt="Discord icon" />
  247. <h2>Discord</h2>
  248. <p>Cross-platform voice and text chat app designed for gamers.</p>
  249. <a href="{% url 'hc-add-discord' %}" class="btn btn-primary">Add Integration</a>
  250. </li>
  251. {% endif %}
  252. <li>
  253. <img src="{% static 'img/integrations/opsgenie.png' %}"
  254. class="icon" alt="OpsGenie icon" />
  255. <h2>OpsGenie</h2>
  256. <p> Alerting &amp; Incident Management Solution for Dev &amp; Ops.</p>
  257. <a href="{% url 'hc-add-opsgenie' %}" class="btn btn-primary">Add Integration</a>
  258. </li>
  259. {% if enable_zendesk %}
  260. <li>
  261. <img src="{% static 'img/integrations/zendesk.png' %}"
  262. class="icon" alt="Zendesk icon" />
  263. <h2>Zendesk Support</h2>
  264. <p>Create a Zendesk support ticket when a check goes down.</p>
  265. <a href="{% url 'hc-add-zendesk' %}" class="btn btn-primary">Add Integration</a>
  266. </li>
  267. {% endif %}
  268. {% if enable_trello %}
  269. <li>
  270. <img src="{% static 'img/integrations/trello.png' %}"
  271. class="icon" alt="Trello icon" />
  272. <h2>Trello</h2>
  273. <p>Create a Trello card when a check goes down.</p>
  274. <a href="{% url 'hc-add-trello' %}" class="btn btn-primary">Add Integration</a>
  275. </li>
  276. {% endif %}
  277. <li class="link-to-github">
  278. <img src="{% static 'img/integrations/missing.png' %}"
  279. class="icon" alt="Suggest New Integration" />
  280. <p>
  281. Your favorite service or notification method not listed? <br />
  282. Please <a href="https://github.com/healthchecks/healthchecks/issues">file an issue on GitHub</a>!
  283. </p>
  284. </li>
  285. </ul>
  286. </div>
  287. </div>
  288. <div id="checks-modal" class="modal">
  289. <div class="modal-dialog">
  290. <div class="modal-content">
  291. </div>
  292. </div>
  293. </div>
  294. <div id="remove-channel-modal" class="modal">
  295. <div class="modal-dialog">
  296. <form id="remove-channel-form" method="post">
  297. {% csrf_token %}
  298. <div class="modal-content">
  299. <div class="modal-header">
  300. <button type="button" class="close" data-dismiss="modal">&times;</button>
  301. <h4 class="remove-check-title">
  302. Remove this
  303. <span class="remove-channel-kind">---</span>
  304. Integration?
  305. </h4>
  306. </div>
  307. <div class="modal-body">
  308. <p>You are about to remove this
  309. <span class="remove-channel-kind">---</span>
  310. integration.
  311. </p>
  312. <p>Once it's gone it's gone. But, if you change your
  313. mind later, you can create a similar channel again.
  314. Do you want to continue?</p>
  315. </div>
  316. <div class="modal-footer">
  317. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  318. <button type="submit" class="btn btn-danger">Remove</button>
  319. </div>
  320. </div>
  321. </form>
  322. </div>
  323. </div>
  324. {% for ch in channels %}
  325. {% if ch.kind == "webhook" %}
  326. <div id="channel-details-{{ ch.code }}" class="modal channel-details">
  327. <div class="modal-dialog">
  328. <div class="modal-content">
  329. <div class="modal-header">
  330. <button type="button" class="close" data-dismiss="modal">&times;</button>
  331. <h4>Integration Details</h4>
  332. </div>
  333. <div class="modal-body">
  334. <table>
  335. <tr>
  336. <th>Request Method</th>
  337. <td>
  338. {% if ch.post_data %}
  339. POST
  340. {% else %}
  341. GET
  342. {% endif %}
  343. </td>
  344. </tr>
  345. <tr>
  346. <th>URL for "down" events</th>
  347. <td>
  348. {% if ch.url_down %}
  349. <code>{{ ch.url_down }}</code>
  350. {% else %}
  351. <span class="missing">(not set)</span>
  352. {% endif %}
  353. </td>
  354. </tr>
  355. {% if ch.url_up %}
  356. <tr>
  357. <th>URL for "up" events</th>
  358. <td>
  359. {% if ch.url_up %}
  360. <code>{{ ch.url_up }}</code>
  361. {% else %}
  362. <span class="missing">(not set)</span>
  363. {% endif %}
  364. </td>
  365. </tr>
  366. {% endif %}
  367. {% if ch.post_data %}
  368. <tr>
  369. <th>POST data</th>
  370. <td><code>{{ ch.post_data }}</code></td>
  371. </tr>
  372. {% endif %}
  373. {% for k, v in ch.headers.items %}
  374. <tr>
  375. <th>Header <code>{{ k }}</code></th>
  376. <td><code>{{ v }}</code></td>
  377. </tr>
  378. {% endfor %}
  379. </table>
  380. </div>
  381. <div class="modal-footer">
  382. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  383. </div>
  384. </div>
  385. </div>
  386. </div>
  387. {% endif %}
  388. {% endfor %}
  389. {% endblock %}
  390. {% block scripts %}
  391. {% compress js %}
  392. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  393. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  394. <script src="{% static 'js/channels.js' %}"></script>
  395. {% endcompress %}
  396. {% endblock %}