Skip to content
fredrikt edited this page Oct 12, 2010 · 2 revisions

This is a real world example of how we intend to use NERDS on Stockholm university.

What we want to do is to automatically generate Nagios configuration to monitor all (well, opt-out anyways) services found open on servers on our server networks.

Workflow (run this from cron) :

  1. Get list of server networks from HOSTDB (host management system).
  2. nmap scan those networks using NERDS producer nmap_services.
  3. Probe servers having Nagios NRPE running using NERDS producer nagios_nrpe.
  4. Add data about hosts from HOSTDB using NERDS producer SU_HOSTDB.
  5. Add data about hosts from cfgstore using NERDS producer SU_cfgstore.
  6. Merge all the NERDS data files produced this far into a single NERDS data file per host using NERDS producer merge_nerds.

This is a real example of such a file (slightly re-ordered and comments added) :

{
   "host" : {

      # basic NERDS information. version 1 is a version defining the current format here.
      "name" : "metrics-dev-srv1.it.su.se",
      "version" : 1,

      "addrs" : [
         "130.237.188.154"
      ],
      "hostnames" : [
         "metrics-dev-srv1.it.su.se"
      ],

      # Information about this host from our host management system HOSTDB
      # (http://github.com/fredrikt/hostdb)
      "SU_HOSTDB" : {
         "alias" : {
            "3326" : {
               "aliasname" : "metrics.it.su.se",
               "comment" : "webb-namn för mätetalsgrafer",
               "dnsstatus" : "ENABLED",
               "dnszone" : "it.su.se"
            }
         },
         "host" : {
            "42007" : {
               "aliases" : [
                  "3326"
               ],
               "dhcpmode" : "STATIC",
               "dhcpstatus" : "ENABLED",
               "dnsmode" : "A_AND_PTR",
               "dnsstatus" : "ENABLED",
               "hostname" : "metrics-dev-srv1.it.su.se",
               "ip" : "130.237.188.154",
               "mac" : "00:50:56:b8:5f:78",
               "manual_zone" : "N",
               "owner" : "ft",
               "profile" : "pxelinux",
               "subnet_id" : "504",
               "zone" : "it.su.se"
            }
         },
         "subnet" : {
            "504" : {
               "description" : "Labbnät för gäster i ESX",
               "name" : "130.237.188.128/26",
               "owner" : "it-staff"
            }
         }
      },

      # Information gathered from scripts running from cron on each Linux server
      "SU_cfgstore" : {
         "goldenname" : "Ubuntu-8.04",
         "is_virtual" : true,
         "virtual_info" : "VMware ESX Server"
      },

      "nmap_services" : {
         # The result of OS fingerprinting in nmap_services.
         "os" : {
            "family" : null,
            "name" : "Linux 2.6.13 - 2.6.27"
         }
      },

      # The services found using nmap_services. Not located under "nmap_services" since
      # other producers than an nmap based one could produce the same data.
      "services" : {
         "ipv4" : {
            "130.237.188.154" : {
               "tcp" : {
                  "22" : {
                     "confidence" : "10",
                     "extrainfo" : "protocol 2.0",
                     "name" : "ssh",
                     "product" : "OpenSSH",
                     "proto" : "unknown",
                     "version" : "4.7p1 Debian 8ubuntu1.2"
                  },
                  "5666" : {
                     "confidence" : "3",
                     "name" : "nrpe",
                     "proto" : "unknown"
                  },
                  "80" : {
                     "confidence" : "3",
                     "name" : "http",
                     "proto" : "unknown"
                  }
               }
            }
         }
      },

      # Because port 5666 was found open, nagios_nrpe probed for NRPE checks and
      # found these to be available :
      "nagios_nrpe" : {
         "check_disk" : {
            "working" : true
         },
         "check_load" : {
            "working" : true
         },
         "check_ntp_time" : {
            "working" : true
         },
         "check_swap" : {
            "working" : true
         }
      }
   }
}
Clone this wiki locally