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

Let the icinga check command also output the error when last reload failed #8430

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

Conversation

Al2Klimov
Copy link
Member

fixes #7263

@Al2Klimov Al2Klimov self-assigned this Oct 30, 2020
@icinga-probot icinga-probot bot added this to the 2.13.0 milestone Oct 30, 2020
@icinga-probot icinga-probot bot added area/distributed Distributed monitoring (master, satellites, clients) enhancement New feature or request ref/NC TBD To be defined - We aren't certain about this yet labels Oct 30, 2020
@Al2Klimov Al2Klimov removed TBD To be defined - We aren't certain about this yet ref/NC labels Oct 30, 2020
@Al2Klimov Al2Klimov force-pushed the feature/icinga-check-output-error-last-reload-failed-7263 branch from 6d76b0e to 70edb93 Compare October 30, 2020 18:04
@Al2Klimov Al2Klimov changed the title WIP Let the icinga check command also output the error when last reload failed Oct 30, 2020
@Al2Klimov Al2Klimov force-pushed the feature/icinga-check-output-error-last-reload-failed-7263 branch from 70edb93 to f0b7d7b Compare October 30, 2020 18:21
@Al2Klimov
Copy link
Member Author

➜  icinga2 git:(feature/icinga-check-output-error-last-reload-failed-7263) ✗ curl -fksSLu root:5c79fb63484ea5dd -X GET 'https://localhost:5665/v1/objects/hosts/master' -d '{ "pretty": true }' |more
{
    "results": [
        {
            "attrs": {
                "__name": "master",
                "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": 5.0,
                "check_period": "",
                "check_timeout": null,
                "command_endpoint": "",
                "display_name": "master",
                "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": 16.1,
                "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": 1604082025.617249,
                "last_check_result": {
                    "active": true,
                    "check_source": "Alexanders-MacBook-Pro.local",
                    "command": "icinga",
                    "execution_end": 1604082025.617249,
                    "execution_start": 1604082025.614826,
                    "exit_status": 0.0,
                    "output": "Icinga 2 has been running for 14 seconds. Version: v2.12.0-rc1-159-g70edb938e; Last reload attempt failed at 2020-10-30 19:20:21 +0100 (reason: see below)\n\n[2020-10-30 19:20:21 +0100] information/cli: Loading configuration file(s).\n[2020-10-30 19:20:21 +0100] critical/config: ../lib/config/expression.cpp(862): Throw in function virtual icinga::ExpressionResult icinga::ThrowExpression::DoEvaluate(icinga::ScriptFrame &, icinga::DebugHint *) const\nDynamic exception type: boost::exception_detail::clone_impl<icinga::ScriptError>\nstd::exception::what: \n[Context] = \nLocation: in /Users/aklimov/NET/WS/icinga2/prefix/etc/icinga2/zones.d/master/my.conf: 7:1-7:8\n/Users/aklimov/NET/WS/icinga2/prefix/etc/icinga2/zones.d/master/my.conf(5): }\n/Users/aklimov/NET/WS/icinga2/prefix/etc/icinga2/zones.d/master/my.conf(6): \n/Users/aklimov/NET/WS/icinga2/prefix/etc/icinga2/zones.d/master/my.conf(7): throw \"\"\n                                                                            ^^^^^^^^\n/Users/aklimov/NET/WS/icinga2/prefix/etc/icinga2/zones.d/master/my.conf(8): \n\n[2020-10-30 19:20:21 +0100] critical/cli: Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config.\n",
                    "performance_data": [
                        {
                            "counter": false,
                            "crit": null,
                            "label": "api_num_conn_endpoints",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 0.0,

@Al2Klimov
Copy link
Member Author

➜  icinga2 git:(feature/icinga-check-output-error-last-reload-failed-7263) curl -fksSLu root:5c79fb63484ea5dd -X GET 'https://localhost:5665/v1/objects/hosts/MSEDGEWIN10' -d '{ "pretty": true }' |more

{
    "results": [
        {
            "attrs": {
                "__name": "MSEDGEWIN10",
                "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": 5.0,
                "check_period": "",
                "check_timeout": null,
                "command_endpoint": "",
                "display_name": "MSEDGEWIN10",
                "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.2,
                "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": 1604083409.599,
                "last_check_result": {
                    "active": true,
                    "check_source": "MSEDGEWIN10",
                    "command": "icinga",
                    "execution_end": 1604083409.599,
                    "execution_start": 1604083409.599,
                    "exit_status": 0.0,
                    "output": "Icinga 2 has been running for 2 minutes and 19 seconds. Version: v2.12.0-rc1-159-gf0b7d7ba2; Last reload attempt failed at 2020-10-30 19:42:50 +0100 (reason: see below)\n\n[2020-10-30 19:42:20 +0100] information/cli: Icinga application loader (version: v2.12.0-rc1-159-gf0b7d7ba2)\r\n[2020-10-30 19:42:20 +0100] information/cli: Loading configuration file(s).\r\n[2020-10-30 19:42:50 +0100] critical/config: Error: LOLCAT!\r\nLocation: in C:/ProgramData/icinga2/var/lib/icinga2/api/zones/MSEDGEWIN10/_etc/my.conf: 11:3-11:17\r\nC:/ProgramData/icinga2/var/lib/icinga2/api/zones/MSEDGEWIN10/_etc/my.conf(9): \r\nC:/ProgramData/icinga2/var/lib/icinga2/api/zones/MSEDGEWIN10/_etc/my.conf(10):  if (get_time() > 1604083285 + 60) {\r\nC:/ProgramData/icinga2/var/lib/icinga2/api/zones/MSEDGEWIN10/_etc/my.conf(11):   throw \"LOLCAT!\"\r\n                                                                                 ^^^^^^^^^^^^^^^\r\nC:/ProgramData/icinga2/var/lib/icinga2/api/zones/MSEDGEWIN10/_etc/my.conf(12):  }\r\nC:/ProgramData/icinga2/var/lib/icinga2/api/zones/MSEDGEWIN10/_etc/my.conf(13): }\r\n\r\n\r\n[2020-10-30 19:42:50 +0100] critical/cli: Config validation failed. Re-run with 'icinga2 daemon -C' after fixing the config.\r\n",
                    "performance_data": [
                        {
                            "counter": false,
                            "crit": null,
                            "label": "api_num_conn_endpoints",
                            "max": null,
                            "min": null,
                            "type": "PerfdataValue",
                            "unit": "",
                            "value": 1.0,

@Al2Klimov Al2Klimov removed their assignment Oct 30, 2020
@julianbrost julianbrost modified the milestones: 2.13.0, 2.14.0 May 31, 2021
@Al2Klimov
Copy link
Member Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Aug 4, 2021

Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA).

Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA.

After that, please reply here with a comment and we'll verify.

Contributors that have not signed yet: @lestat80, @bgroeber, @mcodato

  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Please contact us if you think this is the case.

  • If you signed the CLA as a corporation, your GitHub username may not have been submitted to us. Please reach out to the responsible person in your organization.

@Al2Klimov
Copy link
Member Author

@cla-bot This wasn’t desired. -.-"

@julianbrost julianbrost removed this from the 2.14.0 milestone Jan 17, 2023
@Al2Klimov Al2Klimov force-pushed the feature/icinga-check-output-error-last-reload-failed-7263 branch from f0b7d7b to dc22a0d Compare May 30, 2023 13:47
@cla-bot cla-bot bot added the cla/signed label May 30, 2023
@Al2Klimov Al2Klimov marked this pull request as ready for review May 30, 2023 13:47
@Al2Klimov
Copy link
Member Author

Things to consider: see #9954 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/distributed Distributed monitoring (master, satellites, clients) cla/signed enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Let the icinga check command also output the error when hlast reload failed
2 participants