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

[dev.icinga.com #9264] Extend CheckCommand definitions for nscp-local #3012

Closed
icinga-migration opened this issue May 13, 2015 · 14 comments
Closed
Labels
area/itl Template Library CheckCommands enhancement New feature or request
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/9264

Created by mfriedrich on 2015-05-13 07:22:49 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2016-06-20 15:55:03 +00:00)
Target Version: 2.5.0
Last Update: 2016-06-20 15:55:03 +00:00 (in Redmine)

Backport?: Not yet backported
Include in Changelog: 1

Attachments

Changesets

2016-06-17 13:07:42 +00:00 by lbetz 765e91d

ITL: Add more parameters for nscp-local check commands

nscp-local-cpu, -memory, -disk, -service and -counter

fixes #9264

Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>

2016-06-20 15:46:34 +00:00 by lbetz c393a36

ITL: Fix check commands nscp-local-disk and nscp-local-counter

fixes #9264

Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>

Relations:

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-05-13 07:22:55 +00:00

  • Relates set to 9238

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-05-19 07:57:49 +00:00

  • Target Version deleted 2.4.0

@icinga-migration
Copy link
Author

Updated by lbetz on 2015-06-18 14:57:15 +00:00

A proposal:

object CheckCommand "nscp-local-cpu" {
import "nscp-local"

arguments += {
"warning" = {
value = "warning=load > $nscp_cpu_warning$"
key = "-a"
}
"critical" = {
value = "critical=load > $nscp_cpu_critical$"
key = "-a"
}
"time" = {
value = nscp_prefix("time=", "$nscp_cpu_time$")
key = "-a"
repeat_key = true
}
}

vars.nscp_query = "check_cpu"
vars.nscp_arguments = "$nscp_cpu_arguments$"
vars.nscp_showall = "$nscp_cpu_showall$"

vars.nscp_cpu_time = [ "1m", "5m", "15m" ]
vars.nscp_cpu_arguments = []
vars.nscp_cpu_showall = true
vars.nscp_cpu_warning = 80
vars.nscp_cpu_critical = 90
}

The goal, to have simple options like warning, critical for each service. And i.e. for nscp-local-nscp the time intervals as an array or string, in check_drivesize the same for drive option or in check_service to specify the services.
Additional use of nscp_arguments should be also possible thru a dedicated array for every check command. In commands for storage units, like check_memory or check_drivesize an additional option could be used/free.

globals.nscp_prefix = function(prefix, pmacro) {
return function() use (prefix, pmacro) {
var values = macro(pmacro)
if (typeof(values) == Array) {
var result = []
for (value in values) {
result += [ prefix + value ]
}
return result
} else {
return [ prefix + values ]
}
}
}

@icinga-migration
Copy link
Author

Updated by lbetz on 2015-08-27 07:24:09 +00:00

  • File added commands-nscp.conf

Next offer:

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-09-12 19:12:00 +00:00

If that's meant as addition, please add a git formatted patch.

Furthermore all check commands use the "my-" prefix, which should be removed, shouldn't it?
The indent isn't always a tab too.

@icinga-migration
Copy link
Author

Updated by lbetz on 2015-09-12 19:28:21 +00:00

Sure, the prefix will be removed. This was just a proposal, I thought for an open discussion. If it's ok, I will push a formatted patch.

@icinga-migration
Copy link
Author

Updated by lbetz on 2015-09-21 08:39:04 +00:00

  • File added 0001-Add-more-usable-parameters-for-check-commands.patch

I got now feedback, so here are the format patch for check commands:

  • nscp-local-cpu
  • nscp-local-memory
  • nscp-local-disk
  • nscp-local-service
  • nscp-local-counter

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-04-07 12:15:49 +00:00

  • Assigned to changed from dgoetz to mfriedrich

  • Target Version set to 2.5.0

    if (macro("$nscp_memory_free$") == "false") {

should be changed to

if (!macro("$nscp_memory_free$")) {

@icinga-migration
Copy link
Author

Updated by gbeutner on 2016-06-14 06:25:55 +00:00

lbetz: What's the status for this?

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-06-17 12:55:28 +00:00

git checkout v2.3.10 -b nscp
git am -s 0001-Add-more-usable-parameters-for-check-commands.patch
git rebase master

Simple test case for checking !macro() conditions:

object Host "11483-host" {
  check_command = "dummy"
  check_interval = 10s
  retry_interval = 5s

  vars.dummy_state = 2
  vars.dummy_text = {{
     debugger
     "Next check: " + macro("$host.next_check$") + " Last check: " + macro("$host.last_check$" + " acknowledgement: " + macro("$host.acknowledgement$") + " NSCP test: " + macro("$nscp_memory_warning$"))
  }}

  vars.nscp_memory_free = true

  vars.nscp_memory_warning = {{
    if (!macro("$nscp_memory_free$")) {
      return "nscp_memory_free disabled"
    } else {
      return "nscp_memory_free ehabled"
    }
  }}
}

@icinga-migration
Copy link
Author

Updated by lbetz on 2016-06-17 13:40:03 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset 765e91d.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-06-20 08:10:05 +00:00

  • Status changed from Resolved to Assigned

Extensions for -disk are missing for example in the patch file https://dev.icinga.org/attachments/2726/0001-Add-more-usable-parameters-for-check-commands.patch

@icinga-migration
Copy link
Author

Updated by lbetz on 2016-06-20 15:41:28 +00:00

  • File added 0001-fix-check-commands-nscp-loca-disk-and-nscp-local-cou.patch

Hi Michi,

here's the fix you asked for.... depends on:

commit 89d1d2abf6d8342d5995b0c491eab1d8d9b8b7d0
Author: Lennart Betz <lennart.betz@netways.de>
Date: Mon Jun 20 17:35:43 2016 +0200

fix check commands nscp-loca-disk and nscp-local-counter

commit f10289a
Author: Michael Friedrich <michael.friedrich@netways.de>
Date: Mon Jun 20 16:23:57 2016 +0200

DB IDO: Add missing object_id index for icinga_{scheduleddowntime,comments} tables

fixes #10070
refs #11947

@icinga-migration
Copy link
Author

Updated by lbetz on 2016-06-20 15:55:03 +00:00

  • Status changed from Assigned to Resolved

Applied in changeset c393a36.

@icinga-migration icinga-migration added enhancement New feature or request area/itl Template Library CheckCommands labels Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.5.0 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/itl Template Library CheckCommands enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant