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.

626 lines
24 KiB

6 years ago
6 years ago
8 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. {% elif ch.kind == "call" %}
  68. Phone call to <span>{{ ch.phone_number }}</span>
  69. {% elif ch.kind == "trello" %}
  70. Trello
  71. board <span>{{ ch.trello_board_list|first }}</span>,
  72. list <span>{{ ch.trello_board_list|last }}</span>
  73. {% elif ch.kind == "matrix" %}
  74. Matrix <span>{{ ch.value }}</span>
  75. {% elif ch.kind == "whatsapp" %}
  76. WhatsApp to <span>{{ ch.phone_number }}</span>
  77. {% if ch.whatsapp_notify_down and not ch.whatsapp_notify_up %}
  78. (down only)
  79. {% endif %}
  80. {% if ch.whatsapp_notify_up and not ch.whatsapp_notify_down %}
  81. (up only)
  82. {% endif %}
  83. {% elif ch.kind == "zulip" %}
  84. Zulip
  85. {% if ch.zulip_type == "stream" %}
  86. stream <span>{{ ch.zulip_to}}</span>
  87. {% elif ch.zulip_type == "private" %}
  88. user <span>{{ ch.zulip_to}}</span>
  89. {% endif %}
  90. {% elif ch.kind == "signal" %}
  91. Signal to <span>{{ ch.phone_number }}</span>
  92. {% if ch.signal_notify_down and not ch.signal_notify_up %}
  93. (down only)
  94. {% endif %}
  95. {% if ch.signal_notify_up and not ch.signal_notify_down %}
  96. (up only)
  97. {% endif %}
  98. {% else %}
  99. {{ ch.get_kind_display }}
  100. {% endif %}
  101. </div>
  102. </div>
  103. </td>
  104. <td>
  105. <div class="edit-checks"
  106. data-url="{% url 'hc-channel-checks' ch.code %}">
  107. {{ ch.n_checks }} check{{ ch.n_checks|pluralize }}
  108. </div>
  109. </td>
  110. <td>
  111. {% if ch.kind == "email" and not ch.email_verified %}
  112. <span class="label label-default">Unconfirmed</span>
  113. {% elif ch.kind == "hipchat" or ch.kind == "pagerteam" %}
  114. Retired
  115. {% else %}
  116. Ready to deliver
  117. {% endif %}
  118. </td>
  119. <td>
  120. {% if n %}
  121. {% if n.error %}
  122. <span class="text-danger" data-toggle="tooltip" title="{{ n.error }}">
  123. <strong>Failed</strong>, {{ n.created|naturaltime }}
  124. </span>
  125. {% else %}
  126. Delivered, {{ n.created|naturaltime }}
  127. {% endif %}
  128. {% else %}
  129. Never
  130. {% endif %}
  131. {% if ch.kind == "sms" or ch.kind == "whatsapp" %}
  132. <p>Used {{ profile.sms_sent_this_month }} of {{ profile.sms_limit }} sends this month.</p>
  133. {% endif %}
  134. {% if ch.kind == "call" %}
  135. <p>Used {{ profile.calls_sent_this_month }} of {{ profile.call_limit }} phone calls this month.</p>
  136. {% endif %}
  137. </td>
  138. <td class="actions">
  139. {% if ch.kind == "webhook" and rw %}
  140. <a class="btn btn-sm btn-default" href="{% url 'hc-edit-webhook' ch.code %}">Edit</a>
  141. {% endif %}
  142. <form action="{% url 'hc-channel-test' ch.code %}" method="post">
  143. {% csrf_token %}
  144. <button
  145. class="btn btn-sm btn-default"
  146. data-toggle="tooltip"
  147. title="Send a test notification using this integration"
  148. type="submit">
  149. Test!
  150. </button>
  151. </form>
  152. {% if rw %}
  153. <button
  154. data-kind="{{ ch.get_kind_display }}"
  155. data-url="{% url 'hc-remove-channel' ch.code %}"
  156. class="btn btn-sm btn-default channel-remove"
  157. type="button">
  158. <span class="icon-delete"></span>
  159. </button>
  160. {% endif %}
  161. </td>
  162. <td>
  163. </td>
  164. </tr>
  165. {% endwith %}
  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" 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" 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. {% if enable_pdc %}
  281. <a href="{% url 'hc-add-pdc' project.code %}" class="btn btn-primary">Add Integration</a>
  282. {% else %}
  283. <a href="{% url 'hc-add-pd' project.code %}" class="btn btn-primary">Add Integration</a>
  284. {% endif %}
  285. </li>
  286. {% endif %}
  287. {% if enable_pagertree %}
  288. <li>
  289. <img src="{% static 'img/integrations/pagertree.png' %}"
  290. class="icon" alt="PagerTree icon" />
  291. <h2>PagerTree</h2>
  292. <p>DevOps Incident Management - On-Call Schedules, Alerts, &amp; Notifications.</p>
  293. <a href="{% url 'hc-add-pagertree' project.code %}" class="btn btn-primary">Add Integration</a>
  294. </li>
  295. {% endif %}
  296. {% if enable_call %}
  297. <li>
  298. <img src="{% static 'img/integrations/call.png' %}"
  299. class="icon" alt="Phone icon" />
  300. <h2>Phone Call</h2>
  301. <p>Get a phone call when a check goes down.</p>
  302. <a href="{% url 'hc-add-call' project.code %}" class="btn btn-primary">Add Integration</a>
  303. </li>
  304. {% endif %}
  305. {% if enable_prometheus %}
  306. <li>
  307. <img src="{% static 'img/integrations/prometheus.png' %}"
  308. class="icon" alt="Prometheus icon" />
  309. <h2>Prometheus</h2>
  310. <p>Export check and tag status values to Prometheus.</p>
  311. <a href="{% url 'hc-add-prometheus' project.code %}" class="btn btn-primary">Add Integration</a>
  312. </li>
  313. {% endif %}
  314. {% if enable_pushbullet %}
  315. <li>
  316. <img src="{% static 'img/integrations/pushbullet.png' %}"
  317. class="icon" alt="Pushbullet icon" />
  318. <h2>Pushbullet</h2>
  319. <p>Pushbullet connects your devices, making them feel like one.</p>
  320. <a href="{% url 'hc-add-pushbullet' project.code %}" class="btn btn-primary">Add Integration</a>
  321. </li>
  322. {% endif %}
  323. {% if enable_pushover %}
  324. <li>
  325. <img src="{% static 'img/integrations/po.png' %}"
  326. class="icon" alt="Pushover icon" />
  327. <h2>Pushover</h2>
  328. <p>Receive instant push notifications on your phone or tablet.</p>
  329. <a href="{% url 'hc-add-pushover' project.code %}" class="btn btn-primary">Add Integration</a>
  330. </li>
  331. {% endif %}
  332. {% if enable_shell %}
  333. <li>
  334. <img src="{% static 'img/integrations/shell.png' %}"
  335. class="icon" alt="Shell icon" />
  336. <h2>Shell Command</h2>
  337. <p>Execute a local shell command when a check goes up or down.</p>
  338. <a href="{% url 'hc-add-shell' project.code %}" class="btn btn-primary">Add Integration</a>
  339. </li>
  340. {% endif %}
  341. {% if enable_signal %}
  342. <li>
  343. <img src="{% static 'img/integrations/signal.png' %}"
  344. class="icon" alt="Signal icon" />
  345. <h2>Signal</h2>
  346. <p>Get a Signal message when a check goes up or down.</p>
  347. <a href="{% url 'hc-add-signal' project.code %}" class="btn btn-primary">Add Integration</a>
  348. </li>
  349. {% endif %}
  350. {% if enable_sms %}
  351. <li>
  352. <img src="{% static 'img/integrations/sms.png' %}"
  353. class="icon" alt="SMS icon" />
  354. <h2>SMS</h2>
  355. <p>Get a text message to your phone when a check goes down.</p>
  356. <a href="{% url 'hc-add-sms' project.code %}" class="btn btn-primary">Add Integration</a>
  357. </li>
  358. {% endif %}
  359. {% if enable_spike %}
  360. <li>
  361. <img src="{% static 'img/integrations/spike.png' %}" class="icon" alt="Spike.sh icon" />
  362. <h2>Spike.sh</h2>
  363. <p>Incident management with unlimited alerts and on-call schedules.</p>
  364. <a href="{% url 'hc-add-spike' project.code %}" class="btn btn-primary">Add Integration</a>
  365. </li>
  366. {% endif %}
  367. {% if enable_telegram %}
  368. <li>
  369. <img src="{% static 'img/integrations/telegram.png' %}"
  370. class="icon" alt="Telegram icon" />
  371. <h2>Telegram</h2>
  372. <p>A messaging app with a focus on speed and security.</p>
  373. <a href="{% url 'hc-add-telegram' %}" class="btn btn-primary">Add Integration</a>
  374. </li>
  375. {% endif %}
  376. {% if enable_trello %}
  377. <li>
  378. <img src="{% static 'img/integrations/trello.png' %}"
  379. class="icon" alt="Trello icon" />
  380. <h2>Trello</h2>
  381. <p>Create a Trello card when a check goes down.</p>
  382. <a href="{% url 'hc-add-trello' project.code %}" class="btn btn-primary">Add Integration</a>
  383. </li>
  384. {% endif %}
  385. {% if enable_victorops %}
  386. <li>
  387. <img src="{% static 'img/integrations/victorops.png' %}"
  388. class="icon" alt="VictorOps icon" />
  389. <h2>VictorOps</h2>
  390. <p>On-call scheduling, alerting, and incident tracking.</p>
  391. <a href="{% url 'hc-add-victorops' project.code %}" class="btn btn-primary">Add Integration</a>
  392. </li>
  393. {% endif %}
  394. {% if enable_whatsapp %}
  395. <li>
  396. <img src="{% static 'img/integrations/whatsapp.png' %}"
  397. class="icon" alt="WhatsApp icon" />
  398. <h2>WhatsApp</h2>
  399. <p>Get a WhatsApp message when a check goes up or down.</p>
  400. <a href="{% url 'hc-add-whatsapp' project.code %}" class="btn btn-primary">Add Integration</a>
  401. </li>
  402. {% endif %}
  403. <li>
  404. <img src="{% static 'img/integrations/zulip.png' %}"
  405. class="icon" alt="Zulip icon" />
  406. <h2>Zulip</h2>
  407. <p>Open-source group chat.</p>
  408. <a href="{% url 'hc-add-zulip' project.code %}" class="btn btn-primary">Add Integration</a>
  409. </li>
  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 for="update-name-input" 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-webhook' 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 %}