Chronograph not showing multiple hosts

Hi All,

Very new to the TICK stack. I have 3 raspberry pi’s on a home network, along with a wireless printer, a range extender, and a router. I currently have InfluxDB, Telegraf, and Chronograf running on one pi. Everything is working fine there. I wrote a python script that pings the wireless printer and then writes the results from the ping into Influxdb. The problem is that Chronograf is not picking up the new host. I’ve launched the CLI tools to verify the data has been written, and I see the host listed in the tags.

What am I missing?

Thanks,

What database are you writing it to? Why are the tags, etc.? If you could post some more details about the structure of your database on the Pi, and maybe an example of your line-protocol data insert from Python that would be helpful.

dg

My python code doing a ping and inserting the results into influxdb

from influxdb import InfluxDBClient
import pyping, sys, getopt

host = ""
ipAddress = ""

avg_response = 0.0
max_response = 0.0
min_response = 0.0
packets_received = 0
packets_transmitted = 3
percent_packet_loss = 0

try:
  opts, args = getopt.getopt(sys.argv[1:],"h:a:")
except getopt.GetoptError:
  print 'ping.py -h <host> -a <address>'
  sys.exit(1)

for opt, arg in opts:
  if opt == '-h':
    host = arg
  elif opt == "-a":
    ipAddress = arg

response = pyping.ping(ipAddress)

if response.ret_code == 0:
  avg_response = response.avg_rtt
  max_response = response.max_rtt
  min_response = response.min_rtt
  packets_received = packets_transmitted - response.packet_lost
  percent_packet_loss = 100 * float(response.packet_lost)/float(packets_transmitted)
else:
  packets_received = 0
  percent_packet_loss = 100

json_body = [{"measurement": "ping", "tags": {"host": str(host)},"fields":{"average_response_ms": float(avg_response), "maximum_response_ms": float(max_response), "minimum_response_ms": float(min_response), "packets_received": packets_received, "packets_transmitted": packets_transmitted, "percent_packet_loss": percent_packet_loss}}]

print json_body

client = InfluxDBClient('192.168.50.4', 8086, '', '', 'telegraf')
client.write_points(json_body)

Database tables

> show series from "ping"
key
---
ping,host=monitorpi,url=192.168.5.4
ping,host=monitorpi,url=www.google.com
ping,host=printer

> show measurements with measurement = ping
name: measurements
name
----
ping

> show tag keys from "ping"
name: ping
tagKey
------
host
url

> show tag values with key ="host"

name: ping
key  value
---  -----
host monitorpi
host printer

> show field keys from "ping"
name: ping
fieldKey            fieldType
--------            ---------
average_response_ms float
maximum_response_ms float
minimum_response_ms float
packets_received    integer
packets_transmitted integer
percent_packet_loss float

After going through this the only thing I see different is that url is missing for the printer host. I guess it’s required?

After adding the URL to be part of my insert still no changes.

> show series from "ping"
key
---
ping,host=monitorpi,url=192.168.5.4
ping,host=monitorpi,url=www.google.com
ping,host=printer
ping,host=printer,url=192.168.50.166

So I figured out my issue. Chronograf doesn’t display hosts that don’t have a system or cpu metrics. See: https://github.com/influxdata/chronograf/issues/1077 to which I fixed and create a pull request for: https://github.com/influxdata/chronograf/pull/2087

1 Like