wireguard-exporter-ds.yaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. apiVersion: monitoring.coreos.com/v1
  2. kind: PodMonitor
  3. metadata:
  4. labels:
  5. app.kubernetes.io/name: wg-exporter
  6. jobLabel: wg-exporter
  7. release: prometheus
  8. name: wg-exporter
  9. namespace: mon
  10. spec:
  11. namespaceSelector:
  12. matchNames:
  13. - mon
  14. podMetricsEndpoints:
  15. - interval: 15s
  16. port: metrics
  17. path: /metrics
  18. selector:
  19. matchLabels:
  20. app.kubernetes.io/name: wg-exporter
  21. ---
  22. apiVersion: apps/v1
  23. kind: DaemonSet
  24. metadata:
  25. labels:
  26. app.kubernetes.io/name: wg-exporter
  27. name: wg-exporter
  28. namespace: mon
  29. spec:
  30. selector:
  31. matchLabels:
  32. app.kubernetes.io/name: wg-exporter
  33. template:
  34. metadata:
  35. labels:
  36. app.kubernetes.io/name: wg-exporter
  37. namespace: mon
  38. spec:
  39. hostNetwork: true
  40. containers:
  41. - args:
  42. - -a=true
  43. - -p=9586
  44. - -v=false
  45. - -d=true
  46. image: mindflavor/prometheus-wireguard-exporter
  47. name: wg-exporter
  48. ports:
  49. - containerPort: 9586
  50. name: metrics
  51. protocol: TCP
  52. securityContext:
  53. capabilities:
  54. add: ["NET_ADMIN", "SYS_MODULE"]
  55. privileged: true
  56. terminationMessagePath: /dev/termination-log
  57. terminationMessagePolicy: File
  58. volumeMounts:
  59. - name: wireguard
  60. mountPath: /var/run/wireguard
  61. volumes:
  62. - name: wireguard
  63. hostPath:
  64. path: /var/run/wireguard
  65. tolerations:
  66. - effect: NoSchedule
  67. operator: Exists
  68. ---
  69. apiVersion: v1
  70. kind: ConfigMap
  71. metadata:
  72. name: grafana-wireguard
  73. namespace: mon
  74. labels:
  75. grafana_dashboard: "1"
  76. data:
  77. elastic.json: |
  78. {
  79. "__inputs": [
  80. {
  81. "name": "DS_PROMETHEUS",
  82. "label": "Prometheus",
  83. "description": "",
  84. "type": "datasource",
  85. "pluginId": "prometheus",
  86. "pluginName": "Prometheus"
  87. }
  88. ],
  89. "__requires": [
  90. {
  91. "type": "grafana",
  92. "id": "grafana",
  93. "name": "Grafana",
  94. "version": "7.0.5"
  95. },
  96. {
  97. "type": "panel",
  98. "id": "graph",
  99. "name": "Graph",
  100. "version": ""
  101. },
  102. {
  103. "type": "datasource",
  104. "id": "prometheus",
  105. "name": "Prometheus",
  106. "version": "1.0.0"
  107. },
  108. {
  109. "type": "panel",
  110. "id": "table-old",
  111. "name": "Table (old)",
  112. "version": ""
  113. }
  114. ],
  115. "annotations": {
  116. "list": [
  117. {
  118. "builtIn": 1,
  119. "datasource": "-- Grafana --",
  120. "enable": true,
  121. "hide": true,
  122. "iconColor": "rgba(0, 211, 255, 1)",
  123. "name": "Annotations & Alerts",
  124. "type": "dashboard"
  125. }
  126. ]
  127. },
  128. "editable": true,
  129. "gnetId": null,
  130. "graphTooltip": 0,
  131. "id": null,
  132. "iteration": 1602541218129,
  133. "links": [],
  134. "panels": [
  135. {
  136. "cacheTimeout": null,
  137. "columns": [
  138. {
  139. "$$hashKey": "object:197",
  140. "text": "Current",
  141. "value": "current"
  142. }
  143. ],
  144. "datasource": "${DS_PROMETHEUS}",
  145. "description": "",
  146. "fieldConfig": {
  147. "defaults": {
  148. "custom": {}
  149. },
  150. "overrides": []
  151. },
  152. "fontSize": "100%",
  153. "gridPos": {
  154. "h": 16,
  155. "w": 7,
  156. "x": 0,
  157. "y": 0
  158. },
  159. "id": 7,
  160. "links": [],
  161. "pageSize": null,
  162. "pluginVersion": "6.2.1",
  163. "scroll": true,
  164. "showHeader": true,
  165. "sort": {
  166. "col": 1,
  167. "desc": false
  168. },
  169. "styles": [
  170. {
  171. "$$hashKey": "object:340",
  172. "alias": "",
  173. "align": "auto",
  174. "colorMode": "row",
  175. "colors": [
  176. "rgba(50, 172, 45, 0.97)",
  177. "rgba(237, 129, 40, 0.89)",
  178. "rgba(245, 54, 54, 0.9)"
  179. ],
  180. "dateFormat": "YYYY-MM-DD HH:mm:ss",
  181. "decimals": 0,
  182. "mappingType": 1,
  183. "pattern": "Current",
  184. "thresholds": [
  185. "600",
  186. "3600"
  187. ],
  188. "type": "number",
  189. "unit": "s"
  190. }
  191. ],
  192. "targets": [
  193. {
  194. "expr": "time() - wireguard_latest_handshake_seconds{node=\"$node\"}",
  195. "format": "time_series",
  196. "interval": "",
  197. "intervalFactor": 1,
  198. "legendFormat": "{{allowed_ips}} ({{friendly_name}})",
  199. "refId": "A"
  200. }
  201. ],
  202. "timeFrom": null,
  203. "timeShift": null,
  204. "title": "Latest Handshake",
  205. "transform": "timeseries_aggregations",
  206. "type": "table-old"
  207. },
  208. {
  209. "aliasColors": {
  210. "sent 10.70.0.2": "green"
  211. },
  212. "bars": false,
  213. "dashLength": 10,
  214. "dashes": false,
  215. "datasource": "${DS_PROMETHEUS}",
  216. "fieldConfig": {
  217. "defaults": {
  218. "custom": {}
  219. },
  220. "overrides": []
  221. },
  222. "fill": 1,
  223. "fillGradient": 0,
  224. "gridPos": {
  225. "h": 8,
  226. "w": 17,
  227. "x": 7,
  228. "y": 0
  229. },
  230. "hiddenSeries": false,
  231. "id": 8,
  232. "legend": {
  233. "alignAsTable": false,
  234. "avg": true,
  235. "current": false,
  236. "hideEmpty": true,
  237. "hideZero": true,
  238. "max": true,
  239. "min": true,
  240. "rightSide": true,
  241. "show": true,
  242. "total": false,
  243. "values": true
  244. },
  245. "lines": true,
  246. "linewidth": 1,
  247. "links": [],
  248. "nullPointMode": "null",
  249. "options": {
  250. "dataLinks": []
  251. },
  252. "percentage": false,
  253. "pointradius": 2,
  254. "points": false,
  255. "renderer": "flot",
  256. "seriesOverrides": [],
  257. "spaceLength": 10,
  258. "stack": false,
  259. "steppedLine": false,
  260. "targets": [
  261. {
  262. "expr": "irate(wireguard_sent_bytes_total{node=\"$node\"}[5m])",
  263. "format": "time_series",
  264. "instant": false,
  265. "interval": "",
  266. "intervalFactor": 1,
  267. "legendFormat": "{{allowed_ips}} ({{friendly_name}})",
  268. "refId": "A"
  269. }
  270. ],
  271. "thresholds": [],
  272. "timeFrom": null,
  273. "timeRegions": [],
  274. "timeShift": null,
  275. "title": "Sent Bytes",
  276. "tooltip": {
  277. "shared": true,
  278. "sort": 0,
  279. "value_type": "individual"
  280. },
  281. "type": "graph",
  282. "xaxis": {
  283. "buckets": null,
  284. "mode": "time",
  285. "name": null,
  286. "show": true,
  287. "values": []
  288. },
  289. "yaxes": [
  290. {
  291. "$$hashKey": "object:975",
  292. "format": "Bps",
  293. "label": null,
  294. "logBase": 1,
  295. "max": null,
  296. "min": null,
  297. "show": true
  298. },
  299. {
  300. "$$hashKey": "object:976",
  301. "format": "short",
  302. "label": null,
  303. "logBase": 1,
  304. "max": null,
  305. "min": null,
  306. "show": true
  307. }
  308. ],
  309. "yaxis": {
  310. "align": false,
  311. "alignLevel": null
  312. }
  313. },
  314. {
  315. "aliasColors": {
  316. "sent 10.70.0.2": "green"
  317. },
  318. "bars": false,
  319. "dashLength": 10,
  320. "dashes": false,
  321. "datasource": "${DS_PROMETHEUS}",
  322. "fieldConfig": {
  323. "defaults": {
  324. "custom": {}
  325. },
  326. "overrides": []
  327. },
  328. "fill": 1,
  329. "fillGradient": 0,
  330. "gridPos": {
  331. "h": 8,
  332. "w": 17,
  333. "x": 7,
  334. "y": 8
  335. },
  336. "hiddenSeries": false,
  337. "id": 4,
  338. "legend": {
  339. "alignAsTable": false,
  340. "avg": true,
  341. "current": false,
  342. "hideEmpty": true,
  343. "hideZero": true,
  344. "max": true,
  345. "min": true,
  346. "rightSide": true,
  347. "show": true,
  348. "total": false,
  349. "values": true
  350. },
  351. "lines": true,
  352. "linewidth": 1,
  353. "links": [],
  354. "nullPointMode": "null",
  355. "options": {
  356. "dataLinks": []
  357. },
  358. "percentage": false,
  359. "pointradius": 2,
  360. "points": false,
  361. "renderer": "flot",
  362. "seriesOverrides": [],
  363. "spaceLength": 10,
  364. "stack": false,
  365. "steppedLine": false,
  366. "targets": [
  367. {
  368. "expr": "irate(wireguard_received_bytes_total{node=\"$node\"}[5m])",
  369. "format": "time_series",
  370. "instant": false,
  371. "interval": "",
  372. "intervalFactor": 1,
  373. "legendFormat": "{{allowed_ips}} ({{friendly_name}})",
  374. "refId": "A"
  375. }
  376. ],
  377. "thresholds": [],
  378. "timeFrom": null,
  379. "timeRegions": [],
  380. "timeShift": null,
  381. "title": "Received Bytes",
  382. "tooltip": {
  383. "shared": true,
  384. "sort": 0,
  385. "value_type": "individual"
  386. },
  387. "type": "graph",
  388. "xaxis": {
  389. "buckets": null,
  390. "mode": "time",
  391. "name": null,
  392. "show": true,
  393. "values": []
  394. },
  395. "yaxes": [
  396. {
  397. "$$hashKey": "object:975",
  398. "format": "Bps",
  399. "label": null,
  400. "logBase": 1,
  401. "max": null,
  402. "min": null,
  403. "show": true
  404. },
  405. {
  406. "$$hashKey": "object:976",
  407. "format": "short",
  408. "label": null,
  409. "logBase": 1,
  410. "max": null,
  411. "min": null,
  412. "show": true
  413. }
  414. ],
  415. "yaxis": {
  416. "align": false,
  417. "alignLevel": null
  418. }
  419. }
  420. ],
  421. "refresh": "30s",
  422. "schemaVersion": 25,
  423. "style": "dark",
  424. "tags": [
  425. "prometheus",
  426. "wireguard",
  427. "network"
  428. ],
  429. "templating": {
  430. "list": [
  431. {
  432. "allValue": null,
  433. "current": {},
  434. "datasource": "${DS_PROMETHEUS}",
  435. "definition": "label_values(wireguard_latest_handshake_seconds{job=\"wireguard-exporter\"}, node)",
  436. "hide": 0,
  437. "includeAll": false,
  438. "label": "Node:",
  439. "multi": false,
  440. "name": "node",
  441. "options": [],
  442. "query": "label_values(wireguard_latest_handshake_seconds{job=\"wireguard-exporter\"}, node)",
  443. "refresh": 1,
  444. "regex": "",
  445. "skipUrlSync": false,
  446. "sort": 0,
  447. "tagValuesQuery": "",
  448. "tags": [],
  449. "tagsQuery": "",
  450. "type": "query",
  451. "useTags": false
  452. }
  453. ]
  454. },
  455. "time": {
  456. "from": "now-30m",
  457. "to": "now"
  458. },
  459. "timepicker": {
  460. "refresh_intervals": [
  461. "10s",
  462. "30s",
  463. "1m",
  464. "5m",
  465. "15m",
  466. "30m",
  467. "1h",
  468. "2h",
  469. "1d"
  470. ],
  471. "time_options": [
  472. "5m",
  473. "15m",
  474. "1h",
  475. "6h",
  476. "12h",
  477. "24h",
  478. "2d",
  479. "7d",
  480. "30d"
  481. ]
  482. },
  483. "timezone": "",
  484. "title": "WireGuard",
  485. "uid": "c0T_8RkZz",
  486. "version": 37
  487. }