geerlingguy / internet-pi

Raspberry Pi config for all things Internet.
MIT License
4.15k stars 440 forks source link

How-to add more sites to the Uptime graph?? #584

Closed tim0n3 closed 3 months ago

tim0n3 commented 4 months ago

Hi Please may you help me understand where to edit to enable the Uptime graph to have the same sites that I've specified in the config.yml file

Currently no matter what I do on my Pi it's always locked ot the same 4 sites.

I'd like it to reflect all the sites. Hope someone can help me?

The files I've edited are: config.yml which has 15 sites under monitoring_ping_hosts:

monitoring_ping_hosts: # [URL];[HUMAN_READABLE_NAME]

The intention was to have them appear in both the http graphs below the speedtracker graphs and in the Uptime graph.

I've tried deleting all containers with [ docker kill $(docker ps -aq) ; docker rm $(docker ps -aq) ; docker rmi $(docker image ls) ] and then rerunning the anisible playbook to no avail.

Is there anything I can upload here to provide more context? Hope someone can help me understand this issue better.

Tx

martinbrose commented 4 months ago

Hi @tim0n3,

I can try to help.

I just tried with the following in config.yml:

monitoring_ping_hosts:  # [URL];[HUMAN_READABLE_NAME]
  - http://www.google.com/;google.com
  - https://github.com/;github.com
  - https://www.apple.com/;apple.com
  - https://mail.google.com/;Gmail
  - https://1.1.1.1/;Cloudflare
  - https://nytimes.com/;NYTIMES
  - https://www.reddit.com/;Reddit

And after running ansible-playbook main.yml -K everything was fine for me.

To see where your problem is, some basic questions:

  1. Do you see the targets anywhere? In the Speedtracker graphs or in the Uptime graphs? If you just don't see them in Uptime, then have a look at this issue https://github.com/geerlingguy/internet-pi/issues/510 and change the time range to 5 minutes and wait a bit if you see anything.

  2. If you can't see any targets, look for the targets in Ping and Prometheus and come back with some info. If you installed on 127.0.0.1, this would be the following. For Ping: http://127.0.0.1:9115/ . For Prometheus: http://127.0.0.1:9090/targets?search= .

tim0n3 commented 3 months ago

Hi @tim0n3,

I can try to help.

I just tried with the following in config.yml:

monitoring_ping_hosts:  # [URL];[HUMAN_READABLE_NAME]
  - http://www.google.com/;google.com
  - https://github.com/;github.com
  - https://www.apple.com/;apple.com
  - https://mail.google.com/;Gmail
  - https://1.1.1.1/;Cloudflare
  - https://nytimes.com/;NYTIMES
  - https://www.reddit.com/;Reddit

And after running ansible-playbook main.yml -K everything was fine for me.

To see where your problem is, some basic questions:

  1. Do you see the targets anywhere? In the Speedtracker graphs or in the Uptime graphs? If you just don't see them in Uptime, then have a look at this issue No datapoints in Uptime #510 and change the time range to 5 minutes and wait a bit if you see anything.
  2. If you can't see any targets, look for the targets in Ping and Prometheus and come back with some info. If you installed on 127.0.0.1, this would be the following. For Ping: http://127.0.0.1:9115/ . For Prometheus: http://127.0.0.1:9090/targets?search= .

Thanks a million.

I'll try with the K switch in my anisble command shortly.

Currently my workaround is to remove the blackbox container and images after updating the config.yml hosts section:

docker kill blackbox-id ;\ 
docker rm blackbox-id;\
docker rmi blackbox-image-id ;\ 
ansible-playblook main.yml

This seemed to fix the issue however I'll definitely try the k switch.

tim0n3 commented 3 months ago

Hi @tim0n3, I can try to help. I just tried with the following in config.yml:

monitoring_ping_hosts:  # [URL];[HUMAN_READABLE_NAME]
  - http://www.google.com/;google.com
  - https://github.com/;github.com
  - https://www.apple.com/;apple.com
  - https://mail.google.com/;Gmail
  - https://1.1.1.1/;Cloudflare
  - https://nytimes.com/;NYTIMES
  - https://www.reddit.com/;Reddit

And after running ansible-playbook main.yml -K everything was fine for me. To see where your problem is, some basic questions:

  1. Do you see the targets anywhere? In the Speedtracker graphs or in the Uptime graphs? If you just don't see them in Uptime, then have a look at this issue No datapoints in Uptime #510 and change the time range to 5 minutes and wait a bit if you see anything.
  2. If you can't see any targets, look for the targets in Ping and Prometheus and come back with some info. If you installed on 127.0.0.1, this would be the following. For Ping: http://127.0.0.1:9115/ . For Prometheus: http://127.0.0.1:9090/targets?search= .

Thanks a million.

I'll try with the K switch in my anisble command shortly.

Currently my workaround is to remove the blackbox container and images after updating the config.yml hosts section:

docker kill blackbox-id ;\ 
docker rm blackbox-id;\
docker rmi blackbox-image-id ;\ 
ansible-playblook main.yml

This seemed to fix the issue however I'll definitely try the k switch.

can confirm the -K switch worked, too.

thanks @martinbrose

martinbrose commented 3 months ago

@tim0n3, glad it's solved.

To be honest, I wasn't expecting the -K flag to make the difference. It's the solution to a few other issues, so maybe it's needed here too...

Enjoy!

tim0n3 commented 3 months ago

For the sake of completeness I did more testing and observed that I was too impatient.

The uptime graph will update if you either leave it for a day or change your window period and ctrl-shift-R your browser tab.

If that doesn't work then editing the widget and running the query manually after about 5 minutes seems to update it.

I will keep playing with it but so far it's been working with either of these for me on a RaspberryPi 4B 4G running the headless version of raspiOS arm64

martinbrose commented 3 months ago

Thanks for sharing this additional detail @tim0n3. That's more in line with what I was expecting... 😃