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 #6766] Icinga config validation fails with uncaught exception when extending check command args with array #1817

Closed
icinga-migration opened this issue Jul 19, 2014 · 4 comments
Labels
bug Something isn't working

Comments

@icinga-migration
Copy link

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

Created by pada on 2014-07-19 19:56:58 +00:00

Assignee: (none)
Status: Rejected (closed on 2014-07-21 13:16:18 +00:00)
Target Version: (none)
Last Update: 2014-07-23 09:25:51 +00:00 (in Redmine)

Icinga Version: 2.0.1~icingaautorelease201407101035

$ /usr/sbin/icinga2 -C -c /etc/icinga2/icinga2-test.conf
[2014-07-19 21:53:34 +0200] information/icinga-app: Icinga application loader (version: v2.0.1)
[2014-07-19 21:53:34 +0200] information/icinga-app: Loading application type: icinga/IcingaApplication
[2014-07-19 21:53:34 +0200] information/Utility: Loading library 'libicinga.so'
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Adding include search dir: /usr/share/icinga2/include
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /etc/icinga2/icinga2-test.conf
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /etc/icinga2/constants.conf
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /etc/icinga2/zones.conf
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/itl
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/command.conf
[2014-07-19 21:53:34 +0200] information/Utility: Loading library 'libmethods.so'
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/command-icinga.conf
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/timeperiod.conf
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/plugins
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /usr/share/icinga2/include/command-plugins.conf
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/checker.conf
[2014-07-19 21:53:34 +0200] information/Utility: Loading library 'libchecker.so'
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/command.conf
[2014-07-19 21:53:34 +0200] information/Utility: Loading library 'libcompat.so'
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/compatlog.conf
[2014-07-19 21:53:34 +0200] information/Utility: Loading library 'libcompat.so'
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/mainlog.conf
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/notification.conf
[2014-07-19 21:53:34 +0200] information/Utility: Loading library 'libnotification.so'
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/perfdata.conf
[2014-07-19 21:53:34 +0200] information/Utility: Loading library 'libperfdata.so'
[2014-07-19 21:53:34 +0200] information/ConfigCompiler: Compiling config file: /etc/icinga2/features-enabled/statusdata.conf
[2014-07-19 21:53:34 +0200] information/Utility: Loading library 'libcompat.so'
[2014-07-19 21:53:34 +0200] information/ConfigItem: Validating config items (step 1)...
Caught unhandled exception.
Current time: 2014-07-19 21:53:34 +0200


  • Application version: v2.0.1
  • Installation root: /usr
  • Sysconf directory: /etc
  • Local state directory: /var
  • Package data directory: /usr/share/icinga2
  • State path: /var/lib/icinga2/icinga2.state
  • PID path: /var/run/icinga2/icinga2.pid
  • Application type: icinga/IcingaApplication
    *****

../../../lib/config/aexpression.cpp(64): Throw in function icinga::Value icinga::AExpression::Evaluate(const Ptr&) const
Dynamic exception type: N5boost16exception_detail10clone_implIN6icinga11ConfigErrorEEE
std::exception::what: Error while evaluating expression: Operator + cannot be applied to values of type 'String' and 'Array'
Config location: in /etc/icinga2/icinga2-test.conf: 48:2-48:20
/etc/icinga2/icinga2-test.conf(46): object CheckCommand "http6" {
/etc/icinga2/icinga2-test.conf(47): import "http-common"
/etc/icinga2/icinga2-test.conf(48): command += [ "-6" ]
^
/etc/icinga2/icinga2-test.conf(49): vars.http_address = "$address6$"
/etc/icinga2/icinga2-test.conf(50): }
[PN5boost25errinfo_nested_exception_E] =
../../../lib/base/value-operators.cpp(220): Throw in function icinga::Value icinga::operator+(const icinga::Value&, const icinga::Value&)
Dynamic exception type: N5boost16exception_detail10clone_implINS0_19error_info_injectorISt16invalid_argumentEEEE
std::exception::what: Operator + cannot be applied to values of type 'String' and 'Array'
[PN6icinga10StackTraceE] =
(0) libbase.so: void boost::throw_exception<boost::exception_detail::error_info_injectorstd::invalid_argument >(boost::exception_detail::error_info_injectorstd::invalid_argument const&) (+0x1a3) [0x7f49779c6823]
(1) libbase.so: void boost::exception_detail::throw_exception_std::invalid_argument(std::invalid_argument const&, char const**, char const**, int) (+0x6d) [0x7f49779cf8cd]
(2) libbase.so: icinga::operator+(icinga::Value const&, icinga::Value const&) (+0x28a) [0x7f4977a313ca]
(3) libconfig.so: icinga::AExpression::OpSetPlus(icinga::AExpression const*, boost::shared_ptricinga::Dictionary const&) (+0x10f) [0x7f497767cfef]
(4) libconfig.so: icinga::AExpression::Evaluate(boost::shared_ptricinga::Dictionary const&) const (+0x18) [0x7f49776786d8]
(5) libconfig.so: icinga::AExpression::OpDict(icinga::AExpression const*, boost::shared_ptricinga::Dictionary const&) (+0x151) [0x7f497767c691]
(6) libconfig.so: icinga::AExpression::Evaluate(boost::shared_ptricinga::Dictionary const&) const (+0x18) [0x7f49776786d8]
(7) libconfig.so: icinga::AExpression::OpDict(icinga::AExpression const*, boost::shared_ptricinga::Dictionary const&) (+0x151) [0x7f497767c691]
(8) libconfig.so: icinga::AExpression::Evaluate(boost::shared_ptricinga::Dictionary const&) const (+0x18) [0x7f49776786d8]
(9) libconfig.so: icinga::AExpression::OpDict(icinga::AExpression const*, boost::shared_ptricinga::Dictionary const&) (+0x151) [0x7f497767c691]
(10) libconfig.so: icinga::AExpression::Evaluate(boost::shared_ptricinga::Dictionary const&) const (+0x18) [0x7f49776786d8]
(11) libconfig.so: icinga::ConfigItem::GetProperties() (+0x359) [0x7f49776ab609]
(12) libconfig.so: icinga::ConfigType::ValidateItem(boost::shared_ptricinga::ConfigItem const&) (+0xe7) [0x7f49776c5b37]
(13) libconfig.so: icinga::ConfigItem::ValidateItem() (+0xbd) [0x7f49776a782d]
(14) libbase.so: icinga::WorkQueue::WorkerThreadProc() (+0x367) [0x7f4977a34327]
(15) libboost_thread.so.1.55.0: (+0xc5ba) [0x7f49786825ba]
(16) libpthread.so.0: (+0x80a4) [0x7f4977cde0a4]
(17) libc.so.6: clone (+0x6d) [0x7f4975ce304d]

[PN6icinga12ContextTraceE] =


  • This would indicate a runtime problem or configuration error. If you believe this is a bug in Icinga 2
  • please submit a bug report at https://dev.icinga.org/ and include this stack trace as well as any other
  • information that might be useful in order to reproduce this problem.
    *****
    Aborted

Attachments


Relations:

@icinga-migration
Copy link
Author

Updated by gbeutner on 2014-07-21 13:16:18 +00:00

  • Status changed from New to Rejected

Your command attribute is equivalent to:

command = PluginDir + "/check_http" + [ "-6" ]

I.e. your left-hand-side argument is a string while the right-hand-side argument is an array. The + operator isn't defined for strings and arrays.

You should probably change your "http-common" template to use an array for the command:

command = [ PluginDir + "/check_http" ]

@icinga-migration
Copy link
Author

Updated by pada on 2014-07-22 21:21:58 +00:00

The object CheckCommand "http" is a part of /usr/share/icinga2/include/command-plugins.conf from icinga auto-release package icinga2-common 2.0.1~icingaautorelease20140.

I was asking to add a http-common template to this file, since the current CheckCommand http template is not able to work with IPv6 addresses.

The template CheckCommand "ping-common" already provides array and IPv6 support, please provide a consistent upstream template /usr/share/icinga2/include/command-plugins.conf.

@icinga-migration
Copy link
Author

Updated by gbeutner on 2014-07-23 08:44:17 +00:00

The most-recent version of the "http" check command is already using an array for the "command" attribute. This was changed after 2.0.1 and when developing changes for the ITL commands you might want to use the snapshot builds for tests.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2014-07-23 09:25:51 +00:00

The template request is a different issue (#6767). Feel free to send git-formatted patches over there.

@icinga-migration icinga-migration added the bug Something isn't working label Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant