cloudstack-nagios 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,19 +1,32 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cloudstack-nagios (0.1.0)
4
+ cloudstack-nagios (0.1.2)
5
5
  erubis (~> 2.7.0)
6
+ highline (~> 1.6.20)
7
+ sshkit (~> 1.1.0)
6
8
  thor (~> 0.18.1)
7
9
 
8
10
  GEM
9
11
  remote: https://rubygems.org/
10
12
  specs:
11
13
  erubis (2.7.0)
14
+ highline (1.6.20)
12
15
  json (1.8.1)
16
+ net-scp (1.1.2)
17
+ net-ssh (>= 2.6.5)
18
+ net-ssh (2.7.0)
13
19
  rake (10.0.4)
14
20
  rdoc (4.0.1)
15
21
  json (~> 1.4)
22
+ sshkit (1.1.0)
23
+ net-scp
24
+ net-ssh
25
+ term-ansicolor
26
+ term-ansicolor (1.2.2)
27
+ tins (~> 0.8)
16
28
  thor (0.18.1)
29
+ tins (0.12.0)
17
30
 
18
31
  PLATFORMS
19
32
  ruby
@@ -25,4 +25,6 @@ Gem::Specification.new do |gem|
25
25
 
26
26
  gem.add_dependency('thor', '~> 0.18.1')
27
27
  gem.add_dependency('erubis', '~> 2.7.0')
28
- end
28
+ gem.add_dependency('sshkit', '~> 1.1.0')
29
+ gem.add_dependency('highline', '~> 1.6.20')
30
+ end
@@ -80,19 +80,16 @@ module CloudstackNagios
80
80
  end
81
81
  map :envs => :environments
82
82
 
83
- desc "command COMMAND [arg1=val1 arg2=val2...]", "run a custom api command"
84
- def command(command, *args)
85
- params = {'command' => command}
86
- args.each do |arg|
87
- arg = arg.split('=')
88
- params[arg[0]] = arg[1]
89
- end
90
- puts JSON.pretty_generate(client.send_request params)
83
+ # require subcommands
84
+ Dir[File.dirname(__FILE__) + '/commands/*.rb'].each do |command|
85
+ require command
91
86
  end
92
87
 
93
- require File.dirname(__FILE__) + '/commands/nagios_config.rb'
94
88
  desc "nagios_config SUBCOMMAND ...ARGS", "Nagios configuration commands"
95
89
  subcommand :nagios_config, NagiosConfig
96
90
 
91
+ desc "snmpd_config SUBCOMMAND ...ARGS", "snmpd configuration commands"
92
+ subcommand :snmpd_config, SnmpdConfig
93
+
97
94
  end # class
98
95
  end # module
@@ -0,0 +1,37 @@
1
+ require 'sshkit/dsl'
2
+ require 'highline/import'
3
+
4
+ class SnmpdConfig < CloudstackNagios::Base
5
+
6
+ desc "check", "check if snpd is configured on virtual routers"
7
+ def check
8
+
9
+ end
10
+
11
+ desc "enable", "enable snmpd configuration on virtual routers"
12
+ def enable
13
+ hosts = routers.map {|router| router['linklocalip']}
14
+ on hosts, in: :sequence, wait: 5 do
15
+ puts
16
+ puts "On host #{host}"
17
+ puts "____" * 20
18
+ puts
19
+ puts output = capture(:free, '-m')
20
+ puts output =~ /Mem:\s+(\d+)\s+(\d+)/
21
+ puts $1
22
+ puts $2
23
+ end
24
+ end
25
+
26
+ no_commands do
27
+
28
+ def snmp_hosts(host_names)
29
+ hosts = host_names.map do |host_name|
30
+ host = SSHKit::Host.new("root@#{host_name}")
31
+ host
32
+ end
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,102 @@
1
+ ###############################################################################
2
+ #
3
+ # EXAMPLE.conf:
4
+ # An example configuration file for configuring the Net-SNMP agent ('snmpd')
5
+ # See the 'snmpd.conf(5)' man page for details
6
+ #
7
+ # Some entries are deliberately commented out, and will need to be explicitly activated
8
+ #
9
+ ###############################################################################
10
+ #
11
+ # SNMPv3 AUTHENTICATION
12
+ #
13
+ # Note that these particular settings don't actually belong here.
14
+ # They should be copied to the file /var/lib/snmp/snmpd.conf
15
+ # and the passwords changed, before being uncommented in that file *only*.
16
+ # Then restart the agent
17
+
18
+ # createUser authOnlyUser MD5 "remember to change this password"
19
+ # createUser authPrivUser SHA "remember to change this one too" DES
20
+ # createUser internalUser MD5 "this is only ever used internally, but still change the password"
21
+
22
+ # If you also change the usernames (which might be sensible),
23
+ # then remember to update the other occurances in this example config file to match.
24
+
25
+
26
+
27
+ ###############################################################################
28
+ #
29
+ # ACCESS CONTROL
30
+ #
31
+
32
+ # system + hrSystem groups only
33
+ view systemonly included .1
34
+
35
+ # Full access from the local host
36
+ #rocommunity public localhost
37
+ # Default access to basic system info
38
+ rocommunity public default -V systemonly
39
+
40
+ # Full access from an example network
41
+ # Adjust this network address to match your local
42
+ # settings, change the community string,
43
+ # and check the 'agentAddress' setting above
44
+ #rocommunity secret 10.0.0.0/16
45
+
46
+ # Full read-only access for SNMPv3
47
+ rouser authOnlyUser
48
+ # Full write access for encrypted requests
49
+ # Remember to activate the 'createUser' lines above
50
+ #rwuser authPrivUser priv
51
+
52
+ # It's no longer typically necessary to use the full 'com2sec/group/access' configuration
53
+ # r[ou]user and r[ow]community, together with suitable views, should cover most requirements
54
+
55
+
56
+ ###############################################################################
57
+ #
58
+ # SYSTEM INFORMATION
59
+ #
60
+
61
+ # Note that setting these values here, results in the corresponding MIB objects being 'read-only'
62
+ # See snmpd.conf(5) for more details
63
+ sysLocation Sitting on the Dock of the Bay
64
+ sysContact Me <me@example.org>
65
+ # Application + End-to-End layers
66
+ sysServices 72
67
+
68
+
69
+ #
70
+ # Process Monitoring
71
+ #
72
+ # At least one 'mountd' process
73
+ proc mountd
74
+ # No more than 4 'ntalkd' processes - 0 is OK
75
+ proc ntalkd 4
76
+ # At least one 'sendmail' process, but no more than 10
77
+ proc sendmail 10 1
78
+
79
+ # Walk the UCD-SNMP-MIB::prTable to see the resulting output
80
+ # Note that this table will be empty if there are no "proc" entries in the snmpd.conf file
81
+
82
+
83
+ #
84
+ # Disk Monitoring
85
+ #
86
+ # 10MBs required on root disk, 5% free on /var, 10% free on all other disks
87
+ disk / 10000
88
+ disk /var 5%
89
+ includeAllDisks 10%
90
+
91
+ # Walk the UCD-SNMP-MIB::dskTable to see the resulting output
92
+ # Note that this table will be empty if there are no "disk" entries in the snmpd.conf file
93
+
94
+
95
+ #
96
+ # System Load
97
+ #
98
+ # Unacceptable 1-, 5-, and 15-minute load averages
99
+ load 12 10 5
100
+
101
+ # Walk the UCD-SNMP-MIB::laTable to see the resulting output
102
+ # Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file
@@ -1,3 +1,3 @@
1
1
  module CloudstackNagios
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack-nagios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -75,6 +75,38 @@ dependencies:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
77
  version: 2.7.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: sshkit
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 1.1.0
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 1.1.0
94
+ - !ruby/object:Gem::Dependency
95
+ name: highline
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 1.6.20
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.6.20
78
110
  description: cloudstack-nagios generates nagios configuration and checks for monitoring
79
111
  cloudstack with nagios.
80
112
  email:
@@ -119,6 +151,8 @@ files:
119
151
  - lib/cloudstack-nagios/base.rb
120
152
  - lib/cloudstack-nagios/cli.rb
121
153
  - lib/cloudstack-nagios/commands/nagios_config.rb
154
+ - lib/cloudstack-nagios/commands/snmpd_config.rb
155
+ - lib/cloudstack-nagios/files/snmpd.conf
122
156
  - lib/cloudstack-nagios/helper.rb
123
157
  - lib/cloudstack-nagios/templates/cloudstack_routers_hosts.cfg.erb
124
158
  - lib/cloudstack-nagios/templates/cloudstack_routers_services.cfg.erb