Exporting the list of nodes

Started by jeanb.lott, January 15, 2013, 04:17:01 AM

Previous topic - Next topic

jeanb.lott

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,

Alex Kirhenshtein

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

jeanb.lott


yshiro

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

Alex Kirhenshtein


yshiro

Thanks Alex!
Now i´ll try to implement your script.
Greetings