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 #7582] Variable expansion is single quoted. #2198

Closed
icinga-migration opened this issue Nov 5, 2014 · 5 comments
Closed
Labels
area/documentation End-user or developer help bug Something isn't working
Milestone

Comments

@icinga-migration
Copy link

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

Created by jcasale on 2014-11-05 11:35:10 +00:00

Assignee: mfriedrich
Status: Closed (closed on 2015-02-07 21:06:03 +00:00)
Target Version: 2.3.0
Last Update: 2015-02-13 16:24:30 +00:00 (in Redmine)

Icinga Version: 2.1.1

While setting up an event command I noticed that variables are being expanded with single quotes.
According to http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/monitoring-basics#event-commands
the debug excerpt suggests this is not expected. The Icinga 1 docs mention expansion is
without quotes explicitly however the Icinga 2 docs don't make the same assertion.

Obviously in most cases it won't manifest as a problem, but when the variable is expanded within
a string being piped into the cmdfile it does as 'host.domain.com' != host.domain.com for example.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2014-11-11 21:54:05 +00:00

  • Status changed from New to Assigned
  • Assigned to set to jcasale

I fail to see a problem here?

@icinga-migration
Copy link
Author

Updated by jcasale on 2014-11-11 22:58:00 +00:00

Hi,
Take for example the following:

object EventCommand "my-event" {
  import "plugin-event-command"

  command = "test $service.state_id$ -gt 0 && echo \"[`date +%s`] PROCESS_SERVICE_CHECK_RESULT;$host.name$;$service.name$;0;Auto-reset.\" >> /var/run/icinga2/cmd/icinga2.cmd"
}

That produces a string that is written into the cmdfile with quotes around the expanded data. Neither the host name nor service name exists as a quoted value.

A resolution would be to create a command that took the individual expanded values as arguments so these values would be passed in and parsed correctly.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2014-11-24 12:30:59 +00:00

  • Category changed from libicinga to Documentation
  • Status changed from Assigned to New
  • Assigned to deleted jcasale
  • Target Version set to 2.3.0

The argument escaping is intentional. You should use a shell script and pass arguments to it.

To-do: Update the config examples in the documentation.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-02-07 21:06:03 +00:00

  • Status changed from New to Closed

Can't find the config example in the current docs so I assume this is fixed already.

@icinga-migration
Copy link
Author

Updated by gbeutner on 2015-02-09 14:42:52 +00:00

  • Assigned to set to mfriedrich

@icinga-migration icinga-migration added bug Something isn't working area/documentation End-user or developer help labels Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.3.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/documentation End-user or developer help bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant