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.

623 lines
24 KiB

6 years ago
6 years ago
4 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 {% if rw %}rw{% endif %}">
  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 %}" alt="{{ ch.get_kind_display }}" />
  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.phone_number }}</span>
  65. {% if ch.sms_notify_down and not ch.sms_notify_up %}
  66. (down only)
  67. {% endif %}
  68. {% if ch.sms_notify_up and not ch.sms_notify_down %}
  69. (up only)
  70. {% endif %}
  71. {% elif ch.kind == "call" %}
  72. Phone call to <span>{{ ch.phone_number }}</span>
  73. {% elif ch.kind == "trello" %}
  74. Trello
  75. board <span>{{ ch.trello_board_list|first }}</span>,
  76. list <span>{{ ch.trello_board_list|last }}</span>
  77. {% elif ch.kind == "matrix" %}
  78. Matrix <span>{{ ch.value }}</span>
  79. {% elif ch.kind == "whatsapp" %}
  80. WhatsApp to <span>{{ ch.phone_number }}</span>
  81. {% if ch.whatsapp_notify_down and not ch.whatsapp_notify_up %}
  82. (down only)
  83. {% endif %}
  84. {% if ch.whatsapp_notify_up and not ch.whatsapp_notify_down %}
  85. (up only)
  86. {% endif %}
  87. {% elif ch.kind == "zulip" %}
  88. Zulip
  89. {% if ch.zulip_type == "stream" %}
  90. stream <span>{{ ch.zulip_to}}</span>
  91. {% elif ch.zulip_type == "private" %}
  92. user <span>{{ ch.zulip_to}}</span>
  93. {% endif %}
  94. {% elif ch.kind == "signal" %}
  95. Signal to <span>{{ ch.phone_number }}</span>
  96. {% if ch.signal_notify_down and not ch.signal_notify_up %}
  97. (down only)
  98. {% endif %}
  99. {% if ch.signal_notify_up and not ch.signal_notify_down %}
  100. (up only)
  101. {% endif %}
  102. {% else %}
  103. {{ ch.get_kind_display }}
  104. {% endif %}
  105. </div>
  106. </div>
  107. </td>
  108. <td>
  109. <div class="edit-checks"
  110. data-url="{% url 'hc-channel-checks' ch.code %}">
  111. {{ ch.n_checks }} check{{ ch.n_checks|pluralize }}
  112. </div>
  113. </td>
  114. <td>
  115. {% if ch.kind == "email" and not ch.email_verified %}
  116. <span class="label label-default">Unconfirmed</span>
  117. {% elif ch.kind == "hipchat" or ch.kind == "pagerteam" %}
  118. Retired
  119. {% else %}
  120. Ready to deliver
  121. {% endif %}
  122. </td>
  123. <td>
  124. {% if n %}
  125. {% if n.error %}
  126. <span class="text-danger" data-toggle="tooltip" title="{{ n.error }}">
  127. <strong>Failed</strong>, {{ n.created|naturaltime }}
  128. </span>
  129. {% else %}
  130. Delivered, {{ n.created|naturaltime }}
  131. {% endif %}
  132. {% else %}
  133. Never
  134. {% endif %}
  135. {% if ch.kind == "sms" or ch.kind == "whatsapp" %}
  136. <p>Used {{ profile.sms_sent_this_month }} of {{ profile.sms_limit }} sends this month.</p>
  137. {% endif %}
  138. {% if ch.kind == "call" %}
  139. <p>Used {{ profile.calls_sent_this_month }} of {{ profile.call_limit }} phone calls this month.</p>
  140. {% endif %}
  141. </td>
  142. <td class="actions">
  143. {% if ch.is_editable and rw %}
  144. <a class="btn btn-sm btn-default" href="{% url 'hc-edit-channel' ch.code %}">Edit</a>
  145. {% endif %}
  146. <form action="{% url 'hc-channel-test' ch.code %}" method="post">
  147. {% csrf_token %}
  148. <button
  149. class="btn btn-sm btn-default"
  150. data-toggle="tooltip"
  151. title="Send a test notification using this integration"
  152. type="submit">
  153. Test!
  154. </button>
  155. </form>
  156. {% if rw %}
  157. <button
  158. data-kind="{{ ch.get_kind_display }}"
  159. data-url="{% url 'hc-remove-channel' ch.code %}"
  160. class="btn btn-sm btn-default channel-remove"
  161. type="button">
  162. <span class="ic-delete"></span>
  163. </button>
  164. {% endif %}
  165. </td>
  166. </tr>
  167. {% endwith %}
  168. {% endfor %}
  169. </table>
  170. {% else %}
  171. <div class="alert alert-danger">
  172. <p> The project "{{ project }}" does not have any integrations
  173. set up yet.
  174. </p>
  175. <p>With no configured integrations, {{ site_name }}
  176. <strong>will not send any notifications</strong>
  177. when checks change state.
  178. </p>
  179. </div>
  180. {% endif %}
  181. {% if rw %}
  182. <h1 class="ai-title">Add More</h1>
  183. <ul class="add-integration">
  184. {% if enable_slack %}
  185. <li>
  186. <img src="{% static 'img/integrations/slack.png' %}"
  187. class="icon" alt="Slack icon" />
  188. <h2>Slack</h2>
  189. <p>A messaging app for teams.</p>
  190. {% if enable_slack_btn %}
  191. <a href="{% url 'hc-add-slack-btn' project.code %}" class="btn btn-primary">Add Integration</a>
  192. {% else %}
  193. <a href="{% url 'hc-add-slack' project.code %}" class="btn btn-primary">Add Integration</a>
  194. {% endif %}
  195. </li>
  196. {% endif %}
  197. <li>
  198. <img src="{% static 'img/integrations/email.png' %}"
  199. class="icon" alt="Email icon" />
  200. <h2>Email</h2>
  201. <p>Get an email message when a check goes up or down.</p>
  202. <a href="{% url 'hc-add-email' project.code %}" class="btn btn-primary">Add Integration</a>
  203. </li>
  204. {% if enable_webhooks %}
  205. <li>
  206. <img src="{% static 'img/integrations/webhook.png' %}"
  207. class="icon" alt="Webhook icon" />
  208. <h2>Webhook</h2>
  209. <p>Receive an HTTP callback when a check goes down.</p>
  210. <a href="{% url 'hc-add-webhook' project.code %}" class="btn btn-primary">Add Integration</a>
  211. </li>
  212. {% endif %}
  213. {% if enable_apprise %}
  214. <li>
  215. <img src="{% static 'img/integrations/apprise.png' %}"
  216. class="icon" alt="Apprise icon" />
  217. <h2>Apprise</h2>
  218. <p>Receive instant push notifications using Apprise; see <a href="https://github.com/caronc/apprise#popular-notification-services" >all of the supported services here</a>.</p>
  219. <a href="{% url 'hc-add-apprise' project.code %}" class="btn btn-primary">Add Integration</a>
  220. </li>
  221. {% endif %}
  222. {% if enable_discord %}
  223. <li>
  224. <img src="{% static 'img/integrations/discord.png' %}"
  225. class="icon" alt="Discord icon" />
  226. <h2>Discord</h2>
  227. <p>Cross-platform voice and text chat app designed for gamers.</p>
  228. <a href="{% url 'hc-add-discord' project.code %}" class="btn btn-primary">Add Integration</a>
  229. </li>
  230. {% endif %}
  231. {% if enable_linenotify %}
  232. <li>
  233. <img src="{% static 'img/integrations/linenotify.png' %}"
  234. class="icon" alt="LINE Notify icon" />
  235. <h2>LINE Notify</h2>
  236. <p>Receive a notification on LINE when a check goes up or down.</p>
  237. <a href="{% url 'hc-add-linenotify' project.code %}" class="btn btn-primary">Add Integration</a>
  238. </li>
  239. {% endif %}
  240. {% if enable_matrix %}
  241. <li>
  242. <img src="{% static 'img/integrations/matrix.png' %}"
  243. class="icon matrix" alt="Matrix icon" />
  244. <h2>Matrix</h2>
  245. <p>Post notifications to a Matrix room.</p>
  246. <a href="{% url 'hc-add-matrix' project.code %}" class="btn btn-primary">Add Integration</a>
  247. </li>
  248. {% endif %}
  249. {% if enable_mattermost %}
  250. <li>
  251. <img src="{% static 'img/integrations/mattermost.png' %}"
  252. class="icon mattermost" alt="Mattermost icon" />
  253. <h2>Mattermost</h2>
  254. <p>High Trust Messaging for the Enterprise.</p>
  255. <a href="{% url 'hc-add-mattermost' project.code %}" class="btn btn-primary">Add Integration</a>
  256. </li>
  257. {% endif %}
  258. {% if enable_msteams %}
  259. <li>
  260. <img src="{% static 'img/integrations/msteams.png' %}"
  261. class="icon" alt="Microsoft Teams" />
  262. <h2>Microsoft Teams</h2>
  263. <p>Chat and collaboration platform for Microsoft Office 365 customers.</p>
  264. <a href="{% url 'hc-add-msteams' project.code %}" class="btn btn-primary">Add Integration</a>
  265. </li>
  266. {% endif %}
  267. {% if enable_opsgenie %}
  268. <li>
  269. <img src="{% static 'img/integrations/opsgenie.png' %}"
  270. class="icon" alt="Opsgenie icon" />
  271. <h2>Opsgenie</h2>
  272. <p> Alerting &amp; Incident Management Solution for Dev &amp; Ops.</p>
  273. <a href="{% url 'hc-add-opsgenie' project.code %}" class="btn btn-primary">Add Integration</a>
  274. </li>
  275. {% endif %}
  276. {% if enable_pd %}
  277. <li>
  278. <img src="{% static 'img/integrations/pd.png' %}"
  279. class="icon" alt="PagerDuty icon" />
  280. <h2>PagerDuty</h2>
  281. <p>On-call scheduling, alerting, and incident tracking.</p>
  282. <a href="{% url 'hc-add-pd' project.code %}" class="btn btn-primary">Add Integration</a>
  283. </li>
  284. {% endif %}
  285. {% if enable_pagertree %}
  286. <li>
  287. <img src="{% static 'img/integrations/pagertree.png' %}"
  288. class="icon" alt="PagerTree icon" />
  289. <h2>PagerTree</h2>
  290. <p>DevOps Incident Management - On-Call Schedules, Alerts, &amp; Notifications.</p>
  291. <a href="{% url 'hc-add-pagertree' project.code %}" class="btn btn-primary">Add Integration</a>
  292. </li>
  293. {% endif %}
  294. {% if enable_call %}
  295. <li>
  296. <img src="{% static 'img/integrations/call.png' %}"
  297. class="icon" alt="Phone icon" />
  298. <h2>Phone Call</h2>
  299. <p>Get a phone call when a check goes down.</p>
  300. <a href="{% url 'hc-add-call' project.code %}" class="btn btn-primary">Add Integration</a>
  301. </li>
  302. {% endif %}
  303. {% if enable_prometheus %}
  304. <li>
  305. <img src="{% static 'img/integrations/prometheus.png' %}"
  306. class="icon" alt="Prometheus icon" />
  307. <h2>Prometheus</h2>
  308. <p>Export check and tag status values to Prometheus.</p>
  309. <a href="{% url 'hc-add-prometheus' project.code %}" class="btn btn-primary">Add Integration</a>
  310. </li>
  311. {% endif %}
  312. {% if enable_pushbullet %}
  313. <li>
  314. <img src="{% static 'img/integrations/pushbullet.png' %}"
  315. class="icon" alt="Pushbullet icon" />
  316. <h2>Pushbullet</h2>
  317. <p>Pushbullet connects your devices, making them feel like one.</p>
  318. <a href="{% url 'hc-add-pushbullet' project.code %}" class="btn btn-primary">Add Integration</a>
  319. </li>
  320. {% endif %}
  321. {% if enable_pushover %}
  322. <li>
  323. <img src="{% static 'img/integrations/po.png' %}"
  324. class="icon" alt="Pushover icon" />
  325. <h2>Pushover</h2>
  326. <p>Receive instant push notifications on your phone or tablet.</p>
  327. <a href="{% url 'hc-add-pushover' project.code %}" class="btn btn-primary">Add Integration</a>
  328. </li>
  329. {% endif %}
  330. {% if enable_shell %}
  331. <li>
  332. <img src="{% static 'img/integrations/shell.png' %}"
  333. class="icon" alt="Shell icon" />
  334. <h2>Shell Command</h2>
  335. <p>Execute a local shell command when a check goes up or down.</p>
  336. <a href="{% url 'hc-add-shell' project.code %}" class="btn btn-primary">Add Integration</a>
  337. </li>
  338. {% endif %}
  339. {% if enable_signal %}
  340. <li>
  341. <img src="{% static 'img/integrations/signal.png' %}"
  342. class="icon" alt="Signal icon" />
  343. <h2>Signal</h2>
  344. <p>Get a Signal message when a check goes up or down.</p>
  345. <a href="{% url 'hc-add-signal' project.code %}" class="btn btn-primary">Add Integration</a>
  346. </li>
  347. {% endif %}
  348. {% if enable_sms %}
  349. <li>
  350. <img src="{% static 'img/integrations/sms.png' %}"
  351. class="icon" alt="SMS icon" />
  352. <h2>SMS</h2>
  353. <p>Get a text message to your phone when a check goes down.</p>
  354. <a href="{% url 'hc-add-sms' project.code %}" class="btn btn-primary">Add Integration</a>
  355. </li>
  356. {% endif %}
  357. {% if enable_spike %}
  358. <li>
  359. <img src="{% static 'img/integrations/spike.png' %}" class="icon" alt="Spike.sh icon" />
  360. <h2>Spike.sh</h2>
  361. <p>Incident management with unlimited alerts and on-call schedules.</p>
  362. <a href="{% url 'hc-add-spike' project.code %}" class="btn btn-primary">Add Integration</a>
  363. </li>
  364. {% endif %}
  365. {% if enable_telegram %}
  366. <li>
  367. <img src="{% static 'img/integrations/telegram.png' %}"
  368. class="icon" alt="Telegram icon" />
  369. <h2>Telegram</h2>
  370. <p>A messaging app with a focus on speed and security.</p>
  371. <a href="{% url 'hc-add-telegram' %}" class="btn btn-primary">Add Integration</a>
  372. </li>
  373. {% endif %}
  374. {% if enable_trello %}
  375. <li>
  376. <img src="{% static 'img/integrations/trello.png' %}"
  377. class="icon" alt="Trello icon" />
  378. <h2>Trello</h2>
  379. <p>Create a Trello card when a check goes down.</p>
  380. <a href="{% url 'hc-add-trello' project.code %}" class="btn btn-primary">Add Integration</a>
  381. </li>
  382. {% endif %}
  383. {% if enable_victorops %}
  384. <li>
  385. <img src="{% static 'img/integrations/victorops.png' %}"
  386. class="icon" alt="Splunk On-Call icon" />
  387. <h2>Splunk On-Call (VictorOps)</h2>
  388. <p>On-call scheduling, alerting, and incident tracking.</p>
  389. <a href="{% url 'hc-add-victorops' project.code %}" class="btn btn-primary">Add Integration</a>
  390. </li>
  391. {% endif %}
  392. {% if enable_whatsapp %}
  393. <li>
  394. <img src="{% static 'img/integrations/whatsapp.png' %}"
  395. class="icon" alt="WhatsApp icon" />
  396. <h2>WhatsApp</h2>
  397. <p>Get a WhatsApp message when a check goes up or down.</p>
  398. <a href="{% url 'hc-add-whatsapp' project.code %}" class="btn btn-primary">Add Integration</a>
  399. </li>
  400. {% endif %}
  401. {% if enable_zulip %}
  402. <li>
  403. <img src="{% static 'img/integrations/zulip.png' %}"
  404. class="icon" alt="Zulip icon" />
  405. <h2>Zulip</h2>
  406. <p>Open-source group chat.</p>
  407. <a href="{% url 'hc-add-zulip' project.code %}" class="btn btn-primary">Add Integration</a>
  408. </li>
  409. {% endif %}
  410. <li class="link-to-github">
  411. <img src="{% static 'img/integrations/missing.png' %}"
  412. class="icon" alt="Suggest New Integration" />
  413. <p>
  414. Your favorite service or notification method not listed? <br />
  415. Please <a href="https://github.com/healthchecks/healthchecks/issues">file an issue on GitHub</a>!
  416. </p>
  417. </li>
  418. </ul>
  419. {% endif %}
  420. </div>
  421. </div>
  422. <div id="checks-modal" class="modal">
  423. <div class="modal-dialog">
  424. <div class="modal-content">
  425. </div>
  426. </div>
  427. </div>
  428. <div id="remove-channel-modal" class="modal">
  429. <div class="modal-dialog">
  430. <form id="remove-channel-form" method="post">
  431. {% csrf_token %}
  432. <div class="modal-content">
  433. <div class="modal-header">
  434. <button type="button" class="close" data-dismiss="modal">&times;</button>
  435. <h4>
  436. Remove this
  437. <span class="remove-channel-kind">---</span>
  438. Integration?
  439. </h4>
  440. </div>
  441. <div class="modal-body">
  442. <p>You are about to remove this
  443. <span class="remove-channel-kind">---</span>
  444. integration.
  445. </p>
  446. <p>Once it's gone it's gone. But, if you change your
  447. mind later, you can create a similar channel again.
  448. Do you want to continue?</p>
  449. </div>
  450. <div class="modal-footer">
  451. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  452. <button type="submit" class="btn btn-danger">Remove</button>
  453. </div>
  454. </div>
  455. </form>
  456. </div>
  457. </div>
  458. {% if rw %}
  459. {% for ch in channels %}
  460. <div id="name-{{ ch.code }}" class="modal channel-modal">
  461. <div class="modal-dialog">
  462. <form
  463. action="{% url 'hc-channel-name' ch.code %}"
  464. class="form-horizontal"
  465. method="post">
  466. {% csrf_token %}
  467. <div class="modal-content">
  468. <div class="modal-header">
  469. <button type="button" class="close" data-dismiss="modal">&times;</button>
  470. <h4>Integration Details</h4>
  471. </div>
  472. <div class="modal-body">
  473. <div class="form-group">
  474. <label class="col-sm-2 control-label">
  475. Name
  476. </label>
  477. <div class="col-sm-10">
  478. <input
  479. name="name"
  480. type="text"
  481. maxlength="100"
  482. value="{{ ch.name }}"
  483. placeholder="{{ ch }}"
  484. class="input-name form-control" />
  485. <span class="help-block">
  486. Give this integration a human-friendly name,
  487. so you can easily recognize it later.
  488. </span>
  489. </div>
  490. </div>
  491. {% if ch.kind == "webhook" %}
  492. {% with ch.down_webhook_spec as spec %}
  493. {% if spec.url %}
  494. <p><strong>Execute on "down" events:</strong></p>
  495. <pre>{{ spec.method }} {{ spec.url }}</pre>
  496. {% if spec.body %}
  497. <p>Request Body</p>
  498. <pre>{{ spec.body }}</pre>
  499. {% endif %}
  500. {% if spec.headers %}
  501. <p>Request Headers</p>
  502. <pre>{{ spec.headers|format_headers }}</pre>
  503. {% endif %}
  504. {% endif %}
  505. {% endwith %}
  506. {% with ch.up_webhook_spec as spec %}
  507. {% if spec.url %}
  508. <p><strong>Execute on "up" events:</strong></p>
  509. <pre>{{ spec.method }} {{ spec.url }}</pre>
  510. {% if spec.body %}
  511. <p>Request Body</p>
  512. <pre>{{ spec.body }}</pre>
  513. {% endif %}
  514. {% if spec.headers %}
  515. <p>Request Headers</p>
  516. <pre>{{ spec.headers|format_headers }}</pre>
  517. {% endif %}
  518. {% endif %}
  519. {% endwith %}
  520. {% endif %}
  521. {% if ch.kind == "shell" %}
  522. {% if ch.cmd_down %}
  523. <p><strong>Execute on "down" events:</strong></p>
  524. <pre>{{ ch.cmd_down }}</pre>
  525. {% endif %}
  526. {% if ch.cmd_up %}
  527. <p><strong>Execute on "up" events:</strong></p>
  528. <pre>{{ ch.cmd_up }}</pre>
  529. {% endif %}
  530. {% endif %}
  531. </div>
  532. <div class="modal-footer">
  533. {% if ch.kind == "webhook" %}
  534. <a class="btn btn-default pull-left" href="{% url 'hc-edit-channel' ch.code %}">Edit Webhook Parameters&hellip;</a>
  535. {% endif %}
  536. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  537. <button type="submit" class="btn btn-primary">Save</button>
  538. </div>
  539. </div>
  540. </form>
  541. </div>
  542. </div>
  543. {% endfor %}
  544. {% endif %}
  545. {% endblock %}
  546. {% block scripts %}
  547. {% compress js %}
  548. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  549. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  550. <script src="{% static 'js/channels.js' %}"></script>
  551. {% endcompress %}
  552. {% endblock %}