Page 1 of 1

Custom dashlet command line import?

Posted: Tue Apr 30, 2019 7:40 am
by brandondash
My google-fu is weak and I can't find documentation on this.

How do I upload/import custom dashlets into my Nagios via a command line tool? The documentation on the RESTApi documentation only discusses commands, hosts, and services. The documentation on dashlets only discusses the web interface.

We want user interaction completely out of the equation (Puppet/Ansible/Chef type solution) but I'm stuck on the final step here. Help!

Re: Custom dashlet command line import?

Posted: Tue Apr 30, 2019 1:31 pm
by mcapra
A related thread:
https://support.nagios.com/forum/viewto ... 16&t=53120

Here's how Nagios XI is handling dashlet installation as of 5.5.9 (a bit old), from subcomponents/xidashlets/install:

Code: Select all

#!/bin/bash -e

. ../../xi-sys.cfg

echo "INSTALL: Installing/updating XI dashlets..."

echo "Backing up existing dashlets to /tmp/xidashlets_backup..."

/bin/cp -f ../../nagiosxi/basedir/tools/install_dashlet.php "$proddir/tools/"

/bin/mkdir -p /tmp/xidashlets_backup
cp -rf "$proddir"/html/includes/dashlets/* /tmp/xidashlets_backup

# Install/update each dashlet
for f in `ls -1 dashlets/*.zip`; do
	echo "Installing '$f'"
	
	"$proddir/tools/install_dashlet.php" --file=$f --refresh=0

done

# Things are okay
echo "INSTALL: Dashlets installed/updated OK."

Which reveals a install_dashlet.php script located at nagiosxi/basedir/tools. That's probably a good place to dig around.

Another +1 for official Puppet/Salt/Ansible/Chef/whatever integration :)

Re: Custom dashlet command line import?

Posted: Tue Apr 30, 2019 1:38 pm
by scottwilkerson
brandondash wrote:My google-fu is weak and I can't find documentation on this.

How do I upload/import custom dashlets into my Nagios via a command line tool? The documentation on the RESTApi documentation only discusses commands, hosts, and services. The documentation on dashlets only discusses the web interface.

We want user interaction completely out of the equation (Puppet/Ansible/Chef type solution) but I'm stuck on the final step here. Help!
Are you referring adding dashlets to dashboards, or are you referring to installing custom dashlets into the system?

If the later, then mcapra's suggestion would be a possibility, but if the former, there is no way to do this through the API, but you can deploy dashboards to users from an Admin account.