Mercurial > servermonitor
comparison ServerMonitor/Objects/Checks/DiskSpaceCheck.cs @ 13:a36cc5c123f4
Fix SSH command sublclasses holding on to old command strings after a program update.
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Mon, 15 Apr 2019 19:25:27 -0400 |
parents | 3142e52cbe69 |
children | 68d7834dc28e |
comparison
equal
deleted
inserted
replaced
12:d92176c5398a | 13:a36cc5c123f4 |
---|---|
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 => string.Format(base.Command, Device); | 13 public override string Command => string.Format(DiskSpaceCommand, Device); |
14 | |
15 protected string DiskSpaceCommand => "df -P -k {0}"; | |
14 | 16 |
15 public string Device { get; set; } | 17 public string Device { get; set; } |
16 | 18 |
17 public double MinFreeSpace { get; set; } | 19 public double MinFreeSpace { get; set; } |
18 | 20 |
19 public FreeSpaceUnits FreeSpaceUnits { get; set; } | 21 public FreeSpaceUnits FreeSpaceUnits { get; set; } |
20 | 22 |
21 public DiskSpaceCheck() | 23 public DiskSpaceCheck() |
22 { | 24 { |
23 //Command = "df -P -k {0} | awk 'NR>1' | tr -s ' ' | cut -d ' ' -f 4,5"; | |
24 Command = "df -P -k {0}"; | |
25 CheckExitCode = true; | 25 CheckExitCode = true; |
26 ExitCode = 0; | 26 ExitCode = 0; |
27 } | 27 } |
28 | 28 |
29 protected override List<CheckResult> ProcessCommandResult(string output, int exitCode) | 29 protected override List<CheckResult> ProcessCommandResult(string output, int exitCode) |