sensu / puppet-module-sensuclassic Goto Github PK
View Code? Open in Web Editor NEWPuppet module to manage Sensu Classic (ruby version)
License: MIT License
Puppet module to manage Sensu Classic (ruby version)
License: MIT License
Ubuntu 14.04 LTS is now end of life.
It should be removed from
Migrating issue from sensu/sensu-puppet#1093
Supplying a key for sensu::client_custom
that matches a key used by a property will cause Puppet to think changes are needed as the key is filtered as since it belongs to a property.
@cdenneen If you feel this is more than a documentation issue let us know.
What did you do?
I have this module + https://github.com/jsok/puppet-vault/ in my environment. The JSON module within this module seems to conflict.
What happened?
During a puppet run, I get the following error:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, undefined method `pretty_generate' for Puppet::Pops::Loader::RubyFunctionInstantiator::JSON:Module (file: /etc/puppetlabs/code/environments/production/modules/vault/manifests/config.pp, line: 30, column: 16) on node vault
to compile into a catalog
It should be enough to do a include vault
+ having the sensuclassic module in the environment.
There is no sensu related config on the affected machine
master
The vault module uses to_json_pretty
from stdlib:
https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/functions/to_json_pretty.rb#L75
It basically calls JSON.pretty_generate()
. That method is provided by the default json module from the ruby core lib. My guess is that the module JSON overwrites the class from the core lib.
The methods validate_keys()
, sorted_generate()
and sorted_pretty_generate()
should probably extend the json class or stay within the scope of this module?
Your OS: Redhat 7.8 (Maipo)
Your Ruby version: ruby 2.0.0.648-36.el7.x86_64
Your version of Puppet: 5.5.20 open source
Your version of Sensu: 1.8.0.1 (Windows client)
Your version of this module: 3.4.1
DSC module version: 1.9.3
I have attached the Puppet run below but the main part of the error is:
Error: Could not set 'present' on ensure: PowerShell DSC resource MSFT_ServiceResource failed to execute Set-TargetResource functionality with error message: The service 'sensu-client' to create alre ady exists with path 'c:\opt\sensu\bin\sensu-client.exe' (file: /etc/puppetlabs/code/environments/test/modules/external/sensuclassic/manifests/client.pp, line: 75) Error: Could not set 'present' on ensure: PowerShell DSC resource MSFT_ServiceResource failed to execute Set-TargetResource functionality with error message: The service 'sensu-client' to create alre ady exists with path 'c:\opt\sensu\bin\sensu-client.exe' (file: /etc/puppetlabs/code/environments/test/modules/external/sensuclassic/manifests/client.pp, line: 75) Wrapped exception: PowerShell DSC resource MSFT_ServiceResource failed to execute Set-TargetResource functionality with error message: The service 'sensu-client' to create already exists with path 'c:\opt\sensu\bin\sen su-client.exe'
I noticed warnings like this in the puppetserver logs:
2020-06-01T16:13:11.870Z WARN [qtp605080165-47] [puppetserver] Puppet This method is deprecated, please use the stdlib validate_legacy
function,
with Stdlib::Compat::Bool. There is further documentation for validate_legacy function in the README. at ["/etc/pup
petlabs/code/environments/production/modules/sensuclassic/manifests/init.pp", 631]:["/etc/puppetlabs/code/environments/production/site-
modules/role/manifests/common.pp", 8]
...
I use this module on a Puppetserver 6.5.0 environment
During an agent run, I get the following error message:
...
Info: Retrieving locales
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Internal Server Error: org.jruby.exceptions.SecurityError: (SecurityError) Illegal method definition of method 'validate_keys' on line 8' in legacy function. See https://puppet.com/docs/puppet/latest/functions_refactor_legacy.html for more information
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
I expected a function that doesn't use the legacy 3.x Puppet API.
I will try to post a minimale example later. Everything that uses the sensuclassic_sorted_json()
method will produce this error.
ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-linux]
on the agent, jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.222-b10 on 1.8.0_222-b10 +jit [linux-x86_64
on the serverThe metadata.json mentions that this module supports Puppet 6. The tests work, but the code clearly matches the described one in the error article at https://puppet.com/docs/puppet/latest/functions_refactor_legacy.html. I don't yet understand why the tests work.
In Sensu Enterprise 2.6.0, a reload
option was added to interactive with the service sensu-enterprise
:
https://docs.sensu.io/sensu-enterprise/3.6/changelog/#enterprise-v2-6-0
IMPROVEMENT: Sensu Enterprise now loads configuration and validates it prior to reloading (SIGHUP). If configuration is determined to be invalid prior to reloading, Sensu will report invalid configuration definitions, and it will continue to run with its existing working configuration.
Currently, when a configuration change is detected in /etc/sensu/conf.d/
and Sensu Enterprise is being used, Puppet will attempt a restart
on the senssu-enterprise
service. If invalid JSON some how ends up inside /etc/sensu/conf.d/
, this will cause the service to be stopped and then started again, putting sensu-enterprise
into a non-running state.
This request is to have an option added for Puppet to execute a reload
against sensu-enterprise
instead of a restart
on configuration changes, which allows for the above linked and quoted feature of the sensu-enterperirse
service to be taken advantage of.
In looking at the code, a notify
is being done to the service for configuration changes in /etc/sensu/conf.d
, which based on Puppet documentation, results in a restart
of the service.
https://github.com/sensu/sensu-puppet/blob/v2.63.0/manifests/check.pp#L271
https://github.com/sensu/sensu-puppet/blob/v2.63.0/manifests/write_json.pp#L60
https://puppet.com/docs/puppet/5.3/metaparameter.html#notify
I have tested a possible fix which runs puppet successfully see diff attached as it doesn't display correctly for client.pp:
DSC module version: 1.9.3
Error that is seen when running puppet:
Info: Using configured environment test Info: Retrieving pluginfacts Info: Retrieving plugin Info: Retrieving locales Info: Loading facts Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not find resource 'Exec[install-sensu-client-service]' in parameter 'before' (file: /modules/external/sensuclassic/manifests/client.pp, line: 55) on node test.domain.com Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.