Skip to content

Commit

Permalink
Updating Master (#312)
Browse files Browse the repository at this point in the history
* Fix structlog dependency for app (#280)

* zipfile fix (#284)

* Fix bug 286 random token replacement (#287)

* Fix bug 286 random token replacement

* Change perdayvolume generator logic to get random token value replacement

* Versioning scheme (#278)

* [global] perDayVolume (#288)

* exclude global from perDayVolume assignment

* Address comment

* Fix security vulnerability issue (#289)

* Fix custom plugin stale docs (#290)

* Server fix (#293)

* Flag added

* server fix for count and env clean

* Fix bug 285 (#297)

* Add syslogAddHeader config directive (#296)

* Add syslog header to event in syslog mode

* timezone setting bugfix #249

* Using multiprocess pool to address the OOM issue (#301)

* Using multiprocess pool to address the OOM issue

* Fix test case fail

* Remove workerQueue unfinished tasks (#302)

* Bumped version to 6.5.2

* controller fix (#304)

* controller fix

* variable assignment fix (#306)

* add healthcheck endpoint and ping it every half an hour (#308)

* Fix security vulnerability issue reported by GitHub (#309)

* make controller also hit redis on healthcheck (#311)
  • Loading branch information
Tony Lee authored Oct 14, 2019
1 parent 502b7f6 commit d5db34c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
31 changes: 16 additions & 15 deletions docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
coffee-script (2.4.1)
coffee-script-source
execjs
Expand All @@ -25,18 +25,18 @@ GEM
ffi (>= 1.3.0)
eventmachine (1.2.7)
execjs (2.7.0)
faraday (0.15.4)
faraday (0.17.0)
multipart-post (>= 1.2, < 3)
ffi (1.11.1)
forwardable-extended (2.6.0)
gemoji (3.0.1)
github-pages (198)
github-pages (201)
activesupport (= 4.2.11.1)
github-pages-health-check (= 1.16.1)
jekyll (= 3.8.5)
jekyll-avatar (= 0.6.0)
jekyll-coffeescript (= 1.1.1)
jekyll-commonmark-ghpages (= 0.1.5)
jekyll-commonmark-ghpages (= 0.1.6)
jekyll-default-layout (= 0.1.4)
jekyll-feed (= 0.11.0)
jekyll-gist (= 1.5.0)
Expand All @@ -47,7 +47,7 @@ GEM
jekyll-readme-index (= 0.2.0)
jekyll-redirect-from (= 0.14.0)
jekyll-relative-links (= 0.6.0)
jekyll-remote-theme (= 0.3.1)
jekyll-remote-theme (= 0.4.0)
jekyll-sass-converter (= 1.5.2)
jekyll-seo-tag (= 2.5.0)
jekyll-sitemap (= 1.2.0)
Expand All @@ -72,8 +72,8 @@ GEM
listen (= 3.1.5)
mercenary (~> 0.3)
minima (= 2.5.0)
nokogiri (>= 1.8.5, < 2.0)
rouge (= 2.2.1)
nokogiri (>= 1.10.4, < 2.0)
rouge (= 3.11.0)
terminal-table (~> 1.4)
github-pages-health-check (1.16.1)
addressable (~> 2.3)
Expand Down Expand Up @@ -108,10 +108,10 @@ GEM
jekyll-commonmark (1.3.1)
commonmarker (~> 0.14)
jekyll (>= 3.7, < 5.0)
jekyll-commonmark-ghpages (0.1.5)
jekyll-commonmark-ghpages (0.1.6)
commonmarker (~> 0.17.6)
jekyll-commonmark (~> 1)
rouge (~> 2)
jekyll-commonmark (~> 1.2)
rouge (>= 2.0, < 4.0)
jekyll-default-layout (0.1.4)
jekyll (~> 3.0)
jekyll-feed (0.11.0)
Expand All @@ -133,7 +133,8 @@ GEM
jekyll (~> 3.3)
jekyll-relative-links (0.6.0)
jekyll (~> 3.3)
jekyll-remote-theme (0.3.1)
jekyll-remote-theme (0.4.0)
addressable (~> 2.0)
jekyll (~> 3.5)
rubyzip (>= 1.2.1, < 3.0)
jekyll-sass-converter (1.5.2)
Expand Down Expand Up @@ -203,7 +204,7 @@ GEM
jekyll (~> 3.5)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.11.3)
minitest (5.12.2)
multipart-post (2.1.1)
nokogiri (1.10.4)
mini_portile2 (~> 2.4.0)
Expand All @@ -215,11 +216,11 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
rouge (2.2.1)
rouge (3.11.0)
ruby-enum (0.7.2)
i18n
ruby_dep (1.5.0)
rubyzip (1.2.3)
rubyzip (1.3.0)
safe_yaml (1.0.5)
sass (3.7.4)
sass-listen (~> 4.0.0)
Expand Down
5 changes: 4 additions & 1 deletion splunk_eventgen/eventgen_api_server/eventgen_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def connections_healthcheck(self):
def start_checking():
while True:
time.sleep(60 * 30)
requests.get("http://{}:{}/healthcheck".format("0.0.0.0", int(self.env_vars.get('WEB_SERVER_PORT'))))
try:
requests.get("http://{}:{}/healthcheck".format("0.0.0.0", int(self.env_vars.get('WEB_SERVER_PORT'))))
except Exception as e:
self.logger.error(str(e))
thread = threading.Thread(target=start_checking)
thread.daemon = True
thread.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ def http_reset(target):
@bp.route('/healthcheck', methods=['GET'], defaults={'target': 'all'})
@bp.route('/healthcheck/<string:target>', methods=['GET'])
def http_healthcheck(target):
try:
self.redis_connector.pubsub.check_health()
except Exception as e:
self.logger.info("Connection to Redis failed: {}, re-registering".format(str(e)))
try:
self.redis_connector.register_myself(hostname=self.host, role='controller')
except Exception as connection_error:
self.logger.error(connection_error)
return Response(INTERNAL_ERROR_RESPONSE, mimetype='application/json', status=500)
try:
message_uuid = publish_message('healthcheck', request.method, target=target)
return Response(json.dumps(gather_response('healthcheck', message_uuid=message_uuid, response_number_target=0 if target == 'all' else 1)), mimetype='application/json', status=200)
Expand Down
2 changes: 1 addition & 1 deletion splunk_eventgen/eventgen_api_server/eventgen_server_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def http_post_setup():
return Response(INTERNAL_ERROR_RESPONSE, mimetype='application/json', status=500)

@bp.route('/healthcheck', methods=['GET'])
def redis_connection_health():
def http_get_healthcheck():
try:
return Response(json.dumps(self.healthcheck()), mimetype='application/json', status=200)
except Exception as e:
Expand Down

0 comments on commit d5db34c

Please sign in to comment.