# Monitor available storage

**URL:** <https://discuss.elastic.co/t/monitor-available-storage/67093>\
**Category:** Elasticsearch\
**Created:** [November 24, 2016, 10:49am UTC](https://discuss.elastic.co/t/monitor-available-storage/67093 "2016-11-24T10:49:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lauri.lubi.softronic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@lauri.lubi.softronic](https://discuss.elastic.co/u/lauri.lubi.softronic)\
**Post date:** [November 24, 2016, 10:49am UTC](https://discuss.elastic.co/t/monitor-available-storage/67093/1 "2016-11-24T10:49:39Z")

</div>

We want to monitor that we don't run out of storage space. We want to get noticed before problems start. We make regular requests to the cluster using C# NEST client, using the stats-API. The API reports that we have over 4TB (yepp, terabytes) available storage which would be OK for us, but likely un-true. The portal says though that we have somewhere around 200GB total storage, depending on the size we choose. Which API should we use to get the real value of available storage?

---

<div class="post-metadata">

**Author:** ![txisme](https://avatars.discourse-cdn.com/v4/letter/t/dbc845/32.png) [@txisme](https://discuss.elastic.co/u/txisme)\
**Post date:** [November 24, 2016, 11:06am UTC](https://discuss.elastic.co/t/monitor-available-storage/67093/2 "2016-11-24T11:06:40Z")

</div>

Maybe use metricbeats or winbeats (depending if you are using linux or windows) to send memory logs to elasticsearch and then visualise it 😛

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 27, 2016, 7:38am UTC](https://discuss.elastic.co/t/monitor-available-storage/67093/3 "2016-11-27T07:38:53Z")

</div>

Or use Monitoring and Alerting.

However, which APIs are you calling?

---

<div class="post-metadata">

**Author:** ![lauri.lubi.softronic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@lauri.lubi.softronic](https://discuss.elastic.co/u/lauri.lubi.softronic)\
**Post date:** [November 28, 2016, 3:24pm UTC](https://discuss.elastic.co/t/monitor-available-storage/67093/4 "2016-11-28T15:24:46Z")

</div>

We are using NEST C# client, which I think uses Elastic's Nodes Stats API. From the code below you can see that we request filesystem metrics only. The NEST wrapper classes seem to correspond to [https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html#fs-info](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html#fs-info)

```
var diskFrees = new Dictionary<string, string>();
var nodeStat = client.NodesStats(s => s.Metrics(NodesStatsMetric.Fs));
foreach (var node in nodeStat.Nodes)
{
    var nodeName = node.Key;
    foreach (var dev in node.Value.FileSystem.Data)
    {
        var devName = dev.Dev ?? dev.Mount;
        var diskFree = dev.AvailableInBytes;
        AssertTools.Assert<ModelValidationException>(diskFree >= GetElasticRequiredDiskFree(), string.Format("Disk is getting full! Node={0} Dev={1} Free={2} MinRequiredFree={3}",
            nodeName, devName, FileTools.DisplaySize(diskFree), FileTools.DisplaySize(GetElasticRequiredDiskFree())));
        diskFrees.Add(string.Format("{0} {1}", nodeName, devName), FileTools.DisplaySize(diskFree));
    }
}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 26, 2016, 3:24pm UTC](https://discuss.elastic.co/t/monitor-available-storage/67093/5 "2016-12-26T15:24:57Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
