node-metrics.yaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. ---
  2. apiVersion: v1
  3. kind: Service
  4. metadata:
  5. name: prometheus-server
  6. labels:
  7. app: prometheus-server
  8. spec:
  9. selector:
  10. app: prometheus-server
  11. clusterIP: None
  12. ports:
  13. - port: 9099
  14. targetPort: http
  15. protocol: TCP
  16. ---
  17. apiVersion: apps/v1
  18. kind: Deployment
  19. metadata:
  20. name: prometheus-server
  21. labels:
  22. app: prometheus-server
  23. spec:
  24. replicas: 1
  25. selector:
  26. matchLabels:
  27. app: prometheus-server
  28. template:
  29. metadata:
  30. labels:
  31. app: prometheus-server
  32. spec:
  33. containers:
  34. - name: prometheus
  35. image: prom/prometheus
  36. args:
  37. - "--config.file=/etc/prometheus/prometheus.yml"
  38. - "--storage.tsdb.path=/prometheus/"
  39. ports:
  40. - name: http
  41. containerPort: 9090
  42. volumeMounts:
  43. - name: prometheus-config-volume
  44. mountPath: /etc/prometheus/
  45. - name: prometheus-storage-volume
  46. mountPath: /prometheus/
  47. volumes:
  48. - name: prometheus-config-volume
  49. configMap:
  50. defaultMode: 420
  51. name: prometheus-server-conf
  52. - name: prometheus-storage-volume
  53. emptyDir: {}
  54. ---
  55. apiVersion: v1
  56. kind: ConfigMap
  57. metadata:
  58. name: prometheus-server-conf
  59. data:
  60. prometheus.yml: |-
  61. global:
  62. scrape_interval: 15s
  63. scrape_timeout: 10s
  64. evaluation_interval: 15s
  65. alerting:
  66. alertmanagers:
  67. - follow_redirects: true
  68. scheme: http
  69. timeout: 10s
  70. api_version: v2
  71. static_configs:
  72. - targets: []
  73. scrape_configs:
  74. - job_name: guardian
  75. honor_timestamps: true
  76. scrape_interval: 3s
  77. scrape_timeout: 2s
  78. metrics_path: /metrics
  79. scheme: http
  80. follow_redirects: true
  81. static_configs:
  82. - targets:
  83. - guardian:6060
  84. ---
  85. apiVersion: v1
  86. kind: Service
  87. metadata:
  88. name: grafana
  89. labels:
  90. app: grafana
  91. spec:
  92. selector:
  93. app: grafana
  94. clusterIP: None
  95. ports:
  96. - port: 3033
  97. targetPort: grafana
  98. protocol: TCP
  99. ---
  100. apiVersion: apps/v1
  101. kind: Deployment
  102. metadata:
  103. name: grafana
  104. spec:
  105. replicas: 1
  106. selector:
  107. matchLabels:
  108. app: grafana
  109. template:
  110. metadata:
  111. name: grafana
  112. labels:
  113. app: grafana
  114. spec:
  115. containers:
  116. - name: grafana
  117. image: grafana/grafana:9.0.5
  118. ports:
  119. - name: grafana
  120. containerPort: 3000
  121. volumeMounts:
  122. - mountPath: /var/lib/grafana
  123. name: grafana-storage
  124. - mountPath: /etc/grafana/provisioning/datasources
  125. name: grafana-datasources
  126. readOnly: false
  127. - mountPath: /etc/grafana
  128. name: grafana-config
  129. - mountPath: /var/lib/grafana/dashboards
  130. name: grafana-dashboards-json
  131. readOnly: false
  132. - mountPath: /etc/grafana/provisioning/dashboards
  133. name: grafana-dashboards-yaml
  134. volumes:
  135. - name: grafana-storage
  136. emptyDir: {}
  137. - name: grafana-datasources
  138. configMap:
  139. defaultMode: 420
  140. name: grafana-datasources
  141. - name: grafana-config
  142. configMap:
  143. name: grafana-config
  144. - name: grafana-dashboards-json
  145. configMap:
  146. defaultMode: 420
  147. name: grafana-dashboards-json
  148. - name: grafana-dashboards-yaml
  149. configMap:
  150. name: grafana-dashboards-yaml
  151. ---
  152. apiVersion: v1
  153. kind: ConfigMap
  154. metadata:
  155. name: grafana-datasources
  156. data:
  157. prometheus.yaml: |-
  158. {
  159. "apiVersion": 1,
  160. "datasources": [
  161. {
  162. "access":"proxy",
  163. "editable": true,
  164. "name": "prometheus",
  165. "orgId": 1,
  166. "type": "prometheus",
  167. "url": "http://prometheus-server:9090",
  168. "version": 1,
  169. "default": true
  170. }
  171. ]
  172. }
  173. ---
  174. apiVersion: v1
  175. kind: ConfigMap
  176. metadata:
  177. name: grafana-config
  178. data:
  179. grafana.ini: |
  180. ##################### Grafana Configuration Example #####################
  181. #
  182. # Everything has defaults so you only need to uncomment things you want to
  183. # change
  184. # possible values : production, development
  185. ; app_mode = production
  186. # instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty
  187. ; instance_name = ${HOSTNAME}
  188. #################################### Paths ####################################
  189. [paths]
  190. # Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
  191. #
  192. ;data = /var/lib/grafana
  193. #
  194. # Directory where grafana can store logs
  195. #
  196. ;logs = /var/log/grafana
  197. #
  198. # Directory where grafana will automatically scan and look for plugins
  199. #
  200. ;plugins = /var/lib/grafana/plugins
  201. #
  202. #################################### Server ####################################
  203. [server]
  204. # Protocol (http, https, socket)
  205. ;protocol = http
  206. # The ip address to bind to, empty will bind to all interfaces
  207. ;http_addr =
  208. # The http port to use
  209. ;http_port = 3000
  210. # The public facing domain name used to access grafana from a browser
  211. ;domain = localhost
  212. # Redirect to correct domain if host header does not match domain
  213. # Prevents DNS rebinding attacks
  214. ;enforce_domain = false
  215. # The full public facing url you use in browser, used for redirects and emails
  216. # If you use reverse proxy and sub path specify full url (with sub path)
  217. ;root_url = http://localhost:3000
  218. # Log web requests
  219. ;router_logging = false
  220. # the path relative working path
  221. ;static_root_path = public
  222. # enable gzip
  223. ;enable_gzip = false
  224. # https certs & key file
  225. ;cert_file =
  226. ;cert_key =
  227. # Unix socket path
  228. ;socket =
  229. #################################### Database ####################################
  230. [database]
  231. # You can configure the database connection by specifying type, host, name, user and password
  232. # as seperate properties or as on string using the url propertie.
  233. # Either "mysql", "postgres" or "sqlite3", it's your choice
  234. ;type = sqlite3
  235. ;host = 127.0.0.1:3306
  236. ;name = grafana
  237. ;user = root
  238. # If the password contains # or ; you have to wrap it with trippel quotes. Ex """#password;"""
  239. ;password =
  240. # Use either URL or the previous fields to configure the database
  241. # Example: mysql://user:secret@host:port/database
  242. ;url =
  243. # For "postgres" only, either "disable", "require" or "verify-full"
  244. ;ssl_mode = disable
  245. # For "sqlite3" only, path relative to data_path setting
  246. ;path = grafana.db
  247. # Max conn setting default is 0 (mean not set)
  248. ;max_idle_conn =
  249. ;max_open_conn =
  250. #################################### Session ####################################
  251. [session]
  252. # Either "memory", "file", "redis", "mysql", "postgres", default is "file"
  253. ;provider = file
  254. # Provider config options
  255. # memory: not have any config yet
  256. # file: session dir path, is relative to grafana data_path
  257. # redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=grafana`
  258. # mysql: go-sql-driver/mysql dsn config string, e.g. `user:password@tcp(127.0.0.1:3306)/database_name`
  259. # postgres: user=a password=b host=localhost port=5432 dbname=c sslmode=disable
  260. ;provider_config = sessions
  261. # Session cookie name
  262. ;cookie_name = grafana_sess
  263. # If you use session in https only, default is false
  264. ;cookie_secure = false
  265. # Session life time, default is 86400
  266. ;session_life_time = 86400
  267. #################################### Data proxy ###########################
  268. [dataproxy]
  269. # This enables data proxy logging, default is false
  270. ;logging = false
  271. #################################### Analytics ####################################
  272. [analytics]
  273. # Server reporting, sends usage counters to stats.grafana.org every 24 hours.
  274. # No ip addresses are being tracked, only simple counters to track
  275. # running instances, dashboard and error counts. It is very helpful to us.
  276. # Change this option to false to disable reporting.
  277. ;reporting_enabled = true
  278. # Set to false to disable all checks to https://grafana.net
  279. # for new vesions (grafana itself and plugins), check is used
  280. # in some UI views to notify that grafana or plugin update exists
  281. # This option does not cause any auto updates, nor send any information
  282. # only a GET request to http://grafana.com to get latest versions
  283. ;check_for_updates = true
  284. # Google Analytics universal tracking code, only enabled if you specify an id here
  285. ;google_analytics_ua_id =
  286. #################################### Security ####################################
  287. [security]
  288. # default admin user, created on startup
  289. ;admin_user = admin
  290. # default admin password, can be changed before first start of grafana, or in profile settings
  291. ;admin_password = admin
  292. # used for signing
  293. ;secret_key = SW2YcwTIb9zpOOhoPsMm
  294. # Auto-login remember days
  295. ;login_remember_days = 7
  296. ;cookie_username = grafana_user
  297. ;cookie_remember_name = grafana_remember
  298. # disable gravatar profile images
  299. ;disable_gravatar = false
  300. # data source proxy whitelist (ip_or_domain:port separated by spaces)
  301. ;data_source_proxy_whitelist =
  302. [snapshots]
  303. # snapshot sharing options
  304. ;external_enabled = true
  305. ;external_snapshot_url = https://snapshots-origin.raintank.io
  306. ;external_snapshot_name = Publish to snapshot.raintank.io
  307. # remove expired snapshot
  308. ;snapshot_remove_expired = true
  309. # remove snapshots after 90 days
  310. ;snapshot_TTL_days = 90
  311. #################################### Users ####################################
  312. [users]
  313. # disable user signup / registration
  314. ;allow_sign_up = true
  315. # Allow non admin users to create organizations
  316. ;allow_org_create = true
  317. # Set to true to automatically assign new users to the default organization (id 1)
  318. ;auto_assign_org = true
  319. # Default role new users will be automatically assigned (if disabled above is set to true)
  320. ;auto_assign_org_role = Viewer
  321. # Background text for the user field on the login page
  322. ;login_hint = email or username
  323. # Default UI theme ("dark" or "light")
  324. ;default_theme = dark
  325. [auth]
  326. # Set to true to disable (hide) the login form, useful if you use OAuth, defaults to false
  327. ;disable_login_form = false
  328. # Set to true to disable the signout link in the side menu. useful if you use auth.proxy, defaults to false
  329. ;disable_signout_menu = false
  330. #################################### Anonymous Auth ##########################
  331. [auth.anonymous]
  332. # enable anonymous access
  333. enabled = true
  334. # specify organization name that should be used for unauthenticated users
  335. ;org_name = devnet.
  336. # specify role for unauthenticated users
  337. ;org_role = Viewer
  338. #################################### Github Auth ##########################
  339. [auth.github]
  340. ;enabled = false
  341. ;allow_sign_up = true
  342. ;client_id = some_id
  343. ;client_secret = some_secret
  344. ;scopes = user:email,read:org
  345. ;auth_url = https://github.com/login/oauth/authorize
  346. ;token_url = https://github.com/login/oauth/access_token
  347. ;api_url = https://api.github.com/user
  348. ;team_ids =
  349. ;allowed_organizations =
  350. #################################### Google Auth ##########################
  351. [auth.google]
  352. ;enabled = false
  353. ;allow_sign_up = true
  354. ;client_id = some_client_id
  355. ;client_secret = some_client_secret
  356. ;scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
  357. ;auth_url = https://accounts.google.com/o/oauth2/auth
  358. ;token_url = https://accounts.google.com/o/oauth2/token
  359. ;api_url = https://www.googleapis.com/oauth2/v1/userinfo
  360. ;allowed_domains =
  361. #################################### Generic OAuth ##########################
  362. [auth.generic_oauth]
  363. ;enabled = false
  364. ;name = OAuth
  365. ;allow_sign_up = true
  366. ;client_id = some_id
  367. ;client_secret = some_secret
  368. ;scopes = user:email,read:org
  369. ;auth_url = https://foo.bar/login/oauth/authorize
  370. ;token_url = https://foo.bar/login/oauth/access_token
  371. ;api_url = https://foo.bar/user
  372. ;team_ids =
  373. ;allowed_organizations =
  374. #################################### Grafana.com Auth ####################
  375. [auth.grafana_com]
  376. ;enabled = false
  377. ;allow_sign_up = true
  378. ;client_id = some_id
  379. ;client_secret = some_secret
  380. ;scopes = user:email
  381. ;allowed_organizations =
  382. #################################### Auth Proxy ##########################
  383. [auth.proxy]
  384. ;enabled = false
  385. ;header_name = X-WEBAUTH-USER
  386. ;header_property = username
  387. ;auto_sign_up = true
  388. ;ldap_sync_ttl = 60
  389. ;whitelist = 192.168.1.1, 192.168.2.1
  390. #################################### Basic Auth ##########################
  391. [auth.basic]
  392. ;enabled = true
  393. #################################### Auth LDAP ##########################
  394. [auth.ldap]
  395. ;enabled = false
  396. ;config_file = /etc/grafana/ldap.toml
  397. ;allow_sign_up = true
  398. #################################### SMTP / Emailing ##########################
  399. [smtp]
  400. ;enabled = false
  401. ;host = localhost:25
  402. ;user =
  403. # If the password contains # or ; you have to wrap it with trippel quotes. Ex """#password;"""
  404. ;password =
  405. ;cert_file =
  406. ;key_file =
  407. ;skip_verify = false
  408. ;from_address = admin@grafana.localhost
  409. ;from_name = Grafana
  410. [emails]
  411. ;welcome_email_on_sign_up = false
  412. #################################### Logging ##########################
  413. [log]
  414. # Either "console", "file", "syslog". Default is console and file
  415. # Use space to separate multiple modes, e.g. "console file"
  416. ;mode = console file
  417. # Either "debug", "info", "warn", "error", "critical", default is "info"
  418. ;level = info
  419. # optional settings to set different levels for specific loggers. Ex filters = sqlstore:debug
  420. ;filters =
  421. # For "console" mode only
  422. [log.console]
  423. ;level =
  424. # log line format, valid options are text, console and json
  425. ;format = console
  426. # For "file" mode only
  427. [log.file]
  428. ;level =
  429. # log line format, valid options are text, console and json
  430. ;format = text
  431. # This enables automated log rotate(switch of following options), default is true
  432. ;log_rotate = true
  433. # Max line number of single file, default is 1000000
  434. ;max_lines = 1000000
  435. # Max size shift of single file, default is 28 means 1 << 28, 256MB
  436. ;max_size_shift = 28
  437. # Segment log daily, default is true
  438. ;daily_rotate = true
  439. # Expired days of log file(delete after max days), default is 7
  440. ;max_days = 7
  441. [log.syslog]
  442. ;level =
  443. # log line format, valid options are text, console and json
  444. ;format = text
  445. # Syslog network type and address. This can be udp, tcp, or unix. If left blank, the default unix endpoints will be used.
  446. ;network =
  447. ;address =
  448. # Syslog facility. user, daemon and local0 through local7 are valid.
  449. ;facility =
  450. # Syslog tag. By default, the process' argv[0] is used.
  451. ;tag =
  452. #################################### AMQP Event Publisher ##########################
  453. [event_publisher]
  454. ;enabled = false
  455. ;rabbitmq_url = amqp://localhost/
  456. ;exchange = grafana_events
  457. ;#################################### Dashboard JSON files ##########################
  458. [dashboards.json]
  459. ;enabled = false
  460. enabled = true
  461. ;path = /var/lib/grafana/dashboards
  462. #################################### Alerting ############################
  463. [alerting]
  464. # Disable alerting engine & UI features
  465. ;enabled = true
  466. # Makes it possible to turn off alert rule execution but alerting UI is visible
  467. ;execute_alerts = true
  468. #################################### Internal Grafana Metrics ##########################
  469. # Metrics available at HTTP API Url /api/metrics
  470. [metrics]
  471. # Disable / Enable internal metrics
  472. ;enabled = true
  473. # Publish interval
  474. ;interval_seconds = 10
  475. # Send internal metrics to Graphite
  476. [metrics.graphite]
  477. # Enable by setting the address setting (ex localhost:2003)
  478. ;address =
  479. ;prefix = prod.grafana.%(instance_name)s.
  480. #################################### Grafana.com integration ##########################
  481. # Url used to to import dashboards directly from Grafana.com
  482. [grafana_com]
  483. ;url = https://grafana.com
  484. #################################### External image storage ##########################
  485. [external_image_storage]
  486. # Used for uploading images to public servers so they can be included in slack/email messages.
  487. # you can choose between (s3, webdav)
  488. ;provider =
  489. [external_image_storage.s3]
  490. ;bucket_url =
  491. ;access_key =
  492. ;secret_key =
  493. [external_image_storage.webdav]
  494. ;url =
  495. ;public_url =
  496. ;username =
  497. ;password =
  498. ---
  499. apiVersion: v1
  500. kind: ConfigMap
  501. metadata:
  502. name: grafana-dashboards-yaml
  503. data:
  504. default.yaml: |-
  505. {
  506. "apiVersion": 1,
  507. "providers": [
  508. {
  509. "name": "Default",
  510. "folder": "",
  511. "type": "file",
  512. allowUiUpdates: true,
  513. "options": {
  514. "path": "/var/lib/grafana/dashboards",
  515. "foldersFromFilesStructure": true
  516. }
  517. }
  518. ]
  519. }
  520. ---