mirror of https://bitbucket.org/anguist/ntpa
Removed platform dependent code
This commit is contained in:
parent
7daa991012
commit
956165e6a5
|
@ -4,7 +4,7 @@
|
|||
"version": "0.1.0",
|
||||
"command": "xbuild",
|
||||
"args": [
|
||||
"/p:GenerateFullPaths=true /p:mysql=ON /p:pgsql=ON /p:graph=NPlot"
|
||||
"/p:GenerateFullPaths=true"
|
||||
],
|
||||
"taskSelector": "/t:",
|
||||
"showOutput": "silent",
|
||||
|
|
12
Makefile
12
Makefile
|
@ -1,19 +1,11 @@
|
|||
# NTP Analyzer Makefile v0.3
|
||||
|
||||
FRAMEWORK= v4.0
|
||||
MYSQL= ON
|
||||
PGSQL= ON
|
||||
GRAPH= NPlot
|
||||
|
||||
all: release
|
||||
|
||||
debug:
|
||||
xbuild /p:Configuration=Debug /p:TargetFrameworkVersion=${FRAMEWORK} \
|
||||
/p:MySql=${MYSQL} /p:PgSql=${PGSQL} /p:Graph=${GRAPH} Ntp.Analyzer.sln
|
||||
xbuild /p:Configuration=Debug Ntp.Analyzer.sln
|
||||
|
||||
release:
|
||||
xbuild /p:Configuration=Release /p:TargetFrameworkVersion=${FRAMEWORK} \
|
||||
/p:MySql=${MYSQL} /p:PgSql=${PGSQL} /p:Graph=${GRAPH} Ntp.Analyzer.sln
|
||||
xbuild /p:Configuration=Release Ntp.Analyzer.sln
|
||||
|
||||
install: release
|
||||
install -d ${DESTDIR}$(PREFIX)/sbin
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Ntp.Analyzer.Process
|
|||
public sealed class Initializer
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Ntp.Analyzer.Process.Initializer" /> class.
|
||||
/// Initializes a new instance of the <see cref="Initializer" /> class.
|
||||
/// </summary>
|
||||
/// <param name="configFile">Config file to use.</param>
|
||||
/// <param name="pid">Process ID.</param>
|
||||
|
@ -366,19 +366,6 @@ private bool InitializeLog()
|
|||
Severity.Info);
|
||||
}
|
||||
|
||||
#if !GRAPH
|
||||
foreach (HostConfiguration server in config.Servers)
|
||||
{
|
||||
if (server.HostGraphs.Count() != 0 ||
|
||||
server.PeerGraphs.Count() != 0 ||
|
||||
server.TrafficGraphs.Count() != 0)
|
||||
{
|
||||
initlog.WriteLine(InitializationMessage.NoGraphBuild, Severity.Warn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,5 @@ public static class InitializationMessage
|
|||
public const string ConfigParseError = "Errors in configuration file:";
|
||||
public const string LogFileError = "Cannot create log file. {0}";
|
||||
public const string PidFileError = "Cannot create pid file. {0}";
|
||||
|
||||
public const string NoGraphBuild = "ntpa was not build with graph support but graphs are configured.";
|
||||
}
|
||||
}
|
|
@ -30,12 +30,13 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="NPlot, Version=0.9.10.0, Culture=neutral, PublicKeyToken=4eda430eb4395eb1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NPlot.0.9.10.0\lib\net20\NPlot.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="NPlot">
|
||||
<HintPath>..\libbin\NPlot.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
|
@ -210,7 +211,9 @@
|
|||
<Compile Include="Interface\IPathProvider.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ntp.Analyzer.Objects\Ntp.Analyzer.Objects.csproj">
|
||||
<Project>{02912378-E62D-4445-BA30-F56D3ABE9DA2}</Project>
|
||||
|
@ -234,4 +237,4 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
</Project>
|
||||
</Project>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NPlot" version="0.9.10.0" targetFramework="net452" />
|
||||
</packages>
|
|
@ -19,18 +19,38 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System.IO;
|
||||
|
||||
#if __MonoCS__
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#endif
|
||||
|
||||
namespace Ntp.Common.IO
|
||||
{
|
||||
public static class DirectoryCommand
|
||||
{
|
||||
public static string CreateRecursive(string path)
|
||||
{
|
||||
string fullPath = path.Trim();
|
||||
if (fullPath.Length <= 1)
|
||||
return null;
|
||||
|
||||
string created = null;
|
||||
char[] s = {'/'};
|
||||
var elements = fullPath.Split(s, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
|
||||
string currentPath = string.Empty;
|
||||
foreach (string element in elements)
|
||||
{
|
||||
currentPath = $"{currentPath}/{element}";
|
||||
if (Directory.Exists(currentPath))
|
||||
continue;
|
||||
|
||||
Directory.CreateDirectory(currentPath);
|
||||
created = currentPath;
|
||||
}
|
||||
|
||||
return created;
|
||||
}
|
||||
|
||||
public static string CreateRecursiveFromFile(string file)
|
||||
{
|
||||
int pos = file.LastIndexOf('/');
|
||||
|
@ -40,36 +60,5 @@ public static string CreateRecursiveFromFile(string file)
|
|||
string path = file.Substring(0, pos);
|
||||
return CreateRecursive(path);
|
||||
}
|
||||
|
||||
#if __MonoCS__
|
||||
public static string CreateRecursive(string path)
|
||||
{
|
||||
string fullPath = path.Trim ();
|
||||
if (fullPath.Length <= 1)
|
||||
return null;
|
||||
|
||||
string created = null;
|
||||
char[] s = new char[] { '/' };
|
||||
List<string> elements = fullPath.Split (s, StringSplitOptions.RemoveEmptyEntries).ToList ();
|
||||
|
||||
string currentPath = String.Empty;
|
||||
foreach (string element in elements) {
|
||||
currentPath = currentPath + "/" + element;
|
||||
if (!Directory.Exists (currentPath)) {
|
||||
Directory.CreateDirectory (currentPath);
|
||||
created = currentPath;
|
||||
}
|
||||
}
|
||||
|
||||
return created;
|
||||
}
|
||||
|
||||
#else
|
||||
public static string CreateRecursive(string path)
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
return null;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -183,25 +183,25 @@ private static IEnumerable<string> CreateWrappedLinesIterator(string self, IEnum
|
|||
yield return string.Empty;
|
||||
yield break;
|
||||
}
|
||||
using (IEnumerator<int> ewidths = widths.GetEnumerator())
|
||||
using (var ewidths = widths.GetEnumerator())
|
||||
{
|
||||
bool? hw = null;
|
||||
int width = GetNextWidth(ewidths, int.MaxValue, ref hw);
|
||||
int start = 0;
|
||||
var width = GetNextWidth(ewidths, int.MaxValue, ref hw);
|
||||
var start = 0;
|
||||
do
|
||||
{
|
||||
var end = GetLineEnd(start, width, self);
|
||||
char c = self[end - 1];
|
||||
var c = self[end - 1];
|
||||
if (char.IsWhiteSpace(c))
|
||||
--end;
|
||||
bool needContinuation = end != self.Length && !IsEolChar(c);
|
||||
string continuation = "";
|
||||
var needContinuation = end != self.Length && !IsEolChar(c);
|
||||
var continuation = "";
|
||||
if (needContinuation)
|
||||
{
|
||||
--end;
|
||||
continuation = "-";
|
||||
}
|
||||
string line = self.Substring(start, end - start) + continuation;
|
||||
var line = self.Substring(start, end - start) + continuation;
|
||||
yield return line;
|
||||
start = end;
|
||||
if (char.IsWhiteSpace(c))
|
||||
|
@ -213,9 +213,9 @@ private static IEnumerable<string> CreateWrappedLinesIterator(string self, IEnum
|
|||
|
||||
private static int GetLineEnd(int start, int length, string description)
|
||||
{
|
||||
int end = Math.Min(start + length, description.Length);
|
||||
int sep = -1;
|
||||
for (int i = start; i < end; ++i)
|
||||
var end = Math.Min(start + length, description.Length);
|
||||
var sep = -1;
|
||||
for (var i = start; i < end; ++i)
|
||||
{
|
||||
if (description[i] == '\n')
|
||||
return i + 1;
|
||||
|
@ -549,33 +549,23 @@ public override string ToString()
|
|||
|
||||
protected static T Parse<T>(string value, OptionContext c)
|
||||
{
|
||||
Type tt = typeof(T);
|
||||
#if PCL
|
||||
TypeInfo ti = tt.GetTypeInfo ();
|
||||
#else
|
||||
Type ti = tt;
|
||||
#endif
|
||||
bool nullable =
|
||||
var tt = typeof(T);
|
||||
var ti = tt;
|
||||
|
||||
var nullable =
|
||||
ti.IsValueType &&
|
||||
ti.IsGenericType &&
|
||||
!ti.IsGenericTypeDefinition &&
|
||||
ti.GetGenericTypeDefinition() == typeof(Nullable<>);
|
||||
#if PCL
|
||||
Type targetType = nullable ? tt.GenericTypeArguments [0] : tt;
|
||||
#else
|
||||
Type targetType = nullable ? tt.GetGenericArguments()[0] : tt;
|
||||
#endif
|
||||
T t = default(T);
|
||||
|
||||
var targetType = nullable ? tt.GetGenericArguments()[0] : tt;
|
||||
var t = default(T);
|
||||
try
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
#if PCL
|
||||
t = (T) Convert.ChangeType (value, targetType);
|
||||
#else
|
||||
TypeConverter conv = TypeDescriptor.GetConverter(targetType);
|
||||
var conv = TypeDescriptor.GetConverter(targetType);
|
||||
t = (T) conv.ConvertFromString(value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -591,8 +581,8 @@ protected static T Parse<T>(string value, OptionContext c)
|
|||
|
||||
private static void AddSeparators(string name, int end, ICollection<string> seps)
|
||||
{
|
||||
int start = -1;
|
||||
for (int i = end + 1; i < name.Length; ++i)
|
||||
var start = -1;
|
||||
for (var i = end + 1; i < name.Length; ++i)
|
||||
{
|
||||
switch (name[i])
|
||||
{
|
||||
|
@ -620,16 +610,16 @@ private static void AddSeparators(string name, int end, ICollection<string> seps
|
|||
|
||||
private OptionValueType ParsePrototype()
|
||||
{
|
||||
char type = '\0';
|
||||
List<string> seps = new List<string>();
|
||||
var type = '\0';
|
||||
var seps = new List<string>();
|
||||
|
||||
for (int i = 0; i < Names.Length; ++i)
|
||||
for (var i = 0; i < Names.Length; ++i)
|
||||
{
|
||||
string name = Names[i];
|
||||
var name = Names[i];
|
||||
if (name.Length == 0)
|
||||
throw new ArgumentException("Empty option names are not supported.");
|
||||
|
||||
int end = name.IndexOfAny(NameTerminator);
|
||||
var end = name.IndexOfAny(NameTerminator);
|
||||
if (end == -1)
|
||||
continue;
|
||||
Names[i] = name.Substring(0, end);
|
||||
|
@ -644,7 +634,8 @@ private OptionValueType ParsePrototype()
|
|||
return OptionValueType.None;
|
||||
|
||||
if (MaxValueCount <= 1 && seps.Count != 0)
|
||||
throw new ArgumentException($"Cannot provide key/value separators for Options taking {MaxValueCount} value(s).");
|
||||
throw new ArgumentException(
|
||||
$"Cannot provide key/value separators for Options taking {MaxValueCount} value(s).");
|
||||
|
||||
if (MaxValueCount > 1)
|
||||
{
|
||||
|
@ -682,20 +673,20 @@ private static IEnumerable<string> GetArguments(TextReader reader, bool close)
|
|||
{
|
||||
try
|
||||
{
|
||||
StringBuilder arg = new StringBuilder();
|
||||
var arg = new StringBuilder();
|
||||
|
||||
string line;
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
int t = line.Length;
|
||||
var t = line.Length;
|
||||
|
||||
for (int i = 0; i < t; i++)
|
||||
for (var i = 0; i < t; i++)
|
||||
{
|
||||
char c = line[i];
|
||||
var c = line[i];
|
||||
|
||||
if (c == '"' || c == '\'')
|
||||
{
|
||||
char end = c;
|
||||
var end = c;
|
||||
|
||||
for (i++; i < t; i++)
|
||||
{
|
||||
|
@ -732,7 +723,6 @@ private static IEnumerable<string> GetArguments(TextReader reader, bool close)
|
|||
}
|
||||
}
|
||||
|
||||
#if !PCL
|
||||
public class ResponseFileSource : ArgumentSource
|
||||
{
|
||||
public override string Description => "Read response file for more options.";
|
||||
|
@ -753,11 +743,8 @@ public override string[] GetNames()
|
|||
return new[] {"@file"};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !PCL
|
||||
[Serializable]
|
||||
#endif
|
||||
public class OptionException : Exception
|
||||
{
|
||||
public OptionException()
|
||||
|
@ -776,16 +763,13 @@ public OptionException(string message, string optionName, Exception innerExcepti
|
|||
OptionName = optionName;
|
||||
}
|
||||
|
||||
#if !PCL
|
||||
protected OptionException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
OptionName = info.GetString("OptionName");
|
||||
}
|
||||
#endif
|
||||
|
||||
public string OptionName { get; }
|
||||
#if !PCL
|
||||
#pragma warning disable 618 // SecurityPermissionAttribute is obsolete
|
||||
[SecurityPermission(SecurityAction.LinkDemand, SerializationFormatter = true)]
|
||||
#pragma warning restore 618
|
||||
|
@ -794,7 +778,6 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
|
|||
base.GetObjectData(info, context);
|
||||
info.AddValue("OptionName", OptionName);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public delegate void OptionAction<in TKey, in TValue>(TKey key, TValue value);
|
||||
|
@ -913,14 +896,14 @@ public List<string> Parse(IEnumerable<string> arguments)
|
|||
if (arguments == null)
|
||||
throw new ArgumentNullException(nameof(arguments));
|
||||
|
||||
OptionContext c = CreateOptionContext();
|
||||
var c = CreateOptionContext();
|
||||
c.OptionIndex = -1;
|
||||
bool process = true;
|
||||
List<string> unprocessed = new List<string>();
|
||||
Option def = Contains("<>") ? this["<>"] : null;
|
||||
ArgumentEnumerator ae = new ArgumentEnumerator(arguments);
|
||||
var process = true;
|
||||
var unprocessed = new List<string>();
|
||||
var def = Contains("<>") ? this["<>"] : null;
|
||||
var ae = new ArgumentEnumerator(arguments);
|
||||
|
||||
foreach (string argument in ae)
|
||||
foreach (var argument in ae)
|
||||
{
|
||||
++c.OptionIndex;
|
||||
if (argument == "--")
|
||||
|
@ -945,14 +928,14 @@ public List<string> Parse(IEnumerable<string> arguments)
|
|||
|
||||
public void WriteOptionDescriptions(TextWriter o)
|
||||
{
|
||||
foreach (Option p in this)
|
||||
foreach (var p in this)
|
||||
{
|
||||
int written = 0;
|
||||
var written = 0;
|
||||
|
||||
if (p.Hidden)
|
||||
continue;
|
||||
|
||||
Category c = p as Category;
|
||||
var c = p as Category;
|
||||
if (c != null)
|
||||
{
|
||||
WriteDescription(o, p.Description, "", 80, 80);
|
||||
|
@ -974,17 +957,17 @@ public void WriteOptionDescriptions(TextWriter o)
|
|||
DescriptionFirstWidth, DescriptionRemWidth);
|
||||
}
|
||||
|
||||
foreach (ArgumentSource s in sources)
|
||||
foreach (var s in sources)
|
||||
{
|
||||
string[] names = s.GetNames();
|
||||
var names = s.GetNames();
|
||||
if (names == null || names.Length == 0)
|
||||
continue;
|
||||
|
||||
int written = 0;
|
||||
var written = 0;
|
||||
|
||||
Write(o, ref written, " ");
|
||||
Write(o, ref written, names[0]);
|
||||
for (int i = 1; i < names.Length; ++i)
|
||||
for (var i = 1; i < names.Length; ++i)
|
||||
{
|
||||
Write(o, ref written, ", ");
|
||||
Write(o, ref written, names[i]);
|
||||
|
@ -1042,7 +1025,7 @@ protected Option GetOptionForName(string option)
|
|||
throw new ArgumentNullException(nameof(argument));
|
||||
|
||||
flag = name = sep = value = null;
|
||||
Match m = valueOption.Match(argument);
|
||||
var m = valueOption.Match(argument);
|
||||
if (!m.Success)
|
||||
{
|
||||
return false;
|
||||
|
@ -1100,10 +1083,10 @@ protected virtual bool Parse(string argument, OptionContext c)
|
|||
|
||||
protected override void RemoveItem(int index)
|
||||
{
|
||||
Option p = Items[index];
|
||||
var p = Items[index];
|
||||
base.RemoveItem(index);
|
||||
// KeyedCollection.RemoveItem() handles the 0th item
|
||||
for (int i = 1; i < p.Names.Length; ++i)
|
||||
for (var i = 1; i < p.Names.Length; ++i)
|
||||
{
|
||||
Dictionary.Remove(p.Names[i]);
|
||||
}
|
||||
|
@ -1119,11 +1102,11 @@ private void AddImpl(Option option)
|
|||
{
|
||||
if (option == null)
|
||||
throw new ArgumentNullException(nameof(option));
|
||||
List<string> added = new List<string>(option.Names.Length);
|
||||
var added = new List<string>(option.Names.Length);
|
||||
try
|
||||
{
|
||||
// KeyedCollection.InsertItem/SetItem handle the 0th name.
|
||||
for (int i = 1; i < option.Names.Length; ++i)
|
||||
for (var i = 1; i < option.Names.Length; ++i)
|
||||
{
|
||||
Dictionary.Add(option.Names[i], option);
|
||||
added.Add(option.Names[i]);
|
||||
|
@ -1131,7 +1114,7 @@ private void AddImpl(Option option)
|
|||
}
|
||||
catch (Exception)
|
||||
{
|
||||
foreach (string name in added)
|
||||
foreach (var name in added)
|
||||
Dictionary.Remove(name);
|
||||
throw;
|
||||
}
|
||||
|
@ -1139,7 +1122,7 @@ private void AddImpl(Option option)
|
|||
|
||||
private bool AddSource(ArgumentEnumerator ae, string argument)
|
||||
{
|
||||
foreach (ArgumentSource source in sources)
|
||||
foreach (var source in sources)
|
||||
{
|
||||
IEnumerable<string> replacement;
|
||||
if (!source.GetArguments(argument, out replacement))
|
||||
|
@ -1157,7 +1140,7 @@ private static string GetArgumentName(int index, int maxIndex, string descriptio
|
|||
|
||||
var nameStart = maxIndex == 1 ? new[] {"{0:", "{"} : new[] {"{" + index + ":"};
|
||||
|
||||
foreach (string t in nameStart)
|
||||
foreach (var t in nameStart)
|
||||
{
|
||||
int start, j = 0;
|
||||
do
|
||||
|
@ -1166,7 +1149,7 @@ private static string GetArgumentName(int index, int maxIndex, string descriptio
|
|||
} while (start >= 0 && j != 0 && description[j++ - 1] == '{');
|
||||
if (start == -1)
|
||||
continue;
|
||||
int end = description.IndexOf("}", start, StringComparison.Ordinal);
|
||||
var end = description.IndexOf("}", start, StringComparison.Ordinal);
|
||||
if (end == -1)
|
||||
continue;
|
||||
return description.Substring(start + t.Length, end - start - t.Length);
|
||||
|
@ -1179,9 +1162,9 @@ private static string GetDescription(string description)
|
|||
{
|
||||
if (description == null)
|
||||
return string.Empty;
|
||||
StringBuilder sb = new StringBuilder(description.Length);
|
||||
int start = -1;
|
||||
for (int i = 0; i < description.Length; ++i)
|
||||
var sb = new StringBuilder(description.Length);
|
||||
var start = -1;
|
||||
for (var i = 0; i < description.Length; ++i)
|
||||
{
|
||||
switch (description[i])
|
||||
{
|
||||
|
@ -1251,7 +1234,7 @@ private bool ParseBool(string option, string n, OptionContext c)
|
|||
Contains(rn = n.Substring(0, n.Length - 1)))
|
||||
{
|
||||
var p = this[rn];
|
||||
string v = n[n.Length - 1] == '+' ? option : null;
|
||||
var v = n[n.Length - 1] == '+' ? option : null;
|
||||
c.OptionName = option;
|
||||
c.Option = p;
|
||||
c.OptionValues.Add(v);
|
||||
|
@ -1265,10 +1248,10 @@ private bool ParseBundledValue(string f, string n, OptionContext c)
|
|||
{
|
||||
if (f != "-")
|
||||
return false;
|
||||
for (int i = 0; i < n.Length; ++i)
|
||||
for (var i = 0; i < n.Length; ++i)
|
||||
{
|
||||
string opt = f + n[i];
|
||||
string rn = n[i].ToString();
|
||||
var opt = f + n[i];
|
||||
var rn = n[i].ToString();
|
||||
if (!Contains(rn))
|
||||
{
|
||||
if (i == 0)
|
||||
|
@ -1285,7 +1268,7 @@ private bool ParseBundledValue(string f, string n, OptionContext c)
|
|||
case OptionValueType.Optional:
|
||||
case OptionValueType.Required:
|
||||
{
|
||||
string v = n.Substring(i + 1);
|
||||
var v = n.Substring(i + 1);
|
||||
c.Option = p;
|
||||
c.OptionName = opt;
|
||||
ParseValue(v.Length != 0 ? v : null, c);
|
||||
|
@ -1301,7 +1284,7 @@ private bool ParseBundledValue(string f, string n, OptionContext c)
|
|||
private void ParseValue(string option, OptionContext c)
|
||||
{
|
||||
if (option != null)
|
||||
foreach (string o in c.Option.ValueSeparators != null
|
||||
foreach (var o in c.Option.ValueSeparators != null
|
||||
? option.Split(c.Option.ValueSeparators, c.Option.MaxValueCount - c.OptionValues.Count,
|
||||
StringSplitOptions.None)
|
||||
: new[] {option})
|
||||
|
@ -1339,8 +1322,8 @@ private static void Write(TextWriter o, ref int n, string s)
|
|||
|
||||
private void WriteDescription(TextWriter o, string value, string prefix, int firstWidth, int remWidth)
|
||||
{
|
||||
bool indent = false;
|
||||
foreach (string line in GetLines(MessageLocalizer(GetDescription(value)), firstWidth, remWidth))
|
||||
var indent = false;
|
||||
foreach (var line in GetLines(MessageLocalizer(GetDescription(value)), firstWidth, remWidth))
|
||||
{
|
||||
if (indent)
|
||||
o.Write(prefix);
|
||||
|
@ -1351,9 +1334,9 @@ private void WriteDescription(TextWriter o, string value, string prefix, int fir
|
|||
|
||||
private bool WriteOptionPrototype(TextWriter o, Option p, ref int written)
|
||||
{
|
||||
string[] names = p.Names;
|
||||
var names = p.Names;
|
||||
|
||||
int i = GetNextOptionIndex(names, 0);
|
||||
var i = GetNextOptionIndex(names, 0);
|
||||
if (i == names.Length)
|
||||
return false;
|
||||
|
||||
|
@ -1385,10 +1368,10 @@ private bool WriteOptionPrototype(TextWriter o, Option p, ref int written)
|
|||
Write(o, ref written, MessageLocalizer("["));
|
||||
}
|
||||
Write(o, ref written, MessageLocalizer("=" + GetArgumentName(0, p.MaxValueCount, p.Description)));
|
||||
string sep = p.ValueSeparators != null && p.ValueSeparators.Length > 0
|
||||
var sep = p.ValueSeparators != null && p.ValueSeparators.Length > 0
|
||||
? p.ValueSeparators[0]
|
||||
: " ";
|
||||
for (int c = 1; c < p.MaxValueCount; ++c)
|
||||
for (var c = 1; c < p.MaxValueCount; ++c)
|
||||
{
|
||||
Write(o, ref written, MessageLocalizer(sep + GetArgumentName(c, p.MaxValueCount, p.Description)));
|
||||
}
|
||||
|
@ -1486,7 +1469,7 @@ public IEnumerator<string> GetEnumerator()
|
|||
{
|
||||
do
|
||||
{
|
||||
IEnumerator<string> c = sources[sources.Count - 1];
|
||||
var c = sources[sources.Count - 1];
|
||||
if (c.MoveNext())
|
||||
yield return c.Current;
|
||||
else
|
||||
|
|
|
@ -19,85 +19,47 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
#if __MonoCS__
|
||||
using Mono.Unix;
|
||||
using Mono.Unix.Native;
|
||||
#endif
|
||||
|
||||
namespace Ntp.Common.IO
|
||||
{
|
||||
#if __MonoCS__
|
||||
public static class Permission
|
||||
{
|
||||
public static uint? GetUserId(string userName) {
|
||||
Passwd pw = Syscall.getpwnam(userName);
|
||||
if (pw != null) {
|
||||
return pw.pw_uid;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static uint? GetGroupId(string groupName) {
|
||||
Group gr = Syscall.getgrnam(groupName);
|
||||
if (gr != null) {
|
||||
return gr.gr_gid;
|
||||
}
|
||||
|
||||
return null;
|
||||
public static bool ChangeFileMode(string file, uint mode)
|
||||
{
|
||||
var permissions = NativeConvert.FromOctalPermissionString(mode.ToString());
|
||||
return Syscall.chmod(file, permissions) == 0;
|
||||
}
|
||||
|
||||
public static bool SetUserId(uint userId) {
|
||||
try {
|
||||
Syscall.seteuid (userId);
|
||||
} catch {
|
||||
public static bool ChangeFileOwner(string file, uint user, uint? group)
|
||||
{
|
||||
return Syscall.chown(file, user, group ?? unchecked((uint) -1)) == 0;
|
||||
}
|
||||
|
||||
public static uint? GetGroupId(string groupName)
|
||||
{
|
||||
var gr = Syscall.getgrnam(groupName);
|
||||
return gr?.gr_gid;
|
||||
}
|
||||
|
||||
public static uint? GetUserId(string userName)
|
||||
{
|
||||
var pw = Syscall.getpwnam(userName);
|
||||
return pw?.pw_uid;
|
||||
}
|
||||
|
||||
public static bool SetUserId(uint userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
Syscall.seteuid(userId);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ChangeFileMode(string file, uint mode)
|
||||
{
|
||||
FilePermissions permissions = NativeConvert.FromOctalPermissionString(mode.ToString());
|
||||
return (Syscall.chmod(file, permissions) == 0);
|
||||
}
|
||||
|
||||
public static bool ChangeFileOwner(string file, uint user, uint? group)
|
||||
{
|
||||
return (Syscall.chown(file, user, group ?? unchecked((uint)-1)) == 0);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
public static class Permission
|
||||
{
|
||||
public static bool ChangeFileMode(string file, uint mode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ChangeFileOwner(string file, uint user, uint? group)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static uint? GetGroupId(string groupName)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static uint? GetUserId(string userName)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool SetUserId(uint userId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
|
@ -55,12 +55,12 @@ public StreamReader Execute()
|
|||
RedirectStandardError = true,
|
||||
WorkingDirectory = WorkingDirectory,
|
||||
FileName = command,
|
||||
Arguments = " " + arguments
|
||||
Arguments = $" {arguments}"
|
||||
}
|
||||
};
|
||||
|
||||
string error;
|
||||
log.WriteLine("Executing: " + command + " " + arguments, Severity.Debug);
|
||||
log.WriteLine($"Executing: {command} {arguments}", Severity.Debug);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ public StreamReader Execute()
|
|||
if (error == string.Empty)
|
||||
return proc.StandardOutput;
|
||||
|
||||
log.WriteLine(ErrorMessage + " " + error, Severity.Warn);
|
||||
log.WriteLine($"{ErrorMessage} {error}", Severity.Warn);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#if !__MonoCS__
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Security;
|
||||
|
@ -122,6 +121,4 @@ private static EventLogEntryType GetEventLogEntryType(Severity severity)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ntp.Common.System;
|
||||
|
||||
namespace Ntp.Common.Log
|
||||
{
|
||||
|
@ -87,15 +88,9 @@ public static LogBase CreateLog(IEnumerable<ILogConfiguration> configs)
|
|||
|
||||
public static LogBase CreateSysLog(string name)
|
||||
{
|
||||
#if __MonoCS__
|
||||
LogBase log = new SysLog(name, Severity.Notice);
|
||||
var log = ProcessInfo.CreateSystemLog(name);
|
||||
Logs.Add(log);
|
||||
return log;
|
||||
#else
|
||||
LogBase log = new EventLog(name, Severity.Notice);
|
||||
Logs.Add(log);
|
||||
return log;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Resume()
|
||||
|
@ -122,12 +117,9 @@ private static LogBase CreateLogInternal(ILogConfiguration config)
|
|||
ShowTimeStamp = config.ShowTimestamp
|
||||
};
|
||||
case LogType.Syslog:
|
||||
case LogType.EventLog:
|
||||
#if __MonoCS__
|
||||
return new SysLog(ApplicationName, config.Treshold);
|
||||
#else
|
||||
case LogType.EventLog:
|
||||
return new EventLog(ApplicationName, config.Treshold);
|
||||
#endif
|
||||
case LogType.File:
|
||||
return new FileLog(config.File, config.Treshold, config.TimeFormat)
|
||||
{
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
#if __MonoCS__
|
||||
using System;
|
||||
using Mono.Unix;
|
||||
using Mono.Unix.Native;
|
||||
|
@ -35,39 +33,39 @@ public SysLog(string name, Severity treshold)
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
private readonly string name;
|
||||
private static bool initialized = false;
|
||||
|
||||
private const SyslogFacility Facility = SyslogFacility.LOG_DAEMON;
|
||||
private const SyslogOptions Options = SyslogOptions.LOG_PID;
|
||||
private static bool initialized;
|
||||
|
||||
private readonly string name;
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
Syscall.closelog();
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
|
||||
string ident = name;
|
||||
Syscall.openlog(UnixMarshal.StringToHeap(ident), Options, Facility);
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
public override void Suspend()
|
||||
{
|
||||
// SysLog cannot suspend
|
||||
}
|
||||
|
||||
public override void Resume()
|
||||
{
|
||||
// SysLog cannot resume
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
public override void Suspend()
|
||||
{
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
Syscall.closelog();
|
||||
initialized = false;
|
||||
// SysLog cannot suspend
|
||||
}
|
||||
|
||||
public override void WriteLine(Exception exception)
|
||||
|
@ -88,10 +86,10 @@ public override void WriteLine(string text, Severity severity)
|
|||
if (severity < Treshold)
|
||||
return;
|
||||
|
||||
Syscall.syslog(Facility, GetSyslogLevel(severity), text);
|
||||
Syscall.syslog(Facility, GetSyslogLevel(severity), text);
|
||||
}
|
||||
|
||||
private SyslogLevel GetSyslogLevel(Severity severity)
|
||||
private static SyslogLevel GetSyslogLevel(Severity severity)
|
||||
{
|
||||
switch (severity)
|
||||
{
|
||||
|
@ -104,12 +102,11 @@ private SyslogLevel GetSyslogLevel(Severity severity)
|
|||
case Severity.Info:
|
||||
return SyslogLevel.LOG_INFO;
|
||||
case Severity.Debug:
|
||||
case Severity.Trace:
|
||||
return SyslogLevel.LOG_DEBUG;
|
||||
default:
|
||||
return SyslogLevel.LOG_DEBUG;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
|
@ -30,8 +30,11 @@
|
|||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Mono.Posix.4.0.0.0\lib\net40\Mono.Posix.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Mono.Posix" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
@ -71,4 +74,7 @@
|
|||
<Compile Include="App\Heartbeat.cs" />
|
||||
<Compile Include="Web\UriExtensions.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -20,13 +20,9 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Ntp.Common.Log;
|
||||
|
||||
#if __MonoCS__
|
||||
using Mono.Unix;
|
||||
using Mono.Unix.Native;
|
||||
#endif
|
||||
using Ntp.Common.Log;
|
||||
|
||||
namespace Ntp.Common.System
|
||||
{
|
||||
|
@ -41,98 +37,69 @@ public enum Signal
|
|||
Notify
|
||||
}
|
||||
|
||||
#if __MonoCS__
|
||||
|
||||
private static UnixSignal sigterm, sigquit, sigint, sighup, sigusr1, sigusr2;
|
||||
private static UnixSignal[] signals = new UnixSignal[] {
|
||||
sigint = new UnixSignal (Signum.SIGINT),
|
||||
sigterm = new UnixSignal (Signum.SIGTERM),
|
||||
sigquit = new UnixSignal (Signum.SIGQUIT),
|
||||
sighup = new UnixSignal (Signum.SIGHUP),
|
||||
sigusr1 = new UnixSignal (Signum.SIGUSR1),
|
||||
sigusr2 = new UnixSignal (Signum.SIGUSR2)
|
||||
|
||||
private static readonly UnixSignal[] Signals =
|
||||
{
|
||||
sigint = new UnixSignal(Signum.SIGINT),
|
||||
sigterm = new UnixSignal(Signum.SIGTERM),
|
||||
sigquit = new UnixSignal(Signum.SIGQUIT),
|
||||
sighup = new UnixSignal(Signum.SIGHUP),
|
||||
sigusr1 = new UnixSignal(Signum.SIGUSR1),
|
||||
sigusr2 = new UnixSignal(Signum.SIGUSR2)
|
||||
};
|
||||
|
||||
public static Signal Wait (string name, LogBase log)
|
||||
public static Signal Wait(string name, LogBase log)
|
||||
{
|
||||
int i = 0;
|
||||
while (true) {
|
||||
try {
|
||||
i = UnixSignal.WaitAny (signals, -1);
|
||||
} catch (Exception e) {
|
||||
log.WriteLine ("Unrecoverable error in UnixSignal.WaitAny()",
|
||||
while (true)
|
||||
{
|
||||
int i;
|
||||
try
|
||||
{
|
||||
i = UnixSignal.WaitAny(Signals, -1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.WriteLine("Unrecoverable error in UnixSignal.WaitAny()",
|
||||
Severity.Error);
|
||||
log.WriteLine (e, Severity.Trace);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
return Signal.Error;
|
||||
}
|
||||
|
||||
if (i < 0 || i >= signals.Length) {
|
||||
log.WriteLine (String.Format (
|
||||
"Received unknown signal {0}",
|
||||
signals [i].Signum.ToString ()),
|
||||
Severity.Warn);
|
||||
if (i < 0 || i >= Signals.Length)
|
||||
{
|
||||
log.WriteLine($"Received unknown signal {Signals[i].Signum}", Severity.Warn);
|
||||
continue;
|
||||
}
|
||||
|
||||
log.WriteLine (String.Format (
|
||||
"Received signal {0}",
|
||||
signals [i].Signum.ToString ()),
|
||||
Severity.Debug);
|
||||
log.WriteLine($"Received signal {Signals[i].Signum}", Severity.Debug);
|
||||
|
||||
if (sigint.IsSet || sigterm.IsSet || sigquit.IsSet) {
|
||||
sigint.Reset ();
|
||||
sigterm.Reset ();
|
||||
sigquit.Reset ();
|
||||
if (sigint.IsSet || sigterm.IsSet || sigquit.IsSet)
|
||||
{
|
||||
sigint.Reset();
|
||||
sigterm.Reset();
|
||||
sigquit.Reset();
|
||||
return Signal.Exit;
|
||||
} else if (sighup.IsSet) {
|
||||
sighup.Reset ();
|
||||
}
|
||||
|
||||
if (sighup.IsSet)
|
||||
{
|
||||
sighup.Reset();
|
||||
return Signal.Refresh;
|
||||
} else if (sigusr1.IsSet) {
|
||||
sigusr1.Reset ();
|
||||
}
|
||||
|
||||
if (sigusr1.IsSet)
|
||||
{
|
||||
sigusr1.Reset();
|
||||
return Signal.Reload;
|
||||
} else if (sigusr2.IsSet) {
|
||||
sigusr2.Reset ();
|
||||
}
|
||||
|
||||
if (sigusr2.IsSet)
|
||||
{
|
||||
sigusr2.Reset();
|
||||
return Signal.Notify;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
public static bool Release(string name, LogBase log)
|
||||
{
|
||||
try
|
||||
{
|
||||
EventWaitHandle handle = EventWaitHandle.OpenExisting(name);
|
||||
handle.Set();
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.WriteLine("Error in mutex handling.", Severity.Error);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static Signal Wait(string name, LogBase log)
|
||||
{
|
||||
try
|
||||
{
|
||||
var handle = new EventWaitHandle(
|
||||
false, EventResetMode.ManualReset,
|
||||
name);
|
||||
handle.WaitOne();
|
||||
return Signal.Exit;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.WriteLine("Error in mutex handling.", Severity.Error);
|
||||
log.WriteLine(e, Severity.Trace);
|
||||
return Signal.Error;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -19,25 +19,24 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
|
||||
#if __MonoCS__
|
||||
using System;
|
||||
using Mono.Unix.Native;
|
||||
#endif
|
||||
using Ntp.Common.Log;
|
||||
|
||||
namespace Ntp.Common.System
|
||||
{
|
||||
public class ProcessInfo
|
||||
public static class ProcessInfo
|
||||
{
|
||||
public static int ProcessId
|
||||
public static int ProcessId =>
|
||||
Environment.OSVersion.Platform == PlatformID.Unix
|
||||
? Syscall.getpid()
|
||||
: global::System.Diagnostics.Process.GetCurrentProcess().Id;
|
||||
|
||||
public static LogBase CreateSystemLog(string name)
|
||||
{
|
||||
get
|
||||
{
|
||||
#if __MonoCS__
|
||||
return Syscall.getpid ();
|
||||
#else
|
||||
return global::System.Diagnostics.Process.GetCurrentProcess().Id;
|
||||
#endif
|
||||
}
|
||||
return Environment.OSVersion.Platform == PlatformID.Unix
|
||||
? new SysLog(name, Severity.Notice)
|
||||
: (LogBase) new EventLog("NTP Analyzer", Severity.Notice);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Mono.Posix" version="4.0.0.0" targetFramework="net452" />
|
||||
</packages>
|
|
@ -19,7 +19,6 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#if MYSQL
|
||||
using System.Data;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
@ -131,6 +130,4 @@ private static string BuildConnectionString(bool includeName = true)
|
|||
return b.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
|
@ -51,28 +51,25 @@
|
|||
</PropertyGroup>
|
||||
<!-- PostgreSQL Provider include -->
|
||||
<Choose>
|
||||
<When Condition=" '$(PgSql)' == 'ON' ">
|
||||
<ItemGroup>
|
||||
<Reference Include="Npgsql">
|
||||
<HintPath>..\libbin\Npgsql.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition=" '$(PgSql)' == 'ON' " />
|
||||
</Choose>
|
||||
<!-- MySQL Provider include -->
|
||||
<Choose>
|
||||
<When Condition=" '$(MySql)' == 'ON' ">
|
||||
<ItemGroup>
|
||||
<Reference Include="MySql.Data">
|
||||
<HintPath>..\libbin\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<When Condition=" '$(MySql)' == 'ON' " />
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Reference Include="MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.6.9.9\lib\net45\MySql.Data.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Npgsql, Version=3.1.7.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Npgsql.3.1.7\lib\net451\Npgsql.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
</ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="MySqlFactory.cs" />
|
||||
|
@ -85,4 +82,7 @@
|
|||
<Name>Ntp.Data</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -19,7 +19,6 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#if PGSQL
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
@ -173,6 +172,4 @@ private static string BuildConnectionString(bool includeName = true)
|
|||
return b.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
|
@ -35,17 +35,9 @@ public static SqlDatabaseFactory Instance
|
|||
switch (Config.Provider)
|
||||
{
|
||||
case SqlDatabaseProvider.MySql:
|
||||
#if MYSQL
|
||||
return new MySqlFactory();
|
||||
#else
|
||||
throw new NotSupportedException("Data access was not built with MySQL support.");
|
||||
#endif
|
||||
case SqlDatabaseProvider.PostgreSql:
|
||||
#if PGSQL
|
||||
return new PostgreSqlFactory();
|
||||
#else
|
||||
throw new NotSupportedException("Data access was not built with PostgreSQL support.");
|
||||
#endif
|
||||
case SqlDatabaseProvider.Unknown:
|
||||
throw new NotSupportedException("Unknown SQL data provider was configured.");
|
||||
default:
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MySql.Data" version="6.9.9" targetFramework="net452" />
|
||||
<package id="Npgsql" version="3.1.7" targetFramework="net452" />
|
||||
</packages>
|
|
@ -1,45 +0,0 @@
|
|||
MySQL Connector/Net 6.x
|
||||
|
||||
This is a release of MySQL Connector/Net, Oracle's dual-
|
||||
license ADO.Net Driver for MySQL. For the avoidance of
|
||||
doubt, this particular copy of the software is released
|
||||
under the version 2 of the GNU General Public License.
|
||||
MySQL Connector/Net is brought to you by Oracle.
|
||||
|
||||
Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
License information can be found in the COPYING file.
|
||||
|
||||
MySQL FOSS License Exception
|
||||
We want free and open source software applications under
|
||||
certain licenses to be able to use the GPL-licensed MySQL
|
||||
Connector/NET (specified GPL-licensed MySQL client libraries)
|
||||
despite the fact that not all such FOSS licenses are
|
||||
compatible with version 2 of the GNU General Public License.
|
||||
Therefore there are special exceptions to the terms and
|
||||
conditions of the GPLv2 as applied to these client libraries,
|
||||
which are identified and described in more detail in the
|
||||
FOSS License Exception at
|
||||
<http://www.mysql.com/about/legal/licensing/foss-exception.html>
|
||||
|
||||
This distribution may include materials developed by third
|
||||
parties. For license and attribution notices for these
|
||||
materials, please refer to the documentation that accompanies
|
||||
this distribution (see the "Licenses for Third-Party Components"
|
||||
appendix) or view the online documentation at
|
||||
<http://dev.mysql.com/doc/>
|
||||
|
||||
The accompanying documentation currently exists in MSDN help
|
||||
format and is located in the 'doc' directory.
|
||||
|
||||
GPLv2 Disclaimer
|
||||
For the avoidance of doubt, except that if any license choice
|
||||
other than GPL or LGPL is available it will apply instead,
|
||||
Oracle elects to use only the General Public License version 2
|
||||
(GPLv2) at this time for any software where a choice of GPL
|
||||
license versions is made available with the language indicating
|
||||
that GPLv2 or any later version may be used, or where a choice
|
||||
of which version of the GPL is applied is otherwise unspecified.
|
||||
|
||||
This software is OSI Certified Open Source Software.
|
||||
OSI Certified is a certification mark of the Open Source Initiative.
|
|
@ -1,27 +0,0 @@
|
|||
NPlot - A charting library for .NET
|
||||
Copyright (C) 2003-2006 Matt Howlett and others.
|
||||
Copyright (C) 2013-2016 Carsten Larsen.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
3. Neither the name of NPlot nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGE.
|
BIN
libbin/NPlot.dll
BIN
libbin/NPlot.dll
Binary file not shown.
|
@ -1,7 +0,0 @@
|
|||
Copyright (c) 2002-2016, The Npgsql Development Team
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
|
||||
|
||||
IN NO EVENT SHALL THE NPGSQL DEVELOPMENT TEAM BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE NPGSQL DEVELOPMENT TEAM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
THE NPGSQL DEVELOPMENT TEAM SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,77 @@
|
|||
6.9.9
|
||||
- Fix for Nested transactions are not supported in Entity Framework (MySQL Bug #71502, Oracle Bug #22366266).
|
||||
- Fix for EF5 and EF6 wrong SQL statement to set primary key (MySQL Bug 76292, Oracle Bug #20711384)
|
||||
- Fixed problem where mysql.proc tables would not be used for metadata even though access was available (MySQL Bug #74116, Oracle Bug #20960373)
|
||||
- Added support for TLSv1.1 and TLSv1.2
|
||||
- Fixed Fix for "Aborted connection" (MySQL Bug #80997, Oracle Bug # 23346197).
|
||||
|
||||
|
||||
6.9.8
|
||||
- Added support for Chinese character set gb18030. (Oracle bug # 21098546).
|
||||
- Added support for Json type. (WL # 8132).
|
||||
- Added changes for metadata information in generated columns with 5.7 (WL #411)
|
||||
|
||||
6.9.7
|
||||
- Changed default SSL mode to Preferred in connection string. Now the server connections will be using SSL if server allows it by default but it's possible to override this configuration.
|
||||
- Changed handshake process to use bytes instead of encoded strings.
|
||||
- Fix for Fabric connections (Oracle Bug #20983968).
|
||||
- Fix for Fabric plugin: fabric server selection is broken when master is faulty (Oracle Bug #21203824).
|
||||
|
||||
|
||||
6.9.6
|
||||
- Fix for Incorrect query result with Entity Framework 6 (MySql bug #74918, Oracle bug #20129927).
|
||||
- Fix for GetTimeZoneOffset to use date and time to calculate timediff (MySQL Bug #74905, Oracle Bug #20065691).
|
||||
- Fix for MySqlSimpleMembershipProvider keeps database connections open on some operations (MySQL Bug #74662, Oracle Bug #20109419)
|
||||
- Fix for Any Call to RoleExists() returns true whether or not the role exists (MySql bug #75397, Oracle bug #20325391).
|
||||
- Fix for all dateTimes set as UTC Kind (MySQL Bug #74134, Oracle Bug #20200662).
|
||||
- Fix for Invalid SQL query when eager loading two nested collections (MySQL Bug #70941, Oracle bug #18049862).
|
||||
- Fix for chinese characters used in the connection string when connecting to MySql Server (MySQL Bug #70041, Oracle Bug #18141356).
|
||||
|
||||
|
||||
|
||||
6.9.5
|
||||
- Disabled installation on-demand in Installer (Oracle Bug #19670596).
|
||||
- Fix for Generated SQL requests column that doesn't exist in LINQ to Entities (MySql bug #72004, Oracle bug #19681348).
|
||||
- Fix for MySQL Connector/NET generates incorrect SQL for LINQ 'StartsWith' queries (MySql bug #72058, Oracle bug #19680236).
|
||||
- Fix for Exception when using IEnumerable.Contains(model.property) in Where predicate (MySql bug #73643, Oracle bug #19690370).
|
||||
- Fix for Generated Sql does not contain ORDER BY statement whose is requested by LINQ (MySql bug #73549, Oracle bug #19698010).
|
||||
- Fix for Web providers registration in machine.config (removed v20 suffix) (MySQL Bug #74080, Oracle Bug #19715398)
|
||||
- Fix for Error of "Every derived table must have an alias" in LINQ to Entities when using EF6 + DbFirst + View + Take
|
||||
(MySql Bug #72148, Oracle bug #19356006).
|
||||
- Fix for 'the method or operation is not implemented' when using linq with orderby (MySQL Bug #70722, Oracle Bug #19681723).
|
||||
- Fix for Exception "The given key was not present in the dictionary" when using utf16le charset in a query. (MySql #72737, Oracle Bug #19355906)
|
||||
- Fix for Memory leak in a loop opening a connection to the database and executing a command (MySql Bug #73122, Oracle Bug #19467233).
|
||||
- Fix for Multiple issues caused by trailing and leading white space character in params using MySql Membership Provider (MySql Bug #73411, Oracle Bug #19453313)
|
||||
- Fix for bad assumption leads to modify query adding CALL statement to the beginning of the sql query even when CommandType.Text is specified (MySql Bug #72736, Oracle Bug #19325120).
|
||||
|
||||
|
||||
6.9.4
|
||||
- Added a new plugin for MySql Fabric 1.5 support
|
||||
|
||||
|
||||
6.9.3
|
||||
- Fix for Web Parts Personalization provider
|
||||
- Fix for changing the PK between two int columns (MySql Bug #71418, Oracle bug #18923294).
|
||||
- Fix for Error when Calling MySqlConnection.GetSchema("PROCEDURES WITH PARAMETERS", ...) (Oracle bug #19285959).
|
||||
- Fix for EF provider reports ManifestProviderToken = 5.6 for server 5.7 (Oracle bug #19453814).
|
||||
- Fix for Fluent API DbModelBuilder.HasColumnType is ignored in EF6 (Oracle bug #19456229).
|
||||
- Fix for Setting a PK GUID identity in Code First in EF6 no longer works in Server 5.7 (Oracle bug #19456452).
|
||||
- Non PKs declared as Identity GUID have no GUID autogenerated (Oracle bug #19456415).
|
||||
|
||||
|
||||
6.9.2
|
||||
- Add async/await compatible methods
|
||||
- Fix for Unable to read geometry column when it has been set with a SRID value. (MySql Bug #71869, Oracle Bug #19137999)
|
||||
- Fix for Exception adding a new column to an existing model as identity and PK fails when applying the migration (MySql Bug #71418, Oracle bug #18923294).
|
||||
- Added SiteMap and Personalization configuration web providers to MySql.Web Nuget Package.
|
||||
|
||||
|
||||
6.9.1
|
||||
- Fix for Exception of "duplicate entry" in MySqlSessionProvider (MySql Bug #70409, Oracle bug #18657550).
|
||||
|
||||
|
||||
6.9.0
|
||||
- Added implementation of MySQLPersonalizationProvider.
|
||||
- Added SiteMap Web provider.
|
||||
- Added Simple Membership Web Provider.
|
||||
- Fix for open sockets connections left when connection open fails, the error happens when the client try to get a connection when the max number of connections is reached in the server. (MySql #72025, Oracle Bug #18665388).
|
Binary file not shown.
|
@ -0,0 +1,15 @@
|
|||
Connector/Net 6.9 Release Notes
|
||||
------------------------------------
|
||||
|
||||
Welcome to the release notes for Connector/Net 6.9
|
||||
|
||||
What's new in 6.9
|
||||
--------------------
|
||||
|
||||
- Simple Membership Web Provider
|
||||
- Site Map Web Provider
|
||||
- Personalization Web Provider
|
||||
- MySql Fabric support
|
||||
|
||||
|
||||
Be sure and check the documentation for more information on these new features.
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<remove invariant="MySql.Data.MySqlClient" />
|
||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
|
||||
</DbProviderFactories>
|
||||
</system.data>
|
||||
</configuration>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<system.data>
|
||||
<DbProviderFactories>
|
||||
<remove invariant="MySql.Data.MySqlClient" />
|
||||
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
|
||||
</DbProviderFactories>
|
||||
</system.data>
|
||||
</configuration>
|
Binary file not shown.
0
libbin/MySql.Data.dll → packages/MySql.Data.6.9.9/lib/net45/MySql.Data.dll
vendored
Executable file → Normal file
0
libbin/MySql.Data.dll → packages/MySql.Data.6.9.9/lib/net45/MySql.Data.dll
vendored
Executable file → Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,299 @@
|
|||
######################################################################
|
||||
# Configuration for NTP Analyzer statistical recordings and frontend #
|
||||
######################################################################
|
||||
|
||||
Database {
|
||||
# Select either MySQL or PostgreSQL
|
||||
Provider MySQL
|
||||
|
||||
# Address of SQL server
|
||||
Host 127.0.0.1
|
||||
|
||||
# Name of database
|
||||
Name ntpa2
|
||||
|
||||
# Database user name
|
||||
User ntpau
|
||||
|
||||
# Password for the user
|
||||
Pass test123
|
||||
|
||||
# Set to 1 to automatically create all tables and data.
|
||||
Create 1
|
||||
|
||||
# Set to 1 to automatically upgrade database schema.
|
||||
Upgrade 1
|
||||
}
|
||||
|
||||
Log {
|
||||
# Levels: error, warn, notice, info, debug and trace
|
||||
Severity info
|
||||
File /var/log/ntpa/ntpa.log
|
||||
}
|
||||
|
||||
Log {
|
||||
Type Console
|
||||
Severity debug
|
||||
}
|
||||
|
||||
# Synchronize timestamps for readings across different NTP servers/peers
|
||||
Reading {
|
||||
Name stat1
|
||||
|
||||
# Indicate if generation should happen immediately after start up
|
||||
InitialRun 0
|
||||
|
||||
# Minutes between reading values from NTP servers.
|
||||
Frequency 5
|
||||
|
||||
# Indicate if readings should happen at rounded intervals.
|
||||
FixedRun 1
|
||||
}
|
||||
|
||||
Server {
|
||||
# Primary key in database table 'host'
|
||||
HostID 1
|
||||
|
||||
# Address queried by ntpq and ntpdc
|
||||
HostAddress 192.168.222.114
|
||||
|
||||
# The utility used to query ntpd. Use ntpdc for old hosts.
|
||||
HostType ntpq
|
||||
|
||||
HostStats {
|
||||
# Use name defined in Reading section or number of minutes between readings.
|
||||
Frequency stat1
|
||||
}
|
||||
|
||||
HostIOStats {
|
||||
Frequency stat1
|
||||
}
|
||||
|
||||
PeerStats {
|
||||
Frequency stat1
|
||||
}
|
||||
|
||||
# Base path for generated files
|
||||
#FilePath /usr/local/www/ntpa
|
||||
FilePath "/home/carsten/www/"
|
||||
|
||||
# Base URL for generated files
|
||||
WebPath "file:///home/carsten/www/"
|
||||
|
||||
########## Webpages ##########
|
||||
|
||||
# Main page for a host
|
||||
HostPage ntp1 {
|
||||
# Indicate if generation should happen immediately after start up
|
||||
InitialRun 1
|
||||
|
||||
# Minutes between generation of page
|
||||
Frequency 5
|
||||
|
||||
PageTitle ntp1.example.net
|
||||
|
||||
# Use either 'default' or 'bootstrap'
|
||||
Template bootstrap
|
||||
|
||||
# Link to peer web pages
|
||||
PeerPages ntp1-peers
|
||||
|
||||
# Set to 1 if this page should show a link to pool.ntp.org
|
||||
PoolMember 0
|
||||
|
||||
# Links to graphs
|
||||
Images {
|
||||
# Name of graph group
|
||||
Title "Recent offset graphs"
|
||||
|
||||
# Index in graph destination array
|
||||
LinkIndex 1
|
||||
|
||||
# Link to graphs in config file
|
||||
Graph offset1
|
||||
Graph offset3
|
||||
}
|
||||
|
||||
# Name and path to generated file.
|
||||
Destinations {
|
||||
File index.html
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Web pages for peers
|
||||
# Same usage as host configuration options
|
||||
PeerPages ntp1-peers {
|
||||
InitialRun 1
|
||||
Frequency 240
|
||||
|
||||
PageTitle ntp1.example.net
|
||||
Template bootstrap
|
||||
|
||||
Images {
|
||||
Title "Recent offset graphs"
|
||||
LinkIndex 1
|
||||
Graph offset24
|
||||
Graph offset72
|
||||
Graph delay
|
||||
}
|
||||
|
||||
# Path to use for generated files.
|
||||
Destinations {
|
||||
Directory peers/
|
||||
}
|
||||
|
||||
# Base URL to generated files.
|
||||
Link peers/
|
||||
}
|
||||
|
||||
AboutPage about1 {
|
||||
PageTitle example.net
|
||||
ContentTitle ntp1.example.net
|
||||
Content {
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
Sed et risus vel leo interdum fringilla. Vestibulum ex justo,
|
||||
euismod ac conat tempor a massa. Donec elementum congue.</p>
|
||||
}
|
||||
|
||||
Destinations {
|
||||
File about.html
|
||||
}
|
||||
}
|
||||
|
||||
############### Bootstrap menu ##############
|
||||
|
||||
# Options for boot strap menu
|
||||
# When using the bootstrap theme a bootstrap menu must be included
|
||||
Menu {
|
||||
Item title {
|
||||
Type Name
|
||||
Caption example.net
|
||||
Link http://example.net
|
||||
}
|
||||
|
||||
Item main {
|
||||
Caption NTP
|
||||
Page ntp1
|
||||
}
|
||||
|
||||
Item {
|
||||
Caption About
|
||||
Page about1
|
||||
}
|
||||
}
|
||||
|
||||
########## Host graphs ##########
|
||||
|
||||
HostGraph offset1 {
|
||||
InitialRun 1
|
||||
Frequency 15
|
||||
Timespan 1
|
||||
|
||||
Title "ntp1.example.net (1 day)"
|
||||
Width 1024
|
||||
Height 550
|
||||
|
||||
Stability 0
|
||||
GFrequency 1
|
||||
Jitter 1
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
File ntp1.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntp1.png
|
||||
}
|
||||
}
|
||||
|
||||
HostGraph offset3 {
|
||||
InitialRun 1
|
||||
Frequency 30
|
||||
Timespan 3
|
||||
|
||||
Title "ntp1.example.net (3 days)"
|
||||
Width 1024
|
||||
Height 550
|
||||
|
||||
Stability 0
|
||||
GFrequency 1
|
||||
Jitter 1
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
File ntp3.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntp3.png
|
||||
}
|
||||
}
|
||||
|
||||
########## Peer graphs ##########
|
||||
|
||||
PeerGraphs offset24 {
|
||||
InitialRun 1
|
||||
Frequency 15
|
||||
Timespan 1
|
||||
|
||||
Title "24 hours offset"
|
||||
Width 1024
|
||||
Height 550
|
||||
Jitter 0
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix offset24-
|
||||
Directory /peers/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peer1/offset24-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs offset72 {
|
||||
InitialRun 1
|
||||
Frequency 15
|
||||
Timespan 3
|
||||
|
||||
Title "72 hours offset"
|
||||
Width 1024
|
||||
Height 550
|
||||
Jitter 0
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix offset72-
|
||||
Directory /peers/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peers/offset72-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs delay {
|
||||
InitialRun 1
|
||||
Frequency 180
|
||||
Timespan 15
|
||||
|
||||
Title "15 days delay"
|
||||
Width 1024
|
||||
Height 550
|
||||
Delay 1
|
||||
Jitter 1
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix delay-
|
||||
Directory /peers/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peers/delay-
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,223 @@
|
|||
|
||||
Database {
|
||||
Provider MySql
|
||||
Host 192.168.10.60
|
||||
Name ntpa2
|
||||
User ntpau
|
||||
Pass "test123"
|
||||
Create Yes
|
||||
}
|
||||
|
||||
Log {
|
||||
File ntpa.log
|
||||
Severity Trace
|
||||
}
|
||||
|
||||
Reading {
|
||||
Name stat1
|
||||
Frequency 5
|
||||
TimeStamp UTC
|
||||
}
|
||||
|
||||
Service {
|
||||
Heartbeat 2
|
||||
}
|
||||
|
||||
Server {
|
||||
HostID 1
|
||||
HostAddress 192.168.222.114
|
||||
FilePath "C:/inetpub/ntpa/"
|
||||
|
||||
HostStats {
|
||||
Frequency stat1
|
||||
}
|
||||
|
||||
HostIoStats {
|
||||
Frequency stat1
|
||||
}
|
||||
|
||||
PeerStats {
|
||||
Frequency stat1
|
||||
}
|
||||
|
||||
Menu {
|
||||
|
||||
Item title {
|
||||
Type Link
|
||||
Caption example.net
|
||||
Link http://example.net
|
||||
}
|
||||
|
||||
Item main {
|
||||
Type Page
|
||||
Caption NTP
|
||||
Link /index.html
|
||||
}
|
||||
|
||||
Item {
|
||||
Type Page
|
||||
Caption About
|
||||
Page about1
|
||||
}
|
||||
}
|
||||
|
||||
AboutPage about1 {
|
||||
PageTitle "example.net"
|
||||
Link about.html
|
||||
ContentTitle "ntp1.example.net"
|
||||
|
||||
Content {
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
Sed et risus vel leo interdum fringilla. Vestibulum ex justo,
|
||||
euismod ac conat tempor a massa. Donec elementum congue.</p>
|
||||
}
|
||||
|
||||
Destinations {
|
||||
File about.html
|
||||
}
|
||||
}
|
||||
|
||||
HostPage ntp1 {
|
||||
PageTitle "ntp1.example.net"
|
||||
Template Bootstrap
|
||||
PeerPages ntp1-peers
|
||||
Link index.html
|
||||
|
||||
Images {
|
||||
Title "Recent offset graphs"
|
||||
Graph offset1
|
||||
Graph offset3
|
||||
}
|
||||
|
||||
Destinations {
|
||||
File index.html
|
||||
}
|
||||
}
|
||||
|
||||
PeerPages ntp1-peers {
|
||||
PageTitle "ntp1.example.net"
|
||||
Template Bootstrap
|
||||
Link peers/
|
||||
|
||||
Images {
|
||||
Graph offset24
|
||||
Graph offset72
|
||||
Graph delay
|
||||
}
|
||||
|
||||
Destinations {
|
||||
Directory peers/
|
||||
}
|
||||
}
|
||||
|
||||
HostGraph offset1 {
|
||||
Frequency 15
|
||||
InitialRun Yes
|
||||
Title "ntp1.example.net (1 day)"
|
||||
Timespan 1
|
||||
Jitter 1
|
||||
Offset 1
|
||||
GFrequency 1
|
||||
|
||||
Destinations {
|
||||
File ntp1.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntp1.png
|
||||
}
|
||||
}
|
||||
|
||||
HostGraph offset3 {
|
||||
Frequency 30
|
||||
InitialRun Yes
|
||||
Title "ntp1.example.net (3 days)"
|
||||
Timespan 3
|
||||
Jitter 1
|
||||
Offset 1
|
||||
GFrequency 1
|
||||
|
||||
Destinations {
|
||||
File ntp3.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntp3.png
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs offset24 {
|
||||
Frequency 15
|
||||
InitialRun Yes
|
||||
Title "24 hours offset"
|
||||
Timespan 1
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix offset24-
|
||||
Directory peers/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peer1/offset24-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs offset72 {
|
||||
Frequency 15
|
||||
InitialRun Yes
|
||||
Title "72 hours offset"
|
||||
Timespan 3
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix offset72-
|
||||
Directory /peers/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peers/offset72-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs delay {
|
||||
Frequency 180
|
||||
InitialRun Yes
|
||||
Title "15 days delay"
|
||||
Timespan 15
|
||||
Offset 1
|
||||
Jitter 1
|
||||
Delay 1
|
||||
|
||||
Destinations {
|
||||
Prefix delay-
|
||||
Directory /peers/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peers/delay-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphPage i1pgraphs {
|
||||
InitialRun 1
|
||||
Frequency 0
|
||||
|
||||
GraphPage ntp1-peers
|
||||
|
||||
Destinations {
|
||||
Directory /pgraphs/
|
||||
}
|
||||
}
|
||||
|
||||
HostGraphPage i1graphs {
|
||||
InitialRun 1
|
||||
Frequency 0
|
||||
|
||||
GraphPage ntp1
|
||||
|
||||
Destinations {
|
||||
Directory hgraphs/
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue