You are viewing limited content. For full access, please sign in.

Question

Question

Email Volume size

asked on June 9, 2014

Is it possible in WF or another tool to email a specific email address on a monthly basis the size of specific volumes on our LF server?

 

Currently, each month, I have to log into the Admin Console and navigate to the specific volumes, right click properties and select the path tab to view the Volume size.  It would be great if this could be automated to email me the figures each month.

 

Thanks. 

Replies

replied on June 9, 2014

I can probably refine this process in the future, but I wrote a LINQPad script that calculates some stats for our repository and stores them in a database. I have Workflow invoke LINQPad from the command line using a Script Activity.

 

The end result looks something like this:

 

Is that what you're after?

 

I can probably share the solution in detail, but it might take a while to write up and explain the moving parts.

replied on June 10, 2014

That looks promising, but I'm not to familiar with LINQPad scripts.  

 

Anthony

replied on June 11, 2014

Here's the code. Maybe it will show you roughly what I'm doing. LINQPad is a snippet compiler that lays a LINQ-to-SQL layer over a database and allows you to interact with tables at a high level using collections, objects, and properties. I could probably accomplish the same thing by writing the SQL myself, but my SQL-Fu isn't that strong, and I couldn't get the aggregations right in the relationships between Logical Volume > Physical Volume > Document > Page. So I ended up looping through the volumes. It's not as efficient, but it works.

 

void Main()
{
 var volumes = Vols.Where (v => v.Sourcevol == 0).OrderBy (v => v.Vol_name);
 var TotalEntries = new List<EntryTotal>();
 var now = DateTime.Now;
 var sortIndex = 0;

 foreach (var volume in volumes)
 {
  volume.Vol_name.Dump();
  decimal tmpSize = 0;
  var totalLine = new EntryTotal();
  totalLine.TimeStamp = now;
  totalLine.VolumeName = volume.Vol_name;
  
  var greyPages = Docs.Where (d => d.Img_bpp == 8 && d.Toc.Vol.Sourcevol == volume.Vol_id && d.Toc.Etype == -2);
  
  var grey = (from page in greyPages
   group page by page.Tocid into docGroup
   select new
   {
    key = docGroup.Key,
    size = docGroup.Sum (d => (decimal)d.Img_size + (decimal)d.Lft_size + (decimal)d.Loc_size + (decimal)d.Txt_size)
   }).Distinct();
     
  totalLine.GreyPageCount = greyPages.Count();
  totalLine.GreyDocCount = grey.Count();
  tmpSize = totalLine.GreyDocCount > 0 ? grey.Sum (g => g.size) : 0;
  totalLine.SetGreySize(tmpSize);
  
  var colorPages = Docs.Where (d => d.Img_bpp == 24 && d.Toc.Vol.Sourcevol == volume.Vol_id && d.Toc.Etype == -2);
  
  var color = (from page in colorPages
   group page by page.Tocid into docGroup
   select new
   {
    key = docGroup.Key,
    size = docGroup.Sum (d => (decimal)d.Img_size + (decimal)d.Lft_size + (decimal)d.Loc_size + (decimal)d.Txt_size)
   }).Distinct();
     
  totalLine.ColorPageCount = colorPages.Count();
  totalLine.ColorDocCount = color.Count();
  tmpSize = totalLine.ColorDocCount > 0 ? color.Sum (g => g.size) : 0;
  totalLine.SetColorSize(tmpSize);
  
  var bwPages = Docs.Where (d => d.Img_bpp == 1 && d.Toc.Vol.Sourcevol == volume.Vol_id && d.Toc.Etype == -2);
  
  var bw = (from page in bwPages
   group page by page.Tocid into docGroup
   select new
   {
    key = docGroup.Key,
    size = docGroup.Sum (d => (decimal)d.Img_size + (decimal)d.Lft_size + (decimal)d.Loc_size + (decimal)d.Txt_size)
   }).Distinct();
     
  totalLine.BWPageCount = bwPages.Count();
  totalLine.BWDocCount = bw.Count();
  tmpSize = totalLine.BWDocCount > 0 ? bw.Sum (g => g.size) : 0;
  totalLine.SetBWSize(tmpSize);
  
  var statLine = new LF_LookupTablesTypes.Stats();
  statLine.BWDocCount = totalLine.BWDocCount;
  statLine.BWPageCount = totalLine.BWPageCount;
  statLine.BWSize = totalLine.BWSize;
  statLine.ColorDocCount = totalLine.ColorDocCount;
  statLine.ColorPageCount = totalLine.ColorPageCount;
  statLine.ColorSize = totalLine.ColorSize;
  statLine.GreyDocCount = totalLine.GreyDocCount;
  statLine.GreyPageCount = totalLine.GreyPageCount;
  statLine.GreySize = totalLine.GreySize;
  statLine.TimeStamp = totalLine.TimeStamp;
  statLine.DocCount = totalLine.DocCount;
  statLine.PageCount = totalLine.PageCount;
  statLine.TotalSize = totalLine.TotalSize;
  statLine.VolumeName = totalLine.VolumeName;
  statLine.SortOrder = sortIndex;
  sortIndex++;
  
  LF_LookupTables.Stats.InsertOnSubmit(statLine);
  
  TotalEntries.Add(totalLine);
 }

 var summaryLine = new LF_LookupTablesTypes.Stats();
 summaryLine.BWDocCount = TotalEntries.Sum (te => te.BWDocCount);
 summaryLine.BWPageCount = TotalEntries.Sum (te => te.BWPageCount);
 summaryLine.BWSize = TotalEntries.Sum (te => te.BWSize);
 summaryLine.ColorDocCount = TotalEntries.Sum (te => te.ColorDocCount);
 summaryLine.ColorPageCount = TotalEntries.Sum (te => te.ColorPageCount);
 summaryLine.ColorSize = TotalEntries.Sum (te => te.ColorSize);
 summaryLine.GreyDocCount = TotalEntries.Sum (te => te.GreyDocCount);
 summaryLine.GreyPageCount = TotalEntries.Sum (te => te.GreyPageCount);
 summaryLine.GreySize = TotalEntries.Sum (te => te.GreySize);
 summaryLine.TimeStamp = now;
 summaryLine.DocCount = TotalEntries.Sum (te => te.DocCount);
 summaryLine.PageCount = TotalEntries.Sum (te => te.PageCount);
 summaryLine.TotalSize = TotalEntries.Sum (te => te.TotalSize);
 summaryLine.VolumeName = "Total";
 summaryLine.SortOrder = sortIndex + 1;
 
 LF_LookupTables.Stats.InsertOnSubmit(summaryLine);

 SubmitChanges();

 TotalEntries.Dump();
}

// Define other methods and classes here
class EntryTotal
{
 public DateTime TimeStamp { get; set; }
 public string VolumeName { get; set; }

 public int GreyDocCount { get; set; }
 public int GreyPageCount { get; set; }
 
 private decimal _GreySize;
 
 public void SetGreySize(decimal size)
 {
  _GreySize = size;
 }
 
 public decimal GreySize
 {
  get
  {
   return Math.Round(_GreySize / 1024M / 1024M / 1024M, 2);
  }
 }
 
 public int ColorDocCount { get; set; }
 public int ColorPageCount { get; set; }

 private decimal _ColorSize;
 
 public void SetColorSize(decimal size)
 {
  _ColorSize = size;
 }
 public decimal ColorSize 
 { 
  get
  {
   return Math.Round(_ColorSize / 1024M / 1024M / 1024M, 2);
  }
 }
 
 public int BWDocCount { get; set; }
 public int BWPageCount { get; set; }
 
 private decimal _BWSize;
 
 public void SetBWSize(decimal size)
 {
  _BWSize = size;
 }
 
 public decimal BWSize 
 { 
  get
  {
   return Math.Round(_BWSize / 1024M / 1024M / 1024M, 2);
  }
 }
 
 public int DocCount
 {
  get
  {
   return GreyDocCount + ColorDocCount + BWDocCount;
  }
 }
 
 public int PageCount
 {
  get
  {
   return GreyPageCount + ColorPageCount + BWPageCount;
  }
 }
 
 public decimal TotalSize
 {
  get
  {
   return GreySize + ColorSize + BWSize;
  }
 }
}

 

replied on April 28, 2017

I have been looking back at this question and would love to refresh it.

Would this be possible to run in a Workflow and email out the results each month for new documents/pages & meta data keystrokes added to each volume in a month?

For example, the email would say:

Month: April, 2107

 

Volume Name: XYZ

Page Counts: 1234

Keystrokes: 1234

 

Volume Name: ABC

Page Count: 5678

Keystokes: 6543

etc...

 

Hope this makes sense.  I have bits of code for looking at fields names and pulling keystroke counts, but can't work out how to organise them to only show numbers/totals for each volume in our LF database.

 

Anthony

You are not allowed to follow up in this post.