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.

552 lines
22 KiB

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