@@ -51,9 +51,6 @@ const (
51
51
defaultMonitoringNamespace = "default"
52
52
agentName = "elastic-agent"
53
53
54
- monitoringMetricsUnitID = "metrics-monitoring"
55
- monitoringFilesUnitsID = "filestream-monitoring"
56
-
57
54
windowsOS = "windows"
58
55
59
56
// metricset execution period used for the monitoring metrics inputs
@@ -304,7 +301,7 @@ func (b *BeatsMonitor) injectLogsInput(cfg map[string]interface{}, components []
304
301
305
302
streams := []interface {}{
306
303
map [string ]interface {}{
307
- idKey : fmt . Sprintf ( "%s- agent", monitoringFilesUnitsID ) ,
304
+ idKey : "filestream-monitoring- agent" ,
308
305
"type" : "filestream" ,
309
306
"paths" : []interface {}{
310
307
filepath .Join (logsDrop , agentName + "-*.ndjson" ),
@@ -442,7 +439,7 @@ func (b *BeatsMonitor) injectLogsInput(cfg map[string]interface{}, components []
442
439
fixedBinaryName := strings .ReplaceAll (strings .ReplaceAll (comp .InputSpec .BinaryName , "-" , "_" ), "/" , "_" ) // conform with index naming policy
443
440
dataset := fmt .Sprintf ("elastic_agent.%s" , fixedBinaryName )
444
441
streams = append (streams , map [string ]interface {}{
445
- idKey : fmt .Sprintf ("%s- %s" , monitoringFilesUnitsID , comp .ID ),
442
+ idKey : fmt .Sprintf ("filestream-monitoring- %s" , comp .ID ),
446
443
"type" : "filestream" ,
447
444
"paths" : []interface {}{
448
445
comp .InputSpec .Spec .Service .Log .Path ,
@@ -495,8 +492,8 @@ func (b *BeatsMonitor) injectLogsInput(cfg map[string]interface{}, components []
495
492
496
493
inputs := []interface {}{
497
494
map [string ]interface {}{
498
- idKey : fmt . Sprintf ( "%s- agent", monitoringFilesUnitsID ) ,
499
- "name" : fmt . Sprintf ( "%s- agent", monitoringFilesUnitsID ) ,
495
+ idKey : "filestream-monitoring- agent" ,
496
+ "name" : "filestream-monitoring- agent" ,
500
497
"type" : "filestream" ,
501
498
useOutputKey : monitoringOutput ,
502
499
"streams" : streams ,
@@ -525,13 +522,14 @@ func (b *BeatsMonitor) monitoringNamespace() string {
525
522
}
526
523
527
524
func (b * BeatsMonitor ) injectMetricsInput (cfg map [string ]interface {}, componentIDToBinary map [string ]string , monitoringOutputName string , componentList []component.Component ) error {
525
+
528
526
metricsCollectionIntervalString := metricsCollectionInterval .String ()
529
527
monitoringNamespace := b .monitoringNamespace ()
530
528
fixedAgentName := strings .ReplaceAll (agentName , "-" , "_" )
531
529
beatsStreams := make ([]interface {}, 0 , len (componentIDToBinary ))
532
530
streams := []interface {}{
533
531
map [string ]interface {}{
534
- idKey : fmt . Sprintf ( "%s- agent", monitoringMetricsUnitID ) ,
532
+ idKey : "metrics-monitoring- agent" ,
535
533
"data_stream" : map [string ]interface {}{
536
534
"type" : "metrics" ,
537
535
"dataset" : fmt .Sprintf ("elastic_agent.%s" , fixedAgentName ),
@@ -608,18 +606,7 @@ func (b *BeatsMonitor) injectMetricsInput(cfg map[string]interface{}, componentI
608
606
},
609
607
},
610
608
}
611
-
612
- //create a new map with the monitoring beats included
613
- componentListWithMonitoring := map [string ]string {
614
- fmt .Sprintf ("beat/%s" , monitoringMetricsUnitID ): "metricbeat" ,
615
- fmt .Sprintf ("http/%s" , monitoringMetricsUnitID ): "metricbeat" ,
616
- monitoringFilesUnitsID : "filebeat" ,
617
- }
618
- for k , v := range componentIDToBinary {
619
- componentListWithMonitoring [k ] = v
620
- }
621
-
622
- for unit , binaryName := range componentListWithMonitoring {
609
+ for unit , binaryName := range componentIDToBinary {
623
610
if ! isSupportedMetricsBinary (binaryName ) {
624
611
continue
625
612
}
@@ -629,7 +616,7 @@ func (b *BeatsMonitor) injectMetricsInput(cfg map[string]interface{}, componentI
629
616
630
617
if isSupportedBeatsBinary (binaryName ) {
631
618
beatsStreams = append (beatsStreams , map [string ]interface {}{
632
- idKey : fmt . Sprintf ( "%s-" , monitoringMetricsUnitID ) + name ,
619
+ idKey : "metrics-monitoring-" + name ,
633
620
"data_stream" : map [string ]interface {}{
634
621
"type" : "metrics" ,
635
622
"dataset" : fmt .Sprintf ("elastic_agent.%s" , name ),
@@ -691,7 +678,7 @@ func (b *BeatsMonitor) injectMetricsInput(cfg map[string]interface{}, componentI
691
678
}
692
679
693
680
streams = append (streams , map [string ]interface {}{
694
- idKey : fmt . Sprintf ( "%s-%s-1" , monitoringMetricsUnitID , name ) ,
681
+ idKey : "metrics-monitoring-" + name + "-1" ,
695
682
"data_stream" : map [string ]interface {}{
696
683
"type" : "metrics" ,
697
684
"dataset" : fmt .Sprintf ("elastic_agent.%s" , fixedAgentName ),
@@ -761,7 +748,7 @@ func (b *BeatsMonitor) injectMetricsInput(cfg map[string]interface{}, componentI
761
748
if strings .EqualFold (name , "filebeat" ) {
762
749
fbDataStreamName := "filebeat_input"
763
750
streams = append (streams , map [string ]interface {}{
764
- idKey : fmt . Sprintf ( "%s-%s-1" , monitoringMetricsUnitID , name ) ,
751
+ idKey : "metrics-monitoring-" + name + "-1" ,
765
752
"data_stream" : map [string ]interface {}{
766
753
"type" : "metrics" ,
767
754
"dataset" : fmt .Sprintf ("elastic_agent.%s" , fbDataStreamName ),
@@ -845,7 +832,7 @@ func (b *BeatsMonitor) injectMetricsInput(cfg map[string]interface{}, componentI
845
832
// note: this doesn't fetch anything from the /state endpoint, as it doesn't report much beyond name/version,
846
833
// the equivalent of the beat /state metrics end up in /shipper
847
834
shipperHTTPStreams = append (shipperHTTPStreams , map [string ]interface {}{
848
- idKey : fmt . Sprintf ( "%s- shipper", monitoringMetricsUnitID ) ,
835
+ idKey : "metrics-monitoring- shipper" ,
849
836
"data_stream" : map [string ]interface {}{
850
837
"type" : "metrics" ,
851
838
"dataset" : fmt .Sprintf ("elastic_agent.%s" , name ),
@@ -859,7 +846,7 @@ func (b *BeatsMonitor) injectMetricsInput(cfg map[string]interface{}, componentI
859
846
"processors" : createProcessorsForJSONInput (name , comp .ID , monitoringNamespace , b .agentInfo ),
860
847
},
861
848
map [string ]interface {}{
862
- idKey : fmt . Sprintf ( "%s- shipper-stats", monitoringMetricsUnitID ) ,
849
+ idKey : "metrics-monitoring- shipper-stats" ,
863
850
"data_stream" : map [string ]interface {}{
864
851
"type" : "metrics" ,
865
852
"dataset" : fmt .Sprintf ("elastic_agent.%s" , name ),
@@ -877,8 +864,8 @@ func (b *BeatsMonitor) injectMetricsInput(cfg map[string]interface{}, componentI
877
864
878
865
inputs := []interface {}{
879
866
map [string ]interface {}{
880
- idKey : fmt . Sprintf ( "%s- beats", monitoringMetricsUnitID ) ,
881
- "name" : fmt . Sprintf ( "%s- beats", monitoringMetricsUnitID ) ,
867
+ idKey : "metrics-monitoring- beats" ,
868
+ "name" : "metrics-monitoring- beats" ,
882
869
"type" : "beat/metrics" ,
883
870
useOutputKey : monitoringOutput ,
884
871
"data_stream" : map [string ]interface {}{
@@ -887,8 +874,8 @@ func (b *BeatsMonitor) injectMetricsInput(cfg map[string]interface{}, componentI
887
874
"streams" : beatsStreams ,
888
875
},
889
876
map [string ]interface {}{
890
- idKey : fmt . Sprintf ( "%s- agent", monitoringMetricsUnitID ) ,
891
- "name" : fmt . Sprintf ( "%s- agent", monitoringMetricsUnitID ) ,
877
+ idKey : "metrics-monitoring- agent" ,
878
+ "name" : "metrics-monitoring- agent" ,
892
879
"type" : "http/metrics" ,
893
880
useOutputKey : monitoringOutput ,
894
881
"data_stream" : map [string ]interface {}{
@@ -901,8 +888,8 @@ func (b *BeatsMonitor) injectMetricsInput(cfg map[string]interface{}, componentI
901
888
// if we have shipper data, inject the extra inputs
902
889
if len (shipperHTTPStreams ) > 0 {
903
890
inputs = append (inputs , map [string ]interface {}{
904
- idKey : fmt . Sprintf ( "%s- shipper", monitoringMetricsUnitID ) ,
905
- "name" : fmt . Sprintf ( "%s- shipper", monitoringMetricsUnitID ) ,
891
+ idKey : "metrics-monitoring- shipper" ,
892
+ "name" : "metrics-monitoring- shipper" ,
906
893
"type" : "http/metrics" ,
907
894
useOutputKey : monitoringOutput ,
908
895
"data_stream" : map [string ]interface {}{
0 commit comments