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.

488 lines
19 KiB

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