Page 1 of 1

admin/component configuration via script/API?

Posted: Mon Nov 03, 2014 3:22 pm
by psanchez
Hello,

I would like to know if its possible, and if so how, to configure each of the below items via script/command line/API:
  • Scheduled Backups (FTP/SSH/LOCAL) - /nagiosxi/includes/components/scheduledbackups/managebackups.php
  • Manage Users - /nagiosxi/admin/users.php
  • Manage Components / Active Directory Integration - /nagiosxi/admin/components.php?config=active_directory
Basically, we want to make sure all our nagios instances are using AD authentication and that all members of a few allow groups exists so that they can access the Web GUI (not as contacts).
And if any user is missing, we should be able to quickly added them via script, (same goes for when a user is remove from the group we would like to be able to remove user) so that all our instances match....kind of an AD user import.

Also we are planing on having backup servers ready in case the prod one fails...so we are backing and restoring configuration...but would like to be able to reconfigure the 'Schedule Backup' once it has been restore, so that it doesn't backup to same location as prod instance.

Thanks in Advance!

Re: admin/component configuration via script/API?

Posted: Mon Nov 03, 2014 3:51 pm
by abrist
All three of your requests will require postgres db queries/inserts.


1. Backups: This is a protected component, so altering the script to accept cli params is out of the question for now. You could change the postgres entry for the setting though. You will find the row in the postresql database nagiosxi - table xi_options. You are looking for the name column that matches "scheduled_ssh_backups".

2. Users: This one is very problematic. If you just want the barebones, you could write a query to insert into the postgresql nagiosxi database table "xi_users". This table includes the base user settings and the password hash. The problem arises when you try to pull in all the other user options from the table "xi_usermeta" which contains all the other user settings.

3. AD integration: The same as backups. You will need to run a query to change the entry in xi_options. The row can be found by the 'name' field - the string in question to match is:
active_directory_component_options

Re: admin/component configuration via script/API?

Posted: Mon Nov 03, 2014 4:09 pm
by psanchez
Thanks, was hoping there was a better way....I'll play around with postgres db.

Re: admin/component configuration via script/API?

Posted: Mon Nov 03, 2014 4:15 pm
by abrist
No problem. Let me know if you need more information.