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.

631 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. {% if enable_email %}
  196. <li>
  197. <img src="{% static 'img/integrations/email.png' %}"
  198. class="icon" alt="Email icon" />
  199. <h2>Email</h2>
  200. <p>Get an email message when a check goes up or down.</p>
  201. <a href="{% url 'hc-add-email' project.code %}" class="btn btn-primary">Add Integration</a>
  202. </li>
  203. {% endif %}
  204. {% if enable_webhook %}
  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" 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" 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_pagerduty %}
  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. {% if enable_pdc %}
  283. <a href="{% url 'hc-add-pdc' project.code %}" class="btn btn-primary">Add Integration</a>
  284. {% else %}
  285. <a href="{% url 'hc-add-pd' project.code %}" class="btn btn-primary">Add Integration</a>
  286. {% endif %}
  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="VictorOps icon" />
  391. <h2>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 %}