diff --git a/command_nmap.conf b/command_nmap.conf new file mode 100644 index 0000000..82d006c --- /dev/null +++ b/command_nmap.conf @@ -0,0 +1,25 @@ +object CheckCommand "nmap" { + import "ipv4-or-ipv6" + + command = [ "/home/nagios/check_nmap.sh/check_nmap.sh" ] + timeout = 10m + + arguments = { + "--host" = { + value = "$nmap_host$" + description = "Hostname or address to scan" + required = true + } + "--portrange" = { + value = "$nmap_scan_ports$" + description = "String with ports in nmap format" + } + "--known" = { + value = "$nmap_allowed_ports$" + description = "String with ports in nmap format" + repeat_key = true + } + } + + vars.nmap_host = "$check_address$" +} diff --git a/service_nmap.conf b/service_nmap.conf new file mode 100644 index 0000000..47fbca0 --- /dev/null +++ b/service_nmap.conf @@ -0,0 +1,13 @@ +apply Service "nmap" { + import "generic-service" + + check_command = "nmap" + check_interval = 24h + retry_interval = 2h + + for (k => v in host.vars.nmap) { + vars["nmap_" + k] = v + } + + assign where host.vars.nmap != null +}