UCS Dashboard/Prometheus

It is possible using the prometheus inside univention to get values from other servers? For instance a suse linux server?

Can i send the information from that server to univention and the use that data grafana?

Thanks

Anyone can point me where i can change the prometheus start up command? I need activate the admin api…

Thanks

@botner can you help?

Thanks

You can manually configure Prometheus targets. Prometheus collects the data form all known targets and so the data is available in Grafana, e.g.

UCS with the dashboard Apps and a Ubuntu client (192.138.0.28). On the Ubuntu client, install the prometheus-node-exporter package. On the UCS system add this to the Prometheus config file /var/lib/univention-appcenter/apps/prometheus/conf/prometheus.yml (indentation is important):

  - job_name: 'suse'
    scrape_interval: 1m
    scheme: http
    static_configs:
      - targets: ['192.138.0.28:9100']
    relabel_configs:
      - source_labels: [__address__]
        regex: '([^:]+):.*'
        target_label: instance
        replacement: "$1"

With this config Prometheus tries to find the metrics on http://192.168.0.28:9100/metrics, so as long as the UCS server can reach the ip of the target, we should be fine.

BUT, currently there is no custom Prometheus config so we have to modify /var/lib/univention-appcenter/apps/prometheus/conf/prometheus.yml and this file is auto generated and overwritten during the update of the Prometheus app. But i just added a custom-prometheus.yml for the next version of the app. This file is for “custom” Prometheus configurations, included in the main config file and persistent during updates.

So add the config snippet from above to /var/lib/univention-appcenter/apps/prometheus/conf/prometheus.yml AND create a new file /var/lib/univention-appcenter/apps/prometheus/conf/custom-prometheus.yml with this config.
Then, during the next app update prometheus.yml is (re)generated but thanks to custom-prometheus.yml your config changes will survive.

@botner thanks for your time!

I will do that!
I already use the custom_target.yml files to my other targets.

Other issue that i have is that i cannot change the docker command… and why ? Because i need to activate the --web.enable-admin-api and i think that is only possible in the command it cannot be done via configuration… can we have an ucr variable to activate or deactivate that?

Thanks

I will look into that, not today, but asap

Has this already been implemented? I am running prometheus 2.35.0-4 but I can’t find any hint for a custom-prometheus.yml in the configuration file and altering the prometheus.yml won’t work permanently.

Good morning,

what do you want to achieve? I have not looked into a custom config, but you are able to include custom targets to scrape via a config file like this: https://help.univention.com/t/best-practice-monitor-additional-services-with-the-ucs-dashboard/16967

Best regards
Jan-Luca

Hello Jan-Luca,

thanks for your reply and the link. I missed this one.

What I would like to do is to add an additional scape_job like descriped in the topic above. I have several server which are not joined to my domain but I would like to monitor. Adding them to custom-targets.json does not work.

Best regards
Stefan

Hey Stefan,

why is it not possible to add the additional exporters to the custom-targets?
You can check the state of the configured targets with the Prometheus Web UI available at https://your-prometheus-server/metrics-prometheus/targets
If they are not listed chances are good that the mentioned relabel mangles your URL. To verify that you can add the dummy domain from the article which should be seen in the UI after a restart.

Best regards
Jan-Luca

Hey Jan-Luca,

I am a Newbie to Prometheus so maybe I don’t get the point.
As I understand, the use of custom-target requires the exporters to be available under a strict formatted URI.

In my scenario, I administer a Linux server which hosts a nodejs app and a mongodb.
To monitor all these services I need to install a pm2-metrics exporter.
I also have to run a mongodb exporter and the system node exporter as well.
As I don’t know how to merge the data before export I will have to run these 3 exporters with different URIs

The way with different scape jobs looks more familar to me than using custom targets and URL redirecting.
But maybe I didn’t get it wright.

Best regards
Stefan

The functional difference between a scrape job and another target for an existing job is that every target in one job is configured the same while a new job can be configured separately.

In this case the custom-target file is part of the default scrape job so the same rules apply and therefore the relabeling is done. However this does not mean that you have to change where your exporter is available but you have to insert the target in such fashion that after the relabeling leads to your exporters URL.

Regarding different exporters: The idiomatic way is to just expose your metrics at different ports, the host can stay the same.

Mastodon