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.

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