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.

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