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.

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