Files
librenms-librenms/delhost.php

42 lines
799 B
PHP
Raw Normal View History

#!/usr/bin/env php
<?php
/**
2013-10-28 01:46:59 -07:00
* LibreNMS
*
2013-10-28 01:46:59 -07:00
* This file is part of LibreNMS
*
2013-10-28 01:46:59 -07:00
* @package librenms
* @subpackage cli
2013-10-28 01:46:59 -07:00
* @author LibreNMS Group <librenms-project@google.groups.com>
* @copyright (C) 2006 - 2012 Adam Armstrong (as Observium)
* @copyright (C) 2013 LibreNMS Group
*
*/
chdir(dirname($argv[0]));
include("includes/defaults.inc.php");
include("config.php");
include("includes/definitions.inc.php");
include("includes/functions.php");
# Remove a host and all related data from the system
if ($argv[1])
{
$host = strtolower($argv[1]);
$id = getidbyname($host);
if ($id)
{
echo(delete_device($id));
echo("Removed $host\n");
} else {
echo("Host doesn't exist!\n");
}
} else {
echo("Host Removal Tool\nUsage: ./delhost.php <hostname>\n");
}
?>