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.

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