Mass delete device objects?

Dan Morphis dan at milkcarton.com
Mon Nov 7 23:55:53 EST 2016


Check in is controlled by the InformInterval on the cpe.

-dan

> On Nov 7, 2016, at 3:35 PM, Kris Germann <kgermann at portal.net.co> wrote:
> 
> Thank you very much!
> 
> Is there a process that happens once a device is deleted from GenieACS - ie. is there a delay period in which a connection is re-established between the CPE and the server or is it simply when the connection is repolled again.
> 
> Though there are 3000+ test devices on here I wish to clear, I have a few ‘production’ ones.
> 
> Kris
> 
>> On Nov 7, 2016, at 6:47 PM, Dan Morphis <dan at milkcarton.com> wrote:
>> 
>> With a little bit of scripting, this would be trivial to do. You could use perl, php, python, or bash with awk, or even jq.
>> 
>> Here is something I whipped together that can easily be modified to delete all tasks/devices/presets/files. It requires jq. If you want to change the script to perform the work instead of echoing the command to the console, delete the echo on line 28
>> 
>> #!/usr/bin/env bash
>> 
>> SERVER=192.168.7.80
>> COLLECTION=devices
>> DATA=`curl http://${SERVER}:7557/${COLLECTION}?projection=_id | jq -r '.[]._id'`
>> 
>> urlencode() {
>>     # urlencode <string>
>>     old_lc_collate=$LC_COLLATE
>>     LC_COLLATE=C
>> 
>>     local length="${#1}"
>>     for (( i = 0; i < length; i++ )); do
>>         local c="${1:i:1}"
>>         case $c in
>>             [a-zA-Z0-9.~_-]) printf "$c" ;;
>>             *) printf '%%%02X' "'$c" ;;
>>         esac
>>     done
>> 
>>     LC_COLLATE=$old_lc_collate
>> }
>> 
>> #echo $DATA
>> 
>> for id in $DATA; do
>>     i=$( urlencode $id )
>>     echo curl "http://${SERVER}:7557/${COLLECTION}/${i}" -X DELETE
>> done
>> 
>> 
>>> On Sat, Nov 5, 2016 at 12:37 PM, Kris Germann <kgermann at portal.net.co> wrote:
>>> Thank you,
>>> 
>>> To be clear, this means I need to run:
>>> 
>>> root at config:/opt/genieacs# curl -i 'http://localhost:7557/devices/XXXX' -X DELETE
>>> 
>>> Where XXXX is the unique device_id for each of the devices in my ACS - is there any way I can make this a little easier, I have a few instances with 80 - 5000 devices in each.
>>> 
>>> Kris
>>> 
>>>> On Nov 1, 2016, at 3:49 PM, Oliver Kraitschy <okraits at arcor.de> wrote:
>>>> 
>>>> Hello Kris,
>>>> 
>>>> you have to iterate over all devices and send a delete request for each one
>>>> of them.
>>>> 
>>>> You can use the API for that:
>>>> 
>>>> https://github.com/zaidka/genieacs/wiki/API-Reference
>>>> 
>>>> Or you can do it more easily with the python API:
>>>> 
>>>> https://github.com/TDT-GmbH/python-genieacs
>>>> 
>>>> Greetings,
>>>> Oliver
>>>> 
>>>>> On Tue, Nov 01, 2016 at 12:24:41PM -0400, Kris Germann wrote:
>>>>> I find myself in the unique position of having tested too many devices, so I
>>>>> have about 110 devices I need to delete...
>>>>> 
>>>>> Is there a 'destroy all' function I could incorporate?
>>>>> 
>>>> 
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.genieacs.com
>>>>> http://lists.genieacs.com/mailman/listinfo/users
>>>> 
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.genieacs.com
>>>> http://lists.genieacs.com/mailman/listinfo/users
>>> 
>>> 
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.genieacs.com
>>> http://lists.genieacs.com/mailman/listinfo/users
>>> 
>> 
>> _______________________________________________
>> Users mailing list
>> Users at lists.genieacs.com
>> http://lists.genieacs.com/mailman/listinfo/users
> 
> _______________________________________________
> Users mailing list
> Users at lists.genieacs.com
> http://lists.genieacs.com/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genieacs.com/pipermail/users/attachments/20161107/62aeba6d/attachment-0001.html>


More information about the Users mailing list