Monitor available storage

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?

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

Or use Monitoring and Alerting.

However, which APIs are you calling?

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

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));
    }
}

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