Coder Social home page Coder Social logo

kpetremann / salt-exporter Goto Github PK

View Code? Open in Web Editor NEW
23.0 23.0 6.0 14.18 MB

Salt Prometheus exporter working out of the box without any configuration on Salt side. Comes with an event watcher TUI.

Home Page: https://kpetremann.github.io/salt-exporter/

License: MIT License

Dockerfile 0.30% Go 98.61% Shell 0.94% SaltStack 0.15%
prometheus prometheus-exporter salt saltstack tui

salt-exporter's Introduction

Automation enthusiast

A little about me

Currently a proud SRE@Criteo in the Network Datacenter team.

  • πŸ”­ I’m currently working on AFK, the new Criteo's network automation framework.
  • πŸ”§ Actively maintaining Salt Exporter and MQTT Exporter
  • πŸ’¬ Ask me about Python, Golang, Network, Salt, OpenConfig, SONiC

Articles

For Criteo:

Personal:

My personal projects

Project Category Opensource Status Tech
Salt Exporter Infrastructure, observability true stable Go
MQTT Exporter IoT, observability true stable Python
DHT2MQTT IoT true alpha Go
ClawNetwork Infrastructure true alpha Go
2D game Game development false prototype Go, Ebitengine, LDTK

My professional projects

Project Category Opensource Status Tech
netprobify Probing true stable Python
AFK Infrastructure, network, automation true alpha Go, Python, Salt, NetBox

Languages and Tools

Support

If you like my personal projects, don't hesitate to buy me a coffee :)

Buy Me A Coffee

salt-exporter's People

Contributors

dependabot[bot] avatar kpetremann avatar voyvodov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

salt-exporter's Issues

Differentiate running a function with `test=True` or `mock=True`

When running a function in test mode (for example salt <target> state.highstate test=True), we get metrics reported as if the function was executed successfully/failing according to the result:

salt_expected_responses_total{function="state.highstate",state="highstate"} 1
# HELP salt_function_responses_total Total number of response per function processed
# TYPE salt_function_responses_total counter
salt_function_responses_total{function="state.highstate",state="highstate",success="false"} 1
# HELP salt_function_status Last function/state success, 0=Failed, 1=Success
# TYPE salt_function_status gauge
salt_function_status{function="state.highstate",minion="myminion.company.com",state="highstate"} 0
# HELP salt_new_job_total Total number of new job processed
# TYPE salt_new_job_total counter
salt_new_job_total{function="state.highstate",state="highstate",success="true"} 1
# HELP salt_responses_total Total number of response job processed
# TYPE salt_responses_total counter
salt_responses_total{minion="myminion.company.com",success="false"} 1

It would be benefitial to differentiate running states in test mode, mock mode or "production".

Salt live: improve responsiveness

Two kind of issues:

  • sometimes, we cannot navigate in the list
  • when there are a lot of new events, the list is refreshing a lot making the TUI blinking

Panic at some point

Hi @kpetremann,
Thank you for creating salt-exporter, really great work!

If you have time, could you please take a look at this panic message?

panic: interface conversion: interface {} is []interface {}, not string

goroutine 12 [running]:
github.com/kpetremann/salt-exporter/pkg/events.extractStateFromArgs(...)
	/home/runner/work/salt-exporter/salt-exporter/pkg/events/events.go:47
github.com/kpetremann/salt-exporter/pkg/events.(*SaltEvent).ExtractState(0xc0000a2b60?)
	/home/runner/work/salt-exporter/salt-exporter/pkg/events/events.go:61 +0x47d
github.com/kpetremann/salt-exporter/internal/metrics.ExposeMetrics({0x980978, 0xc000106dc0}, 0xc000072240)
	/home/runner/work/salt-exporter/salt-exporter/internal/metrics/metrics.go:66 +0x89d
created by main.main
	/home/runner/work/salt-exporter/salt-exporter/main.go:62 +0x53e

Probably, events with incorrect schema should be just ignored.

Document salt-live

The documentation should have:

  • a demo
  • usage guide
  • flags explanation
  • a visibility in the root README

Maybe a GitHub Page would be nice.

[salt-live] Invalid memory address

When running salt-live with both soft-filter.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x546d68]

goroutine 3763 [running]:
github.com/charmbracelet/bubbles/list.filterItems.func1()
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/list/list.go:1211 +0x1a8
github.com/charmbracelet/bubbletea.(*Program).handleCommands.func1.1()
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:268 +0x38
created by github.com/charmbracelet/bubbletea.(*Program).handleCommands.func1
        /home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:267 +0x14d

RFE: Allow filtering out minion-specific metrics via a cmdline option

Can you please add a cmdline option that filters out/disables all minion-specific metrics? This is needed to avoid having high-cardinality labels in Prometheus with masters that have a large number (1k+) of minions connecting to them.
Setting the '-health-minions' option to false doesn't work as I still see the following metrics:

    salt_responses_total(minion="XXXX", success=true) = <count>

Salt live: segmentation fault

Happening when a filter is applied.
Due to an oversight while migrating to the "frozen" buffer.

stacktrace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x5432d2]

goroutine 6720 [running]:
github.com/charmbracelet/bubbles/list.filterItems.func1()
	/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/list/list.go:1197 +0x1b2
github.com/charmbracelet/bubbletea.(*Program).handleCommands.func1.1()
	/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:248 +0x38
created by github.com/charmbracelet/bubbletea.(*Program).handleCommands.func1
	/home/runner/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:247 +0x14d

Add support of tag with 20 characters or less

According the Salt docstring here:

In the new style, when the tag is longer than 20 characters, an end of tag
string is appended to the tag given by the string constant TAGEND, that is, two
line feeds '\n\n'.  When the tag is less than 20 characters then the tag is
padded with pipes "|" out to 20 characters as before.  When the tag is exactly
20 characters no padded is done.

Currently the exporter only looks for the '\n\n' delimiter.

Tag with 20 characters or less support must be added.

Add total number of connected minions

On every scrape, the exporter should include a gauge metric with the number of connected minions to that master node.
This way we can keep track of new minions connected, but more importantly, when minions disappear.

please add -version switch

hi,

please add -version switch
for now only option to determinate version is to run exporter (then version is print to output) which could be hard to use in eg. shell scripts.

thanks,

Salt-live: frozen state should be more visible

It is easy to miss/forgot that the list is frozen as the user is scrolling in the list.

The frozen state should be way more visible, with a quick message to explain how to switch back to "follow mode".

Publish a Docker image

Publish a Docker image on both Github and Docker Hub.
Only for the exporter.

It would not make sense for salt-live as the TUI is not working properly via a docker shell.

salt_function_status() counter doesn't increment

The salt_function_status() counter doesn't increment but always stays 1 - here's an example when running total of 7 states on a single minion:

#  curl -s http://localhost:2112/metrics|grep ^salt_
salt_function_responses_total{function="state.apply",state="highstate",success="true"} 3
salt_function_responses_total{function="state.highstate",state="highstate",success="true"} 2
salt_function_responses_total{function="state.sls",state="sys.passwd",success="true"} 2
salt_function_status{function="state.apply",minion="gen12472",state="highstate"} 1
salt_function_status{function="state.highstate",minion="gen12472",state="highstate"} 1
salt_function_status{function="state.sls",minion="gen12472",state="sys.passwd"} 1
salt_responses_total{minion="gen12472",success="true"} 7
#

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.