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.

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