You can generate on-demand or scheduled reports in Foglight to a number of formats. These can be setup to be emailed at the time of generation, or they can be reviewed later via the Foglight UI (Reports -> Manage Reports).
This post will show how to save a report to a disk local to the Foglight Management Server at the time of generation. I had some groovy code from 2011, so I thought it would be worth a refresh. I tested it against FMS 188.8.131.52 and it worked without modification.
Here are the steps to take:
1- Create a new rule. Give it a name and description. Set it to be Event Driven on a ReportGeneratedEvent. Select the checkbox for no scoping query then click Next.
In the Condition, paste the code below, then validate it with the green checkmark. Click Finish when done.
// to be used as the condition in an event driven rule def myReportName = @event.report.reportName def myReportId = @event.report.reportId def myDateRun = @event.report.dateRun def reportType = @event.report.reportFormat reportType = reportType.equals("PDF") ? "pdf" : reportType def myDateString = myDateRun.toString() myDateString = myDateString.replaceAll(":","-") def fos = new FileOutputStream("C:\\temp\\"+myReportName+"__"+myDateString+"."+reportType) fos.write(server.ReportingService.getReportData(myReportId)) fos.close() return false
You can validate from the Manage Rules dashboard that the rule has been saved and enabled.
Next, run a report. I've highlighted the report name (that you enter) and the file type so you can see how it is used when saved to disk.
And there you go! Just make sure that the drive and directory you are saving to exists beforehand. Foglight will not create it for you.