Scheduled Activity returning inaccurate last report time information

I’m trying to create a report (or an alert) that lets me know when less than 75% of systems have a last report time of less than an hour to try to catch BigFix issues.

I’m using the following (in Match Relevance in the Scheduled Activity) to determine if a report (or alert) should be emailed:

(((number  of bes computers whose ((now - last report time of it) / hour <= 1) as floating point)/ (number of bes computers))* 100  < 75)

The report occasionally seems to be sent even when the percentage is way above the 75% threshold, and if I include a custom report, the numbers in the report are off as well (Custom Report below):

<head>
<style>
h1,h2 {
    text-align:  center;
}
h4 {
    text-align:  right;
}
table {
   border-collapse: collapse;
}
th {
   color:white;
   background-color: black;
   border:  1px solid white;
}
table.blk, td.blk {
   border:  1px solid black;
}

td.let {
  text-align:  left;
  padding: 10px;
  border:  1px solid black;
}

td.num {
  text-align:  right;
  padding:  10px;
  border:  1px solid black;
}

td {
  margin:  0px;
}

</style>
</head>


<table>
<tr><td colspan=3><h2>Last Report Time Age</h2></td></tr>
<tr><th>Age Span</th><th>Count</th><th>Percent</th></tr>
<tr><td class="let">1 hour or less</td><td class="num"><?relevance (number of bes computers whose ((now - last report time of it) / hour <= 1)) ?></td><td class="num"><?relevance (number of bes computers whose ((now - last report time of it) / hour <= 1))*100/(number of bes computers) ?></td></tr>
<tr><td class="let">More than 1 hour but 3 hours or less</td><td class="num"><?relevance (number of bes computers whose (((now - last report time of it) / hour> 1) and ((now - last report time of it) / hour <= 3))) ?></td><td class="num"><?relevance (number of bes computers whose (((now - last report time of it) / hour> 1) and ((now - last report time of it) / hour <= 3)))*100/(number of bes computers) ?></td></tr>
<tr><td class="let">More than 3 hours but 7 hours or less</td><td class="num"><?relevance (number of bes computers whose (((now - last report time of it) / hour > 3) and ((now - last report time of it) / hour <= 7))) ?></td><td class="num"><?relevance (number of bes computers whose (((now - last report time of it) / hour > 3) and ((now - last report time of it) / hour <= 7)))*100/(number of bes computers) ?></td></tr>
<tr><td class="let">More than 7 hours</a></td><td class="num"><?relevance (number of bes computers whose ((now - last report time of it) / hour > 7)) ?></td><td class="num"><?relevance (number of bes computers whose ((now - last report time of it) / hour > 7))*100/(number of bes computers) ?></td></tr>
<tr><td class="let">Regardless of Last Report Time Criteria</td><td class="num"><?relevance (number of bes computers) ?></td><td class="num">&nbsp;</td></tr>
</table>

Any reason why this is acting differently than what I expect?

Thanks,
Bob_K

I’m on a phone, so can’t verify, but I think the problem is comparing the time differences being <= 1hr. Integer arithmetic is the root problem.

As a first tweak, try making the time comparison as 60 * minute or comparing the last report time < now - 1 * hour.

Quick test harness:

	(
		number of bes computers , number of bes computers 
		whose
		(
			(
				now - last report time of it 
			)
			/ minute < 60 
		)
		, number of bes computers 
		whose
		(
			(
				now - last report time of it 
			)
			/ hour <=1 
		)
		, number of bes computers 
		whose
		(
			last report time of it > now - 1 * hour 
		)
		, 
		(
			(
				number of bes computers 
				whose
				(
					(
						now - last report time of it 
					)
					/ hour <=1 
				)
				as floating point 
			)
			/ 
			(
				number of bes computers 
			)
		)
		* 100 , 
		(
			number of bes computers 
			whose
			(
				(
					last report time of it > now - 1 * hour 
				)
			)
			* 100 
		)
		/ number of bes computers , 
		(
			(
				number of bes computers 
				whose
				(
					(
						last report time of it > now - 1 * hour 
					)
				)
			)
			/ number of bes computers as floating point 
		)
		* 100 
	)

The numbers comparing <= 1 * hour are markedly different to < 60 * minute or comparing to now - 1 * hour.

Also, you can get a very close result without floating point by doing the multiplication by 100 earlier in the formula.