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.

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