librenms-librenms/delhost.php

33 lines
698 B
PHP
Raw Normal View History

#!/usr/bin/env php
<?php
/**
* LibreNMS
*
* This file is part of LibreNMS.
*
* @package LibreNMS
* @subpackage cli
* @copyright (C) 2006 - 2012 Adam Armstrong
*/
chdir(__DIR__); // cwd to the directory containing this script
2015-07-13 20:10:26 +02:00
require 'includes/defaults.inc.php';
require 'config.php';
require 'includes/definitions.inc.php';
require 'includes/functions.php';
2015-07-13 20:10:26 +02:00
// 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)."\n";
} else {
2015-07-13 20:10:26 +02:00
echo "Host doesn't exist!\n";
}
} else {
2015-07-13 20:10:26 +02:00
echo "Host Removal Tool\nUsage: ./delhost.php <hostname>\n";
}