Example #1
0
        public static void ReportDiskData(SQLLib sql, string MachineID, string Disk, Int64 NotifyValue, Int64 Is, Int64 TotalSZ, ReportingFlags Flags)
        {
            Flags &= ~(ReportingFlags.AdminReported | ReportingFlags.ClientReported | ReportingFlags.UrgentAdminReported | ReportingFlags.UrgentClientReported);

            ReportingDiskData rep = new ReportingDiskData();

            rep.Disk        = Disk;
            rep.Is          = Is;
            rep.NotifyValue = NotifyValue;
            rep.TotalSZ     = TotalSZ;

            sql.InsertMultiData("Reporting",
                                new SQLData("MachineID", MachineID),
                                new SQLData("Type", ReportingPolicyType.Disk),
                                new SQLData("Data", JsonConvert.SerializeObject(rep)),
                                new SQLData("Flags", Flags));
        }
Example #2
0
            public string Explain(string JSON)
            {
                if (JSON == null)
                {
                    return("Disk Data: no data");
                }

                try
                {
                    ReportingDiskData rd = JsonConvert.DeserializeObject <ReportingDiskData>(JSON);
                    return(rd.Disk + ": Free space: " + CommonUtilities.NiceSize(rd.Is) + " of total: " + CommonUtilities.NiceSize(rd.TotalSZ) + " (Notify: " + CommonUtilities.NiceSize(rd.NotifyValue) + ")");
                }
                catch
                {
                    return("Disk Data faulty: " + JSON);
                }
            }