parent
646a8a3356
commit
430ea8553b
@ -162,7 +162,7 @@ in {
|
|||||||
alloy = runTest ./alloy.nix;
|
alloy = runTest ./alloy.nix;
|
||||||
allTerminfo = runTest ./all-terminfo.nix;
|
allTerminfo = runTest ./all-terminfo.nix;
|
||||||
alps = runTest ./alps.nix;
|
alps = runTest ./alps.nix;
|
||||||
amazon-cloudwatch-agent = handleTest ./amazon-cloudwatch-agent.nix {};
|
amazon-cloudwatch-agent = runTest ./amazon-cloudwatch-agent.nix;
|
||||||
amazon-init-shell = handleTest ./amazon-init-shell.nix {};
|
amazon-init-shell = handleTest ./amazon-init-shell.nix {};
|
||||||
amazon-ssm-agent = handleTest ./amazon-ssm-agent.nix {};
|
amazon-ssm-agent = handleTest ./amazon-ssm-agent.nix {};
|
||||||
amd-sev = runTest ./amd-sev.nix;
|
amd-sev = runTest ./amd-sev.nix;
|
||||||
|
@ -1,92 +1,90 @@
|
|||||||
import ./make-test-python.nix (
|
{ pkgs, ... }:
|
||||||
{ lib, pkgs, ... }:
|
let
|
||||||
let
|
# See https://docs.aws.amazon.com/sdkref/latest/guide/file-format.html.
|
||||||
# See https://docs.aws.amazon.com/sdkref/latest/guide/file-format.html.
|
iniFormat = pkgs.formats.ini { };
|
||||||
iniFormat = pkgs.formats.ini { };
|
|
||||||
|
|
||||||
region = "ap-northeast-1";
|
region = "ap-northeast-1";
|
||||||
sharedConfigurationDefaultProfile = "default";
|
sharedConfigurationDefaultProfile = "default";
|
||||||
sharedConfigurationFile = iniFormat.generate "config" {
|
sharedConfigurationFile = iniFormat.generate "config" {
|
||||||
"${sharedConfigurationDefaultProfile}" = {
|
"${sharedConfigurationDefaultProfile}" = {
|
||||||
region = region;
|
region = region;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
sharedCredentialsFile = iniFormat.generate "credentials" {
|
};
|
||||||
"${sharedConfigurationDefaultProfile}" = {
|
sharedCredentialsFile = iniFormat.generate "credentials" {
|
||||||
aws_access_key_id = "placeholder";
|
"${sharedConfigurationDefaultProfile}" = {
|
||||||
aws_secret_access_key = "placeholder";
|
aws_access_key_id = "placeholder";
|
||||||
aws_session_token = "placeholder";
|
aws_secret_access_key = "placeholder";
|
||||||
};
|
aws_session_token = "placeholder";
|
||||||
};
|
};
|
||||||
sharedConfigurationDirectory = pkgs.runCommand ".aws" { } ''
|
};
|
||||||
mkdir $out
|
sharedConfigurationDirectory = pkgs.runCommand ".aws" { } ''
|
||||||
|
mkdir $out
|
||||||
|
|
||||||
cp ${sharedConfigurationFile} $out/config
|
cp ${sharedConfigurationFile} $out/config
|
||||||
cp ${sharedCredentialsFile} $out/credentials
|
cp ${sharedCredentialsFile} $out/credentials
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
name = "amazon-cloudwatch-agent";
|
name = "amazon-cloudwatch-agent";
|
||||||
|
|
||||||
nodes.machine =
|
nodes.machine =
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{
|
{
|
||||||
services.amazon-cloudwatch-agent = {
|
services.amazon-cloudwatch-agent = {
|
||||||
enable = true;
|
enable = true;
|
||||||
commonConfiguration = {
|
commonConfiguration = {
|
||||||
credentials = {
|
credentials = {
|
||||||
shared_credential_profile = sharedConfigurationDefaultProfile;
|
shared_credential_profile = sharedConfigurationDefaultProfile;
|
||||||
shared_credential_file = "${sharedConfigurationDirectory}/credentials";
|
shared_credential_file = "${sharedConfigurationDirectory}/credentials";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
configuration = {
|
|
||||||
agent = {
|
|
||||||
# Required despite documentation saying the agent ignores it in "onPremise" mode.
|
|
||||||
region = region;
|
|
||||||
|
|
||||||
# Show debug logs and write to a file for interactive debugging.
|
|
||||||
debug = true;
|
|
||||||
logfile = "/var/log/amazon-cloudwatch-agent/amazon-cloudwatch-agent.log";
|
|
||||||
};
|
|
||||||
logs = {
|
|
||||||
logs_collected = {
|
|
||||||
files = {
|
|
||||||
collect_list = [
|
|
||||||
{
|
|
||||||
file_path = "/var/log/amazon-cloudwatch-agent/amazon-cloudwatch-agent.log";
|
|
||||||
log_group_name = "/var/log/amazon-cloudwatch-agent/amazon-cloudwatch-agent.log";
|
|
||||||
log_stream_name = "{local_hostname}";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
traces = {
|
|
||||||
local_mode = true;
|
|
||||||
traces_collected = {
|
|
||||||
xray = { };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
mode = "onPremise";
|
|
||||||
};
|
};
|
||||||
|
configuration = {
|
||||||
|
agent = {
|
||||||
|
# Required despite documentation saying the agent ignores it in "onPremise" mode.
|
||||||
|
region = region;
|
||||||
|
|
||||||
# Keep the runtime directory for interactive debugging.
|
# Show debug logs and write to a file for interactive debugging.
|
||||||
systemd.services.amazon-cloudwatch-agent.serviceConfig.RuntimeDirectoryPreserve = true;
|
debug = true;
|
||||||
|
logfile = "/var/log/amazon-cloudwatch-agent/amazon-cloudwatch-agent.log";
|
||||||
|
};
|
||||||
|
logs = {
|
||||||
|
logs_collected = {
|
||||||
|
files = {
|
||||||
|
collect_list = [
|
||||||
|
{
|
||||||
|
file_path = "/var/log/amazon-cloudwatch-agent/amazon-cloudwatch-agent.log";
|
||||||
|
log_group_name = "/var/log/amazon-cloudwatch-agent/amazon-cloudwatch-agent.log";
|
||||||
|
log_stream_name = "{local_hostname}";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
traces = {
|
||||||
|
local_mode = true;
|
||||||
|
traces_collected = {
|
||||||
|
xray = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
mode = "onPremise";
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
# Keep the runtime directory for interactive debugging.
|
||||||
start_all()
|
systemd.services.amazon-cloudwatch-agent.serviceConfig.RuntimeDirectoryPreserve = true;
|
||||||
|
};
|
||||||
|
|
||||||
machine.wait_for_unit("amazon-cloudwatch-agent.service")
|
testScript = ''
|
||||||
|
start_all()
|
||||||
|
|
||||||
machine.wait_for_file("/run/amazon-cloudwatch-agent/amazon-cloudwatch-agent.pid")
|
machine.wait_for_unit("amazon-cloudwatch-agent.service")
|
||||||
machine.wait_for_file("/run/amazon-cloudwatch-agent/amazon-cloudwatch-agent.toml")
|
|
||||||
# "config-translator" omits this file if no trace configurations are specified.
|
machine.wait_for_file("/run/amazon-cloudwatch-agent/amazon-cloudwatch-agent.pid")
|
||||||
#
|
machine.wait_for_file("/run/amazon-cloudwatch-agent/amazon-cloudwatch-agent.toml")
|
||||||
# See https://github.com/aws/amazon-cloudwatch-agent/issues/1320.
|
# "config-translator" omits this file if no trace configurations are specified.
|
||||||
machine.wait_for_file("/run/amazon-cloudwatch-agent/amazon-cloudwatch-agent.yaml")
|
#
|
||||||
machine.wait_for_file("/run/amazon-cloudwatch-agent/env-config.json")
|
# See https://github.com/aws/amazon-cloudwatch-agent/issues/1320.
|
||||||
'';
|
machine.wait_for_file("/run/amazon-cloudwatch-agent/amazon-cloudwatch-agent.yaml")
|
||||||
}
|
machine.wait_for_file("/run/amazon-cloudwatch-agent/env-config.json")
|
||||||
)
|
'';
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user