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.

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