...
Consume the JSON files from the repository with the NOCLook consume scripts.
Collecting and processing network data
Juniper Configuration Producer
...
Code Block |
---|
"host" : { "." : { "os" : { "family" : "", "name" : "" } }, "addrs" : [ "127.0.0.1" ], "hostnames" : [ "host.example.org" ], "name" : "host.example.org", "services" : { "ipv4": { "127.0.0.1": { "tcp": { "1025": { "product": "Microsoft Windows RPC", "confidence": "10", "name": "msrpc", "proto": "unknown"}, "1029": { "product": "Microsoft Windows RPC over HTTP", "confidence": "10", "version": "1.0", "name": "ncacn_http", "proto": "unknown"}, } } } }, "version" : 1 } |
CSV Site Producer
...
/Consumer
https://github.com/fredrikt/nerds/blob/master/producers/csv_producer/csv_producer.py
The script produces JSON output in the NERDS format from the provided CSV file.
The csv file needs to start with the name of the node and then the node type.
After those two columns any other node property may follow.
Start your csv file with a line similar to the one below.
name;node_type;node_property1,node_property2;...;node_property15
Code Block | ||
---|---|---|
| ||
Add later
|
Code Block | ||
---|---|---|
| ||
{
"host": {
"csv_producer": {
"address": "",
"area": "",
"city": "",
"comment": "",
"country": "",
"floor": "",
"latitude": "",
"longitude": "",
"meta_type": "",
"name": "",
"node_type": "",
"owner_id": "",
"postcode": "",
"responsible_for": "",
"room": "",
"site_type": "",
"telenor_subscription_id": ""
},
"name": "",
"version": 1
}
}
|
The consumer script should only be run once as it does not update the sites, only creates new.
The JSON file directory is then inserted in to the database using noclook_site_csv_consumer.py. http://git.nordu.net/?p=norduni.git;a=blob;f=src/scripts/noclook_site_csv_consumer.py
Change the path at the top of the script to be able to import norduni_client.py.
Code Block |
---|
python noclook_site_csv_consumer.py -D /path/to/site_files/json |
Code Block |
JSON Structure
|
Setting up old NOCLook version
...