
synopsis:

	Systems with certificate containing MD5 checksum

description:

	List of registereted systems which use certificate (/etc/sysconfig/rhn/systemid)
	with an MD5 checksum

columns:

	system_id	System ID
	system_name	System name
	organization_id	Organization ID
	last_checkin	Last check of the system

sql:

	select * from (
	select rhnServer.id as system_id,
		rhnServer.name as system_name,
		rhnServer.org_id as organization_id,
		rhnServerInfo.checkin as last_checkin
	from rhnServer
		join rhnServerInfo on rhnServer.id=rhnServerInfo.server_id,
		(
			select cast(coalesce(value, default_value) as integer) as thresh from rhnConfiguration
			where key = 'system_checkin_threshold'
		) C
	where rhnServerInfo.checkin >= current_timestamp - numtodsinterval(
	C.thresh * 86400, 'second') and
	length(rhnServer.secret) = 32
	) X
	-- where placeholder
	order by system_id, organization_id

