[GitHub] incubator-metron pull request: METRON-132 Monit Integration

2016-05-13 Thread cestella
Github user cestella commented on the pull request:

https://github.com/apache/incubator-metron/pull/118#issuecomment-219158724
  
+1, looks great!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request: METRON-132 Monit Integration

2016-05-12 Thread nickwallen
Github user nickwallen commented on the pull request:

https://github.com/apache/incubator-metron/pull/118#issuecomment-218927812
  
@dlyle65535 Recent commits ensure that MySQL is left running when installed 
so that the `mysql_client` role will work.  I then changed the 'start' 
functionality to first stop everything running (should only be mysql), then 
start just the defined services.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request: METRON-132 Monit Integration

2016-05-11 Thread dlyle65535
Github user dlyle65535 commented on a diff in the pull request:

https://github.com/apache/incubator-metron/pull/118#discussion_r62941086
  
--- Diff: metron-deployment/inventory/full-dev-platform/group_vars/all ---
@@ -15,21 +15,38 @@
 #  limitations under the License.
 #
 
-#Ambari variables
+# which services should be started?
+services_to_start:
+  - mysql
+  - elasticsearch
+  - pcap-service
+  - metron-ui
+  - yaf
+  - snort
+  - snort-logs
+  - bro
+  - pcap-replay
+  - yaf-parser
+  - bro-parser
+  - snort-parser
+  - enrichment
--- End diff --

Yeah, I thought that as soon as we needed to start separate services, we'd 
have to separate the inventories. Was just about to create a duplicate 
directory and decided against it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request: METRON-132 Monit Integration

2016-05-11 Thread dlyle65535
Github user dlyle65535 commented on a diff in the pull request:

https://github.com/apache/incubator-metron/pull/118#discussion_r62940190
  
--- Diff: metron-deployment/roles/monit/templates/monit/monit.conf ---
@@ -0,0 +1,29 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+
+set logfile syslog
+set pidfile /var/run/monit.pid
+
+# check services at X second intervals
+set daemon 30
+include /etc/monit.d/*
+
+# allow http access
+set httpd port 2812 and
+use address {{ ansible_host }}
--- End diff --

If you haven't already, I'd double check that the external hostname ends up 
in monit.conf. We could be advantaged by the fact that monit is listening 
everywhere regardless of what is in "use address".


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request: METRON-132 Monit Integration

2016-05-11 Thread dlyle65535
Github user dlyle65535 commented on a diff in the pull request:

https://github.com/apache/incubator-metron/pull/118#discussion_r62940002
  
--- Diff: metron-deployment/roles/elasticsearch/tasks/create-indices.yml ---
@@ -32,7 +35,6 @@
   until: result.content.find("green") != -1
   retries: 10
   delay: 60
-  run_once: yes
 
--- End diff --

Ah, got it. Yeah, that does make sense.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request: METRON-132 Monit Integration

2016-05-11 Thread nickwallen
Github user nickwallen commented on a diff in the pull request:

https://github.com/apache/incubator-metron/pull/118#discussion_r62939193
  
--- Diff: metron-deployment/roles/monit/templates/monit/monit.conf ---
@@ -0,0 +1,29 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+
+set logfile syslog
+set pidfile /var/run/monit.pid
+
+# check services at X second intervals
+set daemon 30
+include /etc/monit.d/*
+
+# allow http access
+set httpd port 2812 and
+use address {{ ansible_host }}
--- End diff --

I have been able to login to the Monit web interface on EC2 hosts.  I 
assume that shows that this is not a problem?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request: METRON-132 Monit Integration

2016-05-11 Thread nickwallen
Github user nickwallen commented on a diff in the pull request:

https://github.com/apache/incubator-metron/pull/118#discussion_r62937315
  
--- Diff: metron-deployment/roles/monit-start/defaults/main.yml ---
@@ -0,0 +1,23 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+---
+
+#
+# defines which services will be started.  by default, no services
+# are started
+#
+services_to_start: []
--- End diff --

Special note - If you do not redefine `services_to_start` nothing will be 
started.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request: METRON-132 Monit Integration

2016-05-11 Thread nickwallen
Github user nickwallen commented on a diff in the pull request:

https://github.com/apache/incubator-metron/pull/118#discussion_r62937090
  
--- Diff: metron-deployment/roles/elasticsearch/tasks/create-indices.yml ---
@@ -32,7 +35,6 @@
   until: result.content.find("green") != -1
   retries: 10
   delay: 60
-  run_once: yes
 
--- End diff --

I had to change this code because we now need to start Elasticsearch, 
create the indices, stop Elasticsearch, then continue on.  We can't create 
indices with ES off.  There is a similar need when loading the Geo data in 
MySQL.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request: METRON-132 Monit Integration

2016-05-11 Thread dlyle65535
Github user dlyle65535 commented on a diff in the pull request:

https://github.com/apache/incubator-metron/pull/118#discussion_r62936985
  
--- Diff: metron-deployment/roles/monit/templates/monit/monit.conf ---
@@ -0,0 +1,29 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+
+set logfile syslog
+set pidfile /var/run/monit.pid
+
+# check services at X second intervals
+set daemon 30
+include /etc/monit.d/*
+
+# allow http access
+set httpd port 2812 and
+use address {{ ansible_host }}
--- End diff --

Should references to ansible_host be changed to inventory_hostname? IIRC, 
ec2 discovered hostnames are internal which may cause a problem.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request: METRON-132 Monit Integration

2016-05-11 Thread nickwallen
Github user nickwallen commented on a diff in the pull request:

https://github.com/apache/incubator-metron/pull/118#discussion_r62936792
  
--- Diff: metron-deployment/roles/elasticsearch/tasks/create-indices.yml ---
@@ -32,7 +35,6 @@
   until: result.content.find("green") != -1
   retries: 10
   delay: 60
-  run_once: yes
 
--- End diff --

Because we want everything in `create-indices.yml` to "run once".  I pulled 
`run_once: yes` out to `roles/elasticsearch/tasks/main.yml`. Make sense?

```
- include: create-indices.yml
  run_once: yes
```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request: METRON-132 Monit Integration

2016-05-11 Thread dlyle65535
Github user dlyle65535 commented on a diff in the pull request:

https://github.com/apache/incubator-metron/pull/118#discussion_r62936350
  
--- Diff: metron-deployment/roles/elasticsearch/tasks/create-indices.yml ---
@@ -32,7 +35,6 @@
   until: result.content.find("green") != -1
   retries: 10
   delay: 60
-  run_once: yes
 
--- End diff --

Why pull these out?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request: METRON-132 Monit Integration

2016-05-11 Thread nickwallen
GitHub user nickwallen opened a pull request:

https://github.com/apache/incubator-metron/pull/118

METRON-132 Monit Integration

 Changes

# METRON-85
Addressed bug that caused Amazon EC2 deployment to always wait a fixed 5 
minutes instead of continuing when the hosts are actually ready

# METRON-132
Decouple Install and Start of System Components

- Decouples the installation of components from the starting of them.  A 
component can be installed, but not started.
- Define which services need started as a property.  
- Enables different deployments to start more or fewer services.  A 
development platform can start no services by default, while an Amazon EC2 
cluster can start all services.
- For example, to start only component related to YAF ingestion
  ```
  services_to_start:
- mysql
- elasticsearch
- enrichment
- yaf-parser
- yaf
  ```

# METRON-132
Monit Integration
- Leverages Monit as a process watchdog to manage sensors, topologies, and 
core services.
- Monit web interface exposed at http://hostname:2812 which can be used to 
start, stop, check status of any of the sensors or topologies.
- When monitoring is enabled (on by default) if a process dies, it will be 
restarted.
- Will not monitor a service that is not installed.
- Monit command line tools simplify the process of managing Metron 
components

For example, tired of the noise from your laptop fan when running 
Metron's 'single node vagrant'?  This will quiet her down.  Finally, peace and 
quiet!
```
monit stop all
```

Need to work on a single ingest feed?
```
monit start bro
monit start bro-parser
```

Getting cold and need some heat?  Start everything.
```
monit start all
```

Groups have also been defined to make things simpler.  For example, 
start all parser topologies.
```
monit -g parsers start
```

Start all components required to consume and enrich Bro data.
```
monit -g bro start
```

What is running?
```
monit summary
```

- The post-deployment report for Amazon-EC2 provides links to Monit's web 
interface.

  ```
  ok: [localhost] => {
"Success": [
"Apache Metron deployed successfully",
"   Metron  @ 
http://ec2-52-39-143-62.us-west-2.compute.amazonaws.com:5000;,
"   Ambari  @ 
http://ec2-52-39-4-93.us-west-2.compute.amazonaws.com:8080;,
"   Sensor Status   @ 
http://ec2-52-39-4-93.us-west-2.compute.amazonaws.com:2812;,
"   Topology Status @ 
http://ec2-52-39-130-62.us-west-2.compute.amazonaws.com:2812;,
"For additional information, see 
https://metron.incubator.apache.org/'"
]
  }
  ```

 Validation

# Quick Dev Platform
- Deploy
- Open http://node1:2812
- Ensure that all of the following services are running and visible in the 
Monit web interface.
  - mysql, elasticsearch, pcap-service, metron-ui
  - yaf, snort, snort-logs, bro, pcap-replay
  - yaf-parser, bro-parser, snort-parser, enrichment
- Login to node1 and validate the previous step by running `monit summary`
- Run `monit stop all`
- Ensure all services stopped on the host

# Amazon EC2
- Deploy
- Open http://ec2-host:2812 across each of the 10 nodes.
- Ensure that all of the following services are running somewhere on the 
cluster.
  - mysql, elasticsearch, pcap-service, metron-ui
  - yaf, snort, snort-logs, bro, pcap-replay
  - yaf-parser, bro-parser, snort-parser, enrichment
- Login to a host and validate the previous step by running `monit summary`
- Run `monit stop all` on the same host
- Ensure all services stopped on the host


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/nickwallen/incubator-metron METRON-132

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-metron/pull/118.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 #118


commit f02229de7acee960ba4d932da0cfd8e0e8049cc2
Author: Nick Allen 
Date:   2016-04-29T16:44:27Z

METRON-132 Leverages Monit as a process watchdog to manage sensors, 
topologies, and core services.
METRON-132 Decouples the installation of components from the starting of 
them. A component can be installed, but not started.
METRON-85 Addressed bug that caused Amazon EC2 deployment to always wait a 
fixed 5 minutes instead of continuing when the hosts are actually ready