Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add needrestart_info.py to monitore needrestart. #195

Merged

Conversation

RomainMou
Copy link
Contributor

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 RomainMou force-pushed the feat/needrestart-script branch from 5b4eb3b to eb588ef Compare December 15, 2023 15:54
needrestart_info.py Outdated Show resolved Hide resolved
needrestart_info.py Outdated Show resolved Hide resolved
needrestart_info.py Outdated Show resolved Hide resolved
needrestart_info.py Outdated Show resolved Hide resolved
needrestart_info.py Show resolved Hide resolved
needrestart_info.py Outdated Show resolved Hide resolved
RomainMou added 2 commits June 3, 2024 10:17
Signed-off-by: RomainMou <58464216+RomainMou@users.noreply.github.com>
Signed-off-by: RomainMou <58464216+RomainMou@users.noreply.github.com>
@RomainMou RomainMou force-pushed the feat/needrestart-script branch from 80c82a9 to d805647 Compare June 3, 2024 08:18
@RomainMou RomainMou requested a review from funkyfuture June 3, 2024 08:21
@RomainMou
Copy link
Contributor Author

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.

Copy link
Contributor

@funkyfuture funkyfuture left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, i've been using it for some weeks now.

@RomainMou
Copy link
Contributor Author

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

needrestart_info.py Outdated Show resolved Hide resolved
needrestart_info.py Outdated Show resolved Hide resolved
@dswarbrick
Copy link
Member

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

Signed-off-by: RomainMou <58464216+RomainMou@users.noreply.github.com>
Signed-off-by: RomainMou <58464216+RomainMou@users.noreply.github.com>
Signed-off-by: RomainMou <58464216+RomainMou@users.noreply.github.com>
@RomainMou RomainMou force-pushed the feat/needrestart-script branch from 62b5d2e to ce87ff3 Compare October 18, 2024 16:18
Signed-off-by: RomainMou <58464216+RomainMou@users.noreply.github.com>
@RomainMou RomainMou requested a review from dswarbrick October 18, 2024 16:22
needrestart_info.py Outdated Show resolved Hide resolved
needrestart_info.py Outdated Show resolved Hide resolved
Signed-off-by: RomainMou <58464216+RomainMou@users.noreply.github.com>
@RomainMou RomainMou requested a review from dswarbrick October 21, 2024 08:50
@dswarbrick dswarbrick merged commit 88a82d6 into prometheus-community:master Oct 21, 2024
4 checks passed
allamiro pushed a commit to allamiro/node-exporter-textfile-collector-scripts that referenced this pull request Nov 16, 2024
…y#195)

Add needrestart_info.py to monitor needrestart

Signed-off-by: RomainMou <58464216+RomainMou@users.noreply.github.com>
@calestyo
Copy link

calestyo commented Dec 2, 2024

Just for the records: There's has also been something coded in needrestart itself: liske/needrestart#291

@RomainMou RomainMou deleted the feat/needrestart-script branch December 2, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants