Bläddra i källkod

some fixes in iot role

Thomas Buck 3 år sedan
förälder
incheckning
6fa91085c0

+ 9
- 2
roles/iot/tasks/influx.yml Visa fil

51
     group=root
51
     group=root
52
   notify: restart telegraf
52
   notify: restart telegraf
53
 
53
 
54
+- name: Set firewall rules for InfluxDB
55
+  ufw: rule=allow port={{ item }} proto=tcp
56
+  with_items:
57
+    - 8086  # http
58
+    - 8088  # rpc
59
+  tags: ufw
60
+
54
 - name: Register new InfluxDB and Telegraf service
61
 - name: Register new InfluxDB and Telegraf service
55
-  systemd: name={{ item }} daemon_reload=yes enabled=yes
62
+  systemd: name={{ item }} daemon_reload=yes enabled=yes
56
   with_items:
63
   with_items:
57
     - influxdb
64
     - influxdb
58
     - telegraf
65
     - telegraf
59
 
66
 
60
 - name: Start new InfluxDB and Telegraf instance
67
 - name: Start new InfluxDB and Telegraf instance
61
-  service: name={{ item }} state=started
68
+  service: name={{ item }} state=started
62
   with_items:
69
   with_items:
63
     - influxdb
70
     - influxdb
64
     - telegraf
71
     - telegraf

+ 2
- 0
roles/iot/templates/etc_apache2_sites-available_grafana.j2 Visa fil

1
 <VirtualHost *:80>
1
 <VirtualHost *:80>
2
     ServerName {{ grafana_subdomain }}.{{ item.name }}
2
     ServerName {{ grafana_subdomain }}.{{ item.name }}
3
+    ServerAlias {{ grafana_subdomain }}
3
 
4
 
4
     Redirect temp / https://{{ grafana_subdomain }}.{{ item.name }}/
5
     Redirect temp / https://{{ grafana_subdomain }}.{{ item.name }}/
5
 </VirtualHost>
6
 </VirtualHost>
6
 
7
 
7
 <VirtualHost *:443>
8
 <VirtualHost *:443>
8
     ServerName {{ grafana_subdomain }}.{{ item.name }}
9
     ServerName {{ grafana_subdomain }}.{{ item.name }}
10
+    ServerAlias {{ grafana_subdomain }}
9
 
11
 
10
     SSLEngine               On
12
     SSLEngine               On
11
     DocumentRoot            "{{ item.doc_root }}"
13
     DocumentRoot            "{{ item.doc_root }}"

+ 13
- 13
roles/iot/templates/etc_telegraf_telegraf.j2 Visa fil

1402
   ## If true, collect raw CPU time metrics.
1402
   ## If true, collect raw CPU time metrics.
1403
   collect_cpu_time = false
1403
   collect_cpu_time = false
1404
   ## If true, compute and report the sum of all non-idle CPU states.
1404
   ## If true, compute and report the sum of all non-idle CPU states.
1405
-  report_active = false
1405
+  report_active = true
1406
 
1406
 
1407
 
1407
 
1408
 # Read metrics about disk usage by mount point
1408
 # Read metrics about disk usage by mount point
3017
 
3017
 
3018
 
3018
 
3019
 # # Read metrics about network interface usage
3019
 # # Read metrics about network interface usage
3020
-# [[inputs.net]]
3021
-#   ## By default, telegraf gathers stats from any up interface (excluding loopback)
3022
-#   ## Setting interfaces will tell it to gather these explicit interfaces,
3023
-#   ## regardless of status.
3024
-#   ##
3025
-#   # interfaces = ["eth0"]
3026
-#   ##
3027
-#   ## On linux systems telegraf also collects protocol stats.
3028
-#   ## Setting ignore_protocol_stats to true will skip reporting of protocol metrics.
3029
-#   ##
3030
-#   # ignore_protocol_stats = false
3031
-#   ##
3020
+[[inputs.net]]
3021
+  ## By default, telegraf gathers stats from any up interface (excluding loopback)
3022
+  ## Setting interfaces will tell it to gather these explicit interfaces,
3023
+  ## regardless of status.
3024
+  ##
3025
+  # interfaces = ["eth0"]
3026
+  ##
3027
+  ## On linux systems telegraf also collects protocol stats.
3028
+  ## Setting ignore_protocol_stats to true will skip reporting of protocol metrics.
3029
+  ##
3030
+  # ignore_protocol_stats = false
3031
+  ##
3032
 
3032
 
3033
 
3033
 
3034
 # # Collect response time of a TCP or UDP connection
3034
 # # Collect response time of a TCP or UDP connection

Laddar…
Avbryt
Spara