beszel icon indicating copy to clipboard operation
beszel copied to clipboard

Custom charts

Open betim opened this issue 1 year ago • 9 comments

Hi,

Long time Cacti user here, but we all know that Cacti can sometimes get to be hairy.

I tried beszel and the experience is great.

From some research I could not find a way to, for example count http connections to my servers. So...

My suggestion is having a VERY simple plugin system where the agent would read a directory of files before sending them to the server and these files are named for example: http_num_conns_min, sql_exec_min, etc.

These files are overwritten by scripts that are written in whatever language the system admin likes and are also reusable from other systems such as Cacti.

On the beszel server side we would see the graph of http_num_conns_min and maybe have an option to put an alias of "HTTP connections per minute" and other metadata if you feel like adding some more inputs.

Let me know if you like this and/or close this enhancement issue if it's a duplicate.

Bless you for writing software like this and keep up the great work!

betim avatar Dec 19 '24 11:12 betim

That's a good idea. Maybe we can use YAML config to let you define extra charts / sources.

henrygd avatar Dec 20 '24 17:12 henrygd

I don't mind how it is done as long as there's a possibility to add it. However I do have some opinions. Why not have a simple modal here:

image

near "Add System" | {if system} "Add Graph" {/if}

This then opens a simple modal that asks for file name and graph name.

On the agent side, provide a tack -watch <dir> or config where scripts output numeric values to the files. Of course agent should parse the contents of the file and ignore if it's not a numerical value since we don't want to lug around garbage.

What do you think?

betim avatar Dec 20 '24 19:12 betim

Sorry for the late reply, I'm not on the computer much because I'm visiting family over the holidays.

Currently the hub cannot pass any information to the agent, and all custom configuration for the agent is defined on the agent side.

Perhaps this will change in the future, which would open the door to features like web SSH and control of Docker containers.

But there are security issues that need to be worked out before this is implemented. It would probably be in a 1.0.0 release much farther down the road.

I think the simplest way to do this as it stands now is to allow the agent to define some options in a yaml file and supply it to the agent with CONFIG=/path/to/config.yml.

How do you feel about something like this?

# monitor network services / devices
services:
  - name: paperless
    host: 192.168.8.8:8000
    type: http
  - name: security-camera
    host: 192.168.8.14
    type: ping

# define custom charts
charts:
  - name: HTTP Connections
    desc: Current number of HTTP connections to the server
    cmd: example-command | grep xxx | sed 's/xxx/xxx/'
  - name: Another Chart
    desc: Lorem ipsum dolor sit amet consectetur
    file: /path/to/file

henrygd avatar Dec 23 '24 15:12 henrygd

Looks good :)

betim avatar Jan 07 '25 11:01 betim

I would love if we could use the ubiquitous monitoring-plugins in beszel - they already cover a wide range of usecases and somebody tried wrote a specification draft for the interface

herkulessi avatar Feb 07 '25 14:02 herkulessi

I'd love to see this and be able to add specific min/max values for the returned command.

So the user could specify custom script in the yaml:

#!/bin/bash
do some commands here and echo the value that should be reported to Beszel

Justinzobel avatar Jun 17 '25 01:06 Justinzobel

See PR #792 for my proposed implementation of this. My approach uses the Pocketbase API store the custom data and the chart information. I don't see a need to use a separate YAML config rather than using the database to hold the information.

pitbox46 avatar Jun 18 '25 10:06 pitbox46

Another option is to include a statsd server in the agent. It's a really simple and convenient way to create charts on the fly with zero configuration. That's also the best way I found to pass custom application metrics to Netdata.

kiwixz avatar Jul 14 '25 02:07 kiwixz

+1 this would be great even if i have to manually add config to the agent yes. Thanks for a great light weight monitoring alternative. Discovered it pretty recently but its a good fit for home lab monitoring etc as apposed to Grafana and Influx

v0d0r avatar Nov 14 '25 12:11 v0d0r