routerconfigs automatic backup not running?

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

grady
Cacti User
Posts: 60
Joined: Wed Feb 20, 2008 5:02 pm

routerconfigs automatic backup not running?

Post by grady »

Hi, I'm running cacti ver 0.8.7e, routerconfigs ver 0.1. The plugin works like a champ when run by hand. It doesn't seem to be working automatically though. I've double checked that all of the devices set to be backed have are set to daily. Beyond that I'm not really sure where to start troubleshooting this. I've seen a couple of threads about it with no posted solution.

Has anyone run into this / have a solution? Thx


EDIT:

Now I'm no big city admin but I think that the following logic is flawed:
(from routerconfigs/functions.php)

Code: Select all

        $t = time();

        // Get device that have not backed up in 24 hours + 30 minutes and that haven't been tried in the last 30 minutes
        $devices = db_fetch_assoc("SELECT * FROM plugin_routerconfigs_devices WHERE enabled = 'on' AND ($t - (schedule * 86400)) - 3600 > lastbackup AND $t - lastattempt > 1800", false);
I just added a new device. time() would have returned an epoch value of 1268851113, thus the above db_fetch_assoc(sql, false) would be evaluated as:

1268851113 - 86400 - 3600 = 12688421113 > 0 and 1268851113 - 0 > 1800,false based on the data I pulled from said table for the new device:

Code: Select all

+----+---------+-----------+-----------+-----------+---------+------------+----------+----------+-----------+------------+-------------+------------+-------+
| id | enabled | ipaddress | hostname  | directory | account | lastchange | username | schedule | lasterror | lastbackup | lastattempt | devicetype | debug |
+----+---------+-----------+-----------+-----------+---------+------------+----------+----------+-----------+------------+-------------+------------+-------+
|  7 | on      | 1.1.1.1 | name |           |       1 |          0 |          |        1 |           |          0 |           0 |          0 |       | 
+----+---------+-----------+-----------+-----------+---------+------------+----------+----------+-----------+------------+-------------+------------+-------+
So, let's run that query direct: (snippets)

Code: Select all

mysql> select * from plugin_routerconfigs_devices where enabled ='on' and 12688421113 > 0 and 1268851113 - 0 > 1800;

|  4 | on      | 1.1.1.2 | name |           |       1 | 1262725443 | admin      |        1 |   

|  3 | on      | 1.1.1.3 | name |           |       1 | 1175569443 | -- Reboot -- |        1 |           | 1268766604 |  1268766598 | 

|  5 | on      | 1.1.1.4 | name |           |       1 | 1262016959 | -- Reboot -- |        1 |           | 1268850360 |  1268850353 |  

|  7 | on      | 1.1.1.1  | name |           |       1 |          0 |              |        1 |           |          0 |           0 |  
The last row returned is the device I just added, id = 7. Thus it won't be backed up. Seems a bit off, no? So it seems like maybe auto backup will work, eventually. Provided that you manually backup the device on each add.

?
joltman
Posts: 16
Joined: Fri May 15, 2009 10:10 am
Location: Bloomington, IL
Contact:

AutoBackup?

Post by joltman »

Did you ever manage to get RouterConfigs to auto-backup your devices? I'm setting up a new install and I can't get this to work. I have initiated a manual backup, so I know it's working. Thanks!

Jim
MrRat
Cacti User
Posts: 135
Joined: Thu Jan 07, 2010 10:33 am

Re: routerconfigs automatic backup not running?

Post by MrRat »

I have the same problem. Routerconfigs will backup configs fine when run manually but not run automatically as scheduled.
joltman
Posts: 16
Joined: Fri May 15, 2009 10:10 am
Location: Bloomington, IL
Contact:

Re: routerconfigs automatic backup not running?

Post by joltman »

Unfortunately, I haven't had time to find a solution for this.
litass
Posts: 25
Joined: Tue Oct 09, 2007 7:46 am

Re: routerconfigs automatic backup not running?

Post by litass »

Can we add cron schedule to download the configs?
MrRat
Cacti User
Posts: 135
Joined: Thu Jan 07, 2010 10:33 am

Re: routerconfigs automatic backup not running?

Post by MrRat »

You can but that is not the way it's supposed to work
ursal
Posts: 6
Joined: Thu Aug 20, 2009 6:52 am

Re: routerconfigs automatic backup not running?

Post by ursal »

When plugin is used by poller - it prevents parallel executing of instances by setting value in "settings" table in mysql. For some reason it is enabled by default after install, so plugin is never used by poller. To activate nightly backups you should just tell to poller that plugin is ready by setting this field to zero:

Code: Select all

mysql> update settings set value="0" where name="plugin_routerconfigs_running";
isaac737
Posts: 23
Joined: Wed Oct 25, 2006 12:37 pm

Re: routerconfigs automatic backup not running?

Post by isaac737 »

Hi,

I know this is slightly off topic but i am trying to get the latest version of routerconfigs running with Cacti 0.8.7g that has been officially patched along with the PIA 2.9

The first plugin I installed (IP Subnet Calculator) works and routerconfigs plugin shows up and has been activated but when I try and add a device or an authentication account it never shows up in my GUI.

Has anyone else experienced this? Where can I look to see what the problem might be? IT would be sweet to get this running... save us lots of worry and time!

Cheers
jg
isaac737
Posts: 23
Joined: Wed Oct 25, 2006 12:37 pm

Re: routerconfigs automatic backup not running?

Post by isaac737 »

Hello again....

It seems as though I don't have this table:

mysql> select * from plugin_routerconfigs_devices;
ERROR 1146 (42S02): Table 'cactidb.plugin_routerconfigs_devices' doesn't exist
mysql>

I copied the routerconfig dir into my plugin dir, enabled and installed the plugin so not sure why it didn't create this table.

thx
jg
hid3
Cacti User
Posts: 63
Joined: Sat Jun 14, 2008 1:59 am

Re: routerconfigs automatic backup not running?

Post by hid3 »

Was the SQL logic ever corrected?

Any updates on this issue?
hid3
Cacti User
Posts: 63
Joined: Sat Jun 14, 2008 1:59 am

Re: routerconfigs automatic backup not running?

Post by hid3 »

Currently I'm working on the RouterConfigs plugin hard since it seems to be dropped and unmaintained. ( I would love to pick up the maintenance off the main developer and continue deleoping it mysqlf, though! )

I have made the following changes:

-Added support to have unlimited count of days for config retention instead of the old 1 year limit;
-Fixed wrong duration in seconds display in cacti log file after RouterConfigs (= RC) nightly run;
-Fixed 'plugin still running' issue in database after RC run when no devices were due to backup;
-Added logging support for the above;
-Fixed and improved flawed SQL logic for device scheduled backups at midnight;
-Fixed 'Monthly' routine to be actually a monthly routine and not a 'week and a bit';
-Fixed the Warning: cannot modify headers annoying bug after manual backup from cacti;
-RC now backups only those devices whose config has actually changed since last backup;
-Changed retention behaviour: you won't end up with no configs for a device if no backups were made during a period. At least one backup will still stay if no newer are present;
-Retention deletes config files from directories as well as MySQL;
-Added automatic file creation before downloading a config to be compatible with paranoid TFTP server daemons;
-Fixed SSH error displaying when doing backups from cacti and device has only telnet;
-Now when deleting a device, config files from directory are deleted also;
- ... More to come ...
Last edited by hid3 on Thu Sep 22, 2011 2:36 am, edited 2 times in total.
druwade
Posts: 5
Joined: Tue Sep 06, 2011 3:11 am

Re: routerconfigs automatic backup not running?

Post by druwade »

Looking forward to your update, i try install and get the following...

Not even close to knowing anything about mysql so hoping your updates assist...

09/29/2011 07:27:10 AM - CMDPHP: Poller[0] ERROR: SQL Cell Failed!, Error:'1146', SQL:"SELECT COUNT(*) FROM plugin_routerconfigs_devices"
09/29/2011 07:27:10 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1146', SQL:"SELECT * FROM plugin_routerconfigs_devices ORDER BY hostname limit 0, 30"
09/29/2011 07:27:10 AM - CMDPHP: Poller[0] ERROR: SQL Save Command Failed for Table 'plugin_routerconfigs_devices'. Error was 'Table 'cacti.plugin_routerconfigs_devices' doesn't exist'
09/29/2011 07:27:05 AM - CMDPHP: Poller[0] ERROR: SQL Cell Failed!, Error:'1146', SQL:"SELECT COUNT(*) FROM plugin_routerconfigs_devices"
09/29/2011 07:27:05 AM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed!, Error:'1146', SQL:"SELECT * FROM plugin_routerconfigs_devices ORDER BY hostname limit 0, 30"
hid3
Cacti User
Posts: 63
Joined: Sat Jun 14, 2008 1:59 am

Re: routerconfigs automatic backup not running?

Post by hid3 »

Have you imported the .sql file which is found inside the plugin directory?
druwade
Posts: 5
Joined: Tue Sep 06, 2011 3:11 am

Re: routerconfigs automatic backup not running?

Post by druwade »

i thought it would of been part of the install process. Will give it a shot, and let you know...
kmtasc
Posts: 3
Joined: Tue Sep 25, 2012 10:11 pm

Re: routerconfigs automatic backup not running?

Post by kmtasc »

Based on grady's analysis, I think the problem maybe in /var/www/html/plugins/routerconfigs/router-download.php

Information of my cacti system:
Cacti Version 0.8.8a
Routerconfigs 0.3

I modified router-download.php

Code: Select all

root@localhost routerconfigs]# diff -u router-download.php router-download.php.old 
--- router-download.php 2012-09-25 14:45:45.000000000 +0800
+++ router-download.php.old     2012-09-24 15:06:59.000000000 +0800
@@ -45,7 +45,7 @@
 db_execute("REPLACE INTO settings (name, value) VALUES ('plugin_routerconfigs_running', 1)");
 
 $t = $stime = time();
-$devices = db_fetch_assoc("SELECT * FROM plugin_routerconfigs_devices WHERE enabled = 'on' AND ($t - (schedule * 86400)) + 3600 > lastbackup");
+$devices = db_fetch_assoc("SELECT * FROM plugin_routerconfigs_devices WHERE enabled = 'on' AND ($t - (schedule * 86400)) - 3600 > lastbackup");
 $failed = array();
 if (!empty($devices)) {
        foreach ($devices as $device) {
@@ -62,7 +62,6 @@
                sleep(10);
        }
 } else {
-        db_execute("REPLACE INTO settings (name, value) VALUES ('plugin_routerconfigs_running', 0)");
        return;
 }
 $success = count($devices) - count($failed);
[root@localhost routerconfigs]# 

Code: Select all

mysql> update settings set value=0 where name='plugin_routerconfigs_running';
It works well in my test system.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests