mirror of
https://bitbucket.org/anguist/ntpa
synced 2025-10-06 11:04:40 +00:00
Removed dependency to org id
This commit is contained in:
@ -25,7 +25,7 @@
|
||||
<LangVersion>4</LangVersion>
|
||||
<Externalconsole>true</Externalconsole>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Commandlineparameters>~/code/ntpa/example/ntpa.stat.conf</Commandlineparameters>
|
||||
<Commandlineparameters>--config ~/code/ntpa/example/ntpa.graph.conf --temp /tmp/</Commandlineparameters>
|
||||
<AssemblyName>ntpa</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Server|AnyCPU' ">
|
||||
|
@ -120,17 +120,16 @@ namespace Ntp.Analyzer.Data.File
|
||||
if (ip == null) {
|
||||
try {
|
||||
ip = Dns.GetHostAddresses (address) [0];
|
||||
} catch (Exception exception) {
|
||||
Debug.WriteLine (exception);
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
Log.WriteLine (e, Severity.Trace);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
IPHostEntry hostEntry = Dns.GetHostEntry (ip);
|
||||
name = hostEntry.HostName;
|
||||
} catch (Exception exception) {
|
||||
Debug.WriteLine (exception);
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
Log.WriteLine (e, Severity.Trace);
|
||||
name = ip.ToString ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,17 +138,19 @@ namespace Ntp.Analyzer.Data.File
|
||||
int orgPos = l.IndexOf ("#", StringComparison.Ordinal);
|
||||
|
||||
if (orgPos != -1) {
|
||||
string org = l.Substring (orgPos + 1).Trim ();
|
||||
orgPos = org.IndexOf (" ", StringComparison.Ordinal);
|
||||
org = org.Substring (0, orgPos).Trim ();
|
||||
try {
|
||||
string org = l.Substring (orgPos + 1).Trim ();
|
||||
orgPos = org.IndexOf (" ", StringComparison.Ordinal);
|
||||
org = org.Substring (0, orgPos).Trim ();
|
||||
|
||||
int realOrgId;
|
||||
|
||||
// Nullable not fully supported by NTP Analyzer.
|
||||
if (!Int32.TryParse (org, out realOrgId))
|
||||
return null;
|
||||
|
||||
orgId = realOrgId;
|
||||
int realOrgId;
|
||||
if (Int32.TryParse (org, out realOrgId)) {
|
||||
orgId = realOrgId;
|
||||
}
|
||||
} catch {
|
||||
// TODO: Make a more secure implementation
|
||||
orgId = null;
|
||||
}
|
||||
}
|
||||
|
||||
return new NtpConfEntry (role, ip, name, orgId);
|
||||
|
@ -64,7 +64,7 @@ namespace Ntp.Analyzer.Process.Description
|
||||
|
||||
foreach (NtpConfEntry entry in DataFace.Instance.NtpConfigCache[config.ConfigFile])
|
||||
{
|
||||
IEnumerable<Peer> peers = DataFace.Instance.Peers.Where(p => p.OrgId == entry.OrgId.Value);
|
||||
IEnumerable<Peer> peers = DataFace.Instance.Peers.Where(p => p.Ip == entry.Address.ToString());
|
||||
|
||||
if (peers.Count() == 0)
|
||||
{
|
||||
|
@ -4,9 +4,19 @@
|
||||
|
||||
# Connection parameters to MySQL database instance.
|
||||
Database {
|
||||
# Address of sql server
|
||||
Host 127.0.0.1
|
||||
|
||||
# Port of sql server. Leave empty to use default.
|
||||
#Port 2567
|
||||
|
||||
# Name of database
|
||||
Name ntpa
|
||||
|
||||
# Database username
|
||||
User ntpau
|
||||
|
||||
# Password for the user
|
||||
Pass xxxx
|
||||
}
|
||||
|
||||
@ -35,7 +45,7 @@ Server {
|
||||
ConfigFile /opt/ntpa/config/ntp.conf
|
||||
|
||||
# Base path for generated files
|
||||
FilePath graphs/
|
||||
FilePath /usr/local/www/
|
||||
|
||||
# Base URL for generated files
|
||||
WebPath /
|
||||
|
Reference in New Issue
Block a user