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.

605 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. <li>
  183. <img src="{% static 'img/integrations/slack.png' %}"
  184. class="icon" alt="Slack icon" />
  185. <h2>Slack</h2>
  186. <p>A messaging app for teams.</p>
  187. {% if enable_slack_btn %}
  188. <a href="{% url 'hc-add-slack-btn' project.code %}" class="btn btn-primary">Add Integration</a>
  189. {% else %}
  190. <a href="{% url 'hc-add-slack' project.code %}" class="btn btn-primary">Add Integration</a>
  191. {% endif %}
  192. </li>
  193. <li>
  194. <img src="{% static 'img/integrations/email.png' %}"
  195. class="icon" alt="Email icon" />
  196. <h2>Email</h2>
  197. <p>Get an email message when a check goes up or down.</p>
  198. <a href="{% url 'hc-add-email' project.code %}" class="btn btn-primary">Add Integration</a>
  199. </li>
  200. <li>
  201. <img src="{% static 'img/integrations/webhook.png' %}"
  202. class="icon" alt="Webhook icon" />
  203. <h2>Webhook</h2>
  204. <p>Receive an HTTP callback when a check goes down.</p>
  205. <a href="{% url 'hc-add-webhook' project.code %}" class="btn btn-primary">Add Integration</a>
  206. </li>
  207. {% if enable_apprise %}
  208. <li>
  209. <img src="{% static 'img/integrations/apprise.png' %}"
  210. class="icon" alt="Apprise icon" />
  211. <h2>Apprise</h2>
  212. <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>
  213. <a href="{% url 'hc-add-apprise' project.code %}" class="btn btn-primary">Add Integration</a>
  214. </li>
  215. {% endif %}
  216. {% if enable_discord %}
  217. <li>
  218. <img src="{% static 'img/integrations/discord.png' %}"
  219. class="icon" alt="Discord icon" />
  220. <h2>Discord</h2>
  221. <p>Cross-platform voice and text chat app designed for gamers.</p>
  222. <a href="{% url 'hc-add-discord' project.code %}" class="btn btn-primary">Add Integration</a>
  223. </li>
  224. {% endif %}
  225. {% if enable_linenotify %}
  226. <li>
  227. <img src="{% static 'img/integrations/linenotify.png' %}"
  228. class="icon" alt="LINE Notify icon" />
  229. <h2>LINE Notify</h2>
  230. <p>Receive a notification on LINE when a check goes up or down.</p>
  231. <a href="{% url 'hc-add-linenotify' project.code %}" class="btn btn-primary">Add Integration</a>
  232. </li>
  233. {% endif %}
  234. {% if enable_matrix %}
  235. <li>
  236. <img src="{% static 'img/integrations/matrix.png' %}"
  237. class="icon" alt="Matrix icon" />
  238. <h2>Matrix</h2>
  239. <p>Post notifications to a Matrix room.</p>
  240. <a href="{% url 'hc-add-matrix' project.code %}" class="btn btn-primary">Add Integration</a>
  241. </li>
  242. {% endif %}
  243. <li>
  244. <img src="{% static 'img/integrations/mattermost.png' %}"
  245. class="icon" alt="Mattermost icon" />
  246. <h2>Mattermost</h2>
  247. <p>High Trust Messaging for the Enterprise.</p>
  248. <a href="{% url 'hc-add-mattermost' project.code %}" class="btn btn-primary">Add Integration</a>
  249. </li>
  250. <li>
  251. <img src="{% static 'img/integrations/msteams.png' %}"
  252. class="icon" alt="Microsoft Teams" />
  253. <h2>Microsoft Teams</h2>
  254. <p>Chat and collaboration platform for Microsoft Office 365 customers.</p>
  255. <a href="{% url 'hc-add-msteams' project.code %}" class="btn btn-primary">Add Integration</a>
  256. </li>
  257. <li>
  258. <img src="{% static 'img/integrations/opsgenie.png' %}"
  259. class="icon" alt="OpsGenie icon" />
  260. <h2>OpsGenie</h2>
  261. <p> Alerting &amp; Incident Management Solution for Dev &amp; Ops.</p>
  262. <a href="{% url 'hc-add-opsgenie' project.code %}" class="btn btn-primary">Add Integration</a>
  263. </li>
  264. <li>
  265. <img src="{% static 'img/integrations/pd.png' %}"
  266. class="icon" alt="PagerDuty icon" />
  267. <h2>PagerDuty</h2>
  268. <p>On-call scheduling, alerting, and incident tracking.</p>
  269. {% if enable_pdc %}
  270. <a href="{% url 'hc-add-pdc' project.code %}" class="btn btn-primary">Add Integration</a>
  271. {% else %}
  272. <a href="{% url 'hc-add-pd' project.code %}" class="btn btn-primary">Add Integration</a>
  273. {% endif %}
  274. </li>
  275. <li>
  276. <img src="{% static 'img/integrations/pagertree.png' %}"
  277. class="icon" alt="PagerTree icon" />
  278. <h2>PagerTree</h2>
  279. <p>DevOps Incident Management - On-Call Schedules, Alerts, &amp; Notifications.</p>
  280. <a href="{% url 'hc-add-pagertree' project.code %}" class="btn btn-primary">Add Integration</a>
  281. </li>
  282. {% if enable_call %}
  283. <li>
  284. <img src="{% static 'img/integrations/call.png' %}"
  285. class="icon" alt="Phone icon" />
  286. <h2>Phone Call</h2>
  287. <p>Get a phone call when a check goes down.</p>
  288. <a href="{% url 'hc-add-call' project.code %}" class="btn btn-primary">Add Integration</a>
  289. </li>
  290. {% endif %}
  291. <li>
  292. <img src="{% static 'img/integrations/prometheus.png' %}"
  293. class="icon" alt="Prometheus icon" />
  294. <h2>Prometheus</h2>
  295. <p>Export check and tag status values to Prometheus.</p>
  296. <a href="{% url 'hc-add-prometheus' project.code %}" class="btn btn-primary">Add Integration</a>
  297. </li>
  298. {% if enable_pushbullet %}
  299. <li>
  300. <img src="{% static 'img/integrations/pushbullet.png' %}"
  301. class="icon" alt="Pushbullet icon" />
  302. <h2>Pushbullet</h2>
  303. <p>Pushbullet connects your devices, making them feel like one.</p>
  304. <a href="{% url 'hc-add-pushbullet' project.code %}" class="btn btn-primary">Add Integration</a>
  305. </li>
  306. {% endif %}
  307. {% if enable_pushover %}
  308. <li>
  309. <img src="{% static 'img/integrations/po.png' %}"
  310. class="icon" alt="Pushover icon" />
  311. <h2>Pushover</h2>
  312. <p>Receive instant push notifications on your phone or tablet.</p>
  313. <a href="{% url 'hc-add-pushover' project.code %}" class="btn btn-primary">Add Integration</a>
  314. </li>
  315. {% endif %}
  316. {% if enable_shell %}
  317. <li>
  318. <img src="{% static 'img/integrations/shell.png' %}"
  319. class="icon" alt="Shell icon" />
  320. <h2>Shell Command</h2>
  321. <p>Execute a local shell command when a check goes up or down.</p>
  322. <a href="{% url 'hc-add-shell' project.code %}" class="btn btn-primary">Add Integration</a>
  323. </li>
  324. {% endif %}
  325. {% if enable_signal %}
  326. <li>
  327. <img src="{% static 'img/integrations/signal.png' %}"
  328. class="icon" alt="Signal icon" />
  329. <h2>Signal</h2>
  330. <p>Get a Signal message when a check goes up or down.</p>
  331. <a href="{% url 'hc-add-signal' project.code %}" class="btn btn-primary">Add Integration</a>
  332. </li>
  333. {% endif %}
  334. {% if enable_sms %}
  335. <li>
  336. <img src="{% static 'img/integrations/sms.png' %}"
  337. class="icon" alt="SMS icon" />
  338. <h2>SMS</h2>
  339. <p>Get a text message to your phone when a check goes down.</p>
  340. <a href="{% url 'hc-add-sms' project.code %}" class="btn btn-primary">Add Integration</a>
  341. </li>
  342. {% endif %}
  343. <li>
  344. <img src="{% static 'img/integrations/spike.png' %}" class="icon" alt="Spike.sh icon" />
  345. <h2>Spike.sh</h2>
  346. <p>Incident management with unlimited alerts and on-call schedules.</p>
  347. <a href="{% url 'hc-add-spike' project.code %}" class="btn btn-primary">Add Integration</a>
  348. </li>
  349. {% if enable_telegram %}
  350. <li>
  351. <img src="{% static 'img/integrations/telegram.png' %}"
  352. class="icon" alt="Telegram icon" />
  353. <h2>Telegram</h2>
  354. <p>A messaging app with a focus on speed and security.</p>
  355. <a href="{% url 'hc-add-telegram' %}" class="btn btn-primary">Add Integration</a>
  356. </li>
  357. {% endif %}
  358. {% if enable_trello %}
  359. <li>
  360. <img src="{% static 'img/integrations/trello.png' %}"
  361. class="icon" alt="Trello icon" />
  362. <h2>Trello</h2>
  363. <p>Create a Trello card when a check goes down.</p>
  364. <a href="{% url 'hc-add-trello' project.code %}" class="btn btn-primary">Add Integration</a>
  365. </li>
  366. {% endif %}
  367. <li>
  368. <img src="{% static 'img/integrations/victorops.png' %}"
  369. class="icon" alt="VictorOps icon" />
  370. <h2>VictorOps</h2>
  371. <p>On-call scheduling, alerting, and incident tracking.</p>
  372. <a href="{% url 'hc-add-victorops' project.code %}" class="btn btn-primary">Add Integration</a>
  373. </li>
  374. {% if enable_whatsapp %}
  375. <li>
  376. <img src="{% static 'img/integrations/whatsapp.png' %}"
  377. class="icon" alt="WhatsApp icon" />
  378. <h2>WhatsApp</h2>
  379. <p>Get a WhatsApp message when a check goes up or down.</p>
  380. <a href="{% url 'hc-add-whatsapp' project.code %}" class="btn btn-primary">Add Integration</a>
  381. </li>
  382. {% endif %}
  383. <li>
  384. <img src="{% static 'img/integrations/zulip.png' %}"
  385. class="icon" alt="Zulip icon" />
  386. <h2>Zulip</h2>
  387. <p>Open-source group chat.</p>
  388. <a href="{% url 'hc-add-zulip' project.code %}" class="btn btn-primary">Add Integration</a>
  389. </li>
  390. <li class="link-to-github">
  391. <img src="{% static 'img/integrations/missing.png' %}"
  392. class="icon" alt="Suggest New Integration" />
  393. <p>
  394. Your favorite service or notification method not listed? <br />
  395. Please <a href="https://github.com/healthchecks/healthchecks/issues">file an issue on GitHub</a>!
  396. </p>
  397. </li>
  398. </ul>
  399. {% endif %}
  400. </div>
  401. </div>
  402. <div id="checks-modal" class="modal">
  403. <div class="modal-dialog">
  404. <div class="modal-content">
  405. </div>
  406. </div>
  407. </div>
  408. <div id="remove-channel-modal" class="modal">
  409. <div class="modal-dialog">
  410. <form id="remove-channel-form" method="post">
  411. {% csrf_token %}
  412. <div class="modal-content">
  413. <div class="modal-header">
  414. <button type="button" class="close" data-dismiss="modal">&times;</button>
  415. <h4>
  416. Remove this
  417. <span class="remove-channel-kind">---</span>
  418. Integration?
  419. </h4>
  420. </div>
  421. <div class="modal-body">
  422. <p>You are about to remove this
  423. <span class="remove-channel-kind">---</span>
  424. integration.
  425. </p>
  426. <p>Once it's gone it's gone. But, if you change your
  427. mind later, you can create a similar channel again.
  428. Do you want to continue?</p>
  429. </div>
  430. <div class="modal-footer">
  431. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  432. <button type="submit" class="btn btn-danger">Remove</button>
  433. </div>
  434. </div>
  435. </form>
  436. </div>
  437. </div>
  438. {% if rw %}
  439. {% for ch in channels %}
  440. <div id="name-{{ ch.code }}" class="modal channel-modal">
  441. <div class="modal-dialog">
  442. <form
  443. action="{% url 'hc-channel-name' ch.code %}"
  444. class="form-horizontal"
  445. method="post">
  446. {% csrf_token %}
  447. <div class="modal-content">
  448. <div class="modal-header">
  449. <button type="button" class="close" data-dismiss="modal">&times;</button>
  450. <h4>Integration Details</h4>
  451. </div>
  452. <div class="modal-body">
  453. <div class="form-group">
  454. <label for="update-name-input" class="col-sm-2 control-label">
  455. Name
  456. </label>
  457. <div class="col-sm-10">
  458. <input
  459. name="name"
  460. type="text"
  461. maxlength="100"
  462. value="{{ ch.name }}"
  463. placeholder="{{ ch }}"
  464. class="input-name form-control" />
  465. <span class="help-block">
  466. Give this integration a human-friendly name,
  467. so you can easily recognize it later.
  468. </span>
  469. </div>
  470. </div>
  471. {% if ch.kind == "webhook" %}
  472. {% with ch.down_webhook_spec as spec %}
  473. {% if spec.url %}
  474. <p><strong>Execute on "down" events:</strong></p>
  475. <pre>{{ spec.method }} {{ spec.url }}</pre>
  476. {% if spec.body %}
  477. <p>Request Body</p>
  478. <pre>{{ spec.body }}</pre>
  479. {% endif %}
  480. {% if spec.headers %}
  481. <p>Request Headers</p>
  482. <pre>{{ spec.headers|format_headers }}</pre>
  483. {% endif %}
  484. {% endif %}
  485. {% endwith %}
  486. {% with ch.up_webhook_spec as spec %}
  487. {% if spec.url %}
  488. <p><strong>Execute on "up" events:</strong></p>
  489. <pre>{{ spec.method }} {{ spec.url }}</pre>
  490. {% if spec.body %}
  491. <p>Request Body</p>
  492. <pre>{{ spec.body }}</pre>
  493. {% endif %}
  494. {% if spec.headers %}
  495. <p>Request Headers</p>
  496. <pre>{{ spec.headers|format_headers }}</pre>
  497. {% endif %}
  498. {% endif %}
  499. {% endwith %}
  500. {% endif %}
  501. {% if ch.kind == "shell" %}
  502. {% if ch.cmd_down %}
  503. <p><strong>Execute on "down" events:</strong></p>
  504. <pre>{{ ch.cmd_down }}</pre>
  505. {% endif %}
  506. {% if ch.cmd_up %}
  507. <p><strong>Execute on "up" events:</strong></p>
  508. <pre>{{ ch.cmd_up }}</pre>
  509. {% endif %}
  510. {% endif %}
  511. </div>
  512. <div class="modal-footer">
  513. {% if ch.kind == "webhook" %}
  514. <a class="btn btn-default pull-left" href="{% url 'hc-edit-webhook' ch.code %}">Edit Webhook Parameters&hellip;</a>
  515. {% endif %}
  516. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  517. <button type="submit" class="btn btn-primary">Save</button>
  518. </div>
  519. </div>
  520. </form>
  521. </div>
  522. </div>
  523. {% endfor %}
  524. {% endif %}
  525. {% endblock %}
  526. {% block scripts %}
  527. {% compress js %}
  528. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  529. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  530. <script src="{% static 'js/channels.js' %}"></script>
  531. {% endcompress %}
  532. {% endblock %}