From f394ee9781ff8c9564d3c6cb30fdfa81ce763774 Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Thu, 25 Apr 2019 09:29:45 -0700 Subject: [PATCH] Updated configs Trying to find a place to install heartbeat. I do not think any client devices need to run this service. --- .gitignore | 1 + .../linux/elastic/config-win-metricbeat.yml | 4 ++-- playbook/linux/elastic/config-winlogbeat.yml | 15 ++++++++++++- playbook/linux/elastic/heartbeat.j2 | 8 +++---- playbook/linux/elastic/t.yml | 15 ------------- playbook/linux/elastic/template-test.yml | 21 ------------------- playbook/linux/elastic/winlogbeat.j2 | 6 +++--- 7 files changed, 24 insertions(+), 46 deletions(-) delete mode 100644 playbook/linux/elastic/t.yml delete mode 100644 playbook/linux/elastic/template-test.yml diff --git a/.gitignore b/.gitignore index e91eb9f..899db53 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .DS_Store hosts +win_hosts diff --git a/playbook/linux/elastic/config-win-metricbeat.yml b/playbook/linux/elastic/config-win-metricbeat.yml index 54f6b0f..66328e0 100644 --- a/playbook/linux/elastic/config-win-metricbeat.yml +++ b/playbook/linux/elastic/config-win-metricbeat.yml @@ -28,7 +28,7 @@ win_service: name: metricbeat -- debug: var=service_metricbeat +#- debug: var=service_metricbeat - name: Install Metricbeat service win_command: powershell.exe -ExecutionPolicy ByPass -File install-service-metricbeat.ps1 @@ -41,7 +41,7 @@ win_service: name: metricbeat -- debug: var=service_metricbeat +#- debug: var=service_metricbeat - name: restart service win_service: diff --git a/playbook/linux/elastic/config-winlogbeat.yml b/playbook/linux/elastic/config-winlogbeat.yml index 7e5b560..0f5df35 100644 --- a/playbook/linux/elastic/config-winlogbeat.yml +++ b/playbook/linux/elastic/config-winlogbeat.yml @@ -14,7 +14,7 @@ creates: C:\temp\winlogbeat-{{ elastic_version }}\ - name: Copy winlogbeat-{{ elastic_version }} folder - win_command: powershell.exe copy-item -Path 'c:\temp\winlogbeat-{{ elastic_version }}\metricbeat-{{ elastic_version }}-windows-x86_64\' -Filter * -Recurse -Destination 'C:\Program Files\winlogbeat\' + win_command: powershell.exe copy-item -Path 'c:\temp\winlogbeat-{{ elastic_version }}\winlogbeat-{{ elastic_version }}-windows-x86_64\' -Filter * -Recurse -Destination 'C:\Program Files\winlogbeat\' args: creates: C:\Program Files\winlogbeat\ @@ -23,17 +23,30 @@ src: winlogbeat.j2 dest: C:\Program Files\winlogbeat\winlogbeat.yml +- name: check for service + register: service + win_service: + name: winlogbeat + - name: Install winlogbeat service win_command: powershell.exe -ExecutionPolicy ByPass -File install-service-winlogbeat.ps1 args: chdir: C:\program files\winlogbeat\ + when: service.exists == false + +- name: check status of service + register: service + win_service: + name: winlogbeat - name: restart service win_service: name: winlogbeat state: restarted + when: service.state == 'started' - name: start service win_service: name: winlogbeat state: started + when: service.state == 'stopped' diff --git a/playbook/linux/elastic/heartbeat.j2 b/playbook/linux/elastic/heartbeat.j2 index 22fdf7c..b5c4efa 100755 --- a/playbook/linux/elastic/heartbeat.j2 +++ b/playbook/linux/elastic/heartbeat.j2 @@ -15,7 +15,7 @@ heartbeat.config.monitors: # Directory + glob pattern to search for configuration files path: ${path.config}/monitors.d/*.yml # If enabled, heartbeat will periodically check the config.monitors path for changes - reload.enabled: false + reload.enabled: true # How often to check for changes reload.period: 5s @@ -24,10 +24,10 @@ heartbeat.monitors: - type: http # List or urls to query - urls: ["http://localhost:9200"] + urls: ["http://localhost:9200", "https://www.directorsmortgage.com", "https://www.usadirectfunding.com":] # Configure task schedule - schedule: '@every 10s' + schedule: '@every 60s' # Total test connection and data exchange timeout #timeout: 16s @@ -43,7 +43,7 @@ setup.template.settings: # The name of the shipper that publishes the network data. It can be used to group # all the transactions sent by a single shipper in the web interface. -#name: +name: {{ ansible_hostname }} # The tags of the shipper are included in their own field with each # transaction published. diff --git a/playbook/linux/elastic/t.yml b/playbook/linux/elastic/t.yml deleted file mode 100644 index c85096b..0000000 --- a/playbook/linux/elastic/t.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: update metricbeat - hosts: linux - - tasks: - - - name: define elasticsearch hosts - become: true - lineinfile: - path: /etc/metricbeat/metricbeat.yml - regexp: 'hosts: \["localhost:9200"\]' - #insertafter: 'hosts: \["localhost:9200"\]' - line: ' hosts: ["dm-nagios.local:9200"]' - state: present - backrefs: yes diff --git a/playbook/linux/elastic/template-test.yml b/playbook/linux/elastic/template-test.yml deleted file mode 100644 index 848db7c..0000000 --- a/playbook/linux/elastic/template-test.yml +++ /dev/null @@ -1,21 +0,0 @@ - - -- name: template test - hosts: elasticClients - vars: - cluster_name: 'logging-dev' - node_name: 'dev-data-01' - node_master: 'true' - node_data: 'true' - path_data: '/var/lib/elasticsearch' - path_logs: '/var/log/elasticsearch' - network_host: ansible_default_ipv4.address - http_port: '9200' - transport_host: 'localhost' - transport_port: '9300' - - tasks: - - name: generate template - template: - src: elasticsearch.j2 - dest: /tmp/elasticsearch.yml diff --git a/playbook/linux/elastic/winlogbeat.j2 b/playbook/linux/elastic/winlogbeat.j2 index 3cc7fc4..8514f47 100644 --- a/playbook/linux/elastic/winlogbeat.j2 +++ b/playbook/linux/elastic/winlogbeat.j2 @@ -50,7 +50,7 @@ setup.template.settings: # These settings control loading the sample dashboards to the Kibana index. Loading # the dashboards is disabled by default and can be enabled either by setting the # options here or by using the `setup` command. -#setup.dashboards.enabled: false +setup.dashboards.enabled: true # The URL from where to download the dashboards archive. By default this URL # has a value which is computed based on the Beat name and version. For released @@ -68,7 +68,7 @@ setup.kibana: # Scheme and port can be left out and will be set to the default (http and 5601) # In case you specify and additional path, the scheme is required: http://localhost:5601/path # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601 - #host: "localhost:5601" + host: {{ kibana_host }} # Kibana Space ID # ID of the Kibana Space into which the dashboards should be loaded. By default, @@ -95,7 +95,7 @@ setup.kibana: #-------------------------- Elasticsearch output ------------------------------ output.elasticsearch: # Array of hosts to connect to. - hosts: ["localhost:9200"] + hosts: {{ elasticsearch_hosts }} # Optional protocol and basic auth credentials. #protocol: "https"