I'm writing a daemon that will continuously run in background and do it's thing. I would like to monitor the performance and various other variables. This will include things like web request latency, errors, number of processed items and so on.
The data should then be available for review, along with graphs, reports (averages, outliers) and alerts when limits are exceeded.
Performance counters on Windows are the closest thing to this I could find. You can define your own counters and then easily access them from the code.
Note that I'm not looking for "performance" counters as those are named, it's more like application counters - i.e. I don't care about number of executed instructions and cache misses, but about custom counters. A StackOverflow questions similar to this where the responses missed the point is here: Application counters in Linux? (and OSX?)
I've looked at Cacti (and alternatives), but they seem to run a script on a schedule which provides the data. That means I would have store the counters in my daemon, along with a thread waiting for some kind of IPC call. Then I would need to create a second application/script which would connect via this IPC interface and retrieve the stored values.
Is there a better way? Some C library that will make it possible to increment a counter with a single function call and it'll automatically get processed via the frontend?