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 #13391] How do I setup nrpe service templates? #638

Closed
icinga-migration opened this issue Dec 2, 2016 · 9 comments
Closed

Comments

@icinga-migration
Copy link

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

Created by mbassett on 2016-12-02 20:41:22 +00:00

Assignee: (none)
Status: New
Target Version: (none)
Last Update: 2016-12-13 19:40:16 +00:00 (in Redmine)


I attempted to build a check-via-nrpe service that i could use to run multiple kinds of nrpe checks. I built the fields and tried to replicate the nrpe imported service as closely as i could and applied this to nodes. I tried using the $HOSTADDRESS$ macro but when the check tried to execute it claimed there was no such macro even though icinga2 docs say that macro should be present everywhere. I tried several ways to get it to work and ended up deleting all my work. What is the correct way to do this?

director imported the existing nrpe service from icinga2 core api but i'm not sure really how to use this.

object CheckCommand "nrpe" {
import "plugin-check-command"
command = [ PluginDir + "/check_nrpe" ]
timeout = 5m
arguments += {
"-4" = {
description = "Use IPv4 connection"
set_if = "$nrpe_ipv4$"
}
"-6" = {
description = "Use IPv6 connection"
set_if = "$nrpe_ipv6$"
}
"-H" = "$nrpe_address$"
"-a" = {
order = 1
repeat_key = false
value = "$nrpe_arguments$"
}
"-c" = "$nrpe_command$"
"-n" = {
description = "Do not use SSL."
set_if = "$nrpe_no_ssl$"
}
"-p" = "$nrpe_port$"
"-t" = "$nrpe_timeout$"
"-u" = {
description = "Make socket timeouts return an UNKNOWN state instead of CRITICAL"
set_if = "$nrpe_timeout_unknown$"
}
}
vars.check_address = {
type = "Function"
}
vars.check_ipv4 = "$nrpe_ipv4$"
vars.check_ipv6 = "$nrpe_ipv6$"
vars.nrpe_address = "$check_address$"
vars.nrpe_no_ssl = false
vars.nrpe_timeout_unknown = false
}

@icinga-migration
Copy link
Author

Updated by mbassett on 2016-12-02 21:59:03 +00:00

Do i need to create fields for all of the vars? Is there a list of which things are macros and which need to be fields?

I don't see any examples in the documentation

@icinga-migration
Copy link
Author

Updated by mbassett on 2016-12-02 23:06:17 +00:00

i believe i have this working but would still like someone to confirm this is the correct way to do it.

create fields:
nrpe_ipv4 boolean
nrpe_ipv6 boolean
nrpe_timeout_unknown boolean
nrpe_no_ssl boolean
nrpe_port number
nrpe_timeout number
nrpe_command string
nrpe_arguments string

Create command:
by_nrpe
imports nrpe
add all above fields as optional except add nrpe_command as mandatory
set custom properties except nrpe_command and nrpe_arguments

Create service:
nrpe-memory
set custom property nrpe_command = check_memory
set custom property nrpe_arguments = 90 95 ( warn level crit level )

Attach service to host template

@icinga-migration
Copy link
Author

Updated by mbassett on 2016-12-03 00:01:34 +00:00

This mostly works, except for the nrpe_arguments.

I cannot get working nrpe arguments. check_memory needs -w 90 -c 95 passed to it, but using -a they get passed as individual arguments.

if i try to quote the arguments the nrpe daemon squawks saying invalid metacharacter "

@icinga-migration
Copy link
Author

Updated by tgelf on 2016-12-05 13:23:44 +00:00

Honestly I didn't even try it out, but using an array field for -a (and adding every key/value arg pair as a single entry) should work fine.

@icinga-migration
Copy link
Author

Updated by mbassett on 2016-12-13 19:40:16 +00:00

I believe my issue is an instance of http://tracker.nagios.org/view.php?id=222

centos7 only has nrpe version 2.15

Looks like i need to abandon this route and go for icinga agent instead.

@mbassett
Copy link

This can be closed.

@Thomas-Gelf
Copy link
Contributor

Thanks! Just curious, have you been able to figure out how it works - or did you opt for the Agent instead?

@mbassett
Copy link

mbassett commented Feb 6, 2017

I went with icinga agent instead. My issue was with the NRPE version installed in centos

@ktella
Copy link

ktella commented Feb 8, 2017

I had similiar issue with passing argument to nrpe. I workaround the issue.

More details here.
Icinga/icinga2#4979

http://serverfault.com/questions/702586/error-with-using-nrpe-with-icinga2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants