Help with heartbeat setup of locations

I have about 30 sites I would like to ping with heartbeat.
I'm confused about how best to add the geo location and other info for each site.

Do I add each site to its own yaml file or is there a simple way to do it all in one file?

Sorry I'm new to beats and moving from another tool so I'm a little confused here, could someone show me an example of pinging multiple sites each with different location data?

To clarify, would you like to add metadata for the Heartbeat instance doing the monitoring, or the site being monitored? I agree we could improve our docs here.

The current docs only discuss how to add geo data for the heartbeat instance doing the monitoring.

Hi I'm adding both host data and observer data actually, but just working out the most efficient way to be adding the host data for each site. eg each site may have about 5 things being monitored then I want to add the host geo data for each of those sites.

I was trying to get it to work with a separate yml file for each site in monitors.d, then I wanted to have an input with the devices to be monitored and a processor for the geo data for that particular site in each "site file"

That doesn't seem to work as I don't think processors apply like that.

Sorry for the delay here. You can apply both host and observer geolocation data (though only the host observer data is shown in the Uptime UI).

I've opened a github issue to investigate making this easier, it'd be great to hear your thoughts on the issue.

Sorry, I forgot to mention how you can apply this per monitor. You can use the fields option at the per-monitor level (and you'll probably want to set fields_under_root to true as well) to add arbitrary fields, including geo location ones.

Which ECS field would be appropriate is probably debatable here, but the host.geo.* fields are probably most appropriate.

Hi Andrew,

I'm also interested in adding geolocation to the hosts being monitored.
From reading the messages above I don't. understand how do you map the host observer data to the monitored host.

Can you show me an example with these 2 hosts?

    - type: icmp
      schedule: '*/5 * * * * * *'
      hosts: ['192.168.100.20']
      name: 'DC1'

    - type: icmp
      schedule: '@every 10s'
      hosts: ['192.168.70.80']
      name: 'SRVLEIEXC1'

Sure, here's an example using the ECS Host fields.

    - type: icmp
      schedule: '@every 10s'
      hosts: ['192.168.70.80']
      name: 'SRVLEIEXC1'
      fields_under_root: true
      fields:
        host:
          geo:
            name: "MyGeoLocName"
            location: "37.773972, -122.431297"

Thanks Andrew for the example,

It's working, now I just need to do the same thing for the others.
If I can give you my opnion, I would prefer to view the host location in the uptime UI Map so I would have my information in the same place instead of the host (elastic) doing the monitoring, for me is not that important.

But I guess you can always build a dashboard for that...

Thanks again,
Luis Pereira

Glad it works! I've opened an issue to track this feature request here: https://github.com/elastic/uptime/issues/191