more generator wip
This commit is contained in:
parent
9940cfbf5a
commit
dae3c590ce
@ -174,6 +174,6 @@
|
|||||||
|
|
||||||
formatter = pkgs.alejandra;
|
formatter = pkgs.alejandra;
|
||||||
|
|
||||||
#packages.snmp-yaml = pkgs.callPackage ./packages/snmp-yaml {};
|
packages.snmp-yaml = pkgs.callPackage ./packages/snmp-yaml {};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
8
packages/snmp-yaml/README.md
Normal file
8
packages/snmp-yaml/README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
How to upgrade snmp.yml
|
||||||
|
|
||||||
|
1. Extend generator.yml from the upstream generator.yml in snmp_exporter/generator/generator.yml
|
||||||
|
2. Generate snmp.yml:
|
||||||
|
|
||||||
|
snmp_exporter/generator$ make mibs
|
||||||
|
packages/snmp-yaml $ MIBDIRS=$HOME/code/snmp_exporter/generator/mibs /nix/store/wmymig1r9jfiaffbdpv1lyaj32rydbzc-snmp_exporter-0.21.0/bin/generator generate
|
||||||
|
|
@ -1,16 +1,19 @@
|
|||||||
{
|
{
|
||||||
stdenv,
|
stdenv,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
prometheus-snmp-exporter,
|
||||||
}:
|
}:
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "snmp-yaml";
|
name = "snmp-yaml";
|
||||||
|
inherit (prometheus-snmp-exporter) version src;
|
||||||
|
|
||||||
buildInputs = [pkgs.prometheus-snmp-exporter];
|
buildInputs = [prometheus-snmp-exporter];
|
||||||
|
|
||||||
installPhase = ''
|
buildPhase = ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
${pkgs.prometheus-snmp-exporter}/bin/generator generate \
|
set -x
|
||||||
${pkgs.prometheus-snmp-exporter}/generator/generator.yaml \
|
cd $src/generator
|
||||||
|
${prometheus-snmp-exporter}/bin/generator generate \
|
||||||
--output-path=$out/snmp.yml
|
--output-path=$out/snmp.yml
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
50
packages/snmp-yaml/generator.yml
Normal file
50
packages/snmp-yaml/generator.yml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
modules:
|
||||||
|
# Default IF-MIB interfaces table with ifIndex.
|
||||||
|
if_mib:
|
||||||
|
walk: [sysUpTime, interfaces, ifXTable]
|
||||||
|
lookups:
|
||||||
|
- source_indexes: [ifIndex]
|
||||||
|
lookup: ifAlias
|
||||||
|
- source_indexes: [ifIndex]
|
||||||
|
# Uis OID to avoid conflict with PaloAlto PAN-COMMON-MIB.
|
||||||
|
lookup: 1.3.6.1.2.1.2.2.1.2 # ifDescr
|
||||||
|
- source_indexes: [ifIndex]
|
||||||
|
# Use OID to avoid conflict with Netscaler NS-ROOT-MIB.
|
||||||
|
lookup: 1.3.6.1.2.1.31.1.1.1.1 # ifName
|
||||||
|
overrides:
|
||||||
|
ifAlias:
|
||||||
|
ignore: true # Lookup metric
|
||||||
|
ifDescr:
|
||||||
|
ignore: true # Lookup metric
|
||||||
|
ifName:
|
||||||
|
ignore: true # Lookup metric
|
||||||
|
ifType:
|
||||||
|
type: EnumAsInfo
|
||||||
|
|
||||||
|
# Mikrotik Router
|
||||||
|
#
|
||||||
|
# http://download2.mikrotik.com/Mikrotik.mib
|
||||||
|
mikrotik:
|
||||||
|
walk:
|
||||||
|
- interfaces
|
||||||
|
- ifMIB
|
||||||
|
- laIndex
|
||||||
|
- sysUpTime
|
||||||
|
- sysDescr
|
||||||
|
- host
|
||||||
|
- mikrotik
|
||||||
|
lookups:
|
||||||
|
- source_indexes: [ifIndex]
|
||||||
|
lookup: ifName
|
||||||
|
- source_indexes: [mtxrInterfaceStatsIndex]
|
||||||
|
lookup: ifName
|
||||||
|
- source_indexes: [hrStorageIndex]
|
||||||
|
lookup: hrStorageDescr
|
||||||
|
- source_indexes: [laIndex]
|
||||||
|
lookup: laNames
|
||||||
|
drop_source_indexes: true
|
||||||
|
overrides:
|
||||||
|
ifName:
|
||||||
|
ignore: true # Lookup metric
|
||||||
|
ifType:
|
||||||
|
type: EnumAsInfo
|
@ -1,35 +0,0 @@
|
|||||||
{
|
|
||||||
stdenv,
|
|
||||||
graphicsmagick,
|
|
||||||
runCommand,
|
|
||||||
sunpaper,
|
|
||||||
}: let
|
|
||||||
# Upper left corner of rectangle.
|
|
||||||
base.x = 3835;
|
|
||||||
base.y = 35;
|
|
||||||
# Add 720p to the coordinates to find the lower right corner.
|
|
||||||
rect.xy0 = "${toString base.x},${toString base.y}";
|
|
||||||
rect.xy1 = "${toString (base.x + 1280)},${toString (base.y + 720)}";
|
|
||||||
# Add some pixels to the base coordinates to place the text nicely.
|
|
||||||
text.xy = "${toString (base.x + 1115)},${toString (base.y + 60)}";
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
pname = "sway-wallpaper";
|
|
||||||
inherit (sunpaper) version src;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out
|
|
||||||
|
|
||||||
# Resize for normal background
|
|
||||||
${graphicsmagick}/bin/gm convert -crop 7680x2160+0+375 -resize 5120x1440 ./images/Lakeside/5.jpg $out/default.jpg
|
|
||||||
|
|
||||||
# Resize a darker variation for screen locker
|
|
||||||
${graphicsmagick}/bin/gm convert -crop 7680x2160+0+375 -resize 5120x1440 ./images/Lakeside/8.jpg $out/dark.jpg
|
|
||||||
|
|
||||||
# Draw a 720p rectangle on top
|
|
||||||
${graphicsmagick}/bin/gm convert -fill '#FFFFFFBB' -draw 'rectangle ${rect.xy0} ${rect.xy1}' $out/default.jpg 720pfigure.jpg
|
|
||||||
|
|
||||||
# Draw a text on top of this
|
|
||||||
${graphicsmagick}/bin/gm convert -fill '#FFFFFF' -pointsize 72 -draw 'text ${text.xy} "720p"' 720pfigure.jpg $out/720pfigure.jpg
|
|
||||||
'';
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
5629
packages/snmp-yaml/snmp.yml
Normal file
5629
packages/snmp-yaml/snmp.yml
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user