Is there any existing documentation to create your own Nagios Fusion Dashlets? I haven't been able to find anything helpful to get me started creating my own dashlets.
Thank you.
Nagios Fusion Dashlets
Re: Nagios Fusion Dashlets
There isn't currently a developer doc to cover this, although it's something I need to write at some point. What kind of data do you want in a dashlet and I can probably send you a commented example dashlet that you could start from.
Re: Nagios Fusion Dashlets
Currently I've seen some of the dashlets that are out and the ones that are available through the Nagios Fusion-> Available Dashlets Section, I believe you've written pretty much all of them and they are all pretty awesome!
Currently I have 2 types of dashlets I want to work on:
1) Instead of aggregating the alerts I would like to aggregate the notifications. So I guess the data that I want to access is the Notifications Section in the Nagios Core Gui, I think it should be possible to get that data through Nagios Fusion since it is accessible through http. The final dashlet(s) would hopefully be something that looks like the Alerts Histogram Dashlet, but instead of alerts it displays the numbers of notifications sent. I've been able to obtain this info by drilling the Nagios Server Logs with Python before but it would be nice to have this information accessible through Nagios Fusion.
2) A more flexible dashlet that allows you to basically search any service or host in each Nagios Server in Fusion and allow the user to acknowledge or downtime an existing alert. All of this without having to go to the Nagios Server Instance. So the type of data required for this one would be access to a list of Nagios Servers Installed in Fusion, the list of Services and Hosts in each Nagios Server and the ability to submit external commands to the Nagios Server through http.
Any information you can provide about the structure of a dashlet and any other info would be appreciated.
Thanks again Mike!
Currently I have 2 types of dashlets I want to work on:
1) Instead of aggregating the alerts I would like to aggregate the notifications. So I guess the data that I want to access is the Notifications Section in the Nagios Core Gui, I think it should be possible to get that data through Nagios Fusion since it is accessible through http. The final dashlet(s) would hopefully be something that looks like the Alerts Histogram Dashlet, but instead of alerts it displays the numbers of notifications sent. I've been able to obtain this info by drilling the Nagios Server Logs with Python before but it would be nice to have this information accessible through Nagios Fusion.
2) A more flexible dashlet that allows you to basically search any service or host in each Nagios Server in Fusion and allow the user to acknowledge or downtime an existing alert. All of this without having to go to the Nagios Server Instance. So the type of data required for this one would be access to a list of Nagios Servers Installed in Fusion, the list of Services and Hosts in each Nagios Server and the ability to submit external commands to the Nagios Server through http.
Any information you can provide about the structure of a dashlet and any other info would be appreciated.
Thanks again Mike!
Re: Nagios Fusion Dashlets
Just as an FYI, the recent alerts page/dashlet does actually pull data from the Notifications pages in both XI and Fusion, so a lot of that data is already there in the local database table fusion_recent_alerts, but only for the last two hours.
For a Fusion dashlet there's two ways you could go about developing it.
- Grab data on-the-fly and process it into the dashlet - (slow load time, but easier to write and minimal burden on the Nagios servers)
- Grab data, cache it locally, and then manipulate it however needed for the UI. - (Easier to sort and filter, additional steps to build)
I think the recent alerts dashlet would be the best starting point for what you want to do. Doing a Fusion dashlet for Core requires fetching the page contents and then parsing the page for the data that you want. It's worth spending some time playing around with the different GET options for the Core cgi's to filter the data to show exactly what you want. Examples would be:
or
I attached the two files used for the recent alerts dashlet. I apologize that I didn't fully document all of the functions and such, but the names should at least give a decent idea as to what each one is doing.
Dashlet #2 is one of the next crucial steps that I think Fusion will need to go. But I haven't tackled that part yet because multiple users have requested that when they actually drill down and take action on the child servers, they want it to be their own account, not the global Fusion login. Both XI and Core have the ability to submit commands entirely with GET requests, so all of that could be done without ever having to access the child servers, it just needs a clever use of AJAX and curl (the load_url() function).
For a Fusion dashlet there's two ways you could go about developing it.
- Grab data on-the-fly and process it into the dashlet - (slow load time, but easier to write and minimal burden on the Nagios servers)
- Grab data, cache it locally, and then manipulate it however needed for the UI. - (Easier to sort and filter, additional steps to build)
I think the recent alerts dashlet would be the best starting point for what you want to do. Doing a Fusion dashlet for Core requires fetching the page contents and then parsing the page for the data that you want. It's worth spending some time playing around with the different GET options for the Core cgi's to filter the data to show exactly what you want. Examples would be:
Code: Select all
$url = get_nagioscore_backend_url($sid);
$url.='notifications.cgi?contact=all&noheader=true'; Code: Select all
$url = get_nagioscore_backend_url($sid);
$url.='history.cgi?host=all&noheader=true'; Dashlet #2 is one of the next crucial steps that I think Fusion will need to go. But I haven't tackled that part yet because multiple users have requested that when they actually drill down and take action on the child servers, they want it to be their own account, not the global Fusion login. Both XI and Core have the ability to submit commands entirely with GET requests, so all of that could be done without ever having to access the child servers, it just needs a clever use of AJAX and curl (the load_url() function).
You do not have the required permissions to view the files attached to this post.
Re: Nagios Fusion Dashlets
Thank you Mike! This is great. I am looking into the code and I will let you know/share if I do something worthwhile that would be good to share with everybody.
Also I might write a blog post on how to get started on creating dashlets and the process of modifying creating your own, if I feel I got a good understanding of them. I will update this thread later on with more info, because I think as soon as people have access to dashlet documentation the number of dashlets will increase by a lot!
Thanks again Mike.
Also I might write a blog post on how to get started on creating dashlets and the process of modifying creating your own, if I feel I got a good understanding of them. I will update this thread later on with more info, because I think as soon as people have access to dashlet documentation the number of dashlets will increase by a lot!
Thanks again Mike.
Re: Nagios Fusion Dashlets
Yeah that'd be awesome! If you do that go ahead and post it back here. We'll try and promote it to get you more views.