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.

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