nixos/grafana-agent: remove (#395514)
This commit is contained in:
commit
8159a40eef
@ -54,6 +54,12 @@
|
||||
- [testers.shellcheck](https://nixos.org/manual/nixpkgs/unstable/#tester-shellcheck) now warns when `name` is not provided.
|
||||
The `name` argument will become mandatory in a future release.
|
||||
|
||||
- `grafana-agent` and `services.grafana-agent` have been removed in favor of
|
||||
Grafana Alloy (`grafana-alloy` and `services.alloy`), as they depend on an EOL compiler version
|
||||
and will become EOL during the 25.05 lifecycle.
|
||||
Grafana recommends migrating to `grafana-alloy` (`services.alloy`).
|
||||
See https://grafana.com/docs/alloy/latest/set-up/migrate/ for details.
|
||||
|
||||
- `xdragon` package has been renamed to `dragon-drop`.
|
||||
`xdragon` is an alias to `dragon-drop` and the package still provides `bin/xdragon`.
|
||||
`bin/dragon` is no longer supplied.
|
||||
|
@ -949,7 +949,6 @@
|
||||
./services/monitoring/glances.nix
|
||||
./services/monitoring/glpi-agent.nix
|
||||
./services/monitoring/goss.nix
|
||||
./services/monitoring/grafana-agent.nix
|
||||
./services/monitoring/grafana-image-renderer.nix
|
||||
./services/monitoring/grafana-reporter.nix
|
||||
./services/monitoring/grafana-to-ntfy.nix
|
||||
|
@ -143,6 +143,13 @@ in
|
||||
] "The fourStoreEndpoint module has been removed")
|
||||
(mkRemovedOptionModule [ "services" "fprot" ] "The corresponding package was removed from nixpkgs.")
|
||||
(mkRemovedOptionModule [ "services" "frab" ] "The frab module has been removed")
|
||||
(mkRemovedOptionModule
|
||||
[
|
||||
"services"
|
||||
"grafana-agent"
|
||||
]
|
||||
"The grafana-agent module has been removed. Consider migrating to `grafana-alloy` (`services.alloy.enable`). See <https://grafana.com/docs/alloy/latest/set-up/migrate/>"
|
||||
)
|
||||
(mkRemovedOptionModule [ "services" "homeassistant-satellite" ]
|
||||
"The `services.homeassistant-satellite` module has been replaced by `services.wyoming-satellite`."
|
||||
)
|
||||
|
@ -1,180 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
generators,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.grafana-agent;
|
||||
settingsFormat = pkgs.formats.yaml { };
|
||||
configFile = settingsFormat.generate "grafana-agent.yaml" cfg.settings;
|
||||
in
|
||||
{
|
||||
meta = {
|
||||
maintainers = with lib.maintainers; [
|
||||
flokli
|
||||
zimbatm
|
||||
];
|
||||
};
|
||||
|
||||
options.services.grafana-agent = {
|
||||
enable = lib.mkEnableOption "grafana-agent";
|
||||
|
||||
package = lib.mkPackageOption pkgs "grafana-agent" { };
|
||||
|
||||
credentials = lib.mkOption {
|
||||
description = ''
|
||||
Credentials to load at service startup. Keys that are UPPER_SNAKE will be loaded as env vars. Values are absolute paths to the credentials.
|
||||
'';
|
||||
type = lib.types.attrsOf lib.types.str;
|
||||
default = { };
|
||||
|
||||
example = {
|
||||
logs_remote_write_password = "/run/keys/grafana_agent_logs_remote_write_password";
|
||||
LOGS_REMOTE_WRITE_URL = "/run/keys/grafana_agent_logs_remote_write_url";
|
||||
LOGS_REMOTE_WRITE_USERNAME = "/run/keys/grafana_agent_logs_remote_write_username";
|
||||
metrics_remote_write_password = "/run/keys/grafana_agent_metrics_remote_write_password";
|
||||
METRICS_REMOTE_WRITE_URL = "/run/keys/grafana_agent_metrics_remote_write_url";
|
||||
METRICS_REMOTE_WRITE_USERNAME = "/run/keys/grafana_agent_metrics_remote_write_username";
|
||||
};
|
||||
};
|
||||
|
||||
extraFlags = lib.mkOption {
|
||||
type = with lib.types; listOf str;
|
||||
default = [ ];
|
||||
example = [
|
||||
"-enable-features=integrations-next"
|
||||
"-disable-reporting"
|
||||
];
|
||||
description = ''
|
||||
Extra command-line flags passed to {command}`grafana-agent`.
|
||||
|
||||
See <https://grafana.com/docs/agent/latest/static/configuration/flags/>
|
||||
'';
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
description = ''
|
||||
Configuration for {command}`grafana-agent`.
|
||||
|
||||
See <https://grafana.com/docs/agent/latest/configuration/>
|
||||
'';
|
||||
|
||||
type = lib.types.submodule {
|
||||
freeformType = settingsFormat.type;
|
||||
};
|
||||
|
||||
default = { };
|
||||
defaultText = lib.literalExpression ''
|
||||
{
|
||||
metrics = {
|
||||
wal_directory = "\''${STATE_DIRECTORY}";
|
||||
global.scrape_interval = "5s";
|
||||
};
|
||||
integrations = {
|
||||
agent.enabled = true;
|
||||
agent.scrape_integration = true;
|
||||
node_exporter.enabled = true;
|
||||
};
|
||||
}
|
||||
'';
|
||||
example = {
|
||||
metrics.global.remote_write = [
|
||||
{
|
||||
url = "\${METRICS_REMOTE_WRITE_URL}";
|
||||
basic_auth.username = "\${METRICS_REMOTE_WRITE_USERNAME}";
|
||||
basic_auth.password_file = "\${CREDENTIALS_DIRECTORY}/metrics_remote_write_password";
|
||||
}
|
||||
];
|
||||
logs.configs = [
|
||||
{
|
||||
name = "default";
|
||||
scrape_configs = [
|
||||
{
|
||||
job_name = "journal";
|
||||
journal = {
|
||||
max_age = "12h";
|
||||
labels.job = "systemd-journal";
|
||||
};
|
||||
relabel_configs = [
|
||||
{
|
||||
source_labels = [ "__journal__systemd_unit" ];
|
||||
target_label = "systemd_unit";
|
||||
}
|
||||
{
|
||||
source_labels = [ "__journal__hostname" ];
|
||||
target_label = "nodename";
|
||||
}
|
||||
{
|
||||
source_labels = [ "__journal_syslog_identifier" ];
|
||||
target_label = "syslog_identifier";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
positions.filename = "\${STATE_DIRECTORY}/loki_positions.yaml";
|
||||
clients = [
|
||||
{
|
||||
url = "\${LOGS_REMOTE_WRITE_URL}";
|
||||
basic_auth.username = "\${LOGS_REMOTE_WRITE_USERNAME}";
|
||||
basic_auth.password_file = "\${CREDENTIALS_DIRECTORY}/logs_remote_write_password";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.grafana-agent.settings = {
|
||||
# keep this in sync with config.services.grafana-agent.settings.defaultText.
|
||||
metrics = {
|
||||
wal_directory = lib.mkDefault "\${STATE_DIRECTORY}";
|
||||
global.scrape_interval = lib.mkDefault "5s";
|
||||
};
|
||||
integrations = {
|
||||
agent.enabled = lib.mkDefault true;
|
||||
agent.scrape_integration = lib.mkDefault true;
|
||||
node_exporter.enabled = lib.mkDefault true;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.grafana-agent = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = ''
|
||||
set -euo pipefail
|
||||
shopt -u nullglob
|
||||
|
||||
# Load all credentials into env if they are in UPPER_SNAKE form.
|
||||
if [[ -n "''${CREDENTIALS_DIRECTORY:-}" ]]; then
|
||||
for file in "$CREDENTIALS_DIRECTORY"/*; do
|
||||
key=$(basename "$file")
|
||||
if [[ $key =~ ^[A-Z0-9_]+$ ]]; then
|
||||
echo "Environ $key"
|
||||
export "$key=$(< "$file")"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# We can't use Environment=HOSTNAME=%H, as it doesn't include the domain part.
|
||||
export HOSTNAME=$(< /proc/sys/kernel/hostname)
|
||||
|
||||
exec ${lib.getExe cfg.package} -config.expand-env -config.file ${configFile} ${lib.escapeShellArgs cfg.extraFlags}
|
||||
'';
|
||||
serviceConfig = {
|
||||
Restart = "always";
|
||||
DynamicUser = true;
|
||||
RestartSec = 2;
|
||||
SupplementaryGroups = [
|
||||
# allow to read the systemd journal for loki log forwarding
|
||||
"systemd-journal"
|
||||
];
|
||||
StateDirectory = "grafana-agent";
|
||||
LoadCredential = lib.mapAttrsToList (key: value: "${key}:${value}") cfg.credentials;
|
||||
Type = "simple";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -546,7 +546,6 @@ in
|
||||
gotify-server = handleTest ./gotify-server.nix { };
|
||||
gotosocial = runTest ./web-apps/gotosocial.nix;
|
||||
grafana = handleTest ./grafana { };
|
||||
grafana-agent = handleTest ./grafana-agent.nix { };
|
||||
graphite = handleTest ./graphite.nix { };
|
||||
grav = runTest ./web-apps/grav.nix;
|
||||
graylog = handleTest ./graylog.nix { };
|
||||
|
@ -1,34 +0,0 @@
|
||||
import ./make-test-python.nix (
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
nodes = {
|
||||
machine = {
|
||||
services.grafana-agent = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
name = "grafana-agent";
|
||||
|
||||
meta = with lib.maintainers; {
|
||||
maintainers = [ zimbatm ];
|
||||
};
|
||||
|
||||
inherit nodes;
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
with subtest("Grafana-agent is running"):
|
||||
machine.wait_for_unit("grafana-agent.service")
|
||||
machine.wait_for_open_port(12345)
|
||||
machine.succeed(
|
||||
"curl -sSfN http://127.0.0.1:12345/-/healthy"
|
||||
)
|
||||
machine.shutdown()
|
||||
'';
|
||||
}
|
||||
)
|
@ -1,136 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
fetchYarnDeps,
|
||||
fixup-yarn-lock,
|
||||
grafana-agent,
|
||||
nix-update-script,
|
||||
nixosTests,
|
||||
nodejs,
|
||||
stdenv,
|
||||
systemd,
|
||||
testers,
|
||||
yarn,
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "grafana-agent";
|
||||
version = "0.44.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "grafana";
|
||||
repo = "agent";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-dAfiTJ0DlChriYOl/bPCEHj/UpbZ2a8BZBCQ82H+O9I=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-6nXUeRpaezzfRykqMCtwP0FQZchRdxLmtupVAMNAjmY=";
|
||||
proxyVendor = true; # darwin/linux hash mismatch
|
||||
|
||||
frontendYarnOfflineCache = fetchYarnDeps {
|
||||
yarnLock = src + "/internal/web/ui/yarn.lock";
|
||||
hash = "sha256-uqKOGSEnR9CU4vlahldrLxDb3z7Yt1DebyRB91NQMRc=";
|
||||
};
|
||||
|
||||
ldflags =
|
||||
let
|
||||
prefix = "github.com/grafana/agent/internal/build";
|
||||
in
|
||||
[
|
||||
"-s"
|
||||
"-w"
|
||||
# https://github.com/grafana/agent/blob/v0.44.2/Makefile#L132-L137
|
||||
"-X ${prefix}.Version=${version}"
|
||||
"-X ${prefix}.Branch=v${version}"
|
||||
"-X ${prefix}.Revision=v${version}"
|
||||
"-X ${prefix}.BuildUser=nix"
|
||||
"-X ${prefix}.BuildDate=1980-01-01T00:00:00Z"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
fixup-yarn-lock
|
||||
nodejs
|
||||
yarn
|
||||
];
|
||||
|
||||
tags = [
|
||||
"builtinassets"
|
||||
"nonetwork"
|
||||
"nodocker"
|
||||
"promtail_journal_enabled"
|
||||
];
|
||||
|
||||
subPackages = [
|
||||
"cmd/grafana-agent"
|
||||
"cmd/grafana-agentctl"
|
||||
"internal/web/ui"
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
export HOME="$TMPDIR"
|
||||
|
||||
pushd internal/web/ui
|
||||
fixup-yarn-lock yarn.lock
|
||||
yarn config --offline set yarn-offline-mirror $frontendYarnOfflineCache
|
||||
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
|
||||
patchShebangs node_modules
|
||||
yarn --offline run build
|
||||
popd
|
||||
'';
|
||||
|
||||
# do not pass preBuild to go-modules.drv, as it would otherwise fail to build.
|
||||
# but even if it would work, it simply isn't needed in that scope.
|
||||
overrideModAttrs = (
|
||||
_: {
|
||||
preBuild = null;
|
||||
}
|
||||
);
|
||||
|
||||
# uses go-systemd, which uses libsystemd headers
|
||||
# https://github.com/coreos/go-systemd/issues/351
|
||||
env.NIX_CFLAGS_COMPILE = toString (
|
||||
lib.optionals stdenv.hostPlatform.isLinux [ "-I${lib.getDev systemd}/include" ]
|
||||
);
|
||||
|
||||
# go-systemd uses libsystemd under the hood, which does dlopen(libsystemd) at
|
||||
# runtime.
|
||||
# Add to RUNPATH so it can be found.
|
||||
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
patchelf \
|
||||
--set-rpath "${
|
||||
lib.makeLibraryPath [ (lib.getLib systemd) ]
|
||||
}:$(patchelf --print-rpath $out/bin/grafana-agent)" \
|
||||
$out/bin/grafana-agent
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
tests = {
|
||||
inherit (nixosTests) grafana-agent;
|
||||
version = testers.testVersion {
|
||||
inherit version;
|
||||
command = "${lib.getExe grafana-agent} --version";
|
||||
package = grafana-agent;
|
||||
};
|
||||
};
|
||||
updateScript = nix-update-script { };
|
||||
# alias for nix-update to be able to find and update this attribute
|
||||
offlineCache = frontendYarnOfflineCache;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Lightweight subset of Prometheus and more, optimized for Grafana Cloud";
|
||||
license = lib.licenses.asl20;
|
||||
homepage = "https://grafana.com/products/cloud";
|
||||
changelog = "https://github.com/grafana/agent/blob/${src.rev}/CHANGELOG.md";
|
||||
maintainers = with lib.maintainers; [
|
||||
flokli
|
||||
emilylange
|
||||
];
|
||||
mainProgram = "grafana-agent";
|
||||
# Breaks with Go 1.23: https://github.com/grafana/agent/issues/6972
|
||||
# Binary panics at runtime with:
|
||||
# 'panic: pattern "GET /debug/pprof/" (registered at net/http/pprof/pprof.go:100) conflicts with pattern "/debug/pprof/delta_heap"'
|
||||
broken = true;
|
||||
};
|
||||
}
|
@ -747,6 +747,7 @@ mapAliases {
|
||||
gobby5 = throw "'gobby5' has been renamed to/replaced by 'gobby'"; # Converted to throw 2024-10-17
|
||||
gradle_6 = throw "Gradle 6 has been removed, as it is end-of-life (https://endoflife.date/gradle) and has many vulnerabilities that are not resolved until Gradle 7."; # Added 2024-10-30
|
||||
gradle_6-unwrapped = throw "Gradle 6 has been removed, as it is end-of-life (https://endoflife.date/gradle) and has many vulnerabilities that are not resolved until Gradle 7."; # Added 2024-10-30
|
||||
grafana-agent = throw "'grafana-agent' has been removed, as it only works with an EOL compiler and will become EOL during the 25.05 release. Consider migrating to 'grafana-alloy' instead"; # Added 2025-04-02
|
||||
|
||||
#godot
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user