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.

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