Open-AudIT https://www.open-audit.org/phpBB3/ |
|
Insert/update multiple computers using XMLs https://www.open-audit.org/phpBB3/viewtopic.php?f=20&t=6505 |
Page 1 of 1 |
Author: | saep [ Thu Feb 04, 2016 6:24 am ] |
Post subject: | Insert/update multiple computers using XMLs |
Hi. I have an infrastructure with a lot of offline computers. So we need to insert/update devices using XMLs generated by scripts. On the web interface (version 1.8.2) I can see that it is possible to add a single computer using XML (audit result) or add a single device manually (form) or add multiple devices using XLS. My question is: Is there a way to add multiple computers using just multiple XMLs that I have? |
Author: | jpa [ Thu Feb 04, 2016 7:03 am ] |
Post subject: | Re: Insert/update multiple computers using XMLs |
I don't think there is anything for this right now. It should be fairly simple to write a script to cycle through a directory of XML files, post the data and remove or archive the files using the same mechanism that all the audit scripts use to post XML. |
Author: | FranzXaver [ Thu Feb 18, 2016 6:49 pm ] |
Post subject: | Re: Insert/update multiple computers using XMLs |
I wrote a bash script for this purpose a while ago, you can use it and change it as you please: [code]#!/bin/bash # Aim: submit manually created Open-Audit files to Auditserver # # usage example: find * -name '*.xml' -exec ls submit_host.sh {} \; AUDIT_URL=<URL to auditserver>/index.php/system/add_system EXPECTED_ARGS=1 WGET=`which wget` if [ $# -ne $EXPECTED_ARGS ] then echo "Usage: $0 hostname-<date>.xml" exit $E_BADARGS fi # append metadata #form_systemXML= sed -i '1s/^/form_systemXML=/' "$1" # fix special chars sed -i -e 's/+/%2B/g' "$1" sed -i -e 's/"/%22/g' "$1" sed -i -e 's/&/%26/g' "$1" $WGET --post-file=$1 $AUDIT_URL 2>/dev/null # switch back to std xml sed -i -e 's/form_systemXML=//g' "$1" sed -i -e 's/%2B/+/g' "$1" sed -i -e 's/%22/"/g' "$1" sed -i -e 's/%26/&/g' "$1" [/code] |
Page 1 of 1 | All times are UTC + 10 hours |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |