From 3a970744be4a7f18ba33706bc3f5c0ae87c50fd5 Mon Sep 17 00:00:00 2001 From: llsth Date: Fri, 11 Mar 2016 23:22:40 +0100 Subject: [PATCH] Updated configuration --- .gitignore | 246 +++++++++++++++++++++++++++++++++++++++ INSTALL | 33 ++++++ Ntp.Analyzer.Cli/Main.cs | 2 +- Ntp.Analyzer.sln | 6 + config/ntpa.s1.conf | 113 ++++++++++++++++++ dist/ntpa.stat.conf.dist | 14 ++- sql/create_tables.sql | 10 +- sql/create_test_data.sql | 2 +- 8 files changed, 413 insertions(+), 13 deletions(-) create mode 100644 .gitignore create mode 100644 INSTALL create mode 100644 config/ntpa.s1.conf diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..4ff55705 --- /dev/null +++ b/.gitignore @@ -0,0 +1,246 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..03673681 --- /dev/null +++ b/INSTALL @@ -0,0 +1,33 @@ +FreeBSD 10.x +------------ + +To run data collection core: +# pkg install mono +# pkg install libgdiplus + +Adjust create_date.sql with real values and run: +# mysql < run create_tables.sql +# mysql < run create_data.sql + +Copy ntp.conf from NTP host to the machine running ntpa and add timeserver ID from support.ntp.org. +Search using google.com with f.x. +"ntp1.innolan.net" site:support.ntp.org +For servers not registret on support.ntp.org just add 10000 and above. + +copy ntpa.stat.conf.dist to /etc/ntpa.conf +Adjust the value of HostName and ConfigFile setting. Hostname must point to a name or IP reachable +by ntpq to get statistics. ConfigFile must match ntp.conf and ntp.conf must have timersver IDs. + +validate ntpa.con file with ntpav using: +# ntpav /etc/ntpa.conf + +Now start ntpa and watch the data arriving in MySQL tables. +# mono ntpa.exe + +Also watch the logfile for errors and other debugging activities. + +Now start ntpa in deamon mode with: +# &mono ntpa.exe + +To stop ntpa use kill. Find ntpa pid in log file. +# kill 77342 diff --git a/Ntp.Analyzer.Cli/Main.cs b/Ntp.Analyzer.Cli/Main.cs index f9546ff3..a0c1477e 100644 --- a/Ntp.Analyzer.Cli/Main.cs +++ b/Ntp.Analyzer.Cli/Main.cs @@ -35,7 +35,7 @@ namespace Ntp.Analyzer.Cli /// public static class MainClass { - [DllImport("libc.so")] + [DllImport("libc")] private static extern int getpid (); [DllImport ("libc")] // Linux diff --git a/Ntp.Analyzer.sln b/Ntp.Analyzer.sln index 3411bc8d..a345aa10 100644 --- a/Ntp.Analyzer.sln +++ b/Ntp.Analyzer.sln @@ -48,6 +48,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ntp.Process", "Ntp.Process\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPlot", "NPlot\NPlot.csproj", "{C2DEBED1-FE91-4929-B686-8E920731E88C}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{79DFB57F-58FD-4F34-A722-60E3B598EBE8}" + ProjectSection(SolutionItems) = preProject + config\ntpa.s1.conf = config\ntpa.s1.conf + INSTALL = INSTALL + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/config/ntpa.s1.conf b/config/ntpa.s1.conf new file mode 100644 index 00000000..6f9493f1 --- /dev/null +++ b/config/ntpa.s1.conf @@ -0,0 +1,113 @@ +##################################################################### +# Configuration for NTP Analyzer - Statistic configuration - S1 # +# - This file is used as configuration in a production environment. # +##################################################################### + +Database { + Host 172.20.83.1 + Name ntpa + User ntpau + Pass xx +} + +Listener { + IP 172.20.87.1 + Port 9091 +} + +Cluster { + Node stat2 { + IP 172.20.87.2 + Port 9091 + } + + Node stat3 { + IP 172.20.87.3 + Port 9091 + } +} + +Log { + Severity info + File /app/log/ntpa.s1.log +} + +########################## application jobs ######################### + +Notify ntpstat-summery { + InitialRun 1 + Frequency 1440 + + Mail ntpa-op@innolan.dk + Subject NTP Analyzer stats daily run - stat 1 + Sender ntpa@innolan.dk + Smtp 172.20.87.1 + Port 25 +} + +Reading stat-bulk-1 { + Name stat1 + InitialRun 0 + FixedRun 1 + Frequency 3 +} + +########################## ntp1.innolan.net ########################## + +Server { + HostID 1 + HostName ntp1.innolan.net + ConfigFile /app/conf/ntp.conf.ntp1 + + HostStats ntp1-host-stat { + Frequency stat1 + } + + HostIOStats ntp1-host-iostat { + Frequency stat1 + } + + PeerStats ntp1-peer-stat { + Frequency stat1 + } +} + +########################## ntp2.innolan.net ########################## + +Server { + HostID 2 + HostName ntp2.innolan.net + ConfigFile /app/conf/ntp.conf.ntp2 + + HostStats ntp2-host-stat { + Frequency stat1 + } + + HostIOStats ntp2-host-iostat { + Frequency stat1 + } + + PeerStats ntp2-peer-stat { + Frequency stat1 + } +} + +########################## ntp3.innolan.net ########################## + +Server { + HostID 3 + HostName ntp3.innolan.net + ConfigFile /app/conf/ntp.conf.ntp3 + + HostStats ntp3-host-stat { + Frequency stat1 + } + + HostIOStats ntp3-host-iostat { + Frequency stat1 + } + + PeerStats ntp3-peer-stat { + Frequency stat1 + } +} diff --git a/dist/ntpa.stat.conf.dist b/dist/ntpa.stat.conf.dist index f2a0e6fd..cf98bb35 100644 --- a/dist/ntpa.stat.conf.dist +++ b/dist/ntpa.stat.conf.dist @@ -3,10 +3,10 @@ ######################################################### Database { - DatabaseHost 192.168.0.1 - DatabaseName ntpa - DatabaseUser ntpau - DatabasePass xxx + Host 192.168.0.1 + Name ntpa + User ntpau + Pass xxxx } Log { @@ -23,14 +23,16 @@ Reading { # Minutes between reading values from NTP servers. Frequency 5 + + # Indicate if readings should happen at rounded intervals. + FixedRun 1 } Server { - # Primary key in table 'host' HostID 1 - # Domain name of hosting NTP server + # Domain name of hosting NTP server (used by for ntpq) HostName ntp1.domain.org # NTP configuration file with IDs from support.ntp.org diff --git a/sql/create_tables.sql b/sql/create_tables.sql index 5ebbf796..25a94695 100644 --- a/sql/create_tables.sql +++ b/sql/create_tables.sql @@ -1,16 +1,16 @@ -- CREATE DATABASE ntpa; -- CHARACTER SET utf8 COLLATE utf8_bin; USE ntpa; -DROP USER 'ntpau'@'localhost'; +-- DROP USER 'ntpau'@'localhost'; CREATE USER 'ntpau'@'localhost' IDENTIFIED BY 'xxxx'; GRANT ALL PRIVILEGES ON ntpa.* TO 'ntpau'@'localhost'; FLUSH PRIVILEGES; -DROP TABLE hostReading; -DROP TABLE peerReading; -DROP TABLE host; -DROP TABLE peer; +-- DROP TABLE hostReading; +-- DROP TABLE peerReading; +-- DROP TABLE host; +-- DROP TABLE peer; CREATE TABLE host ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, diff --git a/sql/create_test_data.sql b/sql/create_test_data.sql index 9450b8ed..631c1385 100644 --- a/sql/create_test_data.sql +++ b/sql/create_test_data.sql @@ -1,3 +1,3 @@ USE ntpa; -INSERT INTO host (ip, name, orgId) VALUES ('0.0.1.1', 'ntp1.innolan.dk', 23); +INSERT INTO host (ip, name, orgId) VALUES ('90.184.222.114', 'ntp1.innolan.net', 901);