public static LinuxNative.StatBuffer StatFile(string fileName)
        {
            if (LinuxNative.Stat(fileName, out LinuxNative.StatBuffer statBuffer) != 0)
            {
                NativeMethods.ThrowLastWin32Exception($"Failed to stat {fileName}");
            }

            return(statBuffer);
        }
예제 #2
0
        /// <summary>
        /// Update data for the metrics. Called immediately before the metrics are scraped.
        /// </summary>
        public void UpdateMetrics()
        {
            var loadAverage = new double[3];

            if (LinuxNative.getloadavg(loadAverage, 3) == 3)
            {
                Load1.Set(loadAverage[0]);
                Load5.Set(loadAverage[1]);
                Load15.Set(loadAverage[2]);
            }
        }
 public override bool IsSocket(string fileName)
 {
     LinuxNative.StatBuffer statBuffer = StatFile(fileName);
     return(LinuxNative.IsSock(statBuffer.Mode));
 }