portertech / chef-monitor Goto Github PK
View Code? Open in Web Editor NEWAn OpsCode Chef cookbook for monitoring services, wrapping the Sensu cookbook.
Home Page: http://community.opscode.com/cookbooks/monitor
An OpsCode Chef cookbook for monitoring services, wrapping the Sensu cookbook.
Home Page: http://community.opscode.com/cookbooks/monitor
Hi all,
I was having some trouble with check-log.rb here. It crashed while parsing /var/log/syslog, because it found some really weird characters in there, which were logged e. g. together with strange GET requests. I fixed this for me applying the patch below, its a one liner. Maybe you want to consider applying this to the check, making it more robust, though it may drop some bytes now.
Kind Regards,
Philipp
@@ -106,6 +106,7 @@
@log.seek(@bytes_to_skip, File::SEEK_SET)
end
@log.each_line do |line|
line.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
The monitor master recipe doesn't work even if I try to put sensu::redis in front of it.
Starting Chef Client, version 11.16.2
resolving cookbooks for run list: ["sensu::redis", "sensu::rabbitmq", "monitor::master"]
Synchronizing Cookbooks:
- apt
- sensu
- yum
- chef_handler
- windows
- rabbitmq
- yum-erlang_solutions
- erlang
- yum-epel
- build-essential
- redisio
- ulimit
- sudo
- monitor
Compiling Cookbooks...
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/sensu/recipes/redis.rb
================================================================================
Chef::Exceptions::ResourceNotFound
----------------------------------
Cannot find a resource matching service[redis6379] (did you define it first?)
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/redisio/recipes/enable.rb:25:in `block in from_file'
/var/chef/cache/cookbooks/redisio/recipes/enable.rb:23:in `each'
/var/chef/cache/cookbooks/redisio/recipes/enable.rb:23:in `from_file'
/var/chef/cache/cookbooks/sensu/recipes/redis.rb:23:in `from_file'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/redisio/recipes/enable.rb:
18: # limitations under the License.
19: #
20:
21: redis = node['redisio']
22:
23: redis['servers'].each do |current_server|
24: server_name = current_server["name"] || current_server["port"]
25>> resource = resources("service[redis#{server_name}]")
26: resource.action Array(resource.action)
27: resource.action << :start
28: resource.action << :enable
29: end
30:
Running handlers:
[2014-09-23T14:43:43+00:00] ERROR: Running exception handlers
Running handlers complete
[2014-09-23T14:43:43+00:00] ERROR: Exception handlers complete
[2014-09-23T14:43:43+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 5.382873795 seconds
[2014-09-23T14:43:43+00:00] ERROR: Cannot find a resource matching service[redis6379] (did you define it first?)
[2014-09-23T14:43:44+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
The actions filter created by this cookbook doesn't work (at least in Sensu 0.12.6) because action is a symbol, not a string.
I don't know if this is due to a recent change in Sensu or if the filter has always been broken; either way see #19 for a fix.
The timeout is applied to the entire request, so it should indicate Check timed out rather than the more specific Connect timed out.
check-log requires that /var/cache/check-log be writeable by the sensu user.
directory '/var/cache/check-log' do
owner 'sensu'
group 'sensu'
end
This is more of a question than an issue, really. Why not just export the sensu-community-plugins, rather than roll your own into files/default/plugins? I'm in the process of modifying this cookbook to do just that (unless I find out I can't do it easily).
The rabbit/redis/api servers may be on different hosts (and perhaps not even search()able in the case of AWS hosted redis). It would be useful if the search blocks could be separated and also overrideable by a static value.
Right now this cookbook uses a redis recipe which builds redis from source. Why is that?
Every modern linux distribution like ubuntu, centos contains a redis package. Using the default package would allow to use the security patches of the distribution and reduce the install complexity.
Please update this check from here:
https://github.com/sensu/sensu-community-plugins/blob/master/plugins/rabbitmq/rabbitmq-overview-metrics.rb
The default rabbitmq management api port ist 15672.
The sensu cookbook doesn't appear to include the sensu::dashboard_service recipe included in master.rb anymore, it probably needs to be removed or replaced with some other thing?
A failing check command like check_http (in case of port to be checked is not listening) does not necessarily have performance data appended. This results in sensu-server.log filling up with
... "extension":{"type":"extension","name":"nagios_perfdata"},"output":"undefined method `strip' for nil:NilClass","status":2}
Checking for a | in check[:output] before trying to split solves the problem
check = event[:check]
output = check[:output]
# https://www.nagios-plugins.org/doc/guidelines.html#AEN200
if output.include? '|'
perfdata = output.split('|').last.strip
...
end
Some users store their Graphite metrics to live.servers.myhost.mycheck, others in servers.live.myhost.mycheck etc ... So supporting a customizable path prefix would be really appriciated.
As an additional requirement this "live" is set in client[:environment] in the Sensu client config.
If you attempt to run test kitchen, it will throw the following error:
sowens-MBP:chef-monitor sowen$ kitchen create
-----> Starting Kitchen (v1.3.1)
!!!!!! The `librarian-chef' gem is missing and must be installed or cannot be properly activated. Run `gem install librarian-chef` or add the following to your Gemfile if you are using Bundler: `gem 'librarian-chef'`.
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::UserError
>>>>>> Message: Could not load or activate Librarian-Chef (cannot load such file -- librarian/chef/environment)
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
I suspect this has something to do with the chef-dk being installed. Even after installing librarian chef, I get the same error.
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.