You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metron.apache.org by nickwallen <gi...@git.apache.org> on 2017/11/09 19:19:31 UTC
[GitHub] metron pull request #839: METRON-1311 Service Check Should Check Elasticsear...
GitHub user nickwallen opened a pull request:
https://github.com/apache/metron/pull/839
METRON-1311 Service Check Should Check Elasticsearch Index Templates
The Service Check in Ambari does not validate that the Elasticsearch index templates have been installed. Without these index templates bad things can happen. For example, the Alerts UI will not be able to display any alerts. With this PR, the Elasticsearch index templates that are installed by Ambari are checked as part of the Metron Service Check.
## Testing
1. Launch a Metron environment like Full Dev
1. Run the Metron Service Check and ensure that it succeeds.
1. Click on Metron > Metron Indexing > Delete Elasticsearch Templates
1. Run the Metron Service Check and ensure that it fails with an error like the following.
```
Missing Elasticsearch index template: name=yaf_index
```
1. Click on Metron > Metron Indexing > Install Elasticsearch Templates.
1. Run the Metron Service Check and ensure that it succeeds.
## Pull Request Checklist
- [ ] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
- [ ] Does your PR title start with METRON-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [ ] Has your PR been rebased against the latest commit within the target branch (typically master)?
- [ ] Have you included steps to reproduce the behavior or problem that is being changed or addressed?
- [ ] Have you included steps or a guide to how the change may be verified and tested manually?
- [ ] Have you ensured that the full suite of tests and checks have been executed in the root metron folder via:
- [ ] Have you written or updated unit tests and or integration tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/nickwallen/metron METRON-1311
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/metron/pull/839.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #839
----
commit 6565b351b0a75aff87acce97afd36978bea00e93
Author: Nick Allen <ni...@nickallen.org>
Date: 2017-11-09T17:41:48Z
METRON-1310 "Template Delete" Action Deletes Search Indices
commit 621feefe2fc20cb93ea78d0acf36a26c2c9aa137
Author: Nick Allen <ni...@nickallen.org>
Date: 2017-11-09T19:13:18Z
METRON-1311 Service Check Should Check Elasticsearch Index Templates
----
---
[GitHub] metron issue #839: METRON-1311 Service Check Should Check Elasticsearch Inde...
Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on the issue:
https://github.com/apache/metron/pull/839
Thanks @anandsubbu . I resolved the merge conflicts from master.
---
[GitHub] metron issue #839: METRON-1311 Service Check Should Check Elasticsearch Inde...
Posted by anandsubbu <gi...@git.apache.org>.
Github user anandsubbu commented on the issue:
https://github.com/apache/metron/pull/839
+1 (non-binding). Validated again on full-dev. Works fine, @nickwallen !
---
[GitHub] metron issue #839: METRON-1311 Service Check Should Check Elasticsearch Inde...
Posted by anandsubbu <gi...@git.apache.org>.
Github user anandsubbu commented on the issue:
https://github.com/apache/metron/pull/839
+1 (non-binding) works fine, and a much needed fix as well ! If for some reason, we were not able to install the templates during the startup, it would be caught by the service check.
Validated this on a full dev environment. For a successful service check, I see this now:
```
2017-11-10 15:48:06,150 - Checking Elasticsearch templates for Indexing
2017-11-10 15:48:06,151 - Execute['curl -s -XGET "http://node1:9200/_template/yaf_index" | grep -o yaf_index'] {'logoutput': True, 'path': ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'], 'tries': 3, 'user': 'metron', 'try_sleep': 5}
yaf_index
yaf_index
2017-11-10 15:48:06,343 - Execute['curl -s -XGET "http://node1:9200/_template/error_index" | grep -o error_index'] {'logoutput': True, 'path': ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'], 'tries': 3, 'user': 'metron', 'try_sleep': 5}
error_index
error_index
2017-11-10 15:48:06,385 - Execute['curl -s -XGET "http://node1:9200/_template/snort_index" | grep -o snort_index'] {'logoutput': True, 'path': ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'], 'tries': 3, 'user': 'metron', 'try_sleep': 5}
snort_index
snort_index
2017-11-10 15:48:06,433 - Execute['curl -s -XGET "http://node1:9200/_template/bro_index" | grep -o bro_index'] {'logoutput': True, 'path': ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'], 'tries': 3, 'user': 'metron', 'try_sleep': 5}
bro_index
bro_index
2017-11-10 15:48:06,491 - Execute['curl -s -XGET "http://node1:9200/_template/metaalert_index" | grep -o metaalert_index'] {'logoutput': True, 'path': ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'], 'tries': 3, 'user': 'metron', 'try_sleep': 5}
metaalert_index
```
And the service check fails when I delete the ES template file.
```
Traceback (most recent call last):
File "/var/lib/ambari-agent/cache/common-services/METRON/0.4.2/package/scripts/service_check.py", line 78, in <module>
ServiceCheck().execute()
File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 280, in execute
method(env)
File "/var/lib/ambari-agent/cache/common-services/METRON/0.4.2/package/scripts/service_check.py", line 51, in service_check
indexing_cmds.service_check(env)
File "/var/lib/ambari-agent/cache/common-services/METRON/0.4.2/package/scripts/indexing_commands.py", line 264, in service_check
self.check_elasticsearch_templates()
File "/var/lib/ambari-agent/cache/common-services/METRON/0.4.2/package/scripts/indexing_commands.py", line 179, in check_elasticsearch_templates
metron_service.execute(cmd, user=self.__params.metron_user, err_msg=err_msg)
File "/var/lib/ambari-agent/cache/common-services/METRON/0.4.2/package/scripts/metron_service.py", line 257, in execute
raise Fail(err_msg)
resource_management.core.exceptions.Fail: Missing Elasticsearch index template: name=yaf_index
```
@nickwallen - I see two conflicting files for the commit. Guess this would be need to be resolved first?
---
[GitHub] metron pull request #839: METRON-1311 Service Check Should Check Elasticsear...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/metron/pull/839
---
[GitHub] metron issue #839: METRON-1311 Service Check Should Check Elasticsearch Inde...
Posted by mmiklavc <gi...@git.apache.org>.
Github user mmiklavc commented on the issue:
https://github.com/apache/metron/pull/839
+1 by inspection. Thanks @nickwallen!
---
[GitHub] metron issue #839: METRON-1311 Service Check Should Check Elasticsearch Inde...
Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on the issue:
https://github.com/apache/metron/pull/839
I ran this through another full test after merge with master. Everything looks good to me.
---