christoph ender's

blog

thursday the 29th of january, 2026

Ignoring exactly one ATA error

I'm running a set of ten harddrives, which, among other measures, are monitored by S.M.A.R.T. checks, the actual check used is Napsty's check_smart.

object Host "my-host.example.org" {
  import "generic-host"
  …

  vars.smart["disk backup-br-02"] = {
    name = "backup-br-02"
    device = "/dev/disk/by-id/wwn-0x5000c500ab761b96"
    interface = "sat"
    dash_w = "ata_errors=2"
  }
}
apply Service for (disk => config in host.vars.smart) {
  import "generic-service"
  name = "smart-device-stats- " + config.name
  check_command = "check-smart"
  command_endpoint = host.vars.agent_endpoint
  vars.device = config.device
  vars.interface = config.interface
  if (config.dash_w) { vars.set_dash_w = true }
  vars.dash_w = config.dash_w
  assign where host.vars.smart && host.vars.agent_endpoint
}
object CheckCommand "check-smart" {
  command = [ "/usr/bin/sudo",
              "/usr/local/nagios/Napsty-check_smart/check_smart.pl" ]

  arguments = {
    "--device" = {
      value = "$device$"
      order = 1
    }
    "--interface" = {
      value = "$interface$"
      order = 2
    }
    "-w" = {
      value = "$dash_w$"
      order = 3
      set_if = "$set_dash_w$"
    }
  }
}