Autodelete generic device (if empty)


#1

Hi,
How can I automaticly delete generic device type if it’s empty : (No results found!)


Thank you in advance


#2

That usually happens when a device is being discovered and will disappear after it’s done.


#3

it’s not done for me apparently. Generic stay active without device


#4

check if this purges it

$config['device_perf_purge']                              = 7;

the number is the total days if no activity it deletes the device


#5

ok thank you
I need to wait 7 days ?


#6

you can bring it down to 1 day but I think you will risk purging all devices that is inactive for one day


#7

inactive, what do you mean ? down/up ?


#8

so if the device has not been updated for 7 days it gets purged. (its like opening a word document changing something and then saving it it then shows date modified) soo if it the device has not been modified for 7 days it auto deletes


#9

ah… I can’t do that, because sometime we need to replace a device and there is a delay


#10

auto run the Discovery and check if it resolves the issue

/opt/librenms/discovery-wrapper.py
/opt/librenms/discovery.php
/opt/librenms/poller-wrapper.py


#11

generic stay active without device after that.


#12

so inside here

vi /opt/librenms/includes/definitions.inc.php

is the Device Types
image
I deleted a group name but no success

is your cron job running correctly


#13

there is no generic

// Device Types
$i = 0;
$config[‘device_types’][$i][‘text’] = ‘Servers’;
$config[‘device_types’][$i][‘type’] = ‘server’;
$config[‘device_types’][$i][‘icon’] = ‘server.png’;

$i++;
$config[‘device_types’][$i][‘text’] = ‘Network’;
$config[‘device_types’][$i][‘type’] = ‘network’;
$config[‘device_types’][$i][‘icon’] = ‘network.png’;

$i++;
$config[‘device_types’][$i][‘text’] = ‘Wireless’;
$config[‘device_types’][$i][‘type’] = ‘wireless’;
$config[‘device_types’][$i][‘icon’] = ‘wireless.png’;

$i++;
$config[‘device_types’][$i][‘text’] = ‘Firewalls’;
$config[‘device_types’][$i][‘type’] = ‘firewall’;
$config[‘device_types’][$i][‘icon’] = ‘firewall.png’;

$i++;
$config[‘device_types’][$i][‘text’] = ‘Power’;
$config[‘device_types’][$i][‘type’] = ‘power’;
$config[‘device_types’][$i][‘icon’] = ‘power.png’;

$i++;
$config[‘device_types’][$i][‘text’] = ‘Environment’;
$config[‘device_types’][$i][‘type’] = ‘environment’;
$config[‘device_types’][$i][‘icon’] = ‘environment.png’;

$i++;
$config[‘device_types’][$i][‘text’] = ‘Load Balancers’;
$config[‘device_types’][$i][‘type’] = ‘loadbalancer’;
$config[‘device_types’][$i][‘icon’] = ‘loadbalancer.png’;

$i++;
$config[‘device_types’][$i][‘text’] = ‘Storage’;
$config[‘device_types’][$i][‘type’] = ‘storage’;
$config[‘device_types’][$i][‘icon’] = ‘storage.png’;

$i++;
$config[‘device_types’][$i][‘text’] = ‘Printers’;
$config[‘device_types’][$i][‘type’] = ‘printer’;
$config[‘device_types’][$i][‘icon’] = ‘printer.png’;

$i++;
$config[‘device_types’][$i][‘text’] = ‘Appliance’;
$config[‘device_types’][$i][‘type’] = ‘appliance’;
$config[‘device_types’][$i][‘icon’] = ‘appliance.png’;

$i++;
$config[‘device_types’][$i][‘text’] = ‘Collaboration’;
$config[‘device_types’][$i][‘type’] = ‘collaboration’;
$config[‘device_types’][$i][‘icon’] = ‘collaboration.png’;

$i++;
$config[‘device_types’][$i][‘text’] = ‘Workstation’;
$config[‘device_types’][$i][‘type’] = ‘workstation’;
$config[‘device_types’][$i][‘icon’] = ‘workstation.png’;


#14

is your cron job running correctly


#15

====================================

Component Version
LibreNMS 1.50-9-gc4fa3278b
DB Schema 2019_02_10_220000_add_dates_to_fdb (132)
PHP 7.2.15-0ubuntu0.18.04.2
MySQL 10.1.38-MariaDB-0ubuntu0.18.04.1
RRDTool 1.7.0
SNMP NET-SNMP 5.7.3

====================================

[OK] Composer Version: 1.8.4
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[WARN] Your install is over 24 hours out of date, last update: Tue, 02 Apr 2019 03:19:31 +0000
[FIX]:
Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.


#16

Run These commands and give the results

cd /opt/librenms/

./daily.sh


#17

I can’t give the result because I forgot to take a photo (it’s a remote server) if it’s connected to internet I’m losing access (usually it is local) and it need internet for cron job

anyway I did > ./daily.sh
and generic has disappeared, thank you


#18

cool bro check that your daily Cron jobs are correctly configured.

cp librenms.nonroot.cron /etc/cron.d/librenms

#19
Summary

Using this cron file requires an additional user on your system, please see install docs.

33 */6 * * * librenms /opt/librenms/cronic /opt/librenms/discovery-wrapper.py 1
*/5 * * * * librenms /opt/librenms/discovery.php -h new >> /dev/null 2>&1
*/5 * * * * librenms /opt/librenms/cronic /opt/librenms/poller-wrapper.py 16
* * * * librenms /opt/librenms/alerts.php >> /dev/null 2>&1
*/5 * * * * librenms /opt/librenms/poll-billing.php >> /dev/null 2>&1
01 * * * * librenms /opt/librenms/billing-calculate.php >> /dev/null 2>&1
*/5 * * * * librenms /opt/librenms/check-services.php >> /dev/null 2>&1

Summary

Daily maintenance script. DO NOT DISABLE!

If you want to modify updates:

Switch to monthly stable release: https://docs.librenms.org/General/Releases/

Disable updates: https://docs.librenms.org/General/Updating/

15 0 * * * librenms /opt/librenms/daily.sh >> /dev/null 2>&1