How to edit query for WAN upload

Hi,
I’m new to grafana and have absolutely no experience in building queries so please pardon me if this question is dumb.
I’ve set up grafana+prometheus to monitor my router (Fritzbox). There is a github project called “fritz_exporter” which extracts the data from the router via upnp.
I’ve downloaded a dashboard which monitors all the data I need, so far so good.

Now I would like to set an alarm when my upload falls under a certain value (e.g. 3Mbyte/s) for 15 minutes or so. The goal is to check if my online backup is complete so I can shut down my NAS. Yes, I know asking the backup software via API would be so much more ideal but afaik Synology Drive Share Sync does not give you such an option.

So I’m able to set an alarm but it also fires when my download rate is under 3Mbyte/s. I just want to monitor the upload rate.

How can I edit the query to achieve that?

Thanks is advance!

  • What Grafana version and what operating system are you using?
    9.4.7

  • What are you trying to achieve?
    Setting up an alarm when Upload is below a certain value.

  • How are you trying to achieve it?
    Using fritz_exporter from Github.

  • What happened?
    I’m unable to separate Upload and Download.

  • What did you expect to happen?
    Alerting only when Upload is below certain value.

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
  • Did you follow any online instructions? If so, what is the URL?
    Can not find examples for this query.
1 Like

Welcome @heeelga

I can’t provide a super-precise answer because I don’t know what metrics are shipped by the fritz_exporter that you’re using, but I can give you the general method to explore/fix.

The query you’re running is taking an average of the fritz_wan_data_bytes_total metric which is presumably both upload and download, which yields the problem you’re seeing. You need to change that metric name to a different metric which would track only the upload rate, it looks like what you’re using is both.

Does your data exporter give you that option? I don’t know. In the screenshot you shared, upper right hand corner you’ll see a switch between “Builder” and “Code”. Click on the builder, and check the drop-down menus to see if you have a different metric available that’s upload only.

You’re ultimately going to be constrained by what metrics you have available, but Grafana will let you slice and dice whatever is delivered. If you don’t have an upload only metric, well then you could still do it if you could subtract the download metric from the total metric. But if the integration you’re using doesn’t give you those points of flexibility, you may be stuck on this one.

Thank you very much for your help David!
I was able to build the query from scratch as I could not figure out how to extract the upload value from the fritz_wan_data_bytes_total metric.

I’ll attach a screenshot if anyone will ever stumble upon this :slight_smile: .