bsmithio / OPNsense-Dashboard

A functional and useful dashboard for OPNsense that utilizes InfluxDB, Grafana, Graylog, and Telegraf.
523 stars 66 forks source link

Telegraf unable to write to influxdb #25

Closed samG60 closed 1 year ago

samG60 commented 2 years ago

Firstly many thanks for your hard work. However after going through your config guide I am getting the following error in the telegraf logs E! [outputs.influxdb] When writing to [http://localhost:8086]: failed doing req: Post "http://localhost:8086/write?consistency=any&db=telegraf": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

Has anyone any idea where I've gone wrong? And more importantly what I would need to do to fix the problem?

bsmithio commented 2 years ago

Hi, did you add your Influx v2 URL? https://github.com/bsmithio/OPNsense-Dashboard/blob/master/configure.md#install-the-plugin-and-configure-options

samgaw58 commented 2 years ago

I checked and rechecked all the settings. I then did "docker-compose up --force-recreate" and that got most of the dashboard to load. However about 25% of it has no data, see the screenshot below

Screenshot 2022-04-16 at 15 50 30

.

bsmithio commented 2 years ago

I checked and rechecked all the settings. I then did "docker-compose up --force-recreate" and that got most of the dashboard to load. However about 25% of it has no data, see the screenshot below

Screenshot 2022-04-16 at 15 50 30

.

What other sections have no data?

samgaw58 commented 2 years ago

It's basically all you can see in the screen shot. Maps, Interface Summary, Gateway RTT & Gateway Loss. For some reason this morning the section that was above the maps with the info on CPU etc. has gone completely.

bsmithio commented 2 years ago

Okay for those could you try this command on OPNsense:

sudo su -m telegraf -c 'sudo /usr/local/bin/telegraf_pfifgw.php'

You should see output like this:

interface,host=hostname,name=igb1_vlan40,ip4_address=192.0.40.1,ip4_subnet=192.0.40.0/24,ip6_address=Unassigned,ip6_subnet=Unassigned,mac_address=11:11:11:11:11:11,friendlyname=Guest,source=pfconfig status=1
gateways,host=hostname,interface=wan,gateway_name=WAN_DHCP monitor="1.1.1.1.",source="1.1.1.1",gwdescr="Interface WAN_DHCP Gateway",delay=10.2,stddev=3.1,loss=0,status="1"

That script is where all the data for those Network Stats sections comes from.

For the map, double check that the GeoIP database file is in /usr/share/graylog/data/data/ on your Graylog docker container. See: https://github.com/bsmithio/OPNsense-Dashboard/blob/master/configure.md#add-geoip-to-graylog

samgaw58 commented 2 years ago

I checked all of your suggestions, and just to make sure I ran the commands again. Sadly it has made no difference at all, everything exactly as it was beforehand.

bsmithio commented 2 years ago

Odd, could you go to the Explore tab on Grafana and use this query:

from(bucket: v.defaultBucket)
  |> range(start: -30s)
  |> filter(fn: (r) =>
    r._measurement == "interface"
  )
  |> last()
  |> group()
  |> keep(columns: ["friendlyname", "ip4_address", "ip4_subnet", "mac_address", "name", "_value"])
  |> sort(columns:["name"])

You should see your interface names/friendly names, IP addresses, MAC addresses, and subnets.

samgaw58 commented 2 years ago

Yeah I have all the vLans listed with their vLan name & IP address.

bsmithio commented 2 years ago

I see the problem now, at least for the interface sections. Since you're on light mode the text is white, so it looks like it's not there. Click on each of the panel's title bar and click on Edit -> On the right scroll down to Thresholds -> Click on Base -> Click on Text Color.

I'll be honest I didn't think about testing light mode while making this dashboard. I will edit the dashboard JSON for light mode compatibility.

As for the map panel, try searching for src_ip_geo_country on Graylog on the Search tab.

You should be able to click on a message and find src_ip_geo_country followed by a country code.

If not, GeoIP isn't working on Graylog for some reason. However, if you do find messages with src_ip_geo_country then it's something else on the map panel on Grafana.

samgaw58 commented 2 years ago

Dark mode fixed Interface summary. Sadly I'm getting nothing from the Map data. I think its getting time to start again and check then check again each step. Your help has been invaluable, thank you so much for your help.