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.

515 lines
22 KiB

6 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. {% if channels %}
  15. <table class="table channels-table">
  16. <tr>
  17. <th></th>
  18. <th class="th-name">Name, Details</th>
  19. <th class="th-checks">Assigned Checks</th>
  20. <th>Status</th>
  21. <th>Last Notification</th>
  22. <th></th>
  23. </tr>
  24. {% for ch in channels %}
  25. {% with n=ch.latest_notification %}
  26. <tr class="channel-row kind-{{ ch.kind }}">
  27. <td class="icon-cell">
  28. <img src="{% static ch.icon_path %}" class="icon" alt="{{ ch.get_kind_display }} icon" />
  29. </td>
  30. <td>
  31. <div class="edit-name" data-toggle="modal" data-target="#name-{{ ch.code }}">
  32. {% if ch.name %}
  33. {{ ch.name }}
  34. {% else %}
  35. <div class="unnamed">unnamed</div>
  36. {% endif %}
  37. <div class="channel-details-mini">
  38. {% if ch.kind == "email" %}
  39. Email to <span>{{ ch.email_value }}</span>
  40. {% if ch.email_notify_down and not ch.email_notify_up %}
  41. (down only)
  42. {% endif %}
  43. {% if ch.email_notify_up and not ch.email_notify_down %}
  44. (up only)
  45. {% endif %}
  46. {% elif ch.kind == "pd" %}
  47. PagerDuty account <span>{{ ch.pd_account }}</span>
  48. {% elif ch.kind == "po" %}
  49. Pushover ({{ ch.po_priority }} priority)
  50. {% elif ch.kind == "slack" %}
  51. Slack
  52. {% if ch.slack_team %}
  53. team <span>{{ ch.slack_team }}</span>,
  54. channel <span>{{ ch.slack_channel }}</span>
  55. {% endif %}
  56. {% elif ch.kind == "telegram" %}
  57. Telegram
  58. {% if ch.telegram_type == "group" %}
  59. chat <span>{{ ch.telegram_name }}</span>
  60. {% elif ch.telegram_type == "private" %}
  61. user <span>{{ ch.telegram_name }}</span>
  62. {% endif %}
  63. {% elif ch.kind == "sms" %}
  64. SMS to <span>{{ ch.sms_number }}</span>
  65. {% elif ch.kind == "trello" %}
  66. Trello
  67. board <span>{{ ch.trello_board_list|first }}</span>,
  68. list <span>{{ ch.trello_board_list|last }}</span>
  69. {% elif ch.kind == "matrix" %}
  70. Matrix <span>{{ ch.value }}</span>
  71. {% elif ch.kind == "whatsapp" %}
  72. WhatsApp to <span>{{ ch.sms_number }}</span>
  73. {% if ch.whatsapp_notify_down and not ch.whatsapp_notify_up %}
  74. (down only)
  75. {% endif %}
  76. {% if ch.whatsapp_notify_up and not ch.whatsapp_notify_down %}
  77. (up only)
  78. {% endif %}
  79. {% elif ch.kind == "zulip" %}
  80. Zulip
  81. {% if ch.zulip_type == "stream" %}
  82. stream <span>{{ ch.zulip_to}}</span>
  83. {% elif ch.zulip_type == "private" %}
  84. user <span>{{ ch.zulip_to}}</span>
  85. {% endif %}
  86. {% else %}
  87. {{ ch.get_kind_display }}
  88. {% endif %}
  89. </div>
  90. </div>
  91. </td>
  92. <td>
  93. <div class="edit-checks" data-url="{% url 'hc-channel-checks' ch.code %}">
  94. {{ ch.n_checks }} check{{ ch.n_checks|pluralize }}
  95. </div>
  96. </td>
  97. <td>
  98. {% if ch.kind == "email" and not ch.email_verified %}
  99. <span class="label label-default">Unconfirmed</span>
  100. {% elif ch.kind == "hipchat" or ch.kind == "pagerteam" %}
  101. Retired
  102. {% else %}
  103. Ready to deliver
  104. {% endif %}
  105. </td>
  106. <td>
  107. {% if n %}
  108. {% if n.error %}
  109. <span class="text-danger" data-toggle="tooltip" title="{{ n.error }}">
  110. <strong>Failed</strong>, {{ n.created|naturaltime }}
  111. </span>
  112. {% else %}
  113. Delivered, {{ n.created|naturaltime }}
  114. {% endif %}
  115. {% else %}
  116. Never
  117. {% endif %}
  118. {% if ch.kind == "sms" or ch.kind == "whatsapp" %}
  119. <p>Used {{ profile.sms_sent_this_month }} of {{ profile.sms_limit }} sends this month.</p>
  120. {% endif %}
  121. </td>
  122. <td class="actions">
  123. {% if ch.kind == "webhook" %}
  124. <a class="btn btn-sm btn-default" href="{% url 'hc-edit-webhook' ch.code %}">Edit</a>
  125. {% endif %}
  126. <form action="{% url 'hc-channel-test' ch.code %}" method="post">
  127. {% csrf_token %}
  128. <button class="btn btn-sm btn-default" data-toggle="tooltip"
  129. title="Send a test notification using this integration" type="submit">
  130. Test!
  131. </button>
  132. </form>
  133. <button data-kind="{{ ch.get_kind_display }}" data-url="{% url 'hc-remove-channel' ch.code %}"
  134. class="btn btn-sm btn-default channel-remove" type="button">
  135. <span class="icon-delete"></span>
  136. </button>
  137. </td>
  138. <td>
  139. </td>
  140. </tr>
  141. {% endwith %}
  142. {% endfor %}
  143. </table>
  144. {% else %}
  145. <div class="alert alert-danger">
  146. <p> The project "{{ project }}" does not have any integrations
  147. set up yet.
  148. </p>
  149. <p>With no configured integrations, {% site_name %}
  150. <strong>will not send any notifications</strong>
  151. when checks change state.
  152. </p>
  153. </div>
  154. {% endif %}
  155. <h1 class="ai-title">Add More</h1>
  156. <ul class="add-integration">
  157. <li>
  158. <img src="{% static 'img/integrations/slack.png' %}" class="icon" alt="Slack icon" />
  159. <h2>Slack</h2>
  160. <p>A messaging app for teams.</p>
  161. {% if enable_slack_btn %}
  162. <a href="{% url 'hc-add-slack-btn' project.code %}" class="btn btn-primary">Add Integration</a>
  163. {% else %}
  164. <a href="{% url 'hc-add-slack' project.code %}" class="btn btn-primary">Add Integration</a>
  165. {% endif %}
  166. </li>
  167. <li>
  168. <img src="{% static 'img/integrations/email.png' %}" class="icon" alt="Email icon" />
  169. <h2>Email</h2>
  170. <p>Get an email message when a check goes up or down.</p>
  171. <a href="{% url 'hc-add-email' project.code %}" class="btn btn-primary">Add Integration</a>
  172. </li>
  173. <li>
  174. <img src="{% static 'img/integrations/webhook.png' %}" class="icon" alt="Webhook icon" />
  175. <h2>Webhook</h2>
  176. <p>Receive a HTTP callback when a check goes down.</p>
  177. <a href="{% url 'hc-add-webhook' project.code %}" class="btn btn-primary">Add Integration</a>
  178. </li>
  179. {% if enable_apprise %}
  180. <li>
  181. <img src="{% static 'img/integrations/apprise.png' %}" class="icon" alt="Apprise icon" />
  182. <h2>Apprise</h2>
  183. <p>Receive instant push notifications using Apprise; see <a
  184. href="https://github.com/caronc/apprise#popular-notification-services">all of the supported
  185. services here</a>.</p>
  186. <a href="{% url 'hc-add-apprise' project.code %}" class="btn btn-primary">Add Integration</a>
  187. </li>
  188. {% endif %}
  189. {% if enable_discord %}
  190. <li>
  191. <img src="{% static 'img/integrations/discord.png' %}" class="icon" alt="Discord icon" />
  192. <h2>Discord</h2>
  193. <p>Cross-platform voice and text chat app designed for gamers.</p>
  194. <a href="{% url 'hc-add-discord' project.code %}" class="btn btn-primary">Add Integration</a>
  195. </li>
  196. {% endif %}
  197. {% if enable_matrix %}
  198. <li>
  199. <img src="{% static 'img/integrations/matrix.png' %}" class="icon" alt="Matrix icon" />
  200. <h2>Matrix</h2>
  201. <p>Post notifications to a Matrix room.</p>
  202. <a href="{% url 'hc-add-matrix' project.code %}" class="btn btn-primary">Add Integration</a>
  203. </li>
  204. {% endif %}
  205. <li>
  206. <img src="{% static 'img/integrations/mattermost.png' %}" class="icon" alt="Mattermost icon" />
  207. <h2>Mattermost</h2>
  208. <p>High Trust Messaging for the Enterprise.</p>
  209. <a href="{% url 'hc-add-mattermost' project.code %}" class="btn btn-primary">Add Integration</a>
  210. </li>
  211. <li>
  212. <img src="{% static 'img/integrations/msteams.png' %}" class="icon" alt="Microsoft Teams" />
  213. <h2>Microsoft Teams</h2>
  214. <p>Chat and collaboration platform for Microsoft Office 365 customers.</p>
  215. <a href="{% url 'hc-add-msteams' project.code %}" class="btn btn-primary">Add Integration</a>
  216. </li>
  217. <li>
  218. <img src="{% static 'img/integrations/opsgenie.png' %}" class="icon" alt="OpsGenie icon" />
  219. <h2>OpsGenie</h2>
  220. <p> Alerting &amp; Incident Management Solution for Dev &amp; Ops.</p>
  221. <a href="{% url 'hc-add-opsgenie' project.code %}" class="btn btn-primary">Add Integration</a>
  222. </li>
  223. <li>
  224. <img src="{% static 'img/integrations/pd.png' %}" class="icon" alt="PagerDuty icon" />
  225. <h2>PagerDuty</h2>
  226. <p>On-call scheduling, alerting, and incident tracking.</p>
  227. {% if enable_pdc %}
  228. <a href="{% url 'hc-add-pdc' project.code %}" class="btn btn-primary">Add Integration</a>
  229. {% else %}
  230. <a href="{% url 'hc-add-pd' project.code %}" class="btn btn-primary">Add Integration</a>
  231. {% endif %}
  232. </li>
  233. <li>
  234. <img src="{% static 'img/integrations/pagertree.png' %}" class="icon" alt="PagerTree icon" />
  235. <h2>PagerTree</h2>
  236. <p>Incident Management - On-Call Schedules, Alerts, &amp; Notifications</p>
  237. <a href="{% url 'hc-add-pagertree' project.code %}" class="btn btn-primary">Add Integration</a>
  238. </li>
  239. <li>
  240. <img src="{% static 'img/integrations/prometheus.png' %}" class="icon" alt="Prometheus icon" />
  241. <h2>Prometheus</h2>
  242. <p>Export check and tag status values to Prometheus.</p>
  243. <a href="{% url 'hc-add-prometheus' project.code %}" class="btn btn-primary">Add Integration</a>
  244. </li>
  245. {% if enable_pushbullet %}
  246. <li>
  247. <img src="{% static 'img/integrations/pushbullet.png' %}" class="icon" alt="Pushbullet icon" />
  248. <h2>Pushbullet</h2>
  249. <p>Pushbullet connects your devices, making them feel like one.</p>
  250. <a href="{% url 'hc-add-pushbullet' project.code %}" class="btn btn-primary">Add Integration</a>
  251. </li>
  252. {% endif %}
  253. {% if enable_pushover %}
  254. <li>
  255. <img src="{% static 'img/integrations/po.png' %}" class="icon" alt="Pushover icon" />
  256. <h2>Pushover</h2>
  257. <p>Receive instant push notifications on your phone or tablet.</p>
  258. <a href="{% url 'hc-add-pushover' project.code %}" class="btn btn-primary">Add Integration</a>
  259. </li>
  260. {% endif %}
  261. {% if enable_shell %}
  262. <li>
  263. <img src="{% static 'img/integrations/shell.png' %}" class="icon" alt="Shell icon" />
  264. <h2>Shell Command</h2>
  265. <p>Execute a local shell command when a check goes up or down.</p>
  266. <a href="{% url 'hc-add-shell' project.code %}" class="btn btn-primary">Add Integration</a>
  267. </li>
  268. {% endif %}
  269. {% if enable_sms %}
  270. <li>
  271. <img src="{% static 'img/integrations/sms.png' %}" class="icon" alt="SMS icon" />
  272. <h2>SMS</h2>
  273. <p>Get a text message to your phone when a check goes down.</p>
  274. <a href="{% url 'hc-add-sms' project.code %}" class="btn btn-primary">Add Integration</a>
  275. </li>
  276. {% endif %}
  277. {% if enable_telegram %}
  278. <li>
  279. <img src="{% static 'img/integrations/telegram.png' %}" class="icon" alt="Telegram icon" />
  280. <h2>Telegram</h2>
  281. <p>A messaging app with a focus on speed and security.</p>
  282. <a href="{% url 'hc-add-telegram' %}" class="btn btn-primary">Add Integration</a>
  283. </li>
  284. {% endif %}
  285. {% if enable_trello %}
  286. <li>
  287. <img src="{% static 'img/integrations/trello.png' %}" class="icon" alt="Trello icon" />
  288. <h2>Trello</h2>
  289. <p>Create a Trello card when a check goes down.</p>
  290. <a href="{% url 'hc-add-trello' project.code %}" class="btn btn-primary">Add Integration</a>
  291. </li>
  292. {% endif %}
  293. <li>
  294. <img src="{% static 'img/integrations/victorops.png' %}" class="icon" alt="VictorOps icon" />
  295. <h2>VictorOps</h2>
  296. <p>On-call scheduling, alerting, and incident tracking.</p>
  297. <a href="{% url 'hc-add-victorops' project.code %}" class="btn btn-primary">Add Integration</a>
  298. </li>
  299. {% if enable_whatsapp %}
  300. <li>
  301. <img src="{% static 'img/integrations/whatsapp.png' %}" class="icon" alt="WhatsApp icon" />
  302. <h2>WhatsApp</h2>
  303. <p>Get a WhatsApp message when a check goes up or down.</p>
  304. <a href="{% url 'hc-add-whatsapp' project.code %}" class="btn btn-primary">Add Integration</a>
  305. </li>
  306. {% endif %}
  307. <li>
  308. <img src="{% static 'img/integrations/zulip.png' %}" class="icon" alt="Zulip icon" />
  309. <h2>Zulip</h2>
  310. <p>Open-source group chat.</p>
  311. <a href="{% url 'hc-add-zulip' project.code %}" class="btn btn-primary">Add Integration</a>
  312. </li>
  313. <li>
  314. <img src="{% static 'img/integrations/spike.png' %}" class="icon" alt="Spike.sh icon" />
  315. <h2>Spike.sh</h2>
  316. <p>No BS Incident management with unlimited alerts and on-call schedules</p>
  317. <a href="{% url 'hc-add-spike' project.code %}" class="btn btn-primary">Add Integration</a>
  318. </li>
  319. <li class="link-to-github">
  320. <img src="{% static 'img/integrations/missing.png' %}" class="icon" alt="Suggest New Integration" />
  321. <p>
  322. Your favorite service or notification method not listed? <br />
  323. Please <a href="https://github.com/healthchecks/healthchecks/issues">file an issue on GitHub</a>!
  324. </p>
  325. </li>
  326. </ul>
  327. </div>
  328. </div>
  329. <div id="checks-modal" class="modal">
  330. <div class="modal-dialog">
  331. <div class="modal-content">
  332. </div>
  333. </div>
  334. </div>
  335. <div id="remove-channel-modal" class="modal">
  336. <div class="modal-dialog">
  337. <form id="remove-channel-form" method="post">
  338. {% csrf_token %}
  339. <div class="modal-content">
  340. <div class="modal-header">
  341. <button type="button" class="close" data-dismiss="modal">&times;</button>
  342. <h4>
  343. Remove this
  344. <span class="remove-channel-kind">---</span>
  345. Integration?
  346. </h4>
  347. </div>
  348. <div class="modal-body">
  349. <p>You are about to remove this
  350. <span class="remove-channel-kind">---</span>
  351. integration.
  352. </p>
  353. <p>Once it's gone it's gone. But, if you change your
  354. mind later, you can create a similar channel again.
  355. Do you want to continue?</p>
  356. </div>
  357. <div class="modal-footer">
  358. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  359. <button type="submit" class="btn btn-danger">Remove</button>
  360. </div>
  361. </div>
  362. </form>
  363. </div>
  364. </div>
  365. {% for ch in channels %}
  366. <div id="name-{{ ch.code }}" class="modal channel-modal">
  367. <div class="modal-dialog">
  368. <form action="{% url 'hc-channel-name' ch.code %}" class="form-horizontal" method="post">
  369. {% csrf_token %}
  370. <div class="modal-content">
  371. <div class="modal-header">
  372. <button type="button" class="close" data-dismiss="modal">&times;</button>
  373. <h4>Integration Details</h4>
  374. </div>
  375. <div class="modal-body">
  376. <div class="form-group">
  377. <label for="update-name-input" class="col-sm-2 control-label">
  378. Name
  379. </label>
  380. <div class="col-sm-10">
  381. <input name="name" type="text" maxlength="100" value="{{ ch.name }}" placeholder="{{ ch }}"
  382. class="input-name form-control" />
  383. <span class="help-block">
  384. Give this integration a human-friendly name,
  385. so you can easily recognize it later.
  386. </span>
  387. </div>
  388. </div>
  389. {% if ch.kind == "webhook" %}
  390. {% with ch.down_webhook_spec as spec %}
  391. {% if spec.url %}
  392. <p><strong>Execute on "down" events:</strong></p>
  393. <pre>{{ spec.method }} {{ spec.url }}</pre>
  394. {% if spec.body %}
  395. <p>Request Body</p>
  396. <pre>{{ spec.body }}</pre>
  397. {% endif %}
  398. {% if spec.headers %}
  399. <p>Request Headers</p>
  400. <pre>{{ spec.headers|format_headers }}</pre>
  401. {% endif %}
  402. {% endif %}
  403. {% endwith %}
  404. {% with ch.up_webhook_spec as spec %}
  405. {% if spec.url %}
  406. <p><strong>Execute on "up" events:</strong></p>
  407. <pre>{{ spec.method }} {{ spec.url }}</pre>
  408. {% if spec.body %}
  409. <p>Request Body</p>
  410. <pre>{{ spec.body }}</pre>
  411. {% endif %}
  412. {% if spec.headers %}
  413. <p>Request Headers</p>
  414. <pre>{{ spec.headers|format_headers }}</pre>
  415. {% endif %}
  416. {% endif %}
  417. {% endwith %}
  418. {% endif %}
  419. {% if ch.kind == "shell" %}
  420. {% if ch.cmd_down %}
  421. <p><strong>Execute on "down" events:</strong></p>
  422. <pre>{{ ch.cmd_down }}</pre>
  423. {% endif %}
  424. {% if ch.cmd_up %}
  425. <p><strong>Execute on "up" events:</strong></p>
  426. <pre>{{ ch.cmd_up }}</pre>
  427. {% endif %}
  428. {% endif %}
  429. </div>
  430. <div class="modal-footer">
  431. {% if ch.kind == "webhook" %}
  432. <a class="btn btn-default pull-left" href="{% url 'hc-edit-webhook' ch.code %}">Edit Webhook
  433. Parameters&hellip;</a>
  434. {% endif %}
  435. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  436. <button type="submit" class="btn btn-primary">Save</button>
  437. </div>
  438. </div>
  439. </form>
  440. </div>
  441. </div>
  442. {% endfor %}
  443. {% endblock %}
  444. {% block scripts %}
  445. {% compress js %}
  446. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  447. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  448. <script src="{% static 'js/channels.js' %}"></script>
  449. {% endcompress %}
  450. {% endblock %}