-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Rundeck execution mode metrics and other fixes (#99)
* chore: update docker-compose example * fix(#98): move metrics variable for correct permission issue message. * feat(#97): add rundeck_execution_mode_<active/passive> metrics
- Loading branch information
Showing
9 changed files
with
169 additions
and
30 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
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
64 changes: 64 additions & 0 deletions
64
examples/docker-compose/configs/rundeck/etc/exporter.aclpolicy
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,64 @@ | ||
by: | ||
username: exporter | ||
description: system:read | ||
for: | ||
resource: | ||
- allow: | ||
- read | ||
equals: | ||
kind: system | ||
context: | ||
application: rundeck | ||
--- | ||
by: | ||
username: exporter | ||
description: project:read | ||
for: | ||
project: | ||
- allow: | ||
- read | ||
match: | ||
name: .* | ||
context: | ||
application: rundeck | ||
--- | ||
by: | ||
username: exporter | ||
description: events:read | ||
for: | ||
resource: | ||
- allow: | ||
- read | ||
equals: | ||
kind: event | ||
job: | ||
- allow: | ||
- read | ||
- view | ||
context: | ||
project: .* | ||
--- | ||
by: | ||
username: exporter | ||
description: Allow [read] for node | ||
for: | ||
node: | ||
- allow: | ||
- read | ||
match: | ||
nodename: .* | ||
context: | ||
project: .* | ||
|
||
--- | ||
by: | ||
username: exporter | ||
description: Allow [read] for (All) node | ||
for: | ||
resource: | ||
- allow: | ||
- read | ||
equals: | ||
kind: node | ||
context: | ||
project: .* |
12 changes: 12 additions & 0 deletions
12
examples/docker-compose/configs/rundeck/etc/realm.properties
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,12 @@ | ||
# | ||
# This file defines users passwords and roles for a HashUserRealm | ||
# | ||
# The format is | ||
# <username>: <password>[,<rolename> ...] | ||
# | ||
# Passwords may be clear text, obfuscated or checksummed. | ||
# | ||
# This sets the default user accounts for the Rundeck apps | ||
# | ||
admin:admin,user,admin | ||
exporter:exporter,user |
2 changes: 2 additions & 0 deletions
2
examples/docker-compose/configs/rundeck/etc/tokens.properties
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 @@ | ||
admin: exporter_admin_auth_token, admin | ||
exporter: exporter_auth_token, user |
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 |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
__author__ = 'Phillipe Smith' | ||
__author_email__ = '[email protected]' | ||
__app__ = 'rundeck_exporter' | ||
__version__ = '2.7.1' | ||
__version__ = '2.8.0' | ||
|
||
# Disable InsecureRequestWarning | ||
requests.urllib3.disable_warnings() | ||
|
@@ -223,6 +223,7 @@ def request(self, endpoint: str) -> dict: | |
session.post( | ||
f'{self.args.rundeck_url}/j_security_check', | ||
data={"j_username": self.args.rundeck_username, "j_password": self.rundeck_userpassword}, | ||
allow_redirects=True, | ||
verify=not self.args.rundeck_skip_ssl | ||
) | ||
|
||
|
@@ -443,6 +444,7 @@ def collect(self): | |
""" | ||
Rundeck system info | ||
""" | ||
metrics = self.request('/metrics/metrics') | ||
system_info = self.request('/system/info') | ||
api_version = int(system_info['system']['rundeck']['apiversion']) | ||
execution_mode = system_info['system'].get('executions', {}).get('executionMode') | ||
|
@@ -453,12 +455,33 @@ def collect(self): | |
) | ||
rundeck_system_info.add_metric(self.default_labels_values, {x: str(y) for x, y in system_info['system']['rundeck'].items()}) | ||
|
||
""" | ||
Rundeck server execution mode | ||
""" | ||
logging.debug(f'Rundeck execution mode: {execution_mode}.') | ||
|
||
if self.args.no_checks_in_passive_mode and execution_mode == 'passive': | ||
return | ||
rundeck_execution_mode_active = GaugeMetricFamily( | ||
'rundeck_execution_mode_active', | ||
f'Rundeck Active Execution Mode Status', | ||
labels=self.default_labels | ||
) | ||
|
||
rundeck_execution_mode_passive = GaugeMetricFamily( | ||
'rundeck_execution_mode_passive', | ||
f'Rundeck Passive Execution Mode Status', | ||
labels=self.default_labels | ||
) | ||
|
||
if execution_mode == 'passive': | ||
rundeck_execution_mode_active.add_metric(self.default_labels_values, 0) | ||
rundeck_execution_mode_passive.add_metric(self.default_labels_values, 1) | ||
else: | ||
rundeck_execution_mode_active.add_metric(self.default_labels_values, 1) | ||
rundeck_execution_mode_passive.add_metric(self.default_labels_values, 0) | ||
|
||
yield rundeck_system_info | ||
yield rundeck_execution_mode_active | ||
yield rundeck_execution_mode_passive | ||
|
||
""" | ||
Rundeck system stats | ||
|
@@ -477,8 +500,6 @@ def collect(self): | |
+ ' Some metrics like rundeck_scheduler_quartz_* will not be available.' | ||
+ ' Use Username and Password options to get the metrics.') | ||
else: | ||
metrics = self.request('/metrics/metrics') | ||
|
||
for counters in self.get_counters(metrics): | ||
yield counters | ||
|
||
|