Exemplo n.º 1
0
        public Json GetJson()
        {
            Json j = new Json();

            j.EnsureArray();
            lock (Entries)
            {
                foreach (LogEntry entry in Entries)
                {
                    j.Append(entry.GetJson());
                }
            }
            return(j);
        }
Exemplo n.º 2
0
        public virtual Json GetRealtimeNetworkStats()
        {
            Json result = new Json();

            result.EnsureArray();
            NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
            foreach (NetworkInterface adapter in interfaces)
            {
                string id = adapter.Id;
                IPv4InterfaceStatistics istats = adapter.GetIPv4Statistics();
                Int64 bytesRcv = istats.BytesReceived;
                Int64 bytesSnd = istats.BytesSent;

                Json jInterface = new Json();
                jInterface["id"].Value = id;
                //jInterface["ts"].Value = Utils.UnixTimeStamp();
                jInterface["rcv"].Value = bytesRcv;
                jInterface["snd"].Value = bytesSnd;
                result.Append(jInterface);
            }
            return(result);
        }