-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
amazon-cloudwatch-agent: init at 1.300049.1 #337212
amazon-cloudwatch-agent: init at 1.300049.1 #337212
Conversation
Tried writing the service module and it seems like this might be a little complicated. The following doesn't work: { lib, pkgs, config, ... }:
let
cfg = config.services.amazon-cloudwatch-agent;
in
{
options.services.amazon-cloudwatch-agent = {
enable = lib.mkEnableOption "amazon-cloudwatch-agent";
package = lib.mkPackageOption pkgs "amazon-cloudwatch-agent" { };
settings = lib.mkOption {
type = types.submodule {
freeformType = (pkgs.formats.json { }).type;
};
default = { };
description = ''
Amazon CloudWatch Agent configuration. See
<https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html>
for supported values.
'';
};
};
# See https://github.com/aws/amazon-cloudwatch-agent/blob/v1.300045.0/packaging/dependencies/amazon-cloudwatch-agent.service.
config = lib.mkIf cfg.enable {
systemd.services.amazon-cloudwatch-agent = {
description = "Amazon CloudWatch Agent";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
# TODO: "start-amazon-cloudwatch-agent" assumes the agent is installed at "/opt/aws/amazon-cloudwatch-agent".
#
# It's inconvenient to use "amazon-cloudwatch-agent" directly since "start-amazon-cloudwatch-agent" calls
# "config-translator" to translate the JSON configuration into separate TOML (for CloudWatch Logs + Metrics)
# and YAML (for X-Ray traces) configuration files. This doesn't seem to be a 1:1 transformation.
ExecStart = "${cfg.package}/bin/start-amazon-cloudwatch-agent";
KillMode = "process";
Restart = "on-failure";
RestartSec = "60s";
};
};
};
environment.etc."amazon-cloudwatch-agent/amazon-cloudwatch-agent.json".text = toJSON cfg.settings;
} The problem is https://github.com/aws/amazon-cloudwatch-agent/blob/v1.300045.0/tool/paths/paths_unix.go#L12
These don't seem to be 1:1 translations either (there may be some key renames). We'll probably need to ask upstream to provide the following options:
Alternatively, they might want to have Going to swap this PR to a draft in the meanwhile. |
Opened an issue upstream about aws/amazon-cloudwatch-agent#1319 We might be able to get away with using ${cfg.package}/bin/config-translator \
-input /etc/amazon-cloudwatch-agent/amazon-cloudwatch-agent.json \
-input-dir /etc/amazon-cloudwatch-agent/amazon-cloudwatch-agent.d \
-mode auto \
-output /run/amazon-cloudwatch-agent/amazon-cloudwatch-agent.toml Then we'll make ${cfg.package}/bin/amazon-cloudwatch-agent \
-config /run/amazon-cloudwatch-agent/amazon-cloudwatch-agent.toml \
-envconfig /run/amazon-cloudwatch-agent/env-config.json \
-otelconfig /run/amazon-cloudwatch-agent/amazon-cloudwatch-agent.yaml \
-pidfile /run/amazon-cloudwatch-agent/amazon-cloudwatch-agent.pid |
d6a58a3
to
417c268
Compare
3efb2a8
to
9caa0fd
Compare
9caa0fd
to
86905fe
Compare
Added the system service. Need to figure out how to test this in a VM now. |
86905fe
to
3f5ab94
Compare
1d850ea
to
6b5c96b
Compare
We'll stick with the current version in the MR (1.300047.0) then given that 1.300048.1 is mostly feature additions with a minor bug fix. As for soliciting a review, the only place I know of is the review request mega-thread in Discourse. If there's another avenue for doing so like a Matrix room, please share this PR there as well. If the reviewer with write permissions asks for changes, I'll also bump the version as well since we'll need to wait for another full OfBorg eval anyways. |
Posted to the Nixpkgs Review Requests channel in Matrix. |
Still no bites. Need to rebase anyways to fix a merge conflict with the release notes. Will bump the version as well. |
af8871c
to
1438c4c
Compare
1438c4c
to
defa3f2
Compare
defa3f2
to
36e7d18
Compare
36e7d18
to
37cd2b9
Compare
Looks like we're stuck waiting for an aarch64-darwin OfBorg runner again. Going to bump to 1.300049.1 since it has some important enhancements and bug fixes. Given that there's no aarch64-darwin tests and I've already tested build on an M2 Mac, we should be good to merge once all of the Linux tests pass. |
37cd2b9
to
1201648
Compare
1201648
to
c4aef4c
Compare
c4aef4c
to
3d0e315
Compare
OfBorg Linux checks passed. Good to merge. |
Description of changes
Initialize amazon-cloudwatch-agent at 1.300049.1.
This is commonly deployed alongside applications run on Amazon Web Services compute (e.g. EC2, Fargate).
Fixes #6848.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.