#!/bin/bash CONFFILE="many.conf" NUMBERHOSTSVC=100 NUMBERHOST=10 rm -f $CONFFILE cat >> $CONFFILE << EOF /* Icinga 2 Generated Test Config */ include include object IcingaApplication "icinga" { macros = { plugindir = "/usr/lib/nagios/plugins" } } library "compat" object CompatComponent "compat" { } object CompatLog "compat-log" { } /* library "livestatus" object LivestatusComponent "livestatus" {} */ object CheckCommand "check_dummy" inherits "plugin-check-command" { command = "\$plugindir$/check_dummy 1 \"icinga2 test\"", } template Service "dummy-service-tmpl" { check_command = "check_dummy", check_interval = 1m, } EOF # host template with services echo 'template Host "dummy-host-tmpl" {' >> $CONFFILE for i in $(seq 1 $NUMBERHOSTSVC) do echo ' services["icinga2_service'$i'"] = { templates = [ "dummy-service-tmpl" ] },' >> $CONFFILE done echo ' hostcheck = "icinga2_service1",' >> $CONFFILE echo '}' >> $CONFFILE # hosts for i in $(seq 1 $NUMBERHOST) do echo 'object Host "icinga2_host'$i'" inherits "dummy-host-tmpl" { }' >> $CONFFILE done