Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial attempt * Convert some resources to InSpec exclusive resource * Put back chef/provisioning * Remove unneccessary comments * Convert munin and nagios conf for mysql to ini resource * Use kernel_parameters resource from InSpec
- Loading branch information
Showing
10 changed files
with
167 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ clients/* | |
cookbooks/* | ||
nodes/* | ||
vms/* | ||
.kitchen.list.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
--- | ||
verifier: | ||
name: inspec | ||
driver: | ||
flavor_ref: 'm1.medium' | ||
provisioner: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
describe file('/data/backup') do | ||
it { should be_directory } | ||
its('mode') { should cmp 0700 } | ||
its('owner') { should eq 'root' } | ||
its('group') { should eq 'root' } | ||
end |
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
...egration/client/serverspec/client_spec.rb → .../integration/client/inspec/client_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
describe file('/etc/nagios/mysql.cnf') do | ||
its('mode') { should cmp 0600 } | ||
its('owner') { should eq 'nrpe' } | ||
its('group') { should eq 'nrpe' } | ||
end | ||
|
||
describe ini('/etc/nagios/mysql.cnf') do | ||
its('client.user') { should eq 'monitor' } | ||
its('client.password') { should eq 'ToJzwUyqQmyV4GgMVpz0' } | ||
end | ||
|
||
%w( | ||
innodb | ||
pidfile | ||
processlist | ||
replication-delay | ||
).each do |p| | ||
describe file("/etc/nagios/nrpe.d/pmp-check-mysql-#{p}.cfg") do | ||
its('content') do | ||
should match(%r{command\[pmp-check-mysql-#{p}\]=\/usr/lib64/nagios/plugins/pmp-check-mysql-#{p}}) | ||
end | ||
end | ||
describe command("/usr/lib64/nagios/plugins/pmp-check-mysql-#{p}") do | ||
its('stdout') { should match(/^OK/) } | ||
its('exit_status') { should eq 0 } | ||
end | ||
end | ||
|
||
describe file('/etc/munin/plugin-conf.d/mysql') do | ||
its('mode') { should cmp 0600 } | ||
its('owner') { should eq 'munin' } | ||
its('group') { should eq 'munin' } | ||
its('content') { should match(/env.mysqluser monitor/) } | ||
its('content') { should match(/env.mysqlpassword ToJzwUyqQmyV4GgMVpz0/) } | ||
end | ||
|
||
# bin_relay_log | ||
# is excluded from here since it doesn't work | ||
# for a single-node mysql installation | ||
%w( | ||
commands | ||
connections | ||
innodb_bpool | ||
innodb_bpool_act | ||
innodb_semaphores | ||
qcache | ||
qcache_mem | ||
queries | ||
slow | ||
slowqueries | ||
table_locks | ||
threads | ||
tmp_tables | ||
).each do |p| | ||
describe command("/usr/sbin/munin-run mysql_#{p}") do | ||
its('exit_status') { should eq 0 } | ||
end | ||
end | ||
|
||
describe command('/usr/local/libexec/mysql-accounting') do | ||
its('exit_status') { should eq 0 } | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
%w( | ||
Percona-Server-server-56 | ||
Percona-Server-devel-56 | ||
Percona-Server-shared-56 | ||
percona-toolkit | ||
percona-xtrabackup | ||
).each do |p| | ||
describe package(p) do | ||
it { should be_installed } | ||
end | ||
end | ||
|
||
# Mysql packages should not be installed | ||
%w( | ||
mysql | ||
mysql-libs | ||
mysql55-libs | ||
).each do |p| | ||
describe package(p) do | ||
it { should_not be_installed } | ||
end | ||
end | ||
|
||
%w(mysqld_safe mysqld).each do |p| | ||
describe processes(p) do | ||
it { should exist } | ||
end | ||
end | ||
|
||
describe port(3306) do | ||
it { should be_listening } | ||
end | ||
|
||
describe file('/root/.my.cnf') do | ||
it { should be_file } | ||
end | ||
|
||
describe ini('/root/.my.cnf') do | ||
its('client.user') { should eq 'root' } | ||
its('client.password') { should eq '\'jzYY0cQUnPAMcqvIxYaC\'' } | ||
its('mysqladmin.user') { should eq 'root' } | ||
its('mysqladmin.password') { should eq '\'jzYY0cQUnPAMcqvIxYaC\'' } | ||
its('mysqldump.user') { should eq 'root' } | ||
its('mysqldump.password') { should eq '\'jzYY0cQUnPAMcqvIxYaC\'' } | ||
end | ||
|
||
describe kernel_parameter('vm.swappiness') do | ||
its('value') { should eq 0 } | ||
end | ||
|
||
describe yum.repo('percona-noarch') do | ||
it { should be_enabled } | ||
end | ||
|
||
describe crontab do | ||
its('minutes') { should include '0' } | ||
its('hours') { should include '0' } | ||
its('days') { should include '*' } | ||
its('months') { should include '*' } | ||
its('weekdays') { should include '*' } | ||
its('commands') do | ||
should include '/usr/local/libexec/mysql-accounting' | ||
end | ||
end | ||
|
||
describe crontab do | ||
its('minutes') { should include '*/30' } | ||
its('hours') { should include '*' } | ||
its('days') { should include '*' } | ||
its('months') { should include '*' } | ||
its('weekdays') { should include '*' } | ||
its('commands') do | ||
should include '/usr/local/libexec/mysql-prometheus' | ||
end | ||
end | ||
|
||
describe command('/usr/local/libexec/mysql-accounting') do | ||
its('exit_status') { should eq 0 } | ||
end | ||
|
||
describe command('/usr/local/libexec/mysql-prometheus') do | ||
its(:exit_status) { should eq 0 } | ||
end | ||
|
||
describe file('/var/lib/node_exporter/mysql_db_size.prom') do | ||
[ | ||
/^mysql_db_size_start_time [0-9].+$/, | ||
/^mysql_db_size\{name="information_schema"\} [0-9].+$/, | ||
/^mysql_db_size\{name="mysql"\} [0-9].+$/, | ||
/^mysql_db_size\{name="performance_schema"\} [0-9]+$/, | ||
/^mysql_db_size_completion_time [0-9].+$/, | ||
].each do |line| | ||
its(:content) { should match(line) } | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters