{"id":2161,"date":"2018-11-22T01:20:10","date_gmt":"2018-11-22T01:20:10","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=2161"},"modified":"2018-11-22T01:22:21","modified_gmt":"2018-11-22T01:22:21","slug":"librenms-bulk-delete","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/librenms-bulk-delete\/","title":{"rendered":"LibreNMS bulk delete"},"content":{"rendered":"<p>There is a php script in \/opt\/librenms\/ that lets you delete a host from the command line.<\/p>\n<pre>sudo \/opt\/librenms\/delhost.php 192.168.1.20<\/pre>\n<p>Replace 192.168.1.20 with the hostname\/ip address of the host you want to delete.<\/p>\n<p><strong>Delete Multiple Hosts<\/strong><\/p>\n<p>First you&#8217;ll need to get a list of devices you want to remove.\u00a0 You can do this by viewing the devices in the LibreNMS MySQL database;<\/p>\n<p>Example:<\/p>\n<pre>$ mysql -u librenms -p librenms\r\nMariaDB [librenms]&gt; select hostname from devices;\r\n+----------------------------------------+\r\n| hostname |\r\n+----------------------------------------+\r\n| 192.168.88.1 |\r\n| 192.168.1.20 |\r\n| 192.168.1.12 |\r\n| 192.168.88.5 |\r\n4 rows in set (0.00 sec)\r\nMariaDB [librenms]&gt; exit<\/pre>\n<p>Put all the IP addresses you want to remove into a file and run the following for loop.\u00a0 Replace &#8220;remove_ip.lst&#8221; with the name of your ip list file.<\/p>\n<pre>for i in `cat ~\/remove_ip.lst`; do sudo \/opt\/librenms\/delhost.php $i; done<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>There is a php script in \/opt\/librenms\/ that lets you delete a host from the command line. sudo \/opt\/librenms\/delhost.php 192.168.1.20 Replace 192.168.1.20 with the hostname\/ip address of the host you want to delete. Delete Multiple Hosts First you&#8217;ll need to &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/librenms-bulk-delete\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[352,3],"tags":[8,353,7,134,389,173,243],"class_list":["post-2161","post","type-post","status-publish","format-standard","hentry","category-librenms","category-linux","tag-command-line-2","tag-librenms","tag-linux-2","tag-monitoring","tag-nms","tag-script","tag-scripts"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=2161"}],"version-history":[{"count":2,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2161\/revisions"}],"predecessor-version":[{"id":2163,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2161\/revisions\/2163"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=2161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=2161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=2161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}