maya
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ot_ro_mon_fs_delay_xi(integer)
Parameters
Name
Type
Mode
lowerbound_min
integer
IN
Definition
/* v20160713 Several XI units have presented great delay along the day, so we need an alert to prevent it from happening again */ with q as (select u.alias,unit_name,lastgpsdate at time zone 'AMERICA/MEXICO_CITY',ignition_on,script_version,others->'relays',ip,* from device d inner join unit u on u.idunit = d.idunit inner join client c on c.idclient = u.idclient where c.clientcode in ('mxbf402','mx64ec5') and d.idmodeldevice = 4 and ignition_on = 't' and (now() - lastgpsdate ) > ($1::varchar||' minutes')::interval and (now() - lastgpsdate ) < interval '8 hours' order by lastgpsdate desc) select count(*)::integer from q;