On Thursday 29 February 2024 at 18:46:05 UTC+7 Puneet Singh wrote:

The default node exporter has the ability to report the disk usage at user 
level in my context?  - by extending it via any flag  ( i came across the 
text collector and i plan to explore that.)
 or writing the custom exporter would be the optimal workaround?


I don't know what the "optimal" solution would be: you haven't said which 
filesystem you're using, and whether you're actually enforcing quotas at 
the filesystem level - in which case the filesystem will be keeping track 
of them, and you can just ask the filesystem for the current quota for each 
user.

If not, then periodically running du -sk /home/* sounds reasonable as long 
as it's not done too often. And yes, if you reformat those into prometheus 
metrics you can just drop them into a file for the textfile collector to 
pick up. Prometheus itself will add the "instance" label, so you only need 
to add "user" and "mountpoint" attributes (the latter would be statically 
"/home")

Don't use du -sh because you'll get metrics like "25M" or "304K" and it 
will be up to you to normalise them.
 
For alerting, the simple template expansion you have is almost certainly 
not going to work; it's almost certainly not usern...@gmail.com. You could 
however make a static set of metrics mapping username to email:

{username="fred",email="f...@flintstone.com"} 1
{username="wilma",email="w...@rubble.com"} 1

Then scrape this, and do another join in your promQL to pick up the email 
label.  This is similar to the approach from
https://www.robustperception.io/using-time-series-as-alert-thresholds

Once you have the E-mail address as a label, then see
https://www.robustperception.io/using-labels-to-direct-email-notifications/

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/df57003b-7ce8-46f7-a507-5b2e59e44b91n%40googlegroups.com.

Reply via email to