Router Config - Devices not Showing

Addons for Cacti and discussion about those addons

Moderators: Moderators, Developers

Post Reply
Author
Message
micmel5997
Posts: 3
Joined: Fri May 03, 2019 10:39 am

Router Config - Devices not Showing

#1 Post by micmel5997 » Fri May 03, 2019 10:46 am

Hello All!

I am new to Cacti and it's plugins. I have been working on installing Cacti on CentOS7.6 and have got a working version of Cacti on 1.2.2. I am now trying to get Router Configs working and automatic backups of our devices. I have installed Router Configs plugin version 1.5.0.

I have TFTP configured and working where I can manually TFTP a configuration from the Switch to the Cacti host and it saves the backups in the folder that Cacti is configured to look at for Router Configs.

My problem is when getting the devices to show in the Router Config Utility itself at this point. I have tried adding devices into Router Configs. When i Go to Utilities -> Router Configs and devices I do not see any devices. I have added 6 devices manually, and i see at the top where it says "All 6 Devices", however no devices are actually shown so I can't select one to do a "Backup" or any action against. Has anyone seen this before or have any ideas on how to troubleshoot this?

I noticed the error messages below:

2019/05/03 12:17:13 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/routerconfigs/router-devices.php[66]:show_devices(), /plugins/routerconfigs/router-devices.php[728]:CactiErrorHandler())

2019/05/03 12:17:13 - ERROR PHP WARNING in Plugin 'routerconfigs': Invalid argument supplied for foreach() in file: /usr/share/cacti/plugins/routerconfigs/router-devices.php on line: 728

Below is the foreach statement that it is referencing in the error message:

foreach ($result as $row) {
form_alternate_row('line' . $row['id'], false);

$total = db_fetch_cell_prepared('SELECT count(device)
FROM plugin_routerconfigs_backups
WHERE device = ?',
array($row['id']));

$state = $date_array[''];
if ($row['lastbackup'] > 0) {
$do_backup = new DateTime();
$do_backup->setTimestamp($row['lastbackup']);
$date_backup = $do_backup->format('Y-m-d H:i:s');

foreach ($date_array as $date_value=>$date_state) {
if ($date_backup >= $date_value) {
$state = $date_state;
break;
}
}
}

micmel5997
Posts: 3
Joined: Fri May 03, 2019 10:39 am

Re: Router Config - Devices not Showing

#2 Post by micmel5997 » Fri May 03, 2019 1:40 pm

So I saw that this was bug 104 for the version 1.5.0 of Router Configs. I updated to 1.5.1 and this was resolved. I ended up finding some other issues though. I had to install SSH2 library for PHP and got past that.

I now have a new issue and am trying to get through, errors below:

2019/05/03 14:29:03 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/routerconfigs/router-backups.php[28]:include(), /include/auth.php[28]:require_once(), /include/global.php[466]:include_once(), /include/vendor/csrf/csrf-magic.php[426]:csrf_check(), /include/vendor/csrf/csrf-magic.php[207]:csrf_error_callback(), /include/global.php[462]:CactiErrorHandler())
2019/05/03 14:29:03 - ERROR PHP NOTICE: Undefined index: REQUEST_URI in file: /usr/share/cacti/include/global.php on line: 462
2019/05/03 14:28:57 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/routerconfigs/router-backups.php[28]:include(), /include/auth.php[28]:require_once(), /include/global.php[466]:include_once(), /include/vendor/csrf/csrf-magic.php[426]:csrf_check(), /include/vendor/csrf/csrf-magic.php[207]:csrf_error_callback(), /include/global.php[462]:CactiErrorHandler())
2019/05/03 14:28:57 - ERROR PHP NOTICE: Undefined index: REQUEST_URI in file: /usr/share/cacti/include/global.php on line: 462
2019/05/03 14:27:22 - RCONFIG 172.16.8.1 (SSH) -> ERROR: Failed to find file at /home/configs/backups/Core_Test
2019/05/03 14:27:22 - RCONFIG ERROR: Failed to download 'Core_Test' to '/home/configs/backups/Core_Test' via 'ssh'
2019/05/03 14:23:23 - CMDPHP ERROR: A DB Cell Failed!, Error: Unknown column 'title' in 'where clause'

netniV
Cacti Guru User
Posts: 2656
Joined: Sun Aug 27, 2017 12:05 am

Re: Router Config - Devices not Showing

#3 Post by netniV » Fri May 17, 2019 3:40 pm

The error regarding REQUEST_URI is coming from the csrf protection code in the core. That would normally only happen if you are running a web-based php file at the command line incorrectly. How where you running the backup which caused those errors to appear?

micmel5997
Posts: 3
Joined: Fri May 03, 2019 10:39 am

Re: Router Config - Devices not Showing

#4 Post by micmel5997 » Fri May 17, 2019 3:56 pm

Thanks for your reply! I am not sure what has changed since the time I opened this post and what I have done to change the results.

But now when I run:

php /usr/share/cacti/plugins/routerconfigs/router-download.php I get the below:

RCONFIG ERROR: Failed to remove pre-existing incoming file: /home/configs/backups/SWITCHNAME

I can TFTP a config to the and it is successful. However it is saving it in /proc/####/task/####/cwd/.

But in the /etc/xinetd.d/ in the tftp file i have set the path to /home/configs/backups.

netniV
Cacti Guru User
Posts: 2656
Joined: Sun Aug 27, 2017 12:05 am

Re: Router Config - Devices not Showing

#5 Post by netniV » Fri May 17, 2019 4:35 pm

You have a permission problem because RC is trying to remove the old config, but cant hence the message.

Post Reply