NetXMS Support Forum

English Support => General Support => Topic started by: jeanb.lott on January 15, 2013, 04:17:01 AM

Title: Exporting the list of nodes
Post by: jeanb.lott on January 15, 2013, 04:17:01 AM
Hi,

I would be interested in exporting the list of nodes of my system along with some of the parameters such as IP configuration (Address, Mask, Gateway) from the database into an excel file for example. It's in order to verify the list of nodes and put all this configuration in a document, is there any functionality to do this?

Thanks,
Title: Re: Exporting the list of nodes
Post by: Alex Kirhenshtein on January 15, 2013, 10:47:18 AM
Hello

You can use following SQL query: SELECT i.ip_addr,i.ip_netmask,op.name FROM interfaces AS i,object_properties AS op WHERE i.node_id=op.object_id AND i.ip_addr NOT IN ('0.0.0.0', '127.0.0.1') ORDER BY i.node_id,i.ip_addr

If you use PostgreSQL, you can do it by using \copy command in psql shell: \copy (SELECT i.ip_addr,i.ip_netmask,op.name FROM interfaces AS i,object_properties AS op WHERE i.node_id=op.object_id AND i.ip_addr NOT IN ('0.0.0.0', '127.0.0.1') ORDER BY i.node_id,i.ip_addr) TO '/tmp/nodes.csv' CSV HEADER
Title: Re: Exporting the list of nodes
Post by: jeanb.lott on February 08, 2013, 08:24:14 AM
That worked great, thanks,
Title: Re: Exporting the list of nodes
Post by: yshiro on February 12, 2013, 12:50:26 PM
It´s possible to make the same question, with scripting ?

I´m trying to make an script, for free ports on my switches.

SELECT op.name,COUNT(i.if_type) AS FreePorts
FROM interfaces i, object_properties op
WHERE i.if_type=6
AND i.node_id=op.object_id
AND i.oper_state='2'
GROUP BY op.name


Greetings
Title: Re: Exporting the list of nodes
Post by: Alex Kirhenshtein on February 12, 2013, 03:17:12 PM
Sure. I've put sample script here: http://wiki.netxms.org/wiki/Using_nxshell_to_automate_bulk_operations#List_free.28administratively_down.29_ethernet_ports_on_switches

Quote from: yshiro on February 12, 2013, 12:50:26 PM
It´s possible to make the same question, with scripting ?

I´m trying to make an script, for free ports on my switches.
Title: Re: Exporting the list of nodes
Post by: yshiro on February 12, 2013, 06:27:08 PM
Thanks Alex!
Now i´ll try to implement your script.
Greetings