Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,642 changes: 1,792 additions & 850 deletions integration-test/env/Extension/bin/VMWatch/NOTICE.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration-test/env/Extension/bin/VMWatch/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.02515.47-official-aa92e8d0
1.0.02564.63-official-aaf5f909
38 changes: 30 additions & 8 deletions integration-test/env/Extension/bin/VMWatch/vmwatch.conf
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
## The logfile will be rotated after the time interval specified. When set
## to 0 no time based rotation is performed. Logs are rotated only when
## written to, if there is no log activity rotation may be delayed.
# logfile_rotation_interval = "0h"
logfile_rotation_interval = "60s"

## The logfile will be rotated when it becomes larger than the specified
## size. When set to 0 no size based rotation is performed.
Expand Down Expand Up @@ -112,47 +112,69 @@

[[inputs.outbound_connectivity]]
interval = "${OUTBOUND_CONNECTIVITY_INTERVAL:-180s}"
name_suffix = "${OUTBOUND_CONNECTIVITY_NAME_SUFFIX:-}"
urls = "${OUTBOUND_CONNECTIVITY_URLS:-http://www.msftconnecttest.com/connecttest.txt}"
timeout_in_milliseconds = ${OUTBOUND_CONNECTIVITY_TIMEOUT_IN_MILLISECONDS:-30000}

[[inputs.disk_io]]
interval = "${DISK_IO_INTERVAL:-180s}"
drives = "${DISK_IO_DRIVES:-}"
fileName = "${DISK_IO_FILENAME:-}"
name_suffix = "${DISK_IO_NAME_SUFFIX:-}"
mount_points = "${DISK_IO_MOUNT_POINTS:-}"
ignore_file_system_list = "${DISK_IO_IGNORE_FS_LIST:-tmpfs,devtmpfs,devfs,iso9660,overlay,aufs,squashfs,autofs}"
file_name = "${DISK_IO_FILENAME:-}"

[[inputs.simple]]
interval = "${SIMPLE_INTERVAL:-10s}"
name_suffix = "${SIMPLE_NAME_SUFFIX:-}"
ok = ${SIMPLE_OK:-false}

[[inputs.az_storage_blob]]
interval = "${AZ_STORAGE_BLOB_INTERVAL:-180s}"
name_suffix = "${AZ_STORAGE_BLOB_NAME_SUFFIX:-}"
storage_account_name = "${AZ_STORAGE_ACCOUNT_NAME:-xstoreverifier}"
container_name = "${AZ_STORAGE_CONTAINER_NAME:-xstoreverifier}"
blob_name = "${AZ_BLOB_NAME:-VMAAgentTestBlobNew.txt}"
sas_token_base64 = "${AZ_STORAGE_SAS_TOKEN_BASE64:-c3A9ciZzdD0yMDIxLTA4LTAyVDIwOjEyOjExWiZzZT0yMDk5LTA4LTAzVDA0OjEyOjExWiZzcHI9aHR0cHMmc3Y9MjAyMC0wOC0wNCZzcj1iJnNpZz10aXBBUjV0dXN6N044N1IxWGpra1M4bWlrUHZma3RHMmtVZWo3MmRCVDdFJTNE}"

[[inputs.clockskew]]
interval = "${CLOCK_SKEW_INTERVAL:-180s}"
name_suffix = "${CLOCK_SKEW_NAME_SUFFIX:-}"
ntp_server = "${CLOCK_SKEW_NTP_SERVER:-time.windows.com}"
time_skew_threshold_in_seconds = ${CLOCK_SKEW_TIME_SKEW_THRESHOLD_IN_SECONDS:-5.0}

[[inputs.process]]
interval = "${PROCESS_INTERVAL:-180s}"
name_suffix = "${PROCESS_NAME_SUFFIX:-}"
timeout = "${PROCESS_TIMEOUT:-10s}"

[[inputs.process_monitor]]
interval = "${PROCESS_MONITOR_INTERVAL:-180s}"
name_suffix = "${PROCESS_MONITOR_NAME_SUFFIX:-}"
process_names = "${PROCESS_MONITOR_PROCESS_NAMES:-}"

[[inputs.test]]
interval = "${TEST_INTERVAL:-1s}"
name_suffix = "${TEST_NAME_SUFFIX:-}"
exit_process = ${TEST_EXIT_PROCESS:-false}
allocate_memory = ${TEST_ALLOCATE_MEMORY:-false}
high_cpu = ${TEST_HIGH_CPU:-false}

[[inputs.dns]]
interval = "${DNS_INTERVAL:-180s}"
name_suffix = "${DNS_NAME_SUFFIX:-}"
dns_names = "${DNS_NAMES:-www.msftconnecttest.com}"

[[aggregators.signal_aggregator]]
period = "${SIGNAL_AGGREGATION_INTERVAL:-300s}"
[[aggregators.check_aggregator]]
period = "${CHECK_AGGREGATION_INTERVAL:-300s}"
drop_original = true
[aggregators.check_aggregator.tagpass]
EventLevel = ["Check"]

[[aggregators.metric_aggregator]]
period = "${METRIC_AGGREGATION_INTERVAL:-300s}"
drop_original = true
[aggregators.metric_aggregator.tagpass]
EventLevel = ["Metric"]

# Send telegraf metrics to file(s)
[[outputs.file]]
Expand All @@ -164,7 +186,7 @@
## Use batch serialization format instead of line based delimiting. The
## batch format allows for the production of non line based output formats and
## may more efficiently encode and write metrics.
use_batch_format = true
use_batch_format = false

## The file will be rotated after the time interval specified. When set
## to 0 no time based rotation is performed.
Expand All @@ -180,7 +202,7 @@
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
data_format = "json"
json_timestamp_format = "2006-01-02T15:04:05Z07:00"
json_nested_fields_include = ["RuntimeParameters", "Errors"]
json_nested_fields_include = ["RuntimeParameters", "Errors", "Stats"]
json_transformation = '''
metrics.$merge([{"Timestamp": timestamp, "Message": $string( $merge([{"Name": name}, fields]) )}, tags])
$merge([{"Timestamp": timestamp, "Message": $string( $merge([{"Name": name}, fields]) )}, tags])
'''
Binary file modified integration-test/env/Extension/bin/VMWatch/vmwatch_linux_amd64
Binary file not shown.
Binary file modified integration-test/env/Extension/bin/VMWatch/vmwatch_linux_arm64
Binary file not shown.
18 changes: 10 additions & 8 deletions main/handlersettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,19 @@ func (h handlerSettings) validate() error {
}

type vmWatchSignalFilters struct {
EnabledTags []string `json:"enabledTags,array"`
DisabledTags []string `json:"disabledTags,array"`
EnabledOptionalSignals []string `json:"enabledOptionalSignals,array"`
DisabledSignals []string `json:"disabledSignals,array"`
EnabledTags []string `json:"enabledTags,array"`
DisabledTags []string `json:"disabledTags,array"`
EnabledOptionalSignals []string `json:"enabledOptionalSignals,array"`
DisabledSignals []string `json:"disabledSignals,array"`
}

type vmWatchSettings struct {
Enabled bool `json:"enabled,boolean"`
SignalFilters *vmWatchSignalFilters `json:"signalFilters"`
ParameterOverrides map[string]interface{} `json:"parameterOverrides,object"`
EnvironmentAttributes map[string]interface{} `json:"environmentAttributes,object"`
Enabled bool `json:"enabled,boolean"`
SignalFilters *vmWatchSignalFilters `json:"signalFilters"`
ParameterOverrides map[string]interface{} `json:"parameterOverrides,object"`
EnvironmentAttributes map[string]interface{} `json:"environmentAttributes,object"`
GlobalConfigUrl string `json:"globalConfigUrl,string"`
DisableConfigReader bool `json:"disableConfigReader,boolean"`
}

// publicSettings is the type deserialized from public configuration section of
Expand Down
9 changes: 9 additions & 0 deletions main/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ const (
"description": "Optional - environment attributes (eg OutboundConnectivityEnabled : true)",
"type": "object",
"default": {}
},
"globalConfigUrl": {
"description": "Optional - specify global config url to download vmwatch configuration from",
"type": "string"
},
"disableConfigReader": {
"description": "Optional - flag to disable config reader",
"type": "boolean",
"default": false
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions main/vmWatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os/exec"
"path/filepath"
"sort"
"strconv"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -37,6 +38,9 @@ const (
const (
AllowVMWatchCgroupAssignmentFailureVariableName string = "ALLOW_VMWATCH_CGROUP_ASSIGNMENT_FAILURE"
RunningInDevContainerVariableName string = "RUNNING_IN_DEV_CONTAINER"
AppHealthExecutionEnvironmentProd string = "Prod"
AppHealthExecutionEnvironmentTest string = "Test"
AppHealthPublisherNameTest string = "Microsoft.ManagedServices.Edp"
)

func (p VMWatchStatus) GetStatusType() StatusType {
Expand Down Expand Up @@ -223,6 +227,7 @@ func setupVMWatchCommand(s *vmWatchSettings, hEnv HandlerEnvironment) (*exec.Cmd
args := []string{"--config", GetVMWatchConfigFullPath(processDirectory)}
args = append(args, "--debug")
args = append(args, "--heartbeat-file", GetVMWatchHeartbeatFilePath(hEnv))
args = append(args, "--execution-environment", GetExecutionEnvironment(hEnv))

if s.SignalFilters != nil {
if s.SignalFilters.DisabledSignals != nil && len(s.SignalFilters.DisabledSignals) > 0 {
Expand All @@ -246,6 +251,12 @@ func setupVMWatchCommand(s *vmWatchSettings, hEnv HandlerEnvironment) (*exec.Cmd
}
}

if len(strings.TrimSpace(s.GlobalConfigUrl)) > 0 {
args = append(args, "--global-config-url", s.GlobalConfigUrl)
}

args = append(args, "--disable-config-reader", strconv.FormatBool(s.DisableConfigReader))

if s.EnvironmentAttributes != nil {
if len(s.EnvironmentAttributes) > 0 {
args = append(args, "--env-attributes")
Expand Down Expand Up @@ -351,6 +362,13 @@ func GetVMWatchHeartbeatFilePath(hEnv HandlerEnvironment) string {
return filepath.Join(hEnv.HandlerEnvironment.LogFolder, "vmwatch-heartbeat.txt")
}

func GetExecutionEnvironment(hEnv HandlerEnvironment) string {
if strings.Contains(hEnv.HandlerEnvironment.LogFolder, AppHealthPublisherNameTest) {
return AppHealthExecutionEnvironmentTest
}
return AppHealthExecutionEnvironmentProd
}

func GetVMWatchConfigFullPath(processDirectory string) string {
return filepath.Join(processDirectory, "VMWatch", VMWatchConfigFileName)
}
Expand Down