# Grafana custom metric

**URL:** <https://community.grafana.com/t/grafana-custom-metric/47343>\
**Category:** Grafana\
**Created:** [May 10, 2021, 6:01pm UTC](https://community.grafana.com/t/grafana-custom-metric/47343 "2021-05-10T18:01:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![schusr](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@schusr](https://community.grafana.com/u/schusr)\
**Post date:** [May 10, 2021, 6:01pm UTC](https://community.grafana.com/t/grafana-custom-metric/47343/1 "2021-05-10T18:01:41Z")

</div>

I want Grafana to run a custom query against a MSSQL database hourly, save the metric in InfluxDB (Grafana DB) and graph this metric.

What is the recommended method?

---

<div class="post-metadata">

**Author:** ![svetb](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/svetb/32/3307_2.png) [@svetb](https://community.grafana.com/u/svetb)\
**Post date:** [May 10, 2021, 6:53pm UTC](https://community.grafana.com/t/grafana-custom-metric/47343/2 "2021-05-10T18:53:42Z")

</div>

That’s not really something that Grafana can do. You’ll need to create a separate service. If you really want your data to be stored in InfluxDB, you may be able to use Telegraf (part of the Influx stack) or similar.

Specifically, Grafana is designed for reading data from databases and visualizing it. There is no functionality for writing data. In that respect, Grafana also has no built-in timeseries data store. Although Grafana is often used to visualize data from InfluxDB databases, the two are completely separate things.

With that in mind, I wonder whether it wouldn’t be better for you to simply write your processed output data into the same MSSQL database that the original data is in? That would seem like a simple approach, which doesn’t require you to set up a new data store (Influx).

---

<div class="post-metadata">

**Author:** ![schusr](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@schusr](https://community.grafana.com/u/schusr)\
**Post date:** [May 12, 2021, 4:38pm UTC](https://community.grafana.com/t/grafana-custom-metric/47343/3 "2021-05-12T16:38:06Z")

</div>

Thanks, think I have an approach figured out.

I’ll create a custom counter using powershell.

I’ll fill this counter with my data, send it to my existing InfluxDB using telegraf.

And now it’s available for visualization.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/grafana/original/2X/e/ef5308cc58c9e5a13187b5012eb99f406928462f.png) [@system](https://community.grafana.com/u/system)\
**Post date:** [May 10, 2022, 6:02pm UTC](https://community.grafana.com/t/grafana-custom-metric/47343/4 "2022-05-10T18:02:04Z")

</div>

Closed on May 10, 2022, 6:02pm UTC

This topic was automatically closed after 365 days. New replies are no longer allowed.
