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.

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