How to remove old poller entries in database

root@librenms:/opt/librenms# ./validate.php

Component Version
LibreNMS 1.33.01
DB Schema 214
PHP 7.1.11-1+ubuntu16.04.1+deb.sury.org+1
MySQL 10.0.31-MariaDB
RRDTool 1.5.5
SNMP NET-SNMP 5.7.3

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

[OK] Database connection successful
[OK] Database schema correct
[FAIL] The poller (15fc2105df16) has not completed within the last 5 minutes, check the cron job
[FAIL] The poller (a4b5b6ea4393) has not completed within the last 5 minutes, check the cron job
[FAIL] The poller (af62ddd9c123) has not completed within the last 5 minutes, check the cron job
[WARN] Your install is over 24 hours out of date, last update: Wed, 01 Nov 2017 17:55:06 +0000
[FIX] Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.
[WARN] Your local git branch is not master, this will prevent automatic updates.
[FIX] You can switch back to master with git checkout master
[WARN] Your local git contains modified files, this could prevent automatic updates.
[FIX] You can fix this with ./scripts/github-remove
Modified Files:
logs/.gitignore
rrd/.gitignore

Hi there,

I am running LibreNMS within a docker container. It is running right now but I get some fails on old hostnames when I run validate.php. I run the docker container right now with the option “docker run -h hostname …” to have a persisten hostname.

When I do a SELECT * from pollers I get the results below. ‘librenms’ is my actual hostname.

id poller_name last_polled devices time_taken
8 15fc2105df16 2017-11-05 13:31:16 10 74
9 a4b5b6ea4393 2017-11-05 14:21:16 10 74
10 af62ddd9c123 2017-11-06 20:56:15 10 74
11 librenms 2017-11-07 14:36:15 10 74

Can I just delete the old hostnames from the table poller with “DELETE from pollers WHERE poller_name=15fc2105df16” or will I mess up dependencies in the database?

Erik

You can run the delete query like you’ve said, easier to do DELETE FROM pollers WHERE poller_name != 'librenms'; though.

@laf Thanks for your answer and suggestion.

Can anyone post the full commands for this? It seems really easy to do, I just don’t know the syntax for selecting my DB and following through with deleting the pollers.

We have a pull request in the queue that will allow you to do it in the webui - give it a try and comment on github if it works for you: https://github.com/librenms/librenms/pull/7721

What I did was executing the command DELETE FROM pollers WHERE poller_name != ‘librenms’; on the LibreNMS database by opening it with PHPMyAdmin, clicking on the database and then paste the command into the SQL tab. When doing it this way you have to know yourself which poller entries are obsolete.

Thank you, will try this. I run my LibreNMS in a Docker container on a Synology RS815+ NAS. I suppose the git pull will be done in the same way as in a ‘normal’ installation.

You use the github-apply script we have, it’s in the PR on how to test, just make sure you pass 7721 as the PR number.

It worked perfectly, what about the warning I get now? The fix doesn’t work unless I’m supposed to put in some arguments after.

Warning: Your local git contains modified files, this could prevent automatic updates.
You can fix this with ./scripts/github-remove

Modified Files
html/pages/pollers/pollers.inc.php

Do I have to issue this command as root or as librenms? For example, when i issue the command sudo docker exec -it librenms bash I am logged in as root. When I want to run the daily.sh script by hand I issue the following commands:

su - librenms
source /etc/librenms_environment
cd /opt/librenms
./daily.sh

Otherwise the environment variables (DB_HOST, DB_USER, …) issued with the docker run command are not set and the script can not access my database.

I just did a discard after the github-remove, looks like that worked.

su - librenms
source /etc/librenms_environment
cd /opt/librenms
./scripts/github-apply 7721

@laf The patch applied successfully:

Checking patch html/includes/forms/delete-poller.inc.php...
Checking patch html/includes/modal/delete_poller.inc.php...
Checking patch html/pages/pollers/pollers.inc.php...
Applied patch html/includes/forms/delete-poller.inc.php cleanly.
Applied patch html/includes/modal/delete_poller.inc.php cleanly.
Applied patch html/pages/pollers/pollers.inc.php cleanly.

But where do I find the option in the GUI. Looked under settings --> pollers but can’t find the option.

you won’t see it until this PR gets pushed to the master.

Forgive me a potential stupid question, i’m fairly new at working with github. When you talk about master is this the master on github or the local master? How long will this take in general?

You should see the option available to you now.

Maybe force refresh the page.

@Kevin_Krumm Used the github-apply script here so no need to wait for merge into master :slight_smile:

1 Like

I did both. I installed the patch with the github-apply script, I refreshed the browser and I even have restarted my docker container in which my LibreNMS runs. However when I run the validate I get some messages about github:

$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS  | 1.33.01
DB Schema | 214
PHP       | 7.1.11-1+ubuntu16.04.1+deb.sury.org+1
MySQL     | 10.0.31-MariaDB
RRDTool   | 1.5.5
SNMP      | NET-SNMP 5.7.3
====================================

[OK]    Database connection successful
[OK]    Database schema correct
[WARN]  Your install is over 24 hours out of date, last update: Wed, 01 Nov 2017 17:55:06 +0000
	[FIX] Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.
[WARN]  Your local git branch is not master, this will prevent automatic updates.
	[FIX] You can switch back to master with git checkout master
[WARN]  Your local git contains modified files, this could prevent automatic updates.
	[FIX] You can fix this with ./scripts/github-remove
	Modified Files:
	 html/pages/pollers/pollers.inc.php
	 logs/.gitignore
	 rrd/.gitignore
$

It can be possible that this is not supported / working in this docker image.