diff --git a/cmd/config.go b/cmd/config.go index ce03839b..26de664a 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -77,11 +77,16 @@ func LoadConfig(fileSystem afero.Fs) (*agent.Config, error) { DiscoveriesPeriodsConfig: discoveryPeriodsConfig, } + prometheusTargets := discovery.PrometheusTargets{ + discovery.NodeExporterName: viper.GetString("node-exporter-target"), + } + return &agent.Config{ AgentID: agentID, InstanceName: hostname, DiscoveriesConfig: discoveriesConfig, FactsServiceURL: viper.GetString("facts-service-url"), PluginsFolder: viper.GetString("plugins-folder"), + PrometheusTargets: prometheusTargets, }, nil } diff --git a/cmd/start.go b/cmd/start.go index 137333b9..a2d47d6c 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -123,6 +123,14 @@ func NewStartCmd() *cobra.Command { startCmd.Flags().String("facts-service-url", "amqp://guest:guest@localhost:5672", "Facts service queue url") + startCmd.Flags(). + String( + "node-exporter-target", + "", + "Node exporter target address in ip:port notation. If not given the lowest "+ + "ipv4 address with the default 9100 port is used", + ) + return startCmd } diff --git a/packaging/config/agent.yaml b/packaging/config/agent.yaml index 76e65817..d7f18fac 100644 --- a/packaging/config/agent.yaml +++ b/packaging/config/agent.yaml @@ -94,4 +94,12 @@ ## Facts gathering service URL -# facts-service-url: amqp://guest:guest@localhost:5672 \ No newline at end of file +# facts-service-url: amqp://guest:guest@localhost:5672 + +############################################################################### + +## Prometheus exporters targets +## Configure the prometheus targets. If not given, the lowest discovered IP address +## with a default port numbers is used + +# node-exporter-target: 192.168.1.10:9100 \ No newline at end of file