mirror of
https://bitbucket.org/anguist/ntpa
synced 2025-10-05 10:30:56 +00:00
Improved error handling
This commit is contained in:
3
INSTALL
3
INSTALL
@ -17,6 +17,7 @@ Run:
|
||||
# sudo apt-get install mono-runtime
|
||||
# sudo apt-get install libgdiplus
|
||||
# sudo apt-get install mysql-server
|
||||
# sudo apt-get install ntp
|
||||
|
||||
Windows
|
||||
-------
|
||||
@ -81,7 +82,7 @@ Now start ntpa and watch the data arriving in MySQL tables.
|
||||
Also watch the logfile for errors and other debugging activities.
|
||||
|
||||
Now start ntpa in daemon mode with:
|
||||
# &ntpa.exe
|
||||
# mono ntpa.exe &
|
||||
|
||||
To stop ntpa use kill. Find ntpa pid in log file.
|
||||
# kill 77342
|
||||
|
@ -74,7 +74,17 @@ namespace Ntp.Analyzer.Cli
|
||||
/// <param name="args">The command-line arguments.</param>
|
||||
public static void Main (string[] args)
|
||||
{
|
||||
string name = (args.Length > 1) ? args [1] : "NTPA_DEFAULT";
|
||||
if (args.Length > 2) {
|
||||
ShowUsage ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length >= 1 && args[0] == "help") {
|
||||
ShowUsage ();
|
||||
return;
|
||||
}
|
||||
|
||||
string name = (args.Length > 1) ? args [1] : "NTPA_DEF";
|
||||
|
||||
if (args.Length >= 1 && args [0] == "stop") {
|
||||
string message = InterLock.Release (name);
|
||||
@ -90,5 +100,11 @@ namespace Ntp.Analyzer.Cli
|
||||
Main main = new Main (configFile, pid, name);
|
||||
main.Start ();
|
||||
}
|
||||
|
||||
private static void ShowUsage()
|
||||
{
|
||||
Console.WriteLine("NTP Analyzer Daemon.");
|
||||
Console.WriteLine("Usage: ntpa [configuration file | stop] [instance name]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,15 +39,22 @@ namespace Ntp.Analyzer.Data.Import
|
||||
|
||||
public string ImportServer(int orgId)
|
||||
{
|
||||
string html = GetOrgHtml(orgId);
|
||||
string html = GetOrgHtml (orgId);
|
||||
if (html == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int serverTagPos = html.IndexOf(ServerTagStart, StringComparison.Ordinal);
|
||||
int tableStartPos = html.IndexOf("<table", serverTagPos, StringComparison.Ordinal);
|
||||
int tableEndPos = html.IndexOf(ServerTagEnd, serverTagPos, StringComparison.Ordinal);
|
||||
try {
|
||||
int serverTagPos = html.IndexOf (ServerTagStart, StringComparison.Ordinal);
|
||||
int tableStartPos = html.IndexOf ("<table", serverTagPos, StringComparison.Ordinal);
|
||||
int tableEndPos = html.IndexOf (ServerTagEnd, serverTagPos, StringComparison.Ordinal);
|
||||
|
||||
string table = html.Substring(tableStartPos, tableEndPos - tableStartPos);
|
||||
string table = html.Substring (tableStartPos, tableEndPos - tableStartPos);
|
||||
|
||||
return table;
|
||||
return table;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetOrgHtml(int orgId)
|
||||
|
@ -168,10 +168,10 @@ namespace Ntp.Analyzer.Data.Static
|
||||
IPAddress.TryParse (ip4, out address);
|
||||
|
||||
TimeServer server = new TimeServer (
|
||||
id, stratum, countryCode, hostName, address, ip6, useDns, poolMember, location,
|
||||
displayLocation, organization, coordinates, synchronization, serviceArea, accessDetails,
|
||||
accessPolicy, notification, autoKeyUrl, symmetricKeyType, symmetricKeyUrl, serverContact,
|
||||
providerPage, providerUrl, updated);
|
||||
id, stratum, countryCode, hostName, address, ip6, useDns, poolMember, location,
|
||||
displayLocation, organization, coordinates, synchronization, serviceArea, accessDetails,
|
||||
accessPolicy, notification, autoKeyUrl, symmetricKeyType, symmetricKeyUrl, serverContact,
|
||||
providerPage, providerUrl, updated);
|
||||
|
||||
AddItem (server);
|
||||
|
||||
@ -192,12 +192,20 @@ namespace Ntp.Analyzer.Data.Static
|
||||
{
|
||||
TimeServerLoader loader = new TimeServerLoader ();
|
||||
TimeServerImporter importer = new TimeServerImporter ();
|
||||
TimeServer server;
|
||||
|
||||
string table = loader.ImportServer (id);
|
||||
TimeServer server = importer.ParseTable (table, id);
|
||||
try {
|
||||
string table = loader.ImportServer (id);
|
||||
if (table == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Insert (server);
|
||||
AddItem (server);
|
||||
server = importer.ParseTable (table, id);
|
||||
Insert (server);
|
||||
AddItem (server);
|
||||
} catch (Exception e) {
|
||||
throw new ApplicationException ("Failed to fetch time server data.", e);
|
||||
}
|
||||
|
||||
return server;
|
||||
}
|
||||
|
@ -42,6 +42,9 @@ namespace Ntp.Analyzer.Log
|
||||
{
|
||||
string severityText;
|
||||
|
||||
if (severity == Severity.Trace)
|
||||
return;
|
||||
|
||||
switch (severity) {
|
||||
case Severity.Error:
|
||||
severityText = "E";
|
||||
@ -83,6 +86,15 @@ namespace Ntp.Analyzer.Log
|
||||
WriteLine (exception.StackTrace, Severity.Debug);
|
||||
}
|
||||
|
||||
public override void WriteLine (Exception exception, Severity severity)
|
||||
{
|
||||
if (severity == Severity.Trace)
|
||||
return;
|
||||
|
||||
WriteLine (exception.Message, severity);
|
||||
WriteLine (exception.StackTrace, severity);
|
||||
}
|
||||
|
||||
public IEnumerator<string> GetEnumerator ()
|
||||
{
|
||||
return activity.GetEnumerator ();
|
||||
|
@ -32,6 +32,8 @@ namespace Ntp.Analyzer.Log
|
||||
{
|
||||
public abstract void WriteLine(string text, Severity severity);
|
||||
|
||||
public abstract void WriteLine(Exception exception, Severity severity);
|
||||
|
||||
public abstract void WriteLine(Exception exception);
|
||||
}
|
||||
}
|
@ -95,6 +95,8 @@ namespace Ntp.Analyzer.Log
|
||||
return Severity.Info;
|
||||
case "debug":
|
||||
return Severity.Debug;
|
||||
case "trace":
|
||||
return Severity.Trace;
|
||||
default:
|
||||
throw new ArgumentException ("Unknown severity type: " + text);
|
||||
}
|
||||
@ -113,6 +115,8 @@ namespace Ntp.Analyzer.Log
|
||||
return "info";
|
||||
case Severity.Debug:
|
||||
return "debug";
|
||||
case Severity.Trace:
|
||||
return "trace";
|
||||
default:
|
||||
throw new ArgumentException ("Unknown severity type: " + severity);
|
||||
}
|
||||
|
@ -50,6 +50,12 @@ namespace Ntp.Analyzer.Log
|
||||
log.WriteLine(exception);
|
||||
}
|
||||
|
||||
public override void WriteLine(Exception exception, Severity severity)
|
||||
{
|
||||
foreach (LogBase log in logs)
|
||||
log.WriteLine(exception, severity);
|
||||
}
|
||||
|
||||
public void Add(LogBase log)
|
||||
{
|
||||
logs.Add(log);
|
||||
|
@ -28,6 +28,7 @@ namespace Ntp.Analyzer.Log
|
||||
{
|
||||
public enum Severity
|
||||
{
|
||||
Trace,
|
||||
Debug,
|
||||
Info,
|
||||
Notice,
|
||||
|
@ -68,25 +68,27 @@ namespace Ntp.Analyzer.Log
|
||||
|
||||
string severityText;
|
||||
|
||||
switch (severity)
|
||||
{
|
||||
case Severity.Error:
|
||||
severityText = "ERROR";
|
||||
break;
|
||||
case Severity.Warn:
|
||||
severityText = "WARN";
|
||||
break;
|
||||
case Severity.Notice:
|
||||
severityText = "NOTICE";
|
||||
break;
|
||||
case Severity.Info:
|
||||
severityText = "INFO";
|
||||
break;
|
||||
case Severity.Debug:
|
||||
severityText = "DEBUG";
|
||||
break;
|
||||
default:
|
||||
throw new ApplicationException("Unknown severity level.");
|
||||
switch (severity) {
|
||||
case Severity.Error:
|
||||
severityText = "ERROR";
|
||||
break;
|
||||
case Severity.Warn:
|
||||
severityText = "WARN";
|
||||
break;
|
||||
case Severity.Notice:
|
||||
severityText = "NOTICE";
|
||||
break;
|
||||
case Severity.Info:
|
||||
severityText = "INFO";
|
||||
break;
|
||||
case Severity.Debug:
|
||||
severityText = "DEBUG";
|
||||
break;
|
||||
case Severity.Trace:
|
||||
severityText = "TRACE";
|
||||
break;
|
||||
default:
|
||||
throw new ApplicationException ("Unknown severity level.");
|
||||
}
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
@ -109,6 +111,15 @@ namespace Ntp.Analyzer.Log
|
||||
WriteLine(exception.StackTrace, Severity.Debug);
|
||||
}
|
||||
|
||||
public override void WriteLine(Exception exception, Severity severity)
|
||||
{
|
||||
if (severity < treshold)
|
||||
return;
|
||||
|
||||
WriteLine(exception.Message, severity);
|
||||
WriteLine(exception.StackTrace, severity);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
writer.Close();
|
||||
|
@ -67,9 +67,10 @@ namespace Ntp.Analyzer.Process.Description
|
||||
{
|
||||
host = DataFace.Instance.Hosts.Single(h => h.Name == config.ServerName);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.WriteLine("Hostname not found in database: " + config.ServerName, Severity.Warn);
|
||||
Log.WriteLine (e, Severity.Trace);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -68,9 +68,16 @@ namespace Ntp.Analyzer.Process.Description
|
||||
return;
|
||||
}
|
||||
|
||||
// Import from NTP daemon
|
||||
NtpdcImporter imp = new NtpdcImporter (host, ReadingBulk.Current);
|
||||
imp.Import ();
|
||||
NtpdcImporter imp;
|
||||
try {
|
||||
// Import from NTP daemon
|
||||
imp = new NtpdcImporter (host, ReadingBulk.Current);
|
||||
imp.Import ();
|
||||
} catch (Exception e) {
|
||||
Log.WriteLine ("Could not get data from NTP daemon: " + e.Message, Severity.Warn);
|
||||
Log.WriteLine (e, Severity.Trace);
|
||||
return;
|
||||
}
|
||||
|
||||
// Save to database
|
||||
foreach (HostReading reading in imp.Entries) {
|
||||
|
@ -65,11 +65,14 @@ namespace Ntp.Analyzer.Process.Description
|
||||
|
||||
protected override void InternalExecute ()
|
||||
{
|
||||
Initalize ();
|
||||
|
||||
Import ();
|
||||
|
||||
SaveResult ();
|
||||
try {
|
||||
Initalize ();
|
||||
Import ();
|
||||
SaveResult ();
|
||||
} catch (Exception e) {
|
||||
Log.WriteLine ("Could not import peer data: " + e.Message, Severity.Warn);
|
||||
Log.WriteLine (e, Severity.Trace);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -83,8 +86,9 @@ namespace Ntp.Analyzer.Process.Description
|
||||
// Find host in database.
|
||||
try {
|
||||
host = DataFace.Instance.Hosts.Single (h => h.Name == config.ServerName);
|
||||
} catch (Exception) {
|
||||
} catch (Exception e) {
|
||||
Log.WriteLine ("Hostname not found in database: " + config.ServerName, Severity.Warn);
|
||||
Log.WriteLine (e, Severity.Trace);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -66,9 +66,10 @@ namespace Ntp.Analyzer.Process.Description
|
||||
{
|
||||
host = DataFace.Instance.Hosts.Single(h => h.Name == config.ServerName);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.WriteLine("Hostname not found in database: " + config.ServerName, Severity.Warn);
|
||||
Log.WriteLine (e, Severity.Trace);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -220,6 +220,7 @@ namespace Ntp.Analyzer.Process
|
||||
} catch (Exception e) {
|
||||
log.WriteLine ("Error during initialization of cluster node.", Severity.Error);
|
||||
log.WriteLine (e.ToString (), Severity.Error);
|
||||
log.WriteLine (e, Severity.Trace);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Externalconsole>true</Externalconsole>
|
||||
<Commandlineparameters>/home/hawk/code/ntp/rel/conf/ntpa.1.conf</Commandlineparameters>
|
||||
<Commandlineparameters>~/code/ntpa/example/ntpa.graph.conf</Commandlineparameters>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
|
@ -41,22 +41,20 @@ namespace Ntp.Analyzer.Validate.Cli
|
||||
public static void Main (string[] args)
|
||||
{
|
||||
if (args.Length != 1) {
|
||||
Console.WriteLine("NTP Analyzer validator tool.");
|
||||
Console.WriteLine ("NTP Analyzer validator tool.");
|
||||
Console.WriteLine ("Usage: ntpav configuration");
|
||||
return;
|
||||
}
|
||||
|
||||
string configFile = args [0];
|
||||
|
||||
if (!File.Exists (configFile)) {
|
||||
Console.WriteLine("File does not exists: " + configFile);
|
||||
return;
|
||||
}
|
||||
|
||||
// Neutralize.
|
||||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
|
||||
Configuration config = LoadConfig (configFile);
|
||||
if (config == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine ("Parsed config ...");
|
||||
Console.WriteLine (config);
|
||||
@ -112,7 +110,7 @@ namespace Ntp.Analyzer.Validate.Cli
|
||||
} else if (item is StreamDestination) {
|
||||
StreamDestination destination = item as StreamDestination;
|
||||
destination.Test ();
|
||||
Console.Write ("Tested " + destination.AbsoluteLocation);
|
||||
Console.WriteLine ("Tested " + destination.AbsoluteLocation);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@ -125,4 +123,4 @@ namespace Ntp.Analyzer.Validate.Cli
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{79DFB57F-58F
|
||||
example\ntp.conf = example\ntp.conf
|
||||
example\ntpa.stat.conf = example\ntpa.stat.conf
|
||||
example\ntpa.web.conf = example\ntpa.web.conf
|
||||
example\ntpa.graph.conf = example\ntpa.graph.conf
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
@ -122,7 +123,7 @@ Global
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = Ntp.Analyzer.Cli\Ntp.Analyzer.Cli.csproj
|
||||
StartupItem = Ntp.Analyzer.Validate.Cli\Ntp.Analyzer.Validate.Cli.csproj
|
||||
Policies = $0
|
||||
$0.DotNetNamingPolicy = $1
|
||||
$1.DirectoryNamespaceAssociation = PrefixedHierarchical
|
||||
|
@ -61,7 +61,10 @@ namespace Ntp.Analyzer.Config.Page
|
||||
link)
|
||||
{
|
||||
this.page = page;
|
||||
page.AttachGraphPages (this);
|
||||
|
||||
if (page != null) {
|
||||
page.AttachGraphPages (this);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly String[] Params = new[] {
|
||||
|
@ -62,7 +62,10 @@ namespace Ntp.Analyzer.Config.Page
|
||||
link)
|
||||
{
|
||||
this.page = page;
|
||||
page.AttachGraphPages (this);
|
||||
|
||||
if (page != null) {
|
||||
page.AttachGraphPages (this);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly String[] Params = new[] {
|
||||
|
@ -34,6 +34,11 @@ namespace Ntp.Monitor.Cli
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
if (args.Length >= 1 && args[0] == "help") {
|
||||
ShowUsage ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.Length != 3) {
|
||||
ShowUsage();
|
||||
return;
|
||||
|
@ -69,6 +69,7 @@ namespace Ntp.Monitor.Server
|
||||
} catch (Exception ex) {
|
||||
log.WriteLine ("Error while initializing listener " + this.ToString (), Severity.Error);
|
||||
log.WriteLine (ex.Message, Severity.Debug);
|
||||
log.WriteLine (ex, Severity.Trace);
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,6 +105,7 @@ namespace Ntp.Monitor.Server
|
||||
} catch (Exception ex) {
|
||||
log.WriteLine ("Unexpected error in listener " + this.ToString (), Severity.Error);
|
||||
log.WriteLine (ex.Message, Severity.Debug);
|
||||
log.WriteLine (ex, Severity.Trace);
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,6 +149,7 @@ namespace Ntp.Monitor.Server
|
||||
} catch (Exception ex) {
|
||||
log.WriteLine ("Unexpected error in listener " + this.ToString (), Severity.Error);
|
||||
log.WriteLine (ex.Message, Severity.Debug);
|
||||
log.WriteLine (ex, Severity.Trace);
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,6 +175,7 @@ namespace Ntp.Monitor.Server
|
||||
} catch (Exception ex) {
|
||||
log.WriteLine ("Unexpected error in listener " + this.ToString (), Severity.Error);
|
||||
log.WriteLine (ex.Message, Severity.Debug);
|
||||
log.WriteLine (ex, Severity.Trace);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,11 +25,11 @@
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ntp.Analyzer.Log;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Principal;
|
||||
using System.Threading;
|
||||
using Ntp.Analyzer.Log;
|
||||
|
||||
namespace Ntp.Process
|
||||
{
|
||||
@ -86,8 +86,9 @@ namespace Ntp.Process
|
||||
if (answer != null && answer == "active") {
|
||||
otherActive = true;
|
||||
}
|
||||
} catch (Exception) {
|
||||
} catch (Exception e) {
|
||||
log.WriteLine ("Error while contacting cluster node " + request, Severity.Warn);
|
||||
log.WriteLine (e, Severity.Trace);
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,6 +100,7 @@ namespace Ntp.Process
|
||||
} catch (Exception e) {
|
||||
log.WriteLine ("Error in scheduler module. Arborting.", Severity.Error);
|
||||
log.WriteLine (e.ToString (), Severity.Error);
|
||||
log.WriteLine (e, Severity.Trace);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@ -125,6 +127,7 @@ namespace Ntp.Process
|
||||
} catch (Exception e) {
|
||||
log.WriteLine ("Error in mutux. Arborting.", Severity.Error);
|
||||
log.WriteLine (e.ToString (), Severity.Error);
|
||||
log.WriteLine (e, Severity.Trace);
|
||||
}
|
||||
|
||||
log.WriteLine ("Closing down.", Severity.Notice);
|
||||
|
@ -38,15 +38,15 @@ namespace Ntp.Process
|
||||
{
|
||||
public static string Release (string name)
|
||||
{
|
||||
try {
|
||||
UnixEndPoint endPoint = new UnixEndPoint (name);
|
||||
Socket socket = new Socket (AddressFamily.Unix, SocketType.Stream, ProtocolType.IP);
|
||||
socket.Connect (endPoint);
|
||||
byte[] bytes = Encoding.UTF8.GetBytes ("RELEASE");
|
||||
socket.Send (bytes);
|
||||
socket.Close ();
|
||||
} catch (Exception e) {
|
||||
return e.Message;
|
||||
using (Socket socket = new Socket (AddressFamily.Unix, SocketType.Stream, ProtocolType.IP)) {
|
||||
try {
|
||||
socket.Connect (new UnixEndPoint (name));
|
||||
byte[] bytes = Encoding.UTF8.GetBytes ("RELEASE");
|
||||
socket.Send (bytes);
|
||||
socket.Close ();
|
||||
} catch (Exception e) {
|
||||
return e.Message;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -54,20 +54,22 @@ namespace Ntp.Process
|
||||
|
||||
public static string Wait (string name)
|
||||
{
|
||||
UnixEndPoint endPoint = new UnixEndPoint (name);
|
||||
Socket socket = new Socket (AddressFamily.Unix, SocketType.Stream, ProtocolType.IP);
|
||||
byte[] buf = new byte[64];
|
||||
|
||||
try {
|
||||
socket.Bind (endPoint);
|
||||
socket.Listen (5);
|
||||
Socket sock = socket.Accept ();
|
||||
sock.Receive (buf);
|
||||
sock.Close ();
|
||||
} catch (Exception e) {
|
||||
return e.Message;
|
||||
} finally {
|
||||
socket.Close ();
|
||||
using (Socket socket = new Socket (AddressFamily.Unix, SocketType.Stream, ProtocolType.IP)) {
|
||||
try {
|
||||
socket.Bind (new UnixEndPoint (name));
|
||||
socket.Listen (5);
|
||||
Socket sock = socket.Accept ();
|
||||
sock.Receive (buf);
|
||||
sock.Close ();
|
||||
} catch (Exception e) {
|
||||
return e.Message;
|
||||
} finally {
|
||||
if (socket != null && socket.IsBound) {
|
||||
socket.Close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -75,7 +77,7 @@ namespace Ntp.Process
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
public static class InterLock
|
||||
{
|
||||
public static string Release (string name)
|
||||
|
601
example/ntpa.graph.conf
Normal file
601
example/ntpa.graph.conf
Normal file
@ -0,0 +1,601 @@
|
||||
########################################################################
|
||||
# Configuration for NTP Analyzer Web Front #
|
||||
########################################################################
|
||||
|
||||
# Connection parameters to MySQL database instance.
|
||||
Database {
|
||||
Host 127.0.0.1
|
||||
Name ntpa
|
||||
User ntpau
|
||||
Pass xxxx
|
||||
}
|
||||
|
||||
Listener {
|
||||
IP 127.0.0.1
|
||||
Port 9070
|
||||
}
|
||||
|
||||
Log {
|
||||
Severity notice
|
||||
File /var/log/ntpa.graph.log
|
||||
}
|
||||
|
||||
Server {
|
||||
# Primary key in table 'host'
|
||||
HostID 1
|
||||
|
||||
# Domain name of hosting NTP server
|
||||
HostName 192.168.222.114
|
||||
|
||||
# NTP configuration file with IDs from support.ntp.org
|
||||
ConfigFile /opt/ntpa/config/ntp.conf
|
||||
|
||||
# Base path for generated files
|
||||
FilePath graphs/
|
||||
|
||||
# Base URL for generated files
|
||||
WebPath /
|
||||
|
||||
HostGraph offset24 {
|
||||
InitialRun 1
|
||||
Frequency 10
|
||||
Timespan 1
|
||||
|
||||
Title ntp1.domain.org 24 hours offset
|
||||
Width 1024
|
||||
Height 550
|
||||
|
||||
Stability 0
|
||||
GFrequency 0
|
||||
Jitter 0
|
||||
Offset 1000
|
||||
|
||||
Destinations {
|
||||
File ntp1.domain.org/ntpgraphs/ntp1-h24-offset.png
|
||||
File domain.org/graphs/ntp1/ntp1-h24-offset.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntpgraphs/ntp1-h24-offset.png
|
||||
Link graphs/ntp1/ntp1-h24-offset.png
|
||||
}
|
||||
}
|
||||
|
||||
HostGraph offset72 {
|
||||
InitialRun 1
|
||||
Frequency 30
|
||||
Timespan 3
|
||||
|
||||
Title ntp1.domain.org 72 hours offset
|
||||
Width 1024
|
||||
Height 550
|
||||
|
||||
Stability 0
|
||||
GFrequency 0
|
||||
Jitter 0
|
||||
Offset 1000
|
||||
|
||||
Destinations {
|
||||
File ntp1.domain.org/ntpgraphs/ntp1-h72-offset.png
|
||||
File domain.org/graphs/ntp1/ntp1-h72-offset.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntpgraphs/ntp1-h72-offset.png
|
||||
Link graphs/ntp1/ntp1-h72-offset.png
|
||||
}
|
||||
}
|
||||
|
||||
HostGraph offset1 {
|
||||
InitialRun 1
|
||||
Frequency 15
|
||||
Timespan 1
|
||||
|
||||
Title ntp1.domain.org (1 day)
|
||||
Width 1024
|
||||
Height 550
|
||||
|
||||
Stability 0
|
||||
GFrequency 1
|
||||
Jitter 1000
|
||||
Offset 1000
|
||||
|
||||
Destinations {
|
||||
File ntp1.domain.org/ntpgraphs/ntp1-1.png
|
||||
File domain.org/graphs/ntp1/ntp1-1.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntpgraphs/ntp1-1.png
|
||||
Link graphs/ntp1/ntp1-1.png
|
||||
}
|
||||
}
|
||||
|
||||
HostGraph offset3 {
|
||||
InitialRun 1
|
||||
Frequency 30
|
||||
Timespan 3
|
||||
|
||||
Title ntp1.domain.org (3 days)
|
||||
Width 1024
|
||||
Height 550
|
||||
|
||||
Stability 0
|
||||
GFrequency 1
|
||||
Jitter 1000
|
||||
Offset 1000
|
||||
|
||||
Destinations {
|
||||
File ntp1.domain.org/ntpgraphs/ntp1-3.png
|
||||
File domain.org/graphs/ntp1/ntp1-3.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntpgraphs/ntp1-3.png
|
||||
Link graphs/ntp1/ntp1-3.png
|
||||
}
|
||||
}
|
||||
|
||||
HostGraph offset15 {
|
||||
InitialRun 1
|
||||
Frequency 45
|
||||
Timespan 15
|
||||
|
||||
Title ntp1.domain.org (15 days)
|
||||
Width 1024
|
||||
Height 550
|
||||
|
||||
Stability 0
|
||||
GFrequency 1
|
||||
Jitter 1000
|
||||
Offset 1000
|
||||
|
||||
Destinations {
|
||||
File ntp1.domain.org/ntpgraphs/ntp1-15.png
|
||||
File domain.org/graphs/ntp1/ntp1-15.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntpgraphs/ntp1-15.png
|
||||
Link graphs/ntp1/ntp1-15.png
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HostGraph offset1f {
|
||||
InitialRun 1
|
||||
Frequency 15
|
||||
Timespan 1
|
||||
|
||||
Title ntp1.domain.org (1 day), avg < x4
|
||||
Width 1024
|
||||
Height 550
|
||||
|
||||
Stability 0
|
||||
GFrequency 1
|
||||
Jitter 1000
|
||||
Offset 1000
|
||||
FilterFactor 4
|
||||
|
||||
Destinations {
|
||||
File ntp1.domain.org/ntpgraphs/ntp1-1f.png
|
||||
File domain.org/graphs/ntp1/ntp1-1f.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntpgraphs/ntp1-1f.png
|
||||
Link graphs/ntp1/ntp1-1f.png
|
||||
}
|
||||
}
|
||||
|
||||
HostGraph offset3f {
|
||||
InitialRun 1
|
||||
Frequency 30
|
||||
Timespan 3
|
||||
|
||||
Title ntp1.domain.org (3 days), avg < x4
|
||||
Width 1024
|
||||
Height 550
|
||||
|
||||
Stability 0
|
||||
GFrequency 1
|
||||
Jitter 1000
|
||||
Offset 1000
|
||||
FilterFactor 4
|
||||
|
||||
Destinations {
|
||||
File ntp1.domain.org/ntpgraphs/ntp1-3f.png
|
||||
File domain.org/graphs/ntp1/ntp1-3f.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntpgraphs/ntp1-3f.png
|
||||
Link graphs/ntp1/ntp1-3f.png
|
||||
}
|
||||
}
|
||||
|
||||
HostGraph offset15f {
|
||||
InitialRun 1
|
||||
Frequency 45
|
||||
Timespan 15
|
||||
|
||||
Title ntp1.domain.org (15 days), avg < x4
|
||||
Width 1024
|
||||
Height 550
|
||||
|
||||
Stability 0
|
||||
GFrequency 1
|
||||
Jitter 1000
|
||||
Offset 1000
|
||||
FilterFactor 4
|
||||
|
||||
Destinations {
|
||||
File ntp1.domain.org/ntpgraphs/ntp1-15f.png
|
||||
File domain.org/graphs/ntp1/ntp1-15f.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntpgraphs/ntp1-15f.png
|
||||
Link graphs/ntp1/ntp1-15f.png
|
||||
}
|
||||
}
|
||||
|
||||
HostGraph offset30 {
|
||||
InitialRun 0
|
||||
Frequency -1
|
||||
Timespan 30
|
||||
|
||||
Title ntp1.domain.org (30 days)
|
||||
Width 1024
|
||||
Height 550
|
||||
|
||||
Stability 0
|
||||
GFrequency 1
|
||||
Jitter 1000
|
||||
Offset 1000
|
||||
|
||||
Destinations {
|
||||
File ntp1.domain.org/ntpgraphs/ntp1-30.png
|
||||
File domain.org/graphs/ntp1/ntp1-30.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntpgraphs/ntp1-30.png
|
||||
Link graphs/ntp1/ntp1-30.png
|
||||
}
|
||||
}
|
||||
|
||||
HostGraph offset60 {
|
||||
InitialRun 0
|
||||
Frequency -1
|
||||
Timespan 60
|
||||
|
||||
Title ntp1.domain.org (60 days)
|
||||
Width 1024
|
||||
Height 550
|
||||
|
||||
Stability 0
|
||||
GFrequency 1
|
||||
Jitter 1000
|
||||
Offset 1000
|
||||
|
||||
Destinations {
|
||||
File ntp1.domain.org/ntpgraphs/ntp1-60.png
|
||||
File domain.org/graphs/ntp1/ntp1-60.png
|
||||
}
|
||||
|
||||
Links {
|
||||
Link ntpgraphs/ntp1-60.png
|
||||
Link graphs/ntp1/ntp1-60.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 offseth24-
|
||||
Directory ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/offseth24-
|
||||
Link graphs/peer1/offseth24-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs offset72 {
|
||||
InitialRun 1
|
||||
Frequency 15
|
||||
Timespan 3
|
||||
|
||||
Title 72 hours offset
|
||||
Width 1024
|
||||
Height 550
|
||||
Jitter 0
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix offset72-
|
||||
Directory ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/offset72-
|
||||
Link graphs/peer1/offset72-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs offset15 {
|
||||
InitialRun 1
|
||||
Frequency 180
|
||||
Timespan 15
|
||||
|
||||
Title 15 days
|
||||
Width 1024
|
||||
Height 550
|
||||
Jitter 1
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix offset15-
|
||||
Directory ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/offset15-
|
||||
Link graphs/peer1/offset15-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs offset15f {
|
||||
InitialRun 1
|
||||
Frequency 180
|
||||
Timespan 15
|
||||
|
||||
Title 15 days, x10 < avg
|
||||
Width 1024
|
||||
Height 550
|
||||
Jitter 1
|
||||
Offset 1
|
||||
FilterFactor 10
|
||||
|
||||
Destinations {
|
||||
Prefix offset15f-
|
||||
Directory ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/offset15f-
|
||||
Link graphs/peer1/offset15f-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs offset1 {
|
||||
InitialRun 1
|
||||
Frequency 20
|
||||
Timespan 1
|
||||
|
||||
Title 1 day
|
||||
Width 1024
|
||||
Height 550
|
||||
Jitter 1
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix offset1-
|
||||
Directory ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/offset1-
|
||||
Link graphs/peer1/offset1-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs offset3 {
|
||||
InitialRun 1
|
||||
Frequency 20
|
||||
Timespan 3
|
||||
|
||||
Title 3 days
|
||||
Width 1024
|
||||
Height 550
|
||||
Jitter 1
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix offset3-
|
||||
Directory ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/offset3-
|
||||
Link graphs/peer1/offset3-
|
||||
}
|
||||
}
|
||||
|
||||
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 ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/delay-
|
||||
Link graphs/peer1/delay-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs delayf {
|
||||
InitialRun 1
|
||||
Frequency 180
|
||||
Timespan 15
|
||||
|
||||
Title 15 days delay, x10 < avg
|
||||
Width 1024
|
||||
Height 550
|
||||
Delay 1
|
||||
Jitter 1
|
||||
Offset 1
|
||||
FilterFactor 10
|
||||
|
||||
Destinations {
|
||||
Prefix delayf-
|
||||
Directory ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/delayf-
|
||||
Link graphs/peer1/delayf-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs balance {
|
||||
InitialRun 1
|
||||
Frequency 180
|
||||
Timespan 15
|
||||
|
||||
Title balanced offset 15 days
|
||||
Width 1024
|
||||
Height 550
|
||||
Balance 1
|
||||
Jitter 0
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix balance-
|
||||
Directory ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/balance-
|
||||
Link graphs/peer1/balance-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs balancef {
|
||||
InitialRun 1
|
||||
Frequency 180
|
||||
Timespan 15
|
||||
|
||||
Title balanced offset 15 days, x10 < avg
|
||||
Width 1024
|
||||
Height 550
|
||||
Balance 1
|
||||
Jitter 0
|
||||
Offset 1
|
||||
FilterFactor 10
|
||||
|
||||
Destinations {
|
||||
Prefix balancef-
|
||||
Directory ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/balancef-
|
||||
Link graphs/peer1/balancef-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs offsetp30 {
|
||||
InitialRun 0
|
||||
Frequency -1
|
||||
Timespan 30
|
||||
|
||||
Title 30 days offset
|
||||
Width 1024
|
||||
Height 550
|
||||
Jitter 1
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix offset30-
|
||||
Directory ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/offset30-
|
||||
Link graphs/peer1/offset30-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs offsetp60 {
|
||||
InitialRun 0
|
||||
Frequency -1
|
||||
Timespan 60
|
||||
|
||||
Title 60 days offset
|
||||
Width 1024
|
||||
Height 550
|
||||
Jitter 1
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix offset60-
|
||||
Directory ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/offset60-
|
||||
Link graphs/peer1/offset60-
|
||||
}
|
||||
}
|
||||
|
||||
PeerGraphs delayp30 {
|
||||
InitialRun 0
|
||||
Frequency -1
|
||||
Timespan 30
|
||||
|
||||
Title 30 days delay
|
||||
Width 1024
|
||||
Height 550
|
||||
Delay 1
|
||||
Jitter 1
|
||||
Offset 1
|
||||
|
||||
Destinations {
|
||||
Prefix delay30-
|
||||
Directory ntp1.domain.org/peergraphs/
|
||||
Directory domain.org/graphs/peer1/
|
||||
}
|
||||
|
||||
Links {
|
||||
Link peergraphs/delay30-
|
||||
Link graphs/peer1/delay30-
|
||||
}
|
||||
}
|
||||
}
|
@ -15,8 +15,8 @@ Listener {
|
||||
}
|
||||
|
||||
Log {
|
||||
Severity debug
|
||||
File /var/log/ntpa-stat.log
|
||||
Severity trace
|
||||
File /var/log/ntpa.stat.log
|
||||
}
|
||||
|
||||
# Use to syncronize timestamp for readings accross different NTP servers
|
||||
|
Reference in New Issue
Block a user