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.

515 lines
20 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. {% elif ch.kind == "mattermost" %}
  100. Mattermost
  101. {% else %}
  102. {{ ch.kind }}
  103. {% endif %}
  104. </div>
  105. </div>
  106. </td>
  107. <td>
  108. <div class="edit-checks"
  109. data-url="{% url 'hc-channel-checks' ch.code %}">
  110. {{ ch.n_checks }} check{{ ch.n_checks|pluralize }}
  111. </div>
  112. </td>
  113. <td>
  114. {% if ch.kind == "email" and not ch.email_verified %}
  115. {% if n and n.error %}
  116. <span class="label label-danger">Disabled</span>
  117. {% else %}
  118. <span class="label label-default">Unconfirmed</span>
  119. {% endif %}
  120. {% elif ch.kind == "hipchat" %}
  121. Retired
  122. {% else %}
  123. Ready to deliver
  124. {% endif %}
  125. </td>
  126. <td>
  127. {% if n %}
  128. {% if n.error %}
  129. <span class="text-danger" data-toggle="tooltip" title="{{ n.error }}">
  130. <strong>Failed</strong>, {{ n.created|naturaltime }}
  131. </span>
  132. {% else %}
  133. Delivered, {{ n.created|naturaltime }}
  134. {% endif %}
  135. {% else %}
  136. Never
  137. {% endif %}
  138. {% if ch.kind == "sms" or ch.kind == "whatsapp" %}
  139. <p>Used {{ profile.sms_sent_this_month }} of {{ profile.sms_limit }} sends this month.</p>
  140. {% endif %}
  141. </td>
  142. <td class="actions">
  143. <form action="{% url 'hc-channel-test' ch.code %}" method="post">
  144. {% csrf_token %}
  145. <button
  146. class="btn btn-sm btn-default"
  147. data-toggle="tooltip"
  148. title="Send a test notification using this integration"
  149. type="submit">
  150. Test!
  151. </button>
  152. </form>
  153. <button
  154. data-kind="{{ ch.get_kind_display }}"
  155. data-url="{% url 'hc-remove-channel' ch.code %}"
  156. class="btn btn-sm btn-default channel-remove"
  157. type="button">
  158. <span class="icon-delete"></span>
  159. </button>
  160. </td>
  161. <td>
  162. </td>
  163. </tr>
  164. {% endwith %}
  165. {% endfor %}
  166. </table>
  167. {% else %}
  168. <div class="alert alert-info">
  169. The project <strong>{{ project }}</strong> has no integrations set up yet.
  170. </div>
  171. {% endif %}
  172. <h1 class="ai-title">Add More</h1>
  173. <ul class="add-integration">
  174. <li>
  175. <img src="{% static 'img/integrations/slack.png' %}"
  176. class="icon" alt="Slack icon" />
  177. <h2>Slack</h2>
  178. <p>A messaging app for teams.</p>
  179. <a href="{% url 'hc-add-slack' %}" class="btn btn-primary">Add Integration</a>
  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' %}" 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' %}" 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' %}" 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' %}" 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' %}" 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' %}" class="btn btn-primary">Add Integration</a>
  228. </li>
  229. <li>
  230. <img src="{% static 'img/integrations/opsgenie.png' %}"
  231. class="icon" alt="OpsGenie icon" />
  232. <h2>OpsGenie</h2>
  233. <p> Alerting &amp; Incident Management Solution for Dev &amp; Ops.</p>
  234. <a href="{% url 'hc-add-opsgenie' %}" class="btn btn-primary">Add Integration</a>
  235. </li>
  236. {% if enable_pd %}
  237. <li>
  238. <img src="{% static 'img/integrations/pd.png' %}"
  239. class="icon" alt="PagerDuty icon" />
  240. <h2>PagerDuty</h2>
  241. <p>On-call scheduling, alerting, and incident tracking.</p>
  242. <a href="{% url 'hc-add-pd' %}" class="btn btn-primary">Add Integration</a>
  243. </li>
  244. {% endif %}
  245. <li>
  246. <img src="{% static 'img/integrations/pagerteam.png' %}"
  247. class="icon" alt="PagerTeam icon" />
  248. <h2>Pager Team</h2>
  249. <p>On-call rotations without limits.</p>
  250. <a href="{% url 'hc-add-pagerteam' %}" class="btn btn-primary">Add Integration</a>
  251. </li>
  252. <li>
  253. <img src="{% static 'img/integrations/pagertree.png' %}"
  254. class="icon" alt="PagerTree icon" />
  255. <h2>PagerTree</h2>
  256. <p>DevOps Incident Management - On-Call Schedules, Alerts, &amp; Notifications</p>
  257. <a href="{% url 'hc-add-pagertree' %}" class="btn btn-primary">Add Integration</a>
  258. </li>
  259. {% if enable_pushbullet %}
  260. <li>
  261. <img src="{% static 'img/integrations/pushbullet.png' %}"
  262. class="icon" alt="Pushbullet icon" />
  263. <h2>Pushbullet</h2>
  264. <p>Pushbullet connects your devices, making them feel like one.</p>
  265. <a href="{% url 'hc-add-pushbullet' %}" class="btn btn-primary">Add Integration</a>
  266. </li>
  267. {% endif %}
  268. {% if enable_pushover %}
  269. <li>
  270. <img src="{% static 'img/integrations/po.png' %}"
  271. class="icon" alt="Pushover icon" />
  272. <h2>Pushover</h2>
  273. <p>Receive instant push notifications on your phone or tablet.</p>
  274. <a href="{% url 'hc-add-pushover' %}" class="btn btn-primary">Add Integration</a>
  275. </li>
  276. {% endif %}
  277. {% if enable_sms %}
  278. <li>
  279. <img src="{% static 'img/integrations/sms.png' %}"
  280. class="icon" alt="SMS icon" />
  281. <h2>SMS {% if use_payments %}<small>(paid plans)</small>{% endif %}</h2>
  282. <p>Get a text message to your phone when a check goes down.</p>
  283. <a href="{% url 'hc-add-sms' %}" class="btn btn-primary">Add Integration</a>
  284. </li>
  285. {% endif %}
  286. {% if enable_telegram %}
  287. <li>
  288. <img src="{% static 'img/integrations/telegram.png' %}"
  289. class="icon" alt="Telegram icon" />
  290. <h2>Telegram</h2>
  291. <p>A messaging app with a focus on speed and security.</p>
  292. <a href="{% url 'hc-add-telegram' %}" class="btn btn-primary">Add Integration</a>
  293. </li>
  294. {% endif %}
  295. {% if enable_trello %}
  296. <li>
  297. <img src="{% static 'img/integrations/trello.png' %}"
  298. class="icon" alt="Trello icon" />
  299. <h2>Trello</h2>
  300. <p>Create a Trello card when a check goes down.</p>
  301. <a href="{% url 'hc-add-trello' %}" class="btn btn-primary">Add Integration</a>
  302. </li>
  303. {% endif %}
  304. <li>
  305. <img src="{% static 'img/integrations/victorops.png' %}"
  306. class="icon" alt="VictorOps icon" />
  307. <h2>VictorOps</h2>
  308. <p>On-call scheduling, alerting, and incident tracking.</p>
  309. <a href="{% url 'hc-add-victorops' %}" class="btn btn-primary">Add Integration</a>
  310. </li>
  311. {% if enable_whatsapp %}
  312. <li>
  313. <img src="{% static 'img/integrations/whatsapp.png' %}"
  314. class="icon" alt="WhatsApp icon" />
  315. <h2>WhatsApp {% if use_payments %}<small>(paid plans)</small>{% endif %}</h2>
  316. <p>Get a WhatsApp message when a check goes up or down.</p>
  317. <a href="{% url 'hc-add-whatsapp' %}" class="btn btn-primary">Add Integration</a>
  318. </li>
  319. {% endif %}
  320. <li class="link-to-github">
  321. <img src="{% static 'img/integrations/missing.png' %}"
  322. class="icon" alt="Suggest New Integration" />
  323. <p>
  324. Your favorite service or notification method not listed? <br />
  325. Please <a href="https://github.com/healthchecks/healthchecks/issues">file an issue on GitHub</a>!
  326. </p>
  327. </li>
  328. </ul>
  329. </div>
  330. </div>
  331. <div id="checks-modal" class="modal">
  332. <div class="modal-dialog">
  333. <div class="modal-content">
  334. </div>
  335. </div>
  336. </div>
  337. <div id="remove-channel-modal" class="modal">
  338. <div class="modal-dialog">
  339. <form id="remove-channel-form" method="post">
  340. {% csrf_token %}
  341. <div class="modal-content">
  342. <div class="modal-header">
  343. <button type="button" class="close" data-dismiss="modal">&times;</button>
  344. <h4>
  345. Remove this
  346. <span class="remove-channel-kind">---</span>
  347. Integration?
  348. </h4>
  349. </div>
  350. <div class="modal-body">
  351. <p>You are about to remove this
  352. <span class="remove-channel-kind">---</span>
  353. integration.
  354. </p>
  355. <p>Once it's gone it's gone. But, if you change your
  356. mind later, you can create a similar channel again.
  357. Do you want to continue?</p>
  358. </div>
  359. <div class="modal-footer">
  360. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  361. <button type="submit" class="btn btn-danger">Remove</button>
  362. </div>
  363. </div>
  364. </form>
  365. </div>
  366. </div>
  367. {% for ch in channels %}
  368. <div id="name-{{ ch.code }}" class="modal channel-modal">
  369. <div class="modal-dialog">
  370. <form
  371. action="{% url 'hc-channel-name' ch.code %}"
  372. class="form-horizontal"
  373. method="post">
  374. {% csrf_token %}
  375. <div class="modal-content">
  376. <div class="modal-header">
  377. <button type="button" class="close" data-dismiss="modal">&times;</button>
  378. <h4 class="update-timeout-title">Integration Details</h4>
  379. </div>
  380. <div class="modal-body">
  381. <div class="form-group">
  382. <label for="update-name-input" class="col-sm-2 control-label">
  383. Name
  384. </label>
  385. <div class="col-sm-10">
  386. <input
  387. name="name"
  388. type="text"
  389. maxlength="100"
  390. value="{{ ch.name }}"
  391. placeholder="{{ ch }}"
  392. class="input-name form-control" />
  393. <span class="help-block">
  394. Give this integration a human-friendly name,
  395. so you can easily recognize it later.
  396. </span>
  397. </div>
  398. </div>
  399. {% if ch.kind == "webhook" %}
  400. {% with ch.down_webhook_spec as spec %}
  401. {% if spec.url %}
  402. <p><strong>Execute on "down" events:</strong></p>
  403. <pre>{{ spec.method }} {{ spec.url }}</pre>
  404. {% if spec.body %}
  405. <p>Request Body</p>
  406. <pre>{{ spec.body }}</pre>
  407. {% endif %}
  408. {% if spec.headers %}
  409. <p>Request Headers</p>
  410. <pre>{{ spec.headers|format_headers }}</pre>
  411. {% endif %}
  412. {% endif %}
  413. {% endwith %}
  414. {% with ch.up_webhook_spec as spec %}
  415. {% if spec.url %}
  416. <p><strong>Execute on "up" events:</strong></p>
  417. <pre>{{ spec.method }} {{ spec.url }}</pre>
  418. {% if spec.body %}
  419. <p>Request Body</p>
  420. <pre>{{ spec.body }}</pre>
  421. {% endif %}
  422. {% if spec.headers %}
  423. <p>Request Headers</p>
  424. <pre>{{ spec.headers|format_headers }}</pre>
  425. {% endif %}
  426. {% endif %}
  427. {% endwith %}
  428. {% endif %}
  429. </div>
  430. <div class="modal-footer">
  431. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  432. <button type="submit" class="btn btn-primary">Save</button>
  433. </div>
  434. </div>
  435. </form>
  436. </div>
  437. </div>
  438. {% endfor %}
  439. {% endblock %}
  440. {% block scripts %}
  441. {% compress js %}
  442. <script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
  443. <script src="{% static 'js/bootstrap.min.js' %}"></script>
  444. <script src="{% static 'js/channels.js' %}"></script>
  445. {% endcompress %}
  446. {% endblock %}