Cacti (home)ForumsDocumentation

tree item remove orphans

type:
userscript
userscript:
tree_item_remove_orphans
author:
wiki:user:gandalf
description:
remove orphaned tree header items
version:
1.0
pia:
none
date:
2012-02-10
scripts:
tree,
remove

Download

This script can be download here: tree_item_remove_orphans.php.gz

Purpose

In case you've accumulated lots of subtrees, some of them may have become orphaned by deleting hosts or graphs that have been listed as children. Thus, over time, some headers may have become orphaned (== don't have any children). This script will list those and optionally delete them.

Features

  • list orphaned headers of a given tree
  • delete orphaned headers of a given tree

Prerequisites

None

Installation

Drop and unzip, e.g. into cli directory

Usage

see:

php -q ./cli/tree_item_remove_orphans.php --help

Additional Help?

If you need additional help, please ask at Cacti Forum

Possible Bugs?

Sample Output

List orphaned headers:

> php -q tree_item_remove_orphans.php --tree-id=1
Orphaned header: Orphaned_Header1
Orphaned header: Orphaned_Header2

Delete orphaned headers:

> php -q tree_item_remove_orphans.php --tree-id=1 --remove
Orphaned header: Orphaned_Header1 deleted
Orphaned header: Orphaned_Header2 deleted





Personal Tools