comparison ServerMonitor/Objects/Checks/DiskSpaceCheck.cs @ 4:3142e52cbe69

Lots more progress
author Brad Greco <brad@bgreco.net>
date Sun, 10 Feb 2019 20:51:26 -0500
parents 96f0b028176d
children a36cc5c123f4
comparison
equal deleted inserted replaced
3:96f0b028176d 4:3142e52cbe69
8 namespace ServerMonitorApp 8 namespace ServerMonitorApp
9 { 9 {
10 [DisplayName("Disk space check"), Description("Check the remaining free disk space"), DisplayWeight(11)] 10 [DisplayName("Disk space check"), Description("Check the remaining free disk space"), DisplayWeight(11)]
11 public class DiskSpaceCheck : SshCheck 11 public class DiskSpaceCheck : SshCheck
12 { 12 {
13 public override string Command { get => string.Format(base.Command, Device); } 13 public override string Command => string.Format(base.Command, Device);
14 14
15 public string Device { get; set; } 15 public string Device { get; set; }
16 16
17 public double MinFreeSpace { get; set; } 17 public double MinFreeSpace { get; set; }
18 18
27 } 27 }
28 28
29 protected override List<CheckResult> ProcessCommandResult(string output, int exitCode) 29 protected override List<CheckResult> ProcessCommandResult(string output, int exitCode)
30 { 30 {
31 List<CheckResult> results = base.ProcessCommandResult(output, exitCode); 31 List<CheckResult> results = base.ProcessCommandResult(output, exitCode);
32 if (results.Any(r => r.CheckStatus != CheckStatus.Success)) 32 if (results.Any(r => r.Failed))
33 return results; 33 return results;
34 34
35 List<string> lines = output.Split('\n').ToList(); 35 List<string> lines = output.Split('\n').ToList();
36 lines.RemoveAt(0); 36 lines.RemoveAt(0);
37 if (lines.Count > 1) 37 if (lines.Count > 1)