diff --git a/manifests/check.pp b/manifests/check.pp index 60ead20e..29b39f20 100644 --- a/manifests/check.pp +++ b/manifests/check.pp @@ -56,7 +56,7 @@ } # Export the precious resource with all modified parameters - @@nagios_service { "check_${title}_${host_name}": + nagios::service { "check_${title}_${host_name}": ensure => $ensure, host_name => $host_name, check_command => "check_${title}", @@ -67,8 +67,6 @@ max_check_attempts => $final_max_check_attempts, notification_period => $final_notification_period, use => $final_use, - # Support an arrays of tags for multiple nagios servers - tag => regsubst($server,'^(.+)$','nagios-\1'), } # Default line for nrpe invoke (used in the nagios_command) @@ -80,10 +78,9 @@ # default => "-a $parameters", # } - @@nagios_command { "check_${title}": + nagios::command { "check_${title}": # command_line => "${nrpe} -c check_${title} $command_parameters", command_line => "${nrpe} -c check_${title}", - tag => regsubst($server,'^(.+)$','nagios-\1'), } } diff --git a/manifests/check/cpu.pp b/manifests/check/cpu.pp index 87a8e95c..1a035216 100644 --- a/manifests/check/cpu.pp +++ b/manifests/check/cpu.pp @@ -9,6 +9,7 @@ $max_check_attempts = $::nagios::client::service_max_check_attempts, $notification_period = $::nagios::client::service_notification_period, $use = $::nagios::client::service_use, + $notes_url = undef, ) inherits ::nagios::client { nagios::client::nrpe_plugin { 'check_cpu': @@ -36,6 +37,7 @@ notification_period => $notification_period, max_check_attempts => $max_check_attempts, use => $use, + notes_url => $notes_url, } } diff --git a/manifests/check/cpu_temp.pp b/manifests/check/cpu_temp.pp index 9ea66b68..a997415c 100644 --- a/manifests/check/cpu_temp.pp +++ b/manifests/check/cpu_temp.pp @@ -3,7 +3,7 @@ class nagios::check::cpu_temp ( $ensure = undef, $args = '', - $package = 'lm_sensors', + $package = $::osfamily ? {'Debian' => 'lm-sensors',default => 'lm_sensors'}, $check_title = $::nagios::client::host_name, $servicegroups = undef, $check_period = $::nagios::client::service_check_period, diff --git a/manifests/check/disk.pp b/manifests/check/disk.pp index 3f5e5b03..556f0ffd 100644 --- a/manifests/check/disk.pp +++ b/manifests/check/disk.pp @@ -18,6 +18,7 @@ $max_check_attempts = $::nagios::client::service_max_check_attempts, $notification_period = $::nagios::client::service_notification_period, $use = $::nagios::client::service_use, + $notes_url = undef, ) inherits ::nagios::client { if $ensure != 'absent' { @@ -45,6 +46,7 @@ notification_period => $notification_period, max_check_attempts => $max_check_attempts, use => $use, + notes_url => $notes_url, } } diff --git a/manifests/check/mysql_health.pp b/manifests/check/mysql_health.pp index 16ba92a3..aefed829 100644 --- a/manifests/check/mysql_health.pp +++ b/manifests/check/mysql_health.pp @@ -27,6 +27,7 @@ $args_slave_io_running = '', $args_slave_sql_running = '', $args_open_files = '', + $notes_url = undef, ) { # Generic overrides diff --git a/manifests/check/mysql_health/mode.pp b/manifests/check/mysql_health/mode.pp index 5b5e5fe9..d7a25b28 100644 --- a/manifests/check/mysql_health/mode.pp +++ b/manifests/check/mysql_health/mode.pp @@ -13,6 +13,7 @@ $args = $::nagios::check::mysql_health::args $modes_enabled = $::nagios::check::mysql_health::modes_enabled $modes_disabled = $::nagios::check::mysql_health::modes_disabled + $notes_url = $::nagios::check::mysql_health::notes_url $ensure = $::nagios::check::mysql_health::ensure # Get the args passed to the main class for our mode @@ -32,6 +33,7 @@ check_command => "check_nrpe_mysql_health_${mode_u}", service_description => "mysql_health_${mode_u}", servicegroups => 'mysql_health', + notes_url => $notes_url, } } else { nagios::client::nrpe_file { "check_mysql_health_${mode_u}": diff --git a/manifests/check/ntp_time.pp b/manifests/check/ntp_time.pp index 3b0a373b..faf38c8c 100644 --- a/manifests/check/ntp_time.pp +++ b/manifests/check/ntp_time.pp @@ -9,6 +9,7 @@ $max_check_attempts = $::nagios::client::service_max_check_attempts, $notification_period = $::nagios::client::service_notification_period, $use = $::nagios::client::service_use, + $notes_url = undef, ) inherits ::nagios::client { if $ensure != 'absent' { @@ -37,6 +38,7 @@ notification_period => $notification_period, max_check_attempts => $max_check_attempts, use => $use, + notes_url => $notes_url, } } diff --git a/manifests/check/ping.pp b/manifests/check/ping.pp index 036923db..39e47ab1 100644 --- a/manifests/check/ping.pp +++ b/manifests/check/ping.pp @@ -9,6 +9,7 @@ $max_check_attempts = $::nagios::client::service_max_check_attempts, $notification_period = $::nagios::client::service_notification_period, $use = $::nagios::client::service_use, + $notes_url = undef, ) inherits ::nagios::client { # Include defaults if no overrides in $args @@ -28,6 +29,7 @@ notification_period => $notification_period, max_check_attempts => $max_check_attempts, use => $use, + notes_url => $notes_url, } } diff --git a/manifests/check/postgres/custom_query.pp b/manifests/check/postgres/custom_query.pp index 32442597..33369553 100644 --- a/manifests/check/postgres/custom_query.pp +++ b/manifests/check/postgres/custom_query.pp @@ -64,9 +64,8 @@ service_description => "postgres_cq_${query_name}", servicegroups => 'postgres', } - @@nagios_command { "check_nrpe_postgres_cq_${query_name}": + nagios::command { "check_nrpe_postgres_cq_${query_name}": command_line => "${nrpe} -c check_postgres_cq_${query_name}", - tag => regsubst($server,'^(.+)$','nagios-\1'), } } elsif ($query_ensure == 'absent') { nagios::client::nrpe_file { "check_postgres_cq_${query_name}": diff --git a/manifests/check/redis.pp b/manifests/check/redis.pp index f723c94e..fc6dd993 100644 --- a/manifests/check/redis.pp +++ b/manifests/check/redis.pp @@ -26,6 +26,7 @@ $max_check_attempts = $::nagios::client::service_max_check_attempts, $notification_period = $::nagios::client::service_notification_period, $use = $::nagios::client::service_use, + $notes_url = undef, ) { nagios::client::nrpe_plugin { 'check_redis': diff --git a/manifests/check/service.pp b/manifests/check/service.pp index d1b1c302..2e7b3a58 100644 --- a/manifests/check/service.pp +++ b/manifests/check/service.pp @@ -8,6 +8,7 @@ $max_check_attempts = $::nagios::client::service_max_check_attempts, $notification_period = $::nagios::client::service_notification_period, $use = $::nagios::client::service_use, + $sudo = false, ) { ensure_resource('nagios::client::nrpe_plugin', 'check_service', {'ensure' => $ensure}) @@ -16,15 +17,16 @@ $nrpe_options = $::nagios::params::nrpe_options $nrpe = "${nrpe_command} ${nrpe_options}" - @@nagios_command { "check_nrpe_service_${title}_${::fqdn}": + nagios::command { "check_nrpe_service_${title}_${::fqdn}": + ensure => $ensure, command_line => "${nrpe} -c check_service_${title}", - tag => 'service', } nagios::client::nrpe_file { "check_service_${title}": ensure => $ensure, args => "-s ${title}", plugin => 'check_service', + sudo => $sudo, } nagios::service { "check_service_${title}_${::nagios::client::host_name}": diff --git a/manifests/check/ssh.pp b/manifests/check/ssh.pp index 691e8e24..2226dd74 100644 --- a/manifests/check/ssh.pp +++ b/manifests/check/ssh.pp @@ -9,6 +9,7 @@ $max_check_attempts = $::nagios::client::service_max_check_attempts, $notification_period = $::nagios::client::service_notification_period, $use = $::nagios::client::service_use, + $notes_url = undef, ) { nagios::service { "check_sshd_${check_title}": @@ -22,6 +23,7 @@ notification_period => $notification_period, max_check_attempts => $max_check_attempts, use => $use, + notes_url => $notes_url, } } diff --git a/manifests/check/swap.pp b/manifests/check/swap.pp index 9ad02e12..3e567034 100644 --- a/manifests/check/swap.pp +++ b/manifests/check/swap.pp @@ -9,6 +9,7 @@ $max_check_attempts = $::nagios::client::service_max_check_attempts, $notification_period = $::nagios::client::service_notification_period, $use = $::nagios::client::service_use, + $notes_url = undef, ) inherits ::nagios::client { if $ensure != 'absent' { @@ -36,6 +37,7 @@ notification_period => $notification_period, max_check_attempts => $max_check_attempts, use => $use, + notes_url => $notes_url, } } diff --git a/manifests/command.pp b/manifests/command.pp new file mode 100644 index 00000000..cc4338e0 --- /dev/null +++ b/manifests/command.pp @@ -0,0 +1,35 @@ +# Define: nagios::command +# +# Wrap around the original nagios_command +# * To be able to export with the correct tag automatically +# * To be able to use defaults overridden or from facts +# +define nagios::command ( + $command_line, + $ensure = undef, + $server = $nagios::client::server, + $host_name = $nagios::client::host_name, + $target = "/etc/nagios/nagios_command.cfg.d/${host_name}.cfg", +) { + + # Support an array of tags for multiple nagios servers + $service_tag = regsubst($server,'^(.+)$','nagios-\1') + @@nagios_command { $title: + ensure => $ensure, + command_line => $command_line, + tag => $service_tag, + target => $target, + notify => Service['nagios'], + require => [ + Package['nagios'], + File[dirname($target)], + ], + } + @@nagios::file_perm { $title: + target => $target, + tag => $service_tag, + require => Nagios_command[$title], + } + +} + diff --git a/manifests/file_perm.pp b/manifests/file_perm.pp new file mode 100644 index 00000000..106535ed --- /dev/null +++ b/manifests/file_perm.pp @@ -0,0 +1,16 @@ +define nagios::file_perm ( + $target, +) { + # Work around a puppet bug where created files are 600 root:root + # Also, restart service after resources are purged + $file_params = { + ensure => 'present', + owner => 'root', + group => 'nagios', + mode => '0640', + audit => 'content', + notify => Service['nagios'], + } + ensure_resource('file', $target, $file_params) + +} diff --git a/manifests/host.pp b/manifests/host.pp index b67827f2..3a9e1011 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -11,6 +11,7 @@ $server = $nagios::client::server, $address = $nagios::client::host_address, $host_alias = $nagios::client::host_alias, + $target = "/etc/nagios/nagios_host.cfg.d/${title}.cfg", $check_period = $nagios::client::host_check_period, $check_command = $nagios::client::host_check_command, $contact_groups = $nagios::client::host_contact_groups, @@ -47,7 +48,10 @@ default => $use, } + # Support an array of tags for multiple nagios servers + $service_tag = regsubst($server,'^(.+)$','nagios-\1') @@nagios_host { $title: + host_name => $title, address => $final_address, alias => $host_alias, check_period => $check_period, @@ -59,7 +63,15 @@ notification_period => $notification_period, use => $final_use, # Support an arrays of tags for multiple nagios servers - tag => regsubst($server,'^(.+)$','nagios-\1'), + tag => $service_tag, + target => $target, + notify => Service['nagios'], + require => Package['nagios'], + } + @@nagios::file_perm { $title: + target => $target, + tag => $service_tag, + require => Nagios_host[$title], } } diff --git a/manifests/server.pp b/manifests/server.pp index 73f793b7..d6b0394c 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -54,7 +54,7 @@ '/etc/nagios/nagios_hostescalation.cfg', '/etc/nagios/nagios_serviceescalation.cfg', ], - $cfg_dir = [], + $cfg_dir = [ '/etc/nagios/nagios_command.cfg.d', '/etc/nagios/nagios_host.cfg.d', '/etc/nagios/nagios_service.cfg.d' ], $cfg_template = $::nagios::params::cfg_template, $process_performance_data = '0', $host_perfdata_command = false, @@ -210,12 +210,12 @@ mode => '0755', content => template('nagios/plugins/check_redis'), } - package { 'perl-Redis' : ensure => present } + ensure_packages(['perl-Redis'], { ensure => present }) } else { file { "${plugin_dir}/check_redis": ensure => 'absent', } - package { 'perl-Redis' : ensure => absent } + ensure_packages(['perl-Redis'], { ensure => absent }) } if $plugin_redis_sentinel { @@ -233,13 +233,6 @@ package { 'rubygem-redis' : ensure => absent } } - file { "${plugin_dir}/check_ssl_cert": - owner => 'root', - group => 'root', - mode => '0755', - content => template('nagios/plugins/check_ssl_cert'), - } - # Other packages # For the default email notifications to work if $mailx_install { @@ -329,14 +322,21 @@ notify => Service['nagios'], require => Package['nagios'], } + file { $cfg_dir: + ensure => 'directory', + owner => 'root', + group => 'nagios', + recurse => true, + purge => true, + force => true, + mode => '0644', + require => Package['nagios'], + } # Realize all nagios related exported resources for this server # Automatically reload nagios for relevant configuration changes # Require the package for the parent directory to exist initially - Nagios_command <<| tag == "nagios-${nagios_server}" |>> { - notify => Service['nagios'], - require => Package['nagios'], - } + Nagios_command <<| tag == "nagios-${nagios_server}" |>> Nagios_contact <<| tag == "nagios-${nagios_server}" |>> { notify => Service['nagios'], require => Package['nagios'], @@ -345,10 +345,7 @@ notify => Service['nagios'], require => Package['nagios'], } - Nagios_host <<| tag == "nagios-${nagios_server}" |>> { - notify => Service['nagios'], - require => Package['nagios'], - } + Nagios_host <<| tag == "nagios-${nagios_server}" |>> Nagios_hostdependency <<| tag == "nagios-${nagios_server}" |>> { notify => Service['nagios'], require => Package['nagios'], @@ -357,14 +354,8 @@ notify => Service['nagios'], require => Package['nagios'], } - Nagios_service <<| tag == "nagios-${nagios_server}" |>> { - notify => Service['nagios'], - require => Package['nagios'], - } - Nagios_servicedependency <<| tag == "nagios-${nagios_server}" |>> { - notify => Service['nagios'], - require => Package['nagios'], - } + Nagios_service <<| tag == "nagios-${nagios_server}" |>> + Nagios_servicedependency <<| tag == "nagios-${nagios_server}" |>> Nagios_servicegroup <<| tag == "nagios-${nagios_server}" |>> { notify => Service['nagios'], require => Package['nagios'], @@ -386,10 +377,6 @@ # FIXME: This does not work from outside here, wrong scope. # We'll need to wrap around these types with our own # definitions like for "host" - Nagios_command { - notify => Service['nagios'], - require => Package['nagios'], - } Nagios_contact { notify => Service['nagios'], require => Package['nagios'], @@ -398,10 +385,6 @@ notify => Service['nagios'], require => Package['nagios'], } - Nagios_host { - notify => Service['nagios'], - require => Package['nagios'], - } Nagios_hostdependency { notify => Service['nagios'], require => Package['nagios'], @@ -410,10 +393,6 @@ notify => Service['nagios'], require => Package['nagios'], } - Nagios_service { - notify => Service['nagios'], - require => Package['nagios'], - } Nagios_servicegroup { notify => Service['nagios'], require => Package['nagios'], @@ -431,6 +410,8 @@ require => Package['nagios'], } + Nagios::File_perm <<| tag == "nagios-${nagios_server}" |>> + # Works great, but only if the "target" is the default (known limitation) resources { [ 'nagios_command', @@ -440,6 +421,7 @@ 'nagios_hostdependency', 'nagios_hostgroup', 'nagios_service', + 'nagios_servicedependency', 'nagios_servicegroup', 'nagios_timeperiod', 'nagios_hostescalation', @@ -550,9 +532,6 @@ nagios_command { 'check_redis_sentinel': command_line => '$USER1$/check_sentinel_master_health $ARG1$', } - nagios_command { 'check_ssl_cert': - command_line => '$USER1$/check_ssl_cert -H $HOSTADDRESS$ $ARG1$', - } # Custom NRPE-based commands nagios_command { 'check_nrpe_users': @@ -1093,10 +1072,10 @@ nagios_command { 'check_nrpe_ups': command_line => "${nrpe} -c check_ups", } - # Collect virtual resources from check_service - Nagios_command <<| tag == 'service' |>> { - notify => Service['nagios'], - require => Package['nagios'], + + # not a real check + nagios_command { 'foo': + command_line => '/bin/true', } # Nagios contacts and contactgroups diff --git a/manifests/service.pp b/manifests/service.pp index 56763d6e..12f76690 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -9,6 +9,7 @@ $ensure = undef, $server = $nagios::client::server, $host_name = $nagios::client::host_name, + $target = "/etc/nagios/nagios_service.cfg.d/${host_name}.cfg", $service_description = $name, $servicegroups = $nagios::client::service_servicegroups, $check_interval = $nagios::client::service_check_interval, @@ -17,6 +18,7 @@ $first_notification_delay = $nagios::client::service_first_notification_delay, $max_check_attempts = $nagios::client::service_max_check_attempts, $notification_period = $nagios::client::service_notification_period, + $notes_url = undef, $use = $nagios::client::service_use, ) { @@ -49,9 +51,10 @@ # Support an array of tags for multiple nagios servers $service_tag = regsubst($server,'^(.+)$','nagios-\1') + $contactgroups = split(String($contact_groups), ',') + $command_name = regsubst(String($check_command), '([^!]+).*', '\\1') @@nagios_service { $title: ensure => $ensure, - host_name => $host_name, check_command => $check_command, service_description => $service_description, servicegroups => $servicegroups, @@ -59,11 +62,26 @@ check_period => $final_check_period, contact_groups => $contact_groups, first_notification_delay => $first_notification_delay, + host_name => $host_name, max_check_attempts => $final_max_check_attempts, notification_period => $final_notification_period, + notes_url => $notes_url, use => $final_use, tag => $service_tag, + target => $target, + notify => Service['nagios'], + require => [ + Package['nagios'], + Nagios_host[$host_name], + Nagios_contactgroup[$contactgroups], + Nagios_command[$command_name], + File[dirname($target)], + ], + } + @@nagios::file_perm { $title: + target => $target, + tag => $service_tag, + require => Nagios_service[$title], } } - diff --git a/manifests/servicedependency.pp b/manifests/servicedependency.pp index 74fefe2b..88210c6a 100644 --- a/manifests/servicedependency.pp +++ b/manifests/servicedependency.pp @@ -16,6 +16,9 @@ ) { + # Support an array of tags for multiple nagios servers + $service_tag = regsubst($server,'^(.+)$','nagios-\1') + $required_hosts = flatten($host_name, split($dependent_host_name, ',')) @@nagios_servicedependency { $title: ensure => $ensure, host_name => $host_name, @@ -24,9 +27,12 @@ dependent_service_description => $dependent_service_description, execution_failure_criteria => $execution_failure_criteria, notification_failure_criteria => $notification_failure_criteria, - # Support an arrays of tags for multiple nagios servers - tag => regsubst($server, - '^(.+)$','nagios-\1'), + tag => $service_tag, + notify => Service['nagios'], + require => [ + Package['nagios'], + Nagios_host[$required_hosts], + ], } } diff --git a/templates/plugins/README b/templates/plugins/README index c5516343..9843b77f 100644 --- a/templates/plugins/README +++ b/templates/plugins/README @@ -46,4 +46,3 @@ check_syncthing: https://github.com/edupr91/nagios-plugin-syncthing check_http_alt: https://gist.github.com/edupr91/1e507ead9ff771be20fff93a9ded7efe -check_ssl_cert: https://github.com/matteocorti/check_ssl_cert diff --git a/templates/plugins/check_megaraid_sas.erb b/templates/plugins/check_megaraid_sas.erb index c3f1a433..6f7166ad 100644 --- a/templates/plugins/check_megaraid_sas.erb +++ b/templates/plugins/check_megaraid_sas.erb @@ -199,7 +199,9 @@ ADAPTER: for ( my $adp = 0; $adp < $adapters; $adp++ ) { if ( $fwstate eq 'Hotspare' ) { $hotsparecount++; } elsif ( $fwstate eq 'Online' ) { - # Do nothing + # Do nothing + } elsif ( $fwstate eq 'JBOD' ) { + # Do nothing } elsif ( $fwstate eq 'Unconfigured' ) { # A drive not in anything, or a non drive device $pdcount--; diff --git a/templates/plugins/check_mongodb b/templates/plugins/check_mongodb index 8b541f4c..c726b73f 100644 --- a/templates/plugins/check_mongodb +++ b/templates/plugins/check_mongodb @@ -55,6 +55,7 @@ if pymongo.version >= "1.9": else: import pymongo.son as son +UNSUPPORTED_SERVICE_CHECK_ERROR = "This service check is not supported for versions of MongoDB 3.2 and above" # # thanks to http://stackoverflow.com/a/1229667/72987 @@ -1215,12 +1216,12 @@ def check_oplog(con, warning, critical, perf_data): critical = critical or 4 try: db = con.local - ol = db.listCollections.find_one({"name": "local.oplog.rs"}) - if (db.listCollections.find_one({"name": "local.oplog.rs"}) != None): + ol = db.system.namespaces.find_one({"name": "local.oplog.rs"}) + if (db.system.namespaces.find_one({"name": "local.oplog.rs"}) != None): oplog = "oplog.rs" else: - ol = db.listCollections.find_one({"name": "local.oplog.$main"}) - if (db.listCollections.find_one({"name": "local.oplog.$main"}) != None): + ol = db.system.namespaces.find_one({"name": "local.oplog.$main"}) + if (db.system.namespaces.find_one({"name": "local.oplog.$main"}) != None): oplog = "oplog.$main" else: message = "neither master/slave nor replica set replication detected" @@ -1259,13 +1260,16 @@ Under very high write situations it is normal for this value to be nonzero. """ warning = warning or 10 critical = critical or 40 + data = get_server_status(con) try: - data = get_server_status(con) j_commits_in_wl = data['dur']['commitsInWriteLock'] - message = "Journal commits in DB write lock : %d" % j_commits_in_wl - message += performance_data(perf_data, [(j_commits_in_wl, "j_commits_in_wl", warning, critical)]) + except KeyError: + return exit_with_general_critical(UNSUPPORTED_SERVICE_CHECK_ERROR) + message = "Journal commits in DB write lock : %d" % j_commits_in_wl + try: + message += performance_data(perf_data, + [(j_commits_in_wl, "j_commits_in_wl", warning, critical)]) return check_levels(j_commits_in_wl, warning, critical, message) - except Exception as e: return exit_with_general_critical(e) @@ -1275,13 +1279,16 @@ def check_journaled(con, warning, critical, perf_data): warning = warning or 20 critical = critical or 40 + data = get_server_status(con) try: - data = get_server_status(con) journaled = data['dur']['journaledMB'] - message = "Journaled : %.2f MB" % journaled - message += performance_data(perf_data, [("%.2f" % journaled, "journaled", warning, critical)]) + except KeyError: + return exit_with_general_critical(UNSUPPORTED_SERVICE_CHECK_ERROR) + message = "Journaled : %.2f MB" % journaled + try: + message += performance_data(perf_data, + [("%.2f" % journaled, "journaled", warning, critical)]) return check_levels(journaled, warning, critical, message) - except Exception as e: return exit_with_general_critical(e) @@ -1292,11 +1299,15 @@ As these writes are already journaled, they can occur lazily, and thus the numbe than the amount physically written to disk.""" warning = warning or 20 critical = critical or 40 + data = get_server_status(con) try: - data = get_server_status(con) writes = data['dur']['writeToDataFilesMB'] - message = "Write to data files : %.2f MB" % writes - message += performance_data(perf_data, [("%.2f" % writes, "write_to_data_files", warning, critical)]) + except KeyError: + return exit_with_general_critical(UNSUPPORTED_SERVICE_CHECK_ERROR) + message = "Write to data files : %.2f MB" % writes + try: + message += performance_data(perf_data, + [("%.2f" % writes, "write_to_data_files", warning, critical)]) return check_levels(writes, warning, critical, message) except Exception as e: @@ -1672,7 +1683,7 @@ def maintain_delta(new_vals, host, port, action): def replication_get_time_diff(con): col = 'oplog.rs' local = con.local - ol = local.listCollections.find_one({"name": "local.oplog.$main"}) + ol = local.system.namespaces.find_one({"name": "local.oplog.$main"}) if ol: col = 'oplog.$main' firstc = local[col].find().sort("$natural", 1).limit(1) diff --git a/templates/plugins/check_ssd-sudoers.erb b/templates/plugins/check_ssd-sudoers.erb index 54bf8d9d..dc531e26 100644 --- a/templates/plugins/check_ssd-sudoers.erb +++ b/templates/plugins/check_ssd-sudoers.erb @@ -3,3 +3,5 @@ Defaults !requiretty <%= scope['nagios::client::nrpe_user'] %> ALL = (root) NOPASSWD: /usr/sbin/smartctl <%= scope['nagios::client::nrpe_user'] %> ALL = (root) NOPASSWD: /usr/sbin/nvme <%= scope['nagios::client::nrpe_user'] %> ALL = (root) NOPASSWD: /usr/sbin/tw_cli +<%= scope['nagios::client::nrpe_user'] %> ALL = (root) NOPASSWD: /opt/MegaRAID/storcli/storcli64 +<%= scope['nagios::client::nrpe_user'] %> ALL = (root) NOPASSWD: /opt/MegaRAID/perccli/perccli64