add the egress log dashboard
This commit is contained in:
parent
fd2861c097
commit
700279026f
1 changed files with 327 additions and 3 deletions
|
|
@ -452,6 +452,27 @@ let
|
|||
]
|
||||
&& lib.all (m: lib.hasInfix "\"${m}\"" recorded) queried;
|
||||
}
|
||||
{
|
||||
# The egress board ships, and the `extract` pattern its queries use is the
|
||||
# field layout of the `would_deny` line squid logs: a changed `logformat`
|
||||
# is a board of empty panels.
|
||||
name = "the egress dashboard ships, and reads the field layout of squid's would_deny log line";
|
||||
ok =
|
||||
let
|
||||
provider = lib.head grafanaWithAuthelia.containers.swarm-grafana.config.services.grafana.provision.dashboards.settings.providers;
|
||||
shipped = lib.attrNames provider.options.path.entries;
|
||||
board = builtins.fromJSON (builtins.readFile ../host-modules/swarm-grafana/dashboards/egress.json);
|
||||
exprs = lib.concatMap (p: map (t: t.expr or "") (p.targets or [ ])) board.panels;
|
||||
pattern = "would_deny user=<agent> method=<method> host=<dest> port=<port> result=<result>";
|
||||
agentVar = lib.findFirst (v: v.name == "agent") null board.templating.list;
|
||||
squid = builtins.readFile ../host-modules/hive-squid.nix;
|
||||
in
|
||||
lib.elem "egress.json" shipped
|
||||
&& lib.length (lib.filter (e: lib.hasInfix pattern e) exprs) == 5
|
||||
&& agentVar != null
|
||||
&& lib.hasInfix pattern agentVar.query.query
|
||||
&& lib.hasInfix "logformat would_deny would_deny user=%[un method=%rm host=%>rd port=%>rP result=" squid;
|
||||
}
|
||||
{
|
||||
# The standing check on the collector's PRIORITY mapping — whether a line
|
||||
# ever reaches the log store carrying no severity. It is shipped config
|
||||
|
|
|
|||
Loading…
Reference in a new issue