device export script

0

Hi

Today I have a Python script for exporting devices in to a csv-file with the following fields:

device_name,device_ips,device_groups,log_collection_policies,distributed_collector,confidentiality,integrity,availability,timezone

Does a script exist that also extract the additional fiels:

uses_proxy , proxy_ip , hostname

This will make moving devices from LogPoint 5 to LogPoint 6 considerably more easy.

Regards

Hans

Share This Post:

9 comments

Date Votes
0
Avatar
Joon Hansen

Hi Hans,

Could you post the script that you are using (remove thecredentials), maybe we can help you extend the script to export the additional fields?

Joon

0
Avatar
Hans-Henrik Mørkholt

Hi Joon

It is a scrip created by LogPoint, and requires cli access to the LogPoint server.

It is executed using:

/opt/immune/bin/envdo python "file_name"

Regards

Hans

0
Avatar
Markus Nebel

Hello @HansHenrikMoerkholt ,

I upgraded your script to be python3 compatible and added the proxy config to the CSV:

0
Avatar
Markus Nebel

Hello @HansHenrikMoerkholt , which logpoint version are you using?

I’ve tested it on 6.11.2.

0
Avatar
Markus Nebel

Hello @HansHenrikMoerkholt ,

okay, this version is old :)

Try to add this line in the import section at the top of the file:

from mongokit import ObjectId

0
Avatar
Reinhard Vielhaber

Hi,

this is older but I have a question regarding the following three lines/statements from the script:

device_groups = str(';'.join([db.dereference(device_group)["name"]
for device_group in device["device_groups"]])) log_collection_policies = str(';'.join([db.dereference(lcp)["name"]         for lcp in device["log_policies"]]))
distributed_collector =

str(';'.join([db.dereference(DBRef('distributedcollector',         ObjectId(dc), MONGODB_DATABASE))["name"]

for dc in device["distributed_collector"]]))

The first to “lines” just use “db.dereference()” for getting the related data, the third “line” uses a more complex way. Is this necessary or would it be sufficient to also just use “db.dereference()” (I have no dsitributed collector in my test environment, otherwise I would have tested it myself ;-) ).

Best regards, Reinhard

(unfortunately I couldn’t manage it to display just one indented code block here)

Please sign in to leave a comment.