I have requirement to collect data of when a device goes up or down and then show that data in a nice graph along with some statistics like availability (%) in last 7 days or number of devices that had less than 95% availability in the last 7 days.
I was thinking of using Prometheus with Graphana. But my research and demo programs shows that Prometheus uses a pull model - the data is scraped at regular intervals. If device goes up and down within the same scan interval, this cannot be captured by Prometheus using a "gauge" meter. Is this the expected behavior? or have I understood the concepts wrong and doing it wrongly?
If device goes up and down within the same scan interval, this cannot be captured by Prometheus using a "gauge" meter. Is this the expected behavior?
Yes, it is expected behavior.
Prometheus, as most of the monitoring tools, don't provide real-time monitoring.
or have I understood the concepts wrong and doing it wrongly?
You understood concept correctly, but maybe have wrong expectations of the tool.
Precision of avaliablity statistics depends heavily on scrape interval and downtime duration, independently of pull or push model.
If you have really short restart intervals, they are most likely wouldn't be detected by Prometheus. You could consider lowering scrape interval or exposing additional metric containing last restart timestamp.
If restarts of your device could happen in "bursts", and you'd like to register every reboot event, I'd suggest looking into push-based monitoring systems, allowing pushing metrics right after reboot.