Summary:
Out of the box functionality with New Relic:
- An entity is created for your each one of your router/s.
- A default overview with charts for CPU, memory, throughput, ...
- Metrics and tags attached to the entity, which can be used to query and further explore data.
- Create a New Relic account if not having one already.
- Follow the steps under Register an Insert API key in this documentatation:
- Login to your Mikrotik router:
- Go to
System > Scripts
, clickAdd New
.- Copy the content of newrelic-metrics.rsc in the
Source
field. - Set the
Name
andPolicy
fields as described in that file. - Paste your API Key as the
nrApiKey
value. - There are two
metricsUrl
variables, one of them commented out. One is for the US region and the other one is for the Europe region. Use the one that matches the region of your NR account. - Click OK to save it.
- Copy the content of newrelic-metrics.rsc in the
- Go to
System > Scheduler
, clickAdd New
.- Set
Start Time
tostartup
. - Set the
Interval
to00:00:15
, so that it runs and sends metrics every 15 seconds. You can always adjust it later to any value you prefer. - Click OK to save it.
- Set
- Reboot your router -so that the
startup
hook is fired and the scheduler starts calling the script.
- Go to
- After the script has run and sent data at least once, you can check if New Relic is getting the data:
- Open the Data Explorer ("Query your data" button at top navigation).
- Make sure you are in the Metrics tab.
- Use the input to filter by
mikrotik
(as all data is dumped with that string at the start)
Not seeing data in New Relic?
If you can't see the data in the Data Explorer, try to:
- In New Relic, go to Data Explorer => Events tab
- Look for the NrIntegrationError table -if the API is receiving the POSTs and rejecting the data, you can see the reason there.
- Run the script manually in your router console
- Login to the router's web GUI
- Click Terminal at top right
- Type
system script run newrelic-metrics
and press Enter. - It will run the script once -if there's a script error, or an HTTP error when sending the data, you can see it there.
Either posting in the Issues tab or Opening PRs are very welcome.