Page 1 of 1

Scheduling custom reports from within XI

Posted: Tue Apr 28, 2015 12:16 pm
by CWSI
Hi guys,

I've managed to create completely bespoke alert emails by using Commands to pass the various variables of an alert to a PHP script which crafts a branded email and sends it out. I'd now like to do something similar but for a report, I'm just trying to figure out what is the best way to go about it with XI or if it is even possible without going off the reservation a bit :).

So I see I could create my own Component and in that write a PHP script that puts together a nicely formatted and branded email (similar to the Executive Summary I guess). Then I see I can Schedule reports, but from the Schedule Reports section we don't really get the flexibility we get with Commands, so I don't see how I could schedule my new Report Component and tell it which Hostgroup to report on for instance.

I guess I could use a few cron jobs on the host to call my PHP script with different hostgroup names and manage it this way, but it would be much nicer to keep it within the XI GUI if possible. Is there any other XI feature I'm missing that might achieve what I'm trying to do?


Cheers!

Re: Scheduling custom reports from within XI

Posted: Tue Apr 28, 2015 4:56 pm
by jdalrymple
CWSI wrote:'m just trying to figure out what is the best way to go about it with XI or if it is even possible without going off the reservation a bit :)
Might be a bit late for that...

Joking aside :) You want to exploit a command that you've already written, but on a schedule it sounds like? What about using a cron job to send a passive check to kick off a notification command on an interval? I might be just as off the reservation - but unfortunately within the XI interface there is no method to run service or host checks on a specific schedule.

Or maybe I'm out in left field regarding what it is exactly you're trying to do?

Re: Scheduling custom reports from within XI

Posted: Wed Apr 29, 2015 5:07 am
by CWSI
Hey,

Yeah trying to give the alert and report emails a bit more "sizzle" :) than the built-in functionality allows, but ideally I'd like to keep as much of it within the GUI as possible otherwise support by anybody other than me in future would be troublesome. This is easily enough done with alerts, just call a Command which calls a PHP script and feeds all the info required to it, this then creates and formats emails and SMSs as required.

I'm just looking at the reports now. So again I'll need to write a custom PHP script to generate the HTML report that will then be emailed, this looks to be fairly doable, just need to take say execsummary.php and expand on it. Where I'm struggling is getting the scheduling to happen preferably within the GUI. So I'd like to see a list of scheduled report like -
Custom Report 1 - /usr/local/nagiosxi/html/reports/mymonthlyreport.php?period=lastmonth&hostgroup=myhostgroup1&recipient=contactemail1 - 09:00 last day of each month
Custom Report 2 - /usr/local/nagiosxi/html/reports/mymonthlyreport.php?period=lastmonth&hostgroup=myhostgroup2&recipient=contactemail2 - 09:00 last day of each month
Custom Report 3 - /usr/local/nagiosxi/html/reports/mymonthlyreport.php?period=lastmonth&hostgroup=myhostgroup3&recipient=contactemail3 - 09:00 last day of each month
Custom Report 4 - /usr/local/nagiosxi/html/reports/mymonthlyreport.php?period=lastmonth&hostgroup=myhostgroup4&recipient=contactemail4 - 09:00 last day of each month

I actually think this functionality is basically in XI already, just not exposed to the GUI fully. If you schedule a Page you see the URL the schedule will call for instance, I just want to be able to customise this page URL. And also disable the sending of a PDF/email.

Your idea of scheduling a command would also work and is probably the way I'll have to go for now, would be just much nicer (from a support point of view) if it showed up in the Reports section of the console. Maybe it's something the devs can think of for a future enhancement, commands are so customisable at the moment it's what makes Nagios great, but report management could do with the same love.

Re: Scheduling custom reports from within XI

Posted: Wed Apr 29, 2015 4:47 pm
by jdalrymple
REALLY what we need is the ability to run a custom report. I can put in a feature request.

The good news - I think you're right - I think most of the pieces are in place and the developers should be able to pretty easily make that happen!

The bad news - I bet this is a very narrow scope issue, not many people are creating their own PHP reports.

I like the idea though. If you think that's about right I'll add it as a feature request...

Something like "Allow users to add their own customized report programs to be managed by the XI GUI" or some such?

Re: Scheduling custom reports from within XI

Posted: Thu Apr 30, 2015 9:32 am
by CWSI
Yep if you could add that as a feature request it would be great!

Re: Scheduling custom reports from within XI

Posted: Thu Apr 30, 2015 9:40 am
by jdalrymple
Feature request submitted. I'll lock this up and return to it to mark resolved once the request has been completed (assuming I get the testing task)

Re: Scheduling custom reports from within XI

Posted: Tue May 26, 2015 9:44 am
by scottwilkerson
Just wanted to mention you can use the "Schedule Page" icon to schedule any page that is loaded in the frame
schedule_page.PNG