Page 1 of 1

Create source via API

Posted: Mon Nov 23, 2020 11:17 am
by danielheaton
Hi all

Very new to Nagios NA so apologies if this is a dumb question, have looked around forums but drawn a blank so far, and this is a bit old and quite limited https://support.nagios.com/kb/article/n ... s-800.html.

We use Ansible to provision our hosts, and to register them in NagiosXI and create services, etc. via the API. Is it possible to do a similar thing with sources in Network Analyzer?

Eg. in my hosts file I would have

10.1.2.3 hostname=myServer nagios_na_server=nagiosNaForThisNetwork nagios_na_port=1234

This would then give me the info I need to install my netflow forwarder, point that to the chosen port and Network Analyzer node, and create a source with the name of the server and the defined port on the appropriate Network Analyzer node.

Is that doable?

If not, be good to hear of any timesaving ways to set up lots of hosts quickly!

Cheers

Daniel

Re: Create source via API

Posted: Mon Nov 23, 2020 5:48 pm
by cdienger
The ability to add sources via the API isn't available at the moment, but you could add a new source by adding it directly to the database.

For example:

Code: Select all

echo "insert into nagiosna_Sources(port, addresses, name, flowtype, directory, lifetime, disable_abnormal) values(9999,'5.6.7.8','test','netflow','/usr/local/nagiosna/var/test','48H',0);" | mysql -unagiosna -pnagiosna -Dnagiosna
echo "select * from nagiosna_Sources;" | mysql -unagiosna -pnagiosna -Dnagiosna 

Re: Create source via API

Posted: Thu Nov 26, 2020 2:07 am
by danielheaton
Thanks, that should be scriptable, cheers!

Re: Create source via API

Posted: Mon Nov 30, 2020 12:01 pm
by benjaminsmith
Hi,

Grea! Did you have other questions or shall we close out this topic?

Re: Create source via API

Posted: Mon Nov 30, 2020 12:01 pm
by cdienger
Cheers!