delete from metricdata_latest where metric_id in (
  select id from metric where name in (
             'org.sam.WN-CAver',
             'hr.srce.SRM1-CertLifetime',
             'org.gstat.CE',
             'org.gstat.SE',
             'org.gstat.Site',
             'org.nagios.LocalLogger-PortCheck',
             'org.nmap.CREAM-CE',
             'org.nmap.Central-LFC',
             'org.nmap.Classic-SE',
             'org.nmap.GRAM',
             'org.nmap.LB',
             'org.nmap.Local-LFC',
             'org.nmap.MyProxy',
             'org.nmap.SRM',
             'org.nmap.SRM1',
             'org.nmap.Site-BDII',
             'org.nmap.Top-BDII',
             'org.nmap.WMProxy',
             'org.nmap.WMS',
             'org.sam.CREAMCE-JobState',
             'org.osg.general.vo-supported',
             'org.osg.certificates.crl-expiry',
             'org.osg.batch.jobmanager-default-status',
             'org.osg.batch.jobmanagers-available',
             'org.osg.general.vdt-version',
             'hr.srce.VOMS-ServiceStatus',
             'org.sam.CREAMCE-DirectJobState',
             'org.sam.CE-JobState',
             'org.sam.mpi.CE-JobState',
             'ch.cern.LFC-Readdir',
             'ch.cern.LFC-ReadDli',
             'org.sam.CE-JobState',
             'hr.srce.CAdist-Version',
             'ch.cern.LFC-Readdir',
             'hr.srce.VOMS-ServiceStatus',
             'ch.cern.LFC-ReadDli',
             'ch.cern.RGMA-ServiceStatus',
             'org.nmap.MON',
             'org.ggus.Tickets',
             'org.nmap.FTS',
             'org.sam.CREAMCE-JobState',
             'org.sam.CREAMCE-DirectJobState',
             'org.arc.RLS',
             'org.osg.certificates.crl-expiry',
             'org.osg.batch.jobmanager-default-status',
             'org.osg.general.vo-supported',
             'org.osg.batch.jobmanagers-available',
             'org.osg.general.vdt-version',
             'org.osg.gums.authorization-status',
             'org.sam.mpi.CE-JobState',
             'org.lhcb.WN-lhcb-FileAccess',
             'hr.srce.RGMA-CertLifetime'));

commit;

delete from metricdata_spool where metric_id in (
  select id from metric where name in (
             'org.sam.WN-CAver',
             'hr.srce.SRM1-CertLifetime',
             'org.gstat.CE',
             'org.gstat.SE',
             'org.gstat.Site',
             'org.nagios.LocalLogger-PortCheck',
             'org.nmap.CREAM-CE',
             'org.nmap.Central-LFC',
             'org.nmap.Classic-SE',
             'org.nmap.GRAM',
             'org.nmap.LB',
             'org.nmap.Local-LFC',
             'org.nmap.MyProxy',
             'org.nmap.SRM',
             'org.nmap.SRM1',
             'org.nmap.Site-BDII',
             'org.nmap.Top-BDII',
             'org.nmap.WMProxy',
             'org.nmap.WMS',
             'org.sam.CREAMCE-JobState',
             'org.osg.general.vo-supported',
             'org.osg.certificates.crl-expiry',
             'org.osg.batch.jobmanager-default-status',
             'org.osg.batch.jobmanagers-available',
             'org.osg.general.vdt-version',
             'hr.srce.VOMS-ServiceStatus',
             'org.sam.CREAMCE-DirectJobState',
             'org.sam.CE-JobState',
             'org.sam.mpi.CE-JobState',
             'ch.cern.LFC-Readdir',
             'ch.cern.LFC-ReadDli',
             'org.sam.CE-JobState',
             'hr.srce.CAdist-Version',
             'ch.cern.LFC-Readdir',
             'hr.srce.VOMS-ServiceStatus',
             'ch.cern.LFC-ReadDli',
             'ch.cern.RGMA-ServiceStatus',
             'org.nmap.MON',
             'org.ggus.Tickets',
             'org.nmap.FTS',
             'org.sam.CREAMCE-JobState',
             'org.sam.CREAMCE-DirectJobState',
             'org.arc.RLS',
             'org.osg.certificates.crl-expiry',
             'org.osg.batch.jobmanager-default-status',
             'org.osg.general.vo-supported',
             'org.osg.batch.jobmanagers-available',
             'org.osg.general.vdt-version',
             'org.osg.gums.authorization-status',
             'org.sam.mpi.CE-JobState',
             'org.lhcb.WN-lhcb-FileAccess',
             'hr.srce.RGMA-CertLifetime'));

commit;


delete from statuschange_metric_service where metric_id in (
  select id from metric where name in (
             'org.sam.WN-CAver',
             'hr.srce.SRM1-CertLifetime',
             'org.gstat.CE',
             'org.gstat.SE',
             'org.gstat.Site',
             'org.nagios.LocalLogger-PortCheck',
             'org.nmap.CREAM-CE',
             'org.nmap.Central-LFC',
             'org.nmap.Classic-SE',
             'org.nmap.GRAM',
             'org.nmap.LB',
             'org.nmap.Local-LFC',
             'org.nmap.MyProxy',
             'org.nmap.SRM',
             'org.nmap.SRM1',
             'org.nmap.Site-BDII',
             'org.nmap.Top-BDII',
             'org.nmap.WMProxy',
             'org.nmap.WMS',
             'org.sam.CREAMCE-JobState',
             'org.osg.general.vo-supported',
             'org.osg.certificates.crl-expiry',
             'org.osg.batch.jobmanager-default-status',
             'org.osg.batch.jobmanagers-available',
             'org.osg.general.vdt-version',
             'hr.srce.VOMS-ServiceStatus',
             'org.sam.CREAMCE-DirectJobState',
             'org.sam.CE-JobState',
             'org.sam.mpi.CE-JobState',
             'ch.cern.LFC-Readdir',
             'ch.cern.LFC-ReadDli',
             'org.sam.CE-JobState',
             'hr.srce.CAdist-Version',
             'ch.cern.LFC-Readdir',
             'hr.srce.VOMS-ServiceStatus',
             'ch.cern.LFC-ReadDli',
             'ch.cern.RGMA-ServiceStatus',
             'org.nmap.MON',
             'org.ggus.Tickets',
             'org.nmap.FTS',
             'org.sam.CREAMCE-JobState',
             'org.sam.CREAMCE-DirectJobState',
             'org.arc.RLS',
             'org.osg.certificates.crl-expiry',
             'org.osg.batch.jobmanager-default-status',
             'org.osg.general.vo-supported',
             'org.osg.batch.jobmanagers-available',
             'org.osg.general.vdt-version',
             'org.osg.gums.authorization-status',
             'org.sam.mpi.CE-JobState',
             'org.lhcb.WN-lhcb-FileAccess',
             'hr.srce.RGMA-CertLifetime'));

commit;

call delete_obsolete_metrics(1000);