feat: Added grafana other devices
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
nixd
|
||||
nil
|
||||
@@ -43,6 +44,13 @@
|
||||
reveal_target = "center";
|
||||
}
|
||||
];
|
||||
"space f g" = [
|
||||
"task::Spawn"
|
||||
{
|
||||
task_name = "file_manager";
|
||||
reveal_target = "center";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
{
|
||||
@@ -119,21 +127,34 @@
|
||||
userTasks = [
|
||||
{
|
||||
label = "file_finder";
|
||||
command = "${lib.getExe pkgs.zed-editor} \"$(tv files)\"";
|
||||
command = "${lib.getExe pkgs.zed-editor} \"$(${lib.getExe pkgs.television} files)\"";
|
||||
hide = "always";
|
||||
allow_concurrent_runs = true;
|
||||
use_new_terminal = true;
|
||||
}
|
||||
{
|
||||
label = "live_grep";
|
||||
command = "tv text | read -alz res; and ${lib.getExe pkgs.zed-editor} $res";
|
||||
command = "${lib.getExe pkgs.television} text | read -alz res; and ${lib.getExe pkgs.zed-editor} $res";
|
||||
hide = "always";
|
||||
allow_concurrent_runs = false;
|
||||
use_new_terminal = false;
|
||||
shell = {
|
||||
with_arguments = {
|
||||
program = "fish";
|
||||
args = ["--no-config"];
|
||||
args = [ "--no-config" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
{
|
||||
label = "file_manager";
|
||||
command = "${lib.getExe pkgs.yazi} --chooser-file /dev/stdout | read -alz res;and ${lib.getExe pkgs.zed-editor} $res";
|
||||
hide = "always";
|
||||
allow_concurrent_runs = false;
|
||||
use_new_terminal = false;
|
||||
shell = {
|
||||
with_arguments = {
|
||||
program = "fish";
|
||||
args = [ "--no-config" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
lib,
|
||||
device,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
inputs.nix-index-database.homeModules.nix-index
|
||||
../modules
|
||||
@@ -23,7 +24,9 @@
|
||||
};
|
||||
|
||||
programs = {
|
||||
home-manager = {enable = true;};
|
||||
home-manager = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
fonts.fontconfig.enable = true;
|
||||
@@ -31,16 +34,12 @@
|
||||
home = {
|
||||
username = device.user;
|
||||
homeDirectory =
|
||||
if device.isDarwin
|
||||
then lib.mkForce "/Users/${device.user}"
|
||||
else lib.mkForce "/home/${device.user}";
|
||||
if device.isDarwin then lib.mkForce "/Users/${device.user}" else lib.mkForce "/home/${device.user}";
|
||||
|
||||
file = {
|
||||
".config/fish/themes".source = pkgs.catppuccinThemes.fish + "/themes";
|
||||
".cargo/config.toml".text =
|
||||
/*
|
||||
toml
|
||||
*/
|
||||
# toml
|
||||
''
|
||||
[alias]
|
||||
lldb = ["with", "rust-lldb", "--"]
|
||||
@@ -61,12 +60,12 @@
|
||||
EDITOR = "nvim";
|
||||
SHELL = "${pkgs.bash}/bin/bash";
|
||||
CARGO_TARGET_DIR = "${config.xdg.cacheHome}/cargo/target";
|
||||
BROWSER =
|
||||
if device.isDarwin
|
||||
then "open"
|
||||
else "xdg-open";
|
||||
BROWSER = if device.isDarwin then "open" else "xdg-open";
|
||||
};
|
||||
sessionPath = ["${config.home.homeDirectory}/.cargo/bin" "${config.home.homeDirectory}/.local/bin"];
|
||||
sessionPath = [
|
||||
"${config.home.homeDirectory}/.cargo/bin"
|
||||
"${config.home.homeDirectory}/.local/bin"
|
||||
];
|
||||
|
||||
stateVersion = "23.11";
|
||||
};
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./goread.nix
|
||||
./hyprpaper.nix
|
||||
|
||||
@@ -2,29 +2,40 @@
|
||||
pkgs,
|
||||
# config,
|
||||
...
|
||||
}: let
|
||||
mkMappings = mappings:
|
||||
[]
|
||||
}:
|
||||
let
|
||||
mkMappings =
|
||||
mappings:
|
||||
[ ]
|
||||
++ (pkgs.lib.optionals (builtins.hasAttr "normal" mappings) (mkMode mappings.normal "n"))
|
||||
++ (pkgs.lib.optionals (builtins.hasAttr "terminal" mappings) (mkMode mappings.terminal "t"))
|
||||
++ (pkgs.lib.optionals (builtins.hasAttr "insert" mappings) (mkMode mappings.insert "i"))
|
||||
++ (pkgs.lib.optionals (builtins.hasAttr "visual" mappings) (mkMode mappings.visual "v"))
|
||||
++ (pkgs.lib.optionals (builtins.hasAttr "global" mappings) (mkMode mappings.global ""));
|
||||
mkMode = mappings: mode:
|
||||
pkgs.lib.mapAttrsToList
|
||||
(key: value: {
|
||||
mkMode =
|
||||
mappings: mode:
|
||||
pkgs.lib.mapAttrsToList (key: value: {
|
||||
key = key;
|
||||
action = rawLua value;
|
||||
mode = mode;
|
||||
})
|
||||
mappings;
|
||||
border = ["╭" "─" "╮" "│" "╯" "─" "╰" "│"];
|
||||
}) mappings;
|
||||
border = [
|
||||
"╭"
|
||||
"─"
|
||||
"╮"
|
||||
"│"
|
||||
"╯"
|
||||
"─"
|
||||
"╰"
|
||||
"│"
|
||||
];
|
||||
rawLua = lua: {
|
||||
"__raw" = ''
|
||||
${lua}
|
||||
'';
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
opts = {
|
||||
completeopt = "menu,menuone,popup,noselect";
|
||||
expandtab = true;
|
||||
@@ -113,7 +124,10 @@ in {
|
||||
|
||||
autoCmd = [
|
||||
{
|
||||
event = ["BufEnter" "BufWinEnter"];
|
||||
event = [
|
||||
"BufEnter"
|
||||
"BufWinEnter"
|
||||
];
|
||||
pattern = "*.norg";
|
||||
command = "set conceallevel=3";
|
||||
}
|
||||
@@ -123,12 +137,12 @@ in {
|
||||
# command = "nnoremap <buffer> F :Sqlfmt<cr>";
|
||||
# }
|
||||
{
|
||||
event = ["BufWinLeave"];
|
||||
event = [ "BufWinLeave" ];
|
||||
pattern = "?*";
|
||||
command = "mkview!";
|
||||
}
|
||||
{
|
||||
event = ["BufWinEnter"];
|
||||
event = [ "BufWinEnter" ];
|
||||
pattern = "?*";
|
||||
command = "silent! loadview!";
|
||||
}
|
||||
@@ -148,9 +162,7 @@ in {
|
||||
enable = true;
|
||||
settings = {
|
||||
format_on_save =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
# lua
|
||||
''
|
||||
function(bufnr)
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
@@ -160,10 +172,10 @@ in {
|
||||
end
|
||||
'';
|
||||
formatters_by_ft = {
|
||||
d2 = ["d2"];
|
||||
sql = ["sleek"];
|
||||
toml = ["taplo"];
|
||||
nix = ["alejandra"];
|
||||
d2 = [ "d2" ];
|
||||
sql = [ "sleek" ];
|
||||
toml = [ "taplo" ];
|
||||
nix = [ "alejandra" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -182,27 +194,6 @@ in {
|
||||
};
|
||||
};
|
||||
};
|
||||
avante = {
|
||||
enable = true;
|
||||
settings = {
|
||||
provider = "copilot";
|
||||
providers = {
|
||||
ollama = {
|
||||
endpoint = "https://ollama.ryu.darksailor.dev";
|
||||
model = "qwen3:30b-a3b";
|
||||
};
|
||||
};
|
||||
input = {
|
||||
provider = "snacks";
|
||||
provider_opts = {
|
||||
# Additional snacks.input options
|
||||
title = "Avante Input";
|
||||
icon = " ";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
snacks.enable = true;
|
||||
|
||||
yazi = {
|
||||
enable = true;
|
||||
@@ -226,8 +217,8 @@ in {
|
||||
mini = {
|
||||
enable = true;
|
||||
modules = {
|
||||
ai = {};
|
||||
starter = {};
|
||||
ai = { };
|
||||
starter = { };
|
||||
};
|
||||
};
|
||||
|
||||
@@ -296,9 +287,7 @@ in {
|
||||
comment = {
|
||||
enable = true;
|
||||
settings.pre_hook =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
# lua
|
||||
''
|
||||
require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook()
|
||||
'';
|
||||
@@ -391,9 +380,7 @@ in {
|
||||
settings = {
|
||||
close_fold_kinds = null;
|
||||
provider_selector =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
# lua
|
||||
''
|
||||
function(bufnr, filetype, buftype)
|
||||
return {'treesitter', 'indent'}
|
||||
@@ -407,30 +394,28 @@ in {
|
||||
server = {
|
||||
on_attach =
|
||||
rawLua
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
''
|
||||
function(client, bufnr)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>a",
|
||||
function()
|
||||
vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping
|
||||
-- or vim.lsp.buf.codeAction() if you don't want grouping.
|
||||
end,
|
||||
{ silent = true, buffer = bufnr }
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"K", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions
|
||||
function()
|
||||
vim.cmd.RustLsp({'hover', 'actions'})
|
||||
end,
|
||||
{ silent = true, buffer = bufnr }
|
||||
)
|
||||
end
|
||||
'';
|
||||
# lua
|
||||
''
|
||||
function(client, bufnr)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"<leader>a",
|
||||
function()
|
||||
vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping
|
||||
-- or vim.lsp.buf.codeAction() if you don't want grouping.
|
||||
end,
|
||||
{ silent = true, buffer = bufnr }
|
||||
)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
"K", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions
|
||||
function()
|
||||
vim.cmd.RustLsp({'hover', 'actions'})
|
||||
end,
|
||||
{ silent = true, buffer = bufnr }
|
||||
)
|
||||
end
|
||||
'';
|
||||
default_settings = {
|
||||
rust-analyzer = {
|
||||
inlayHints = {
|
||||
@@ -462,27 +447,32 @@ in {
|
||||
};
|
||||
};
|
||||
};
|
||||
dap = let
|
||||
vscode-lldb = pkgs.vscode-extensions.vadimcn.vscode-lldb;
|
||||
liblldb =
|
||||
if pkgs.stdenv.isLinux
|
||||
then "${vscode-lldb.lldb}/lib/liblldb.so"
|
||||
else if pkgs.stdenv.isDarwin
|
||||
then "${vscode-lldb.lldb}/lib/liblldb.dylib"
|
||||
else null;
|
||||
codelldb = "${vscode-lldb.adapter}/bin/codelldb";
|
||||
in {
|
||||
autoload_configurations = false;
|
||||
# adapter =
|
||||
# /*
|
||||
# lua
|
||||
# */
|
||||
# ''
|
||||
# require('rustaceanvim.config').get_codelldb_adapter("${codelldb}", "${liblldb}")
|
||||
# '';
|
||||
};
|
||||
dap =
|
||||
let
|
||||
vscode-lldb = pkgs.vscode-extensions.vadimcn.vscode-lldb;
|
||||
liblldb =
|
||||
if pkgs.stdenv.isLinux then
|
||||
"${vscode-lldb.lldb}/lib/liblldb.so"
|
||||
else if pkgs.stdenv.isDarwin then
|
||||
"${vscode-lldb.lldb}/lib/liblldb.dylib"
|
||||
else
|
||||
null;
|
||||
codelldb = "${vscode-lldb.adapter}/bin/codelldb";
|
||||
in
|
||||
{
|
||||
autoload_configurations = false;
|
||||
# adapter =
|
||||
# /*
|
||||
# lua
|
||||
# */
|
||||
# ''
|
||||
# require('rustaceanvim.config').get_codelldb_adapter("${codelldb}", "${liblldb}")
|
||||
# '';
|
||||
};
|
||||
tools = {
|
||||
float_win_config = {border = "rounded";};
|
||||
float_win_config = {
|
||||
border = "rounded";
|
||||
};
|
||||
enable_clippy = false;
|
||||
};
|
||||
};
|
||||
@@ -526,7 +516,7 @@ in {
|
||||
typeHints.enable = false;
|
||||
};
|
||||
check = {
|
||||
features = ["default"];
|
||||
features = [ "default" ];
|
||||
};
|
||||
files.exclude = [
|
||||
".cargo/"
|
||||
@@ -585,26 +575,26 @@ in {
|
||||
settings = {
|
||||
autoEnableSources = true;
|
||||
sources = [
|
||||
{name = "buffer";}
|
||||
{name = "buffer";}
|
||||
{name = "cmdline";}
|
||||
{name = "cmp-clippy";}
|
||||
{name = "cmp-cmdline-history";}
|
||||
{name = "crates";}
|
||||
{name = "dap";}
|
||||
{ name = "buffer"; }
|
||||
{ name = "buffer"; }
|
||||
{ name = "cmdline"; }
|
||||
{ name = "cmp-clippy"; }
|
||||
{ name = "cmp-cmdline-history"; }
|
||||
{ name = "crates"; }
|
||||
{ name = "dap"; }
|
||||
# {name = "dictionary";}
|
||||
{name = "fish";}
|
||||
{name = "git";}
|
||||
{name = "luasnip";}
|
||||
{name = "nvim_lsp";}
|
||||
{name = "nvim_lua";}
|
||||
{name = "nvim_lsp_signature_help";}
|
||||
{name = "nvim_lsp_document_symbol";}
|
||||
{name = "path";}
|
||||
{name = "rg";}
|
||||
{name = "spell";}
|
||||
{name = "tmux";}
|
||||
{name = "treesitter";}
|
||||
{ name = "fish"; }
|
||||
{ name = "git"; }
|
||||
{ name = "luasnip"; }
|
||||
{ name = "nvim_lsp"; }
|
||||
{ name = "nvim_lua"; }
|
||||
{ name = "nvim_lsp_signature_help"; }
|
||||
{ name = "nvim_lsp_document_symbol"; }
|
||||
{ name = "path"; }
|
||||
{ name = "rg"; }
|
||||
{ name = "spell"; }
|
||||
{ name = "tmux"; }
|
||||
{ name = "treesitter"; }
|
||||
];
|
||||
view = {
|
||||
entries = {
|
||||
@@ -628,9 +618,7 @@ in {
|
||||
"<C-p>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
|
||||
};
|
||||
snippet.expand =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
# lua
|
||||
''
|
||||
function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
@@ -640,9 +628,7 @@ in {
|
||||
};
|
||||
};
|
||||
extraConfigLua =
|
||||
/*
|
||||
lua
|
||||
*/
|
||||
# lua
|
||||
''
|
||||
function catcher(callback)
|
||||
do
|
||||
@@ -802,6 +788,18 @@ in {
|
||||
pkgs.tree-sitter-grammars.tree-sitter-norg-meta
|
||||
pkgs.tree-sitter-grammars.tree-sitter-nu
|
||||
];
|
||||
extraLuaPackages = luaPkgs: with luaPkgs; [lua-utils-nvim nvim-nio pathlib-nvim];
|
||||
extraPackages = [pkgs.lldb pkgs.taplo pkgs.d2 pkgs.sleek pkgs.graphqurl pkgs.sqls];
|
||||
extraLuaPackages =
|
||||
luaPkgs: with luaPkgs; [
|
||||
lua-utils-nvim
|
||||
nvim-nio
|
||||
pathlib-nvim
|
||||
];
|
||||
extraPackages = [
|
||||
pkgs.lldb
|
||||
pkgs.taplo
|
||||
pkgs.d2
|
||||
pkgs.sleek
|
||||
pkgs.graphqurl
|
||||
pkgs.sqls
|
||||
];
|
||||
}
|
||||
|
||||
@@ -75,6 +75,26 @@
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "127.0.0.1:9100" ];
|
||||
labels = {
|
||||
device = "mirai";
|
||||
type = "server";
|
||||
};
|
||||
}
|
||||
{
|
||||
targets = [ "tsuba:9100" ];
|
||||
labels = {
|
||||
device = "tsuba";
|
||||
type = "server";
|
||||
arch = "aarch64";
|
||||
};
|
||||
}
|
||||
{
|
||||
targets = [ "ryu:9100" ];
|
||||
labels = {
|
||||
device = "ryu";
|
||||
type = "desktop";
|
||||
arch = "x86_64";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -83,6 +103,26 @@
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "127.0.0.1:9256" ];
|
||||
labels = {
|
||||
device = "mirai";
|
||||
type = "server";
|
||||
};
|
||||
}
|
||||
{
|
||||
targets = [ "tsuba:9256" ];
|
||||
labels = {
|
||||
device = "tsuba";
|
||||
type = "server";
|
||||
arch = "aarch64";
|
||||
};
|
||||
}
|
||||
{
|
||||
targets = [ "ryu:9256" ];
|
||||
labels = {
|
||||
device = "ryu";
|
||||
type = "desktop";
|
||||
arch = "x86_64";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -91,6 +131,9 @@
|
||||
static_configs = [
|
||||
{
|
||||
targets = [ "127.0.0.1:9090" ];
|
||||
labels = {
|
||||
device = "mirai";
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -112,13 +155,13 @@
|
||||
settings = {
|
||||
access_control = {
|
||||
rules = [
|
||||
# {
|
||||
# domain = "grafana.darksailor.dev";
|
||||
# policy = "bypass";
|
||||
# resources = [
|
||||
# "^/api([/?].*)?$"
|
||||
# ];
|
||||
# }
|
||||
{
|
||||
domain = "grafana.darksailor.dev";
|
||||
policy = "bypass";
|
||||
resources = [
|
||||
"^/api([/?].*)?$"
|
||||
];
|
||||
}
|
||||
{
|
||||
domain = "grafana.darksailor.dev";
|
||||
policy = "one_factor";
|
||||
@@ -144,7 +187,6 @@
|
||||
# Provision dashboards directly
|
||||
environment.etc = {
|
||||
"grafana/dashboards/system-dashboard.json".source = ./grafana/system-dashboard.json;
|
||||
"grafana/dashboards/services-dashboard.json".source = ./grafana/services-dashboard.json;
|
||||
"grafana/dashboards/processes-dashboard.json".source = ./grafana/processes-dashboard.json;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,654 +0,0 @@
|
||||
{
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": {
|
||||
"type": "grafana",
|
||||
"uid": "-- Grafana --"
|
||||
},
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
}
|
||||
]
|
||||
},
|
||||
"editable": true,
|
||||
"fiscalYearStartMonth": 0,
|
||||
"graphTooltip": 0,
|
||||
"id": null,
|
||||
"links": [],
|
||||
"liveNow": false,
|
||||
"panels": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"barAlignment": 0,
|
||||
"drawStyle": "line",
|
||||
"fillOpacity": 10,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"vis": false
|
||||
},
|
||||
"lineInterpolation": "linear",
|
||||
"lineWidth": 1,
|
||||
"pointSize": 5,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"group": "A",
|
||||
"mode": "none"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"id": 1,
|
||||
"options": {
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "table",
|
||||
"placement": "right",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "node_systemd_unit_state{state=\"active\", name=~\"(atuin|authelia|caddy|gitea|grafana|immich|navidrome|nextcloud|paperless|prowlarr|seafile|searxng|syncthing|tailscale|lldap|prometheus)\\.service\"}",
|
||||
"format": "time_series",
|
||||
"intervalFactor": 1,
|
||||
"legendFormat": "{{name}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Service Status (Active Services)",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"custom": {
|
||||
"align": "auto",
|
||||
"cellOptions": {
|
||||
"type": "auto"
|
||||
},
|
||||
"inspect": false
|
||||
},
|
||||
"mappings": [
|
||||
{
|
||||
"options": {
|
||||
"0": {
|
||||
"color": "red",
|
||||
"index": 0,
|
||||
"text": "Inactive"
|
||||
},
|
||||
"1": {
|
||||
"color": "green",
|
||||
"index": 1,
|
||||
"text": "Active"
|
||||
}
|
||||
},
|
||||
"type": "value"
|
||||
}
|
||||
],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "red",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "green",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 12,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 8
|
||||
},
|
||||
"id": 2,
|
||||
"options": {
|
||||
"cellHeight": "sm",
|
||||
"footer": {
|
||||
"countRows": false,
|
||||
"fields": "",
|
||||
"reducer": ["sum"],
|
||||
"show": false
|
||||
},
|
||||
"showHeader": true
|
||||
},
|
||||
"pluginVersion": "8.0.0",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "node_systemd_unit_state{name=~\"(atuin|authelia|caddy|gitea|grafana|immich|navidrome|nextcloud|paperless|prowlarr|seafile|searxng|syncthing|tailscale|lldap|prometheus)\\.service\", state=\"active\"}",
|
||||
"format": "table",
|
||||
"instant": true,
|
||||
"intervalFactor": 1,
|
||||
"legendFormat": "",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Service Status Table",
|
||||
"transformations": [
|
||||
{
|
||||
"id": "organize",
|
||||
"options": {
|
||||
"excludeByName": {
|
||||
"Time": true,
|
||||
"__name__": true,
|
||||
"instance": true,
|
||||
"job": true,
|
||||
"state": true
|
||||
},
|
||||
"indexByName": {},
|
||||
"renameByName": {
|
||||
"Value": "Status",
|
||||
"name": "Service"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": "table"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 6,
|
||||
"x": 12,
|
||||
"y": 8
|
||||
},
|
||||
"id": 3,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"justifyMode": "auto",
|
||||
"orientation": "auto",
|
||||
"reduceOptions": {
|
||||
"calcs": ["lastNotNull"],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"pluginVersion": "8.0.0",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "count(node_systemd_unit_state{name=~\"(atuin|authelia|caddy|gitea|grafana|immich|navidrome|nextcloud|paperless|prowlarr|seafile|searxng|syncthing|tailscale|lldap|prometheus)\\.service\", state=\"active\"})",
|
||||
"format": "time_series",
|
||||
"intervalFactor": 1,
|
||||
"legendFormat": "Active Services",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Total Active Services",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "yellow",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 6,
|
||||
"w": 6,
|
||||
"x": 18,
|
||||
"y": 8
|
||||
},
|
||||
"id": 4,
|
||||
"options": {
|
||||
"colorMode": "value",
|
||||
"graphMode": "area",
|
||||
"justifyMode": "auto",
|
||||
"orientation": "auto",
|
||||
"reduceOptions": {
|
||||
"calcs": ["lastNotNull"],
|
||||
"fields": "",
|
||||
"values": false
|
||||
},
|
||||
"textMode": "auto"
|
||||
},
|
||||
"pluginVersion": "8.0.0",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "count(node_systemd_unit_state{name=~\"(atuin|authelia|caddy|gitea|grafana|immich|navidrome|nextcloud|paperless|prowlarr|seafile|searxng|syncthing|tailscale|lldap|prometheus)\\.service\", state=\"failed\"})",
|
||||
"format": "time_series",
|
||||
"intervalFactor": 1,
|
||||
"legendFormat": "Failed Services",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Failed Services",
|
||||
"type": "stat"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"barAlignment": 0,
|
||||
"drawStyle": "line",
|
||||
"fillOpacity": 10,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"vis": false
|
||||
},
|
||||
"lineInterpolation": "linear",
|
||||
"lineWidth": 1,
|
||||
"pointSize": 5,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"group": "A",
|
||||
"mode": "none"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 12,
|
||||
"y": 14
|
||||
},
|
||||
"id": 5,
|
||||
"options": {
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "table",
|
||||
"placement": "bottom",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "time() - node_systemd_unit_state_start_time_seconds{name=~\"(atuin|authelia|caddy|gitea|grafana|immich|navidrome|nextcloud|paperless|prowlarr|seafile|searxng|syncthing|tailscale|lldap|prometheus)\\.service\", state=\"active\"}",
|
||||
"format": "time_series",
|
||||
"intervalFactor": 1,
|
||||
"legendFormat": "{{name}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Service Uptime",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "palette-classic"
|
||||
},
|
||||
"custom": {
|
||||
"axisLabel": "",
|
||||
"axisPlacement": "auto",
|
||||
"barAlignment": 0,
|
||||
"drawStyle": "line",
|
||||
"fillOpacity": 10,
|
||||
"gradientMode": "none",
|
||||
"hideFrom": {
|
||||
"legend": false,
|
||||
"tooltip": false,
|
||||
"vis": false
|
||||
},
|
||||
"lineInterpolation": "linear",
|
||||
"lineWidth": 1,
|
||||
"pointSize": 5,
|
||||
"scaleDistribution": {
|
||||
"type": "linear"
|
||||
},
|
||||
"showPoints": "never",
|
||||
"spanNulls": false,
|
||||
"stacking": {
|
||||
"group": "A",
|
||||
"mode": "none"
|
||||
},
|
||||
"thresholdsStyle": {
|
||||
"mode": "off"
|
||||
}
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 20
|
||||
},
|
||||
"id": 6,
|
||||
"options": {
|
||||
"legend": {
|
||||
"calcs": [],
|
||||
"displayMode": "table",
|
||||
"placement": "right",
|
||||
"showLegend": true
|
||||
},
|
||||
"tooltip": {
|
||||
"mode": "single",
|
||||
"sort": "none"
|
||||
}
|
||||
},
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "increase(node_systemd_unit_state_restarts_total{name=~\"(atuin|authelia|caddy|gitea|grafana|immich|navidrome|nextcloud|paperless|prowlarr|seafile|searxng|syncthing|tailscale|lldap|prometheus)\\.service\"}[1h])",
|
||||
"format": "time_series",
|
||||
"intervalFactor": 1,
|
||||
"legendFormat": "{{name}}",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Service Restarts (Last Hour)",
|
||||
"type": "timeseries"
|
||||
},
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"color": {
|
||||
"mode": "thresholds"
|
||||
},
|
||||
"custom": {
|
||||
"align": "auto",
|
||||
"cellOptions": {
|
||||
"type": "auto"
|
||||
},
|
||||
"inspect": false
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
},
|
||||
"unit": "s"
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 28
|
||||
},
|
||||
"id": 7,
|
||||
"options": {
|
||||
"cellHeight": "sm",
|
||||
"footer": {
|
||||
"countRows": false,
|
||||
"fields": "",
|
||||
"reducer": ["sum"],
|
||||
"show": false
|
||||
},
|
||||
"showHeader": true,
|
||||
"sortBy": [
|
||||
{
|
||||
"desc": true,
|
||||
"displayName": "Start Time"
|
||||
}
|
||||
]
|
||||
},
|
||||
"pluginVersion": "8.0.0",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "prometheus",
|
||||
"uid": "prometheus"
|
||||
},
|
||||
"expr": "node_systemd_unit_state_start_time_seconds{name=~\"(atuin|authelia|caddy|gitea|grafana|immich|navidrome|nextcloud|paperless|prowlarr|seafile|searxng|syncthing|tailscale|lldap|prometheus)\\.service\", state=\"active\"}",
|
||||
"format": "table",
|
||||
"instant": true,
|
||||
"intervalFactor": 1,
|
||||
"legendFormat": "",
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"title": "Service Start Times",
|
||||
"transformations": [
|
||||
{
|
||||
"id": "organize",
|
||||
"options": {
|
||||
"excludeByName": {
|
||||
"Time": true,
|
||||
"__name__": true,
|
||||
"instance": true,
|
||||
"job": true,
|
||||
"state": true
|
||||
},
|
||||
"indexByName": {},
|
||||
"renameByName": {
|
||||
"Value": "Start Time",
|
||||
"name": "Service"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "convertFieldType",
|
||||
"options": {
|
||||
"conversions": [
|
||||
{
|
||||
"destinationType": "time",
|
||||
"targetField": "Start Time"
|
||||
}
|
||||
],
|
||||
"fields": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": "table"
|
||||
}
|
||||
],
|
||||
"refresh": "30s",
|
||||
"schemaVersion": 27,
|
||||
"style": "dark",
|
||||
"tags": ["services", "monitoring", "systemd"],
|
||||
"templating": {
|
||||
"list": []
|
||||
},
|
||||
"time": {
|
||||
"from": "now-1h",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {},
|
||||
"timezone": "",
|
||||
"title": "Services Monitoring Dashboard",
|
||||
"uid": "services-monitoring",
|
||||
"version": 1
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
{...}: {
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
# ./rsyncd.nix
|
||||
# ./sunshine.nix
|
||||
@@ -15,5 +16,6 @@
|
||||
./minecraft.nix
|
||||
./fwupd.nix
|
||||
./caddy.nix
|
||||
./monitoring.nix
|
||||
];
|
||||
}
|
||||
|
||||
42
nixos/ryu/services/monitoring.nix
Normal file
42
nixos/ryu/services/monitoring.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{ ... }:
|
||||
{
|
||||
services = {
|
||||
prometheus = {
|
||||
exporters = {
|
||||
node = {
|
||||
enable = true;
|
||||
enabledCollectors = [
|
||||
"systemd"
|
||||
"textfile"
|
||||
"filesystem"
|
||||
"loadavg"
|
||||
"meminfo"
|
||||
"netdev"
|
||||
"stat"
|
||||
"time"
|
||||
"uname"
|
||||
"vmstat"
|
||||
];
|
||||
port = 9100;
|
||||
};
|
||||
process = {
|
||||
enable = true;
|
||||
settings.process_names = [
|
||||
{
|
||||
name = "{{.Comm}}";
|
||||
cmdline = [ ".*" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Open firewall ports for Prometheus exporters
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [
|
||||
9100 # node exporter
|
||||
9256 # process exporter
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
{...}: {
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./tailscale.nix
|
||||
./samba.nix
|
||||
@@ -9,6 +10,7 @@
|
||||
./homeassistant.nix
|
||||
./flaresolverr.nix
|
||||
./caddy.nix
|
||||
./monitoring.nix
|
||||
# ./grafana.nix
|
||||
# ./dnscrypt.nix
|
||||
# ./resolved.nix
|
||||
|
||||
42
nixos/tsuba/services/monitoring.nix
Normal file
42
nixos/tsuba/services/monitoring.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{ ... }:
|
||||
{
|
||||
services = {
|
||||
prometheus = {
|
||||
exporters = {
|
||||
node = {
|
||||
enable = true;
|
||||
enabledCollectors = [
|
||||
"systemd"
|
||||
"textfile"
|
||||
"filesystem"
|
||||
"loadavg"
|
||||
"meminfo"
|
||||
"netdev"
|
||||
"stat"
|
||||
"time"
|
||||
"uname"
|
||||
"vmstat"
|
||||
];
|
||||
port = 9100;
|
||||
};
|
||||
process = {
|
||||
enable = true;
|
||||
settings.process_names = [
|
||||
{
|
||||
name = "{{.Comm}}";
|
||||
cmdline = [ ".*" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Open firewall ports for Prometheus exporters
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [
|
||||
9100 # node exporter
|
||||
9256 # process exporter
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user