forked from BonnyCI/hoist
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds dd-ansible-runner check and role
This adds a simple datadog check that fails if it finds any flag files for failing ansible-runner environments. This depends on PR BonnyCI#363 but should pass OK if it lands before that merges. Related-Issue: BonnyCI/projman#224 Signed-off-by: Adam Gandelman <[email protected]>
- Loading branch information
1 parent
125f537
commit ccea7e5
Showing
5 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
dd_ansible_runner_failing_dir: /var/www/html/cron-logs/failing/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
import os | ||
|
||
from checks import AgentCheck | ||
|
||
|
||
class ZuulServerCheck(AgentCheck): | ||
|
||
SERVICE_CHECK_NAME = 'ansible_runner.failing_environments' | ||
|
||
def check(self, instance): | ||
if 'failing_dir' not in instance: | ||
self.log.info("Skipping instance, no failing_dir found") | ||
return | ||
|
||
failing_dir = instance['failing_dir'] | ||
|
||
if os.path.isdir(failing_dir): | ||
failing_files = os.listdir(failing_dir) | ||
if failing_files: | ||
msg = 'ansible-runner envs failing: %s' % \ | ||
', '.join(failing_files) | ||
self.service_check(self.SERVICE_CHECK_NAME, | ||
AgentCheck.CRITICAL, | ||
message=msg) | ||
else: | ||
self.service_check(self.SERVICE_CHECK_NAME, | ||
AgentCheck.OK, | ||
message="No failing ansible-runner envs found", | ||
tags=service_check_tags) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
dependencies: | ||
- role: dd-checks | ||
|
||
datadog_checks: | ||
ansible_runner: | ||
instances: | ||
- failing_dir: "{{ dd_ansible_runner_failing_dir }}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- name: install ansible-runner check | ||
copy: | ||
src: ansible_runner.py | ||
dest: "{{ datadog_file_dir }}/ansible_runner.py" | ||
notify: restart dd-agent |