Skip to content

Commit ba83058

Browse files
committed
[node_exporter] add new module of node-exporter
1 parent faf6855 commit ba83058

File tree

12 files changed

+2439
-1610
lines changed

12 files changed

+2439
-1610
lines changed

artifacts/config.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
---
22
name: dingodb-deploy
3-
version: v0.2.0
3+
version: develop
44
artifacts:
5-
- { name: "cfg_jdk_local_path", path_in_repo: "jdk-8u171-linux-x64.tar.gz" }
6-
- { name: "cfg_system_open_file_limits_path", path_in_repo: "system/centos8/limits/limits.conf" }
7-
- { name: "cfg_dingodb_local_path", path_in_repo: "dingo.zip"}
8-
- { name: "prometheus_local_file", path_in_repo: "prometheus-2.14.0.linux-amd64.tar.gz" }
9-
- { name: "grafana_local_file", path_in_repo: "grafana-7.3.1.linux-amd64.tar.gz"}
5+
- {name: "cfg_jdk_local_path", path_in_repo: "jdk-8u171-linux-x64.tar.gz" }
6+
- {name: "cfg_system_open_file_limits_path", path_in_repo: "system/centos8/limits/limits.conf" }
7+
- {name: "cfg_dingodb_local_path", path_in_repo: "dingo.zip"}
8+
- {name: "prometheus_local_file", path_in_repo: "prometheus-2.14.0.linux-amd64.tar.gz" }
9+
- {name: "grafana_local_file", path_in_repo: "grafana-7.3.1.linux-amd64.tar.gz"}
10+
- {name: "node_exporter_local_file", path_in_repo: "node_exporter-0.18.1.linux-amd64.tar.gz"}

filter_plugins/custom_filter.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python
2+
import json
3+
4+
5+
class FilterModule(object):
6+
def filters(self):
7+
return {
8+
'cidr': self.cidr,
9+
'json_result': self.json_result,
10+
}
11+
12+
@staticmethod
13+
def cidr(ip, netmask):
14+
return ip + "/" + str(sum(bin(int(x)).count('1') for x in netmask.split('.')))
15+
16+
@staticmethod
17+
def json_result(json_str):
18+
json_result = {}
19+
try:
20+
json_result = json.loads(json_str)
21+
except json.JSONDecodeError:
22+
pass
23+
return json_result

group_vars/all/_shared.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,17 @@ blackbox_exporter_port: 19115
4343
blackbox_exporter_server: "{{ prometheus_server }}"
4444

4545
# Node Exporter
46+
install_node_exporter: true
4647
node_exporter_port: 19100
47-
node_exporter_servers: "{{ ansible_context | server_list('node_exporter') }}"
48+
node_exporter_servers: "{{ groups['node_exporter'] }}"
4849

4950
# Process Exporter
5051
process_exporter_port: 19256
51-
process_exporter_servers: "{{ ansible_context | server_list('process_exporter') }}"
52+
process_exporter_servers: "{{ groups['process_exporter'] }}"
5253

5354
# Prometheus
5455
prometheus_port: 19090
55-
prometheus_server: "{{ ansible_context | local_or_default('prometheus') }}"
56+
prometheus_server: "{{ groups['prometheus'][0] }}"
5657
prometheus_url: "http://{{ prometheus_server }}:{{ prometheus_port }}/prometheus"
5758

5859
# Pushgateway
@@ -62,5 +63,5 @@ pushgateway_server: "{{ prometheus_server }}"
6263
# Grafana
6364
install_grafana: true
6465
grafana_port: 3000
65-
grafana_server: "{{ ansible_context | local_or_default('grafana') }}"
66-
default_dashboard_uid: "RNezu0fWk"
66+
grafana_server: "{{ groups['grafana'][0] }}"
67+
default_dashboard_uid: "RNezu0fWk"

playbook.yml

+7
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,10 @@
4242
tasks:
4343
- include_role: name=grafana
4444
when: install_grafana
45+
46+
- hosts:
47+
- all_nodes
48+
tasks:
49+
- include_role: name=node_exporter
50+
when: install_node_exporter
51+

roles/grafana/tasks/main.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22

3+
- name: "Check grafana should install or Not"
4+
meta: end_play
5+
when: install_grafana == false
6+
37
- name: "Load artifacts info"
48
action: resolve_artifacts
59

@@ -155,7 +159,7 @@
155159
register: get_dashboard_result
156160

157161
- debug: var=get_dashboard_result
158-
when: get_dashboard_result.rc != 0
162+
# when: get_dashboard_result.rc != 0
159163

160164
- set_fact:
161165
dingo_dashboard_id: "{{ (get_dashboard_result.stdout | json_result )['dashboard']['id'] }}"

0 commit comments

Comments
 (0)