chef-monitor 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/bin/chef-logmon CHANGED
@@ -50,6 +50,7 @@ MQSERVER = Monitor::Config[:mq_server]
50
50
  MQQUEUE = Monitor::Config[:mq_queue]
51
51
  MON_FILE = Monitor::Config[:mon_file]
52
52
  CHEF_URL = Monitor::Config[:chef_url]
53
+ LOGMONNAME = %x[hostname]
53
54
  DEBUG = debug
54
55
 
55
56
  @options = {
@@ -95,6 +95,8 @@ class Monitor
95
95
  def get_item_json(object)
96
96
  begin
97
97
  item = rest.get_rest(object)
98
+ # item.delete('automatic') if item['automatric']
99
+ item = view_node_data(item) if item.class == Chef::Node
98
100
  result = JSON.pretty_generate(item)
99
101
  rescue Exception => e
100
102
  Monitor::Log.new(e.message + ' with object: ' + @organization + "/" + object , 'ERROR')
@@ -103,6 +105,19 @@ class Monitor
103
105
  return result
104
106
  end
105
107
 
108
+ def view_node_data(node)
109
+ result = {}
110
+ result["name"] = node.name
111
+ result["chef_environment"] = node.chef_environment
112
+ result["normal"] = node.normal_attrs
113
+ result["run_list"] = node.run_list
114
+ result["default"] = node.default_attrs
115
+ result["override"] = node.override_attrs
116
+ # result["automatic"] = node.automatic_attrs
117
+ result
118
+ end
119
+
120
+
106
121
  def commit(path)
107
122
  current_dir = Dir.pwd
108
123
  commit_dir = File.join(path, @organization)
@@ -47,7 +47,7 @@ class Monitor
47
47
  data = {}
48
48
  data['time'] = $3
49
49
  data['user'] = $16
50
- data['server'] = ENV['HOSTNAME']
50
+ data['server'] = LOGMONNAME
51
51
  data['org'] = $5.split('/')[2] unless $5.split('/')[2].nil?
52
52
  data['object'] = $5.split('/')[3] unless $5.split('/')[3].nil?
53
53
  data['name'] = $5.split('/')[4] unless $5.split('/')[4].nil?
@@ -16,6 +16,6 @@
16
16
  # limitations under the License.
17
17
 
18
18
  class Monitor
19
- VERSION = "0.1.3"
19
+ VERSION = "0.1.4"
20
20
  MAJOR, MINOR, TINY = VERSION.split('.')
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-08 00:00:00.000000000 Z
12
+ date: 2014-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bunny