prometheus-community / node-exporter-textfile-collector-scripts

Scripts for node-exporter's textfile collector
Apache License 2.0
512 stars 191 forks source link

Add needrestart_info.py to monitore needrestart. #195

Closed RomainMou closed 1 month ago

RomainMou commented 11 months ago

Hi,

I've made a small script to retrieve some metrics from needrestart, and perhaps it could be useful for others?

The script runs needrestart -b (batch mode), parses the output, and displays some metrics. It looks like this:

# HELP needrestart_timestamp information about the version and when it was last run
# TYPE needrestart_timestamp gauge
needrestart_timestamp{version="3.5"} 1.702655157e+09
# HELP needrestart_kernel_status information about the kernel status
# TYPE needrestart_kernel_status gauge
needrestart_kernel_status{current="5.10.0-26-amd64",expected="5.10.0-26-amd64"} 1.0
# HELP needrestart_services_count number of services requiring a restart
# TYPE needrestart_services_count gauge
needrestart_services_count 0.0
# HELP needrestart_containers_count number of containers requiring a restart
# TYPE needrestart_containers_count gauge
needrestart_containers_count 0.0
# HELP needrestart_sessions_count number of sessions requiring a restart
# TYPE needrestart_sessions_count gauge
needrestart_sessions_count 0.0
RomainMou commented 5 months ago

Hello @funkyfuture, thanks for all your feedback, they are very appreciate for a beginner like me. I've try to take all of them into account.

RomainMou commented 1 month ago

Is there anything missing to merge this PR? Anything I can do?

dswarbrick commented 1 month ago

Please also check that your metric names conform to the Prometheus best practice guide: https://prometheus.io/docs/practices/naming/