Automating Deletion of Old Foglight Reports - Foglight for Databases - Foglight for Databases - Dell Community

Automating Deletion of Old Foglight Reports

Automating Deletion of Old Foglight Reports

This question has suggested answer(s)

Hi,

I am trying to create a rule that will automatically delete old Foglight reports after they have been stored for a few months. Is there a way to do this? 

Thanks! 

All Replies
  • rule in schedule driven without data : here for 30 days.

    import com.quest.nitro.service.uiquery.ReportQueryHandlerMBean;
    import com.quest.wcf.datasupport.datasource.DataSourceManager;
    import com.quest.nitro.model.topology.DataObject;
    repService = server.ReportingService;
    def handler = DataSourceManager.getInstanceHandler("foglight-5");
    def ids = handler.getInstanceIds();
    def ds = ids.isEmpty()? null : handler.getInstance(ids.iterator().next());
    def v_send_day=(new Date())-30;
    def List v_list =new ArrayList();
    //check if report was not generated in the after v_send_day
    for (rep in ds.getUIQueryService().getQueryHandler(ReportQueryHandlerMBean.ROOT_PATH_REPORT ).listReports()) {
    if ((rep.get('dateRun')
    print "NBB clean manual report: " + rep.getUniqueId() + " - " + rep.get('reportName') + '-' + " - " + rep.get('dateRun') + " - " + rep.get('user') + " - " + rep.get('name') + " - " + rep.get('templateName') + "\n";
    v_list.add(rep);
    //exit script whith dummy script
    }
    }
    if (!v_list.isEmpty()){
    repService.deleteGeneratedReports(v_list);
    }
    return false;