Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icinga, cluster: add option to limit perfdata #8403

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Al2Klimov
Copy link
Member

fixes #8124

@Al2Klimov Al2Klimov self-assigned this Oct 28, 2020
@icinga-probot icinga-probot bot added this to the 2.13.0 milestone Oct 28, 2020
@icinga-probot icinga-probot bot added area/checks Check execution and results enhancement New feature or request labels Oct 28, 2020
@Al2Klimov Al2Klimov marked this pull request as draft October 28, 2020 17:32
@Al2Klimov
Copy link
Member Author

Al2Klimov commented Oct 28, 2020

@Al2Klimov Al2Klimov force-pushed the feature/limit-perfdata-8124 branch 6 times, most recently from 5a176a7 to c46a30c Compare October 28, 2020 17:43
@Al2Klimov
Copy link
Member Author

➜  icinga2 git:(feature/limit-perfdata-8124) prefix/sbin/icinga2 daemon -d
[2020-10-28 18:48:08 +0100] information/cli: Icinga application loader (version: v2.12.0-rc1-154-gc46a30c7f)
[2020-10-28 18:48:08 +0100] information/cli: Closing console log.
➜  icinga2 git:(feature/limit-perfdata-8124) cat prefix/etc/icinga2/conf.d/my.conf
object Host "a" {
	check_command = "icinga"
}

object Host "b" {
	check_command = "icinga"
	vars.icinga_perfdata = [ "*_latency", "*_execution_time" ]
}
➜  icinga2 git:(feature/limit-perfdata-8124) curl -fksSLu root:a5782f48c3f84d1a -X GET 'https://localhost:5665/v1/objects/hosts/a' -d '{ "pretty": true }'; echo
{
    "results": [
        {
            "attrs": {
                "__name": "a",
                "acknowledgement": 0.0,
                "acknowledgement_expiry": 0.0,
                "acknowledgement_last_change": 0.0,
                "action_url": "",
                "active": true,
                "address": "",
                "address6": "",
                "check_attempt": 1.0,
                "check_command": "icinga",
                "check_interval": 300.0,
                "check_period": "",
                "check_timeout": null,
                "command_endpoint": "",
                "display_name": "a",
                "downtime_depth": 0.0,
                "enable_active_checks": true,
                "enable_event_handler": true,
                "enable_flapping": false,
                "enable_notifications": true,
                "enable_passive_checks": true,
                "enable_perfdata": true,
                "event_command": "",
                "executions": null,
                "flapping": false,
                "flapping_current": 5.9,
                "flapping_last_change": 0.0,
                "flapping_threshold": 0.0,
                "flapping_threshold_high": 30.0,
                "flapping_threshold_low": 25.0,
                "force_next_check": false,
                "force_next_notification": false,
                "groups": [],
                "ha_mode": 0.0,
                "handled": false,
                "icon_image": "",
                "icon_image_alt": "",
                "last_check": 1603907330.806379,
                "last_check_result": {
                    "active": true,
                    "check_source": "Alexanders-MacBook-Pro.local",
                    "command": "icinga",
                    "execution_end": 1603907330.806379,
                    "execution_start": 1603907330.803679,
                    "exit_status": 0.0,
                    "output": "Icinga 2 has been running for 42 seconds. Version: v2.12.0-rc1-154-gc46a30c7f",
                    "performance_data": [
                        {
                            "counter": false,
                            "crit": null,
                            "label": "api_num_conn_endpoints",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "api_num_endpoints",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "api_num_http_clients",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "api_num_json_rpc_anonymous_clients",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "api_num_json_rpc_relay_queue_item_rate",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.9,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "api_num_json_rpc_relay_queue_items",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "api_num_json_rpc_sync_queue_item_rate",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "api_num_json_rpc_sync_queue_items",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "api_num_json_rpc_work_queue_item_rate",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "api_num_not_conn_endpoints",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "checkercomponent_checker_idle",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 13.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "checkercomponent_checker_pending",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 1.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "active_host_checks",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.023575045205273287,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "passive_host_checks",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "active_host_checks_1min",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 1.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "passive_host_checks_1min",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "active_host_checks_5min",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 1.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "passive_host_checks_5min",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "active_host_checks_15min",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 1.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "passive_host_checks_15min",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "active_service_checks",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.25932549725800613,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "passive_service_checks",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "active_service_checks_1min",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 12.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "passive_service_checks_1min",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "active_service_checks_5min",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 12.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "passive_service_checks_5min",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "active_service_checks_15min",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 12.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "passive_service_checks_15min",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "current_pending_callbacks",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "current_concurrent_checks",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "remote_check_queue",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "min_latency",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.00541996955871582,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "max_latency",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.009162664413452148,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "avg_latency",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.007565617561340332,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "min_execution_time",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.002293109893798828,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "max_execution_time",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0026929378509521484,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "avg_execution_time",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0024891197681427,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_services_ok",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_services_warning",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_services_critical",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_services_unknown",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 11.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_services_pending",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 3.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_services_unreachable",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_services_flapping",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_services_in_downtime",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_services_acknowledged",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_services_handled",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_services_problem",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 8.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "uptime",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 42.41813611984253,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_hosts_up",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 1.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_hosts_down",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 2.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_hosts_pending",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 2.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_hosts_unreachable",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_hosts_flapping",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_hosts_in_downtime",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_hosts_acknowledged",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_hosts_handled",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "num_hosts_problem",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "last_messages_sent",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "last_messages_received",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "sum_messages_sent_per_second",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "sum_messages_received_per_second",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "sum_bytes_sent_per_second",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "sum_bytes_received_per_second",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,
                            "warn": null
                        }
                    ],
                    "schedule_end": 1603907330.806379,
                    "schedule_start": 1603907330.801403,
                    "state": 0.0,
                    "ttl": 0.0,
                    "type": "CheckResult",
                    "vars_after": {
                        "attempt": 1.0,
                        "reachable": true,
                        "state": 0.0,
                        "state_type": 1.0
                    },
                    "vars_before": null
                },
                "last_hard_state": 0.0,
                "last_hard_state_change": 1603907330.806379,
                "last_reachable": true,
                "last_state": 1.0,
                "last_state_change": 1603907330.806379,
                "last_state_down": 0.0,
                "last_state_type": 0.0,
                "last_state_unreachable": 0.0,
                "last_state_up": 1603907330.806388,
                "max_check_attempts": 3.0,
                "name": "a",
                "next_check": 1603907627.586403,
                "next_update": 1603907927.596355,
                "notes": "",
                "notes_url": "",
                "original_attributes": null,
                "package": "_etc",
                "paused": false,
                "previous_state_change": 0.0,
                "problem": false,
                "retry_interval": 60.0,
                "severity": 0.0,
                "source_location": {
                    "first_column": 0.0,
                    "first_line": 1.0,
                    "last_column": 14.0,
                    "last_line": 1.0,
                    "path": "/Users/aklimov/NET/WS/icinga2/prefix/etc/icinga2/conf.d/my.conf"
                },
                "state": 0.0,
                "state_type": 1.0,
                "templates": [
                    "a"
                ],
                "type": "Host",
                "vars": null,
                "version": 0.0,
                "volatile": false,
                "zone": ""
            },
            "joins": {},
            "meta": {},
            "name": "a",
            "type": "Host"
        }
    ]
}
➜  icinga2 git:(feature/limit-perfdata-8124) curl -fksSLu root:a5782f48c3f84d1a -X GET 'https://localhost:5665/v1/objects/hosts/b' -d '{ "pretty": true }'; echo
{
    "results": [
        {
            "attrs": {
                "__name": "b",
                "acknowledgement": 0.0,
                "acknowledgement_expiry": 0.0,
                "acknowledgement_last_change": 0.0,
                "action_url": "",
                "active": true,
                "address": "",
                "address6": "",
                "check_attempt": 1.0,
                "check_command": "icinga",
                "check_interval": 300.0,
                "check_period": "",
                "check_timeout": null,
                "command_endpoint": "",
                "display_name": "b",
                "downtime_depth": 0.0,
                "enable_active_checks": true,
                "enable_event_handler": true,
                "enable_flapping": false,
                "enable_notifications": true,
                "enable_passive_checks": true,
                "enable_perfdata": true,
                "event_command": "",
                "executions": null,
                "flapping": false,
                "flapping_current": 5.9,
                "flapping_last_change": 0.0,
                "flapping_threshold": 0.0,
                "flapping_threshold_high": 30.0,
                "flapping_threshold_low": 25.0,
                "force_next_check": false,
                "force_next_notification": false,
                "groups": [],
                "ha_mode": 0.0,
                "handled": false,
                "icon_image": "",
                "icon_image_alt": "",
                "last_check": 1603907314.590995,
                "last_check_result": {
                    "active": true,
                    "check_source": "Alexanders-MacBook-Pro.local",
                    "command": "icinga",
                    "execution_end": 1603907314.590995,
                    "execution_start": 1603907314.588265,
                    "exit_status": 0.0,
                    "output": "Icinga 2 has been running for 26 seconds. Version: v2.12.0-rc1-154-gc46a30c7f",
                    "performance_data": [
                        {
                            "counter": false,
                            "crit": null,
                            "label": "min_latency",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0052373409271240234,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "max_latency",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.009162664413452148,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "avg_latency",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.007196760177612305,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "min_execution_time",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.002012014389038086,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "max_execution_time",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.024259090423583984,
                            "warn": null
                        },
                        {
                            "counter": false,
                            "crit": null,
                            "label": "avg_execution_time",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.006796598434448242,
                            "warn": null
                        }
                    ],
                    "schedule_end": 1603907314.590995,
                    "schedule_start": 1603907314.58281,
                    "state": 0.0,
                    "ttl": 0.0,
                    "type": "CheckResult",
                    "vars_after": {
                        "attempt": 1.0,
                        "reachable": true,
                        "state": 0.0,
                        "state_type": 1.0
                    },
                    "vars_before": null
                },
                "last_hard_state": 0.0,
                "last_hard_state_change": 1603907314.590995,
                "last_reachable": true,
                "last_state": 1.0,
                "last_state_change": 1603907314.590995,
                "last_state_down": 0.0,
                "last_state_type": 0.0,
                "last_state_unreachable": 0.0,
                "last_state_up": 1603907314.591004,
                "max_check_attempts": 3.0,
                "name": "b",
                "next_check": 1603907611.371038,
                "next_update": 1603907911.3874083,
                "notes": "",
                "notes_url": "",
                "original_attributes": null,
                "package": "_etc",
                "paused": false,
                "previous_state_change": 0.0,
                "problem": false,
                "retry_interval": 60.0,
                "severity": 0.0,
                "source_location": {
                    "first_column": 1.0,
                    "first_line": 5.0,
                    "last_column": 15.0,
                    "last_line": 5.0,
                    "path": "/Users/aklimov/NET/WS/icinga2/prefix/etc/icinga2/conf.d/my.conf"
                },
                "state": 0.0,
                "state_type": 1.0,
                "templates": [
                    "b"
                ],
                "type": "Host",
                "vars": {
                    "icinga_perfdata": [
                        "*_latency",
                        "*_execution_time"
                    ]
                },
                "version": 0.0,
                "volatile": false,
                "zone": ""
            },
            "joins": {},
            "meta": {},
            "name": "b",
            "type": "Host"
        }
    ]
}
➜  icinga2 git:(feature/limit-perfdata-8124)

@Al2Klimov Al2Klimov marked this pull request as ready for review December 14, 2020 13:24
@Al2Klimov Al2Klimov force-pushed the feature/limit-perfdata-8124 branch from c46a30c to 2ce1287 Compare December 14, 2020 13:24
@Al2Klimov Al2Klimov modified the milestones: 2.13.0, 2.14.0 Jun 2, 2021
@Al2Klimov
Copy link
Member Author

@cla-bot check

@cla-bot cla-bot bot added the cla/signed label Aug 4, 2021
Copy link
Contributor

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#8124 mentions a few more checks than what is done is this PR:

"icinga", "cluster", "custer-zone" and "ido"

Did you omit cluster-zone because it only emits 7 perfdata values? Seems low enough that I think it would be absolutely necessary to filter here. @dgoetz Would there be a particular need for filters on that check?

ido could be fine to omit as it's effectively deprecated, but the icingadb check also emits lots of perfdata, so there might very well be the desire to filter here as well.

In general, would it make to sense to provide the ability to filter perfdata values as an option for all check commands? That would avoid that we have to hand pick the internal checks we want to implement this for and that would sound equally useful for external checks as well. Quick cross-reference that just came to my mind: implementing something like the suggestion in #6937 (comment) should allow this and would solve other issues as well.

Comment on lines +1915 to +1925
if (!filter.IsObject()) {
return;
}

auto filterArray (dynamic_pointer_cast<Array>((Object::Ptr)filter));

if (!filterArray) {
return;
}

auto filterStrings (filterArray->ToSet<String>());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid configuration shouldn't be ignored silently like the first two ifs do (except in the filter == Empty case, but that's valid config). Without having tested this, this also looks to be inconsistent: with (in DSL syntax) filter = 42 it would be ignored whereas I thing filter = [[42]] would throw an exception as [42] can't be casted to String.

Comment on lines +1927 to +1952
for (decltype(perfdata->GetLength()) i = 0; i < perfdata->GetLength(); ++i) {
auto item (perfdata->Get(i));

if (!item.IsObject()) {
continue;
}

auto itemPerfdataValue (dynamic_pointer_cast<PerfdataValue>((Object::Ptr)item));

if (!itemPerfdataValue) {
continue;
}

auto label (itemPerfdataValue->GetLabel());

for (auto& pattern : filterStrings) {
if (Utility::Match(pattern, label)) {
// continue 2;
goto NextItem;
}
}

perfdata->Remove(i--);

NextItem:;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a good place to use std::remove_if. That would avoid the need for goto here and also has linear complexity (though questionably if anyone would notice a difference here).

@Al2Klimov
Copy link
Member Author

@lippserd What do you think? Custom vars (as-is, vars.icinga_perfdata = [ "*_latency", "*_execution_time" ]), a dedicated option at CheckCommand and/or Checkable level (perfdata = [ "*_latency", "*_execution_time" ]) or Julian's idea (#6937 (comment))?

@Al2Klimov
Copy link
Member Author

FYI I personally prefer to close this and -depending on customers' needs- either do nothing at all or let the users do this by themselves via this feature as Julian described: #6937 (comment)

@lippserd lippserd removed this from the 2.14.0 milestone Mar 30, 2023
@Isotop7
Copy link
Contributor

Isotop7 commented Apr 11, 2023

FYI I personally prefer to close this and -depending on customers' needs- either do nothing at all or let the users do this by themselves via this feature as Julian described: #6937 (comment)

The feature you refer to is not implemented iirc.

@Al2Klimov
Copy link
Member Author

This one here is neither merged. I prefer one feature you can use twice rather than two features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/checks Check execution and results cla/signed enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make performance data output for internal checks configurable
4 participants