Menu

Remove duplicate network devices

2015-06-24
2015-07-02
  • Greg Sacrey

    Greg Sacrey - 2015-06-24

    Hi folks,

    I am hoping someone can help me. I am looking to search out and remove duplicates of network devices where the name is the same. I wish to keep the newest record. Can someone direct me to how this can be done cleanly? I wish to remove all references to the duplicates.

    Thanks

    Greg

     
  • Greg Sacrey

    Greg Sacrey - 2015-06-26

    Any advice folks? Sure hoping one of the gurus chimes in.

     
  • Greg Sacrey

    Greg Sacrey - 2015-06-29

    Any advice on removing duplicate CIs period? Has anyone had to do this in bulk?

     
  • lndevnull

    lndevnull - 2015-06-30

    There is probably a better way but usually I query the view's from within MySQL first to get the ID's of the duplicates. Once you have a list of ID's you can run an OQL query within iTop and use the mass-delete option. The following example is for Person CIs though can be applied to just about anything.

    1.Get the list of duplicated Object IDs.

    MYSQL>  SELECT count(*) as count, group_concat(id), email, employee_number, friendlyname FROM `view_Person` where status='active' group by friendlyname having count >1
    

    2.Cleanup the list removing the first "unique" entry. There is probably a complex SQL query which can do this for you. For the sake of time I bring this list into Excel and clean it up there.

    3.With iTop's query tool select all of the objects with their matching IDs

    OQL>  SELECT Person WHERE id IN (6153,6154,6257,6258,6259)
    

    4.From the resulting list select Delete under "Other Actions".

     

    Last edit: lndevnull 2015-06-30
  • Greg Sacrey

    Greg Sacrey - 2015-07-02

    Thanks for the reply, I have done something similar in the past and it has worked with mixed results.

    I have noticed that anything big brought into OQL seems to time it out. I am needing to scan through 60K records for duplicates...I will keep plugging away.

     

Log in to post a comment.