From 0d344b456fa3ca26d672fe1aea884144c31f84ee Mon Sep 17 00:00:00 2001 From: Jonny007-MKD Date: Fri, 28 Feb 2020 21:42:40 +0100 Subject: [PATCH] Added icinga command and service file --- command_nmap.conf | 25 +++++++++++++++++++++++++ service_nmap.conf | 13 +++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 command_nmap.conf create mode 100644 service_nmap.conf 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 +}