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

Service Status via Labels and Bages, not being updated when service is brought down #401

Open
thygizmo opened this issue Sep 5, 2022 · 3 comments

Comments

@thygizmo
Copy link

thygizmo commented Sep 5, 2022

Hi,
Ever since some years ago, I have noticed that the "service monitoring" implementation, actually shows the badges/labels as "Red"/down if the ports for instance are actually closed.

Starting up a service (e.g.: FTP service on port 21), actually makes the label/badge change from red to green status, which is ok and expected. However, if I stop an FTP server listening on port 21 (e.g.: netstat correctly reports there is no port being LISTENed), but the Label/Badge does not change back to red...

Does anyone know if this is a known issue, or I am doing something wrong, somewhere?

Here's the relevant configuration that I have setup for the ftp Service monitoring:

dynamic.1.name=ftp
dynamic.1.source=netstat -nlt
dynamic.1.regexp=tcp .:(21).*LISTEN

web.status.1.content.1.line.1=Badge(data.ftp,"==21","ftp(21)","success") + Badge(data.ftp,"!=21","ftp(21)","danger")

Many thanks for any tips you might have...:)

Cheers,
Gizmo

@thygizmo thygizmo changed the title Service Status via Labels and Bages, not being updated when service is brough down Service Status via Labels and Bages, not being updated when service is brought down Sep 5, 2022
@JappeHallunken
Copy link

JappeHallunken commented Sep 17, 2022

I've got this working with labels, and I use ss, since netstatis deprecated.
Your web.status stuff looks right, so I guess the error happens maybe at the regexp?
Here my code for comparison:

dynamic.3.name=http
dynamic.3.source=ss -nltp
dynamic.3.regexp=LISTEN .+:(80).+
dynamic.3.default=0

web.status.1.content.1.line.2="<b>Lighttpd HTTP</b>: "+Label(data.http,"==80","listening","success")+Label(data.http,"!=80","not listening","danger")

EDIT:
I tested your regexp with RegExr and it's not working. It should be;

tcp .+:(21).*LISTEN

@thygizmo
Copy link
Author

Hi! Thanks for the feedback and for your piece of code!
Actually the regexp is correct and matches the output of the netstat command!
However, I did not have in my configuration the "dynmic.x.default=0 value" and that made the whole difference!!!

Thank you for your feedback, I finally got it fully working!

Many thanks!
Giz

@JappeHallunken
Copy link

JappeHallunken commented Sep 19, 2022

Nice that you found a solution.
It's a bit offtopic, but I'm still wondering about the regexp.
Because when I test this https://regexr.com/6ub3v, it doesn't match without the + and I don't understand why.

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

No branches or pull requests

2 participants