-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add object and feature for PerfdataWriter (#68)
* Closes #19 * Add feature perfdata * Add documentation snippet for perfdatawriter * add tests for perfdata * added feature perfdata to readme Co-authored-by: Thilo W <mkayontour@gmail.com>
- Loading branch information
1 parent
66fd19e
commit 290b70e
Showing
7 changed files
with
106 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,42 @@ | ||
## PerfdataWriter | ||
|
||
To enable the feature perfdata use the following block in the variable `icinga2_features`. | ||
|
||
**INFO** For detailed information and instructions see the Icinga 2 Docs. [Feature PerfdataWriter](https://icinga.com/docs/icinga-2/latest/doc/09-object-types/#perfdatabwriter) | ||
|
||
``` | ||
icinga2_features: | ||
- name: perfdata | ||
host_perfdata_path: "/var/spool/icinga2/perfdata/host-perfdata" | ||
service_perfdata_path: "/var/spool/icinga2/perfdata/service-perfdata" | ||
host_format_template: "DATATYPE::HOSTPERFDATA" | ||
service_format_template: "DATATYPE::SERVICEPERFDATA" | ||
rotation_interval = 15s | ||
``` | ||
|
||
### Feature variables | ||
|
||
* `host_perfdata_path: string` | ||
* Path to the host performance data file. Defaults to SpoolDir + “/perfdata/host-perfdata”. | ||
|
||
* `service_perfdata_path: string` | ||
* Path to the service performance data file. Defaults to SpoolDir + “/perfdata/service-perfdata”. | ||
|
||
* `host_temp_path: string` | ||
* Path to the temporary host file. Defaults to SpoolDir + “/tmp/host-perfdata”. | ||
|
||
* `service_temp_path: string` | ||
* Path to the temporary service file. Defaults to SpoolDir + “/tmp/service-perfdata”. | ||
|
||
* `host_format_template: string` | ||
* Host Format template for the performance data file. Defaults to a template that’s suitable for use with PNP4Nagios. | ||
|
||
* `service_format_template: string` | ||
* Service Format template for the performance data file. Defaults to a template that’s suitable for use with PNP4Nagios. | ||
|
||
* `rotation_interval: string` | ||
* Rotation interval for the files specified in {host,service}_perfdata_path. Defaults to 30s. | ||
|
||
* `enable_ha: boolean` | ||
* Enable the high availability functionality. Only valid in a cluster setup. Defaults to false. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/python | ||
|
||
|
||
from ansible.module_utils.basic import AnsibleModule | ||
|
||
def main(): | ||
module = AnsibleModule( | ||
supports_check_mode=True, | ||
argument_spec = dict( | ||
state = dict(default='present', choices=['present', 'absent']), | ||
name = dict(required=True), | ||
order = dict(default=10, type='int'), | ||
file = dict(default='features-available/perfdata.conf', type='str'), | ||
host_perfdata_path = dict(type='str'), | ||
service_perfdata_path = dict(type='str'), | ||
host_temp_path = dict(type='str'), | ||
service_temp_path = dict(type='str'), | ||
host_format_template = dict(type='str'), | ||
service_format_template = dict(type='str'), | ||
rotation_interval = dict(type='str'), | ||
enable_ha = dict(type='bool'), | ||
) | ||
) | ||
|
||
args = module.params | ||
name = args.pop('name') | ||
order = args.pop('order') | ||
state = args.pop('state') | ||
file = args.pop('file') | ||
|
||
module.exit_json(changed=False, args=args, name=name, order=str(order), state=state, file=file) | ||
|
||
if __name__ == '__main__': | ||
main() |
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 @@ | ||
--- | ||
|
||
- name: feature perfdata PerfdataWriter object | ||
icinga2_object: | ||
name: perfdata | ||
type: PerfdataWriter | ||
file: features-available/perfdata.conf | ||
args: "{{ icinga2_dict_features.perfdata }}" | ||
register: result | ||
|
||
- set_fact: | ||
icinga2_local_objects: "{{ icinga2_local_objects|default([]) + [result.dest] }}" |
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