25 namespace Ntp.Analyzer.Import
32 this.address = address;
37 private readonly
bool ntpq;
39 protected override string Command => ntpq ?
"ntpq" :
"ntpdc";
41 protected override string Arguments =>
"-c iostats " + address;
47 int timeSinceReset = -1;
48 int receiveBuffers = -1;
49 int freeReceiveBuffers = -1;
50 int usedReceiveBuffers = -1;
51 int lowWaterRefills = -1;
52 long droppedPackets = -1;
53 long ignoredPackets = -1;
54 long receivedPackets = -1;
55 long packetsSent = -1;
56 long packetsNotSent = -1;
57 int interruptsHandled = -1;
58 int receivedByInt = -1;
60 while (Reader.Peek() != -1)
62 string line = Reader.ReadLine();
64 if (
string.IsNullOrWhiteSpace(line) || line.Length < 24)
67 string name = line.Substring(0, 22).Replace(
":",
string.Empty).TrimEnd();
68 string value = line.Substring(22).TrimEnd();
72 if (!
long.TryParse(value, out parsedValue))
79 case "time since reset":
80 timeSinceReset = (int) parsedValue;
82 case "receive buffers":
83 receiveBuffers = (int) parsedValue;
85 case "free receive buffers":
86 freeReceiveBuffers = (int) parsedValue;
88 case "used receive buffers":
89 usedReceiveBuffers = (int) parsedValue;
91 case "low water refills":
92 lowWaterRefills = (int) parsedValue;
94 case "dropped packets":
95 droppedPackets = parsedValue;
97 case "ignored packets":
98 ignoredPackets = parsedValue;
100 case "received packets":
101 receivedPackets = parsedValue;
104 packetsSent = parsedValue;
106 case "packets not sent":
107 case "packet send failures":
108 packetsNotSent = parsedValue;
110 case "input wakeups":
111 case "interrupts handled":
112 interruptsHandled = (int) parsedValue;
114 case "useful input wakeups":
115 case "received by int":
116 receivedByInt = (int) parsedValue;
119 Log.NtpValueError(name);
override void ReadFromStream()
const string ImportIoError
IoStatsImporter(string address, bool ntpq, LogBase log)