예제 #1
0
 public ProcessList(ServerDataConfig c)
 {
     log         = new Logging("Process Data Collector", c.debug_level);
     debug_level = c.debug_level;
     sample_rate = c.ProcessSampleRate;
     log.debug(1, "Created Process Data Collector", 1);
 }
예제 #2
0
 public SessionList(ServerDataConfig c)
 {
     config           = c;
     eventLog1        = new EventLog();
     eventLog1.Source = "Samana Service Session query";
     eventLog1.Log    = "SamanaMonitorLog";
 }
예제 #3
0
        public RamData(ulong t, ServerDataConfig c)
        {
            Stopwatch sw = new Stopwatch();

            log = new Logging("RAM Data Collector", c.debug_level);
            sw.Start();
            config       = c;
            ramTotal     = t;
            ramLoad      = 0;
            ramFree      = t;
            ramPercUsage = 0;
            sw.Stop();
            ticks = sw.ElapsedMilliseconds;
            log.debug(1, "Created RAM Data ", 1);
        }
        protected void LoadConfig()
        {
            ServerDataConfig sconfig = new ServerDataConfig();
            var k = Registry.LocalMachine.OpenSubKey("Software\\Samana Group\\SamanaMonitor");

            if (k == null)
            {
                throw new Exception("Unable to load configuration from registry.");
            }

            port  = (int)k.GetValue("Port", 11000);
            debug = (int)k.GetValue("Debug", 0);
            sconfig.debug_level = debug;
            Interval            = (int)k.GetValue("Interval", 6000); // poller interval default 6s
            sconfig.Interval    = Interval;

            // extract data every 5 minutes (6*50=300)
            sconfig.app_sample_rate = (int)k.GetValue("AppLogSample", 50);
            sconfig.app_hours       = (int)k.GetValue("AppLogHours", 2);
            sconfig.app_level       = (int)k.GetValue("AppLogLevel", (int)EventLevel.Warning);

            // extract data every 5 minutes (6*50=300)
            sconfig.sys_sample_rate = (int)k.GetValue("SysLogSample", 50);
            sconfig.sys_hours       = (int)k.GetValue("SysLogHours", 2);
            sconfig.sys_level       = (int)k.GetValue("SysLogLevel", (int)EventLevel.Warning);

            // extract data every 1 minute (6*10=60)
            sconfig.ServiceSampleRate = (int)k.GetValue("ServiceSampleRate", 10);

            // extract data every 1 minute (6*10=60)
            sconfig.HDSampleRate = (int)k.GetValue("HDSampleRate", 10);

            // extract data every 6 seconds (6*1=6)
            sconfig.CPUSampleRate = (int)k.GetValue("CPUSampleRate", 1);

            // extract data every 1 minute (6*10=60)
            sconfig.RAMSampleRate = (int)k.GetValue("RAMSampleRate", 10);

            // extract data every 5 minutes (6*50=300)
            sconfig.ProcessSampleRate = (int)k.GetValue("ProcessSampleRate", 50);

            // extract data every 1 minute (6*10=60)
            sconfig.SessionSampleRate = (int)k.GetValue("SessionSampleRate", 10);

            sd = new ServerData(sconfig);
            log.debug(1, "Configuration Loaded", 104);
        }
예제 #5
0
 public EventList(ServerDataConfig c, EventPath p)
 {
     log         = new Logging("Event Data Collector", c.debug_level);
     debug_level = c.debug_level;
     if (p == EventPath.System)
     {
         path        = "System";
         hours       = c.sys_hours;
         event_level = c.sys_level;
         sample_rate = c.sys_sample_rate;
     }
     else if (p == EventPath.Application)
     {
         hours       = c.app_hours;
         path        = "Application";
         event_level = c.app_level;
         sample_rate = c.app_sample_rate;
     }
     log.debug(1, "Created eventlist " + path, 1);
 }
예제 #6
0
        public CPUData(ServerDataConfig c)
        {
            Stopwatch sw = new Stopwatch();

            log = new Logging("CPU Data Collector", c.debug_level);
            sw.Start();
            config       = c;
            datasize     = 300000 / c.Interval;
            cpuLoad      = 0;
            cpuqLoad     = 0;
            cpu5minLoad  = new float[datasize];
            cpuq5minLoad = new float[datasize];
            cpu5ptr      = 0;
            cpuq5ptr     = 0;
            cpu5avg      = 0;
            cpuq5avg     = 0;
            cpu5max      = 0;
            cpuq5max     = 0;
            sw.Stop();
            ticks = sw.ElapsedMilliseconds;
            log.debug(1, "Created CPU Data ", 1);
        }
예제 #7
0
        public ServerData(ServerDataConfig s)
        {
            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            FileVersionInfo            fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);

            version = fvi.FileVersion;
            Tick    = 0;
            evtlog  = new Logging("Samana Service Data", 0);
            ComputerInfo c = new ComputerInfo();

            config = s;

            cpudata      = new CPUData(config);
            allProcesses = new ProcessList(config);
            syslog       = new EventList(config, EventPath.System);
            applog       = new EventList(config, EventPath.Application);
            hdlist       = new HDList(config);
            Services     = new ServiceList(config);
            log          = new JSONItemList();
            ramdata      = new RamData(c.TotalPhysicalMemory / 1024 / 1024, config);
            sessions     = new SessionList(config);
            Poll();
        }