-
Notifications
You must be signed in to change notification settings - Fork 289
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
Windows sensu purge issue #879
Comments
@danb223 Could you please provide Puppet code for resources so I can try and reproduce? |
Please re-open if this is still have an issue. |
An example below: I also tried to do the same with sensu::write_json instead of using file, but the same happens, the file get changed on every puppet run and therefore sensu reloads every time. When sensu reloads this also causes an issue in the windows plugin, but providing it isn't reloading all the time then it isn't too much of an issue (sensu-plugins/sensu-plugins-windows#33). This causes no problem with a Linux client and the workaround we have in Windows is to tell sensu purge config to false, but is not ideal. @ghoneycutt can you please re-open? |
The above is not valid puppet code that we can use to reproduce the issue. Could you please provide valid Puppet code. |
This is just in a Hiera format. If you just make a file in puppet or use the sensu::write_json along with any content, you should be able to recreate this with Windows. |
@danb223 What parameters are being passed to class { '::sensu':
version => '1.2.0-1',
rabbitmq_password => 'correct-horse-battery-staple',
rabbitmq_host => '192.168.56.10',
rabbitmq_vhost => '/sensu',
subscriptions => 'all',
client_address => $facts['networking']['ip'],
purge => true,
}
# Test for #820
::sensu::subscription { 'roundrobin:foo':
ensure => present,
}
file { 'C:/opt/sensu/conf.d/notification.json':
ensure => 'file',
content => '{}',
notify => Service['sensu-client'],
} |
Have you tried with content, does the actual file get created on the Windows client? here is the extract from our Windows in Hiera
We are using the sensu::check: along with the multiple checks from sensu-plugin-windows sensu::client_name: "%{::environment}-%{::role}-%{::stack}-%{::hostname}-%{::ipaddress}" sensu::server: false |
Added In your original output from Puppet, I don't see Puppet putting the file back. I only see Puppet removing the file. If I comment out the file resource for
Test case below, run first with class { '::sensu':
version => '1.3.1-2',
rabbitmq_password => 'correct-horse-battery-staple',
rabbitmq_host => '192.168.56.10',
rabbitmq_vhost => '/sensu',
subscriptions => 'all',
client_address => $facts['networking']['ip'],
purge => true,
}
# Test for #820
::sensu::subscription { 'roundrobin:foo':
ensure => present,
}
#file { 'C:/opt/sensu/conf.d/notification.json':
# ensure => 'file',
# content => '{"windows" : {"api_key": "test"}}',
# notify => Service['sensu-client'],
#}
::sensu::plugin { 'sensu-plugins-windows':
type => 'package',
} |
My initial output looks like it was wrong, apologises. However if I remove the sensu::purge, this is what happens everytime puppet runs Info: Caching catalog for nfirlajxzp98mc6ukq70vdt52boshwe4 |
Looks like the |
https://github.com/jake-dog/puppet-resource_tree latest version (1.1.0) |
Is the file defined using a key above |
So there is a "windows" file in hiera that is applied through a fact to windows machine. This contains the below:
Then in a file that contains our resrouce_tree::collections
Checks from https://github.com/sensu-plugins/sensu-plugins-windows here
We then have the "sensu_apikey_windows" stored elsewhere, but this is irrelevant as if I specify anything instead of that whole string in there, the same happens. |
@treydock could you have another look at this please |
I managed to reproduce:
This is reproducer used with Vagrant: class { '::sensu':
version => '1.3.1-2',
rabbitmq_password => 'correct-horse-battery-staple',
rabbitmq_host => '192.168.56.10',
rabbitmq_vhost => '/sensu',
subscriptions => 'all',
client_address => $facts['networking']['ip'],
purge => true,
}
class { 'resource_tree':
collections => {
'windowsbase' => {
'package' => {
'sensu-plugins-windows' => { 'ensure' => '2.4.0', 'provider' => 'sensu_gem' },
},
'file' => {
'c:\\opt\\sensu\\conf.d\\notification.json' => { 'content' => '{"windows":{"api_key":"test"}}', 'rt_notify' => { 'service' => 'sensu-client' }},
}
}
},
apply => ['windowsbase'],
} I did manage to make |
@danb223 Try using upper case |
@treydock that did the trick. I'm not sure whether this is now a puppet issue, or whether some logic needs to be applied to this sensu module, or whether we just need to make sure we are using an upper case C: |
I think this is a Puppet + Windows quirk. There is this page: https://puppet.com/docs/puppet/5.5/lang_windows_file_paths.html but it doesn't mention |
Thanks for figuring this out! |
When trying to put a json file in the conf.d directory, sensu removes the file and then puppet puts it back, on every puppet run (plus the sensu service restarting). The same does not happen in linux. The workaround for this is to disable purging for conf for windows, but not an ideal workaround. I have tried with both File resource and using the sensu::write_json, the same happens for both, but run fine on a Linux client, example below:
Info: Caching catalog for 89asuydasd1
Info: Applying configuration version '1517237731'
Info: Computing checksum on file C:/opt/sensu/conf.d/notification.json
Info: FileBucket got a duplicate file {md5}fe1ead95b9e306de4b898f21f22261e9
Info: /Stage[main]/Sensu::Package/File[C:/opt/sensu/conf.d/notification.json]: Filebucketed C:/opt/sensu/conf.d/notification.json to puppet with sum fe1ead95b9e306de4b898f21f22261e9
Notice: /Stage[main]/Sensu::Package/File[C:/opt/sensu/conf.d/notification.json]/ensure: removed
Info: Class[Sensu::Package]: Scheduling refresh of Service[sensu-client]
Notice: /Stage[main]/Sensu::Client/Service[sensu-client]: Triggered 'refresh' from 1 events
Notice: Applied catalog in 13.72 seconds
Platform and version information
The text was updated successfully, but these errors were encountered: