Routerconfigs not work

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
slava75
Posts: 7
Joined: Tue Nov 15, 2011 6:00 pm

Routerconfigs not work

Post by slava75 »

Hello! At start backup in auto and a manual mode in the table "plugin_routerconfigs_devices" mysql there is an error lasterror = "ERROR: Unable to open telnet network connection". That it is necessary to check up. I understand that the script can't create connection to a host. How it is possible to include detailed debug works of this script? In a cacti.log the information routerconfigs isn't displayed. The usual telnet from the server on a host passes without problems. In advance I am sorry for my English, I use the translator.
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Routerconfigs not work

Post by noname »

slava75
Posts: 7
Joined: Tue Nov 15, 2011 6:00 pm

Re: Routerconfigs not work

Post by slava75 »

I don't use ssh, only telnet
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Routerconfigs not work

Post by noname »

slava75 wrote:I don't use ssh, only telnet
Ah, sorry.

Probably it fails fsockopen() function in 'plugins/routerconfigs/functions.php'.
In 'Settings -> General', change "Poller Logging Level" to DEBUG then look into cacti.log for details.
slava75
Posts: 7
Joined: Tue Nov 15, 2011 6:00 pm

Re: Routerconfigs not work

Post by slava75 »

And unless poller participates in process if to press manually the button backup? Whether Should occur backup during each start poller? In quality poller costs spine. Debug level is inconvenient, as for 2 intervals (for 5 minutes) the size логфайла > 10Mb. For 2 periods in a broad gull there are no lines containing "router"
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Routerconfigs not work

Post by noname »

slava75 wrote:Debug level is inconvenient, as for 2 intervals (for 5 minutes) the size логфайла > 10Mb. For 2 periods in a broad gull there are no lines containing "router"
Then, try this test code:
<?php

include("./include/global.php");
include("./plugins/routerconfigs/functions.php");

$devicetype = array('username' => 'sername:',
'password' => 'assword:',
'copytftp' => 'copy start tftp',
'version' => 'show version',
'forceconfirm' => 0,
'checkendinconfig' => 1
);

$connection = new PHPTelnet();
$result = $connection->Connect("IP address", "username", "password", "enable password", $devicetype);
echo "\nResult: $result\n";

$connection->DoCommand("show clock", $result);
echo "\nResult: $result\n";

$connection->Disconnect();

?>
Parameters in blue should be specified by yourself.

In my case: (*** is unreadable character)

Code: Select all

% php telnet_test.php
*******

User Access Verification

Username: *************
Password:

Switch>en
Password:
Switch#
Result: 0

Result: 17:15:42.319 JST Wed Nov 16 2011
You also have another choice: http://forums.cacti.net/viewtopic.php?f=19&t=39573
slava75
Posts: 7
Joined: Tue Nov 15, 2011 6:00 pm

Re: Routerconfigs not work

Post by slava75 »

This script works without errors :)

Code: Select all

php -f ./test_backup.php 



User Access Verification

Username: xxxx
Password: 

C3560>en
Password: 
C3560#
Result: 0

Result: show users
    Line       User       Host(s)              Idle       Location
*  1 vty 0     xxxxx      idle                 00:00:00 xxx.xxx.xxx.xxx

  Interface      User        Mode                     Idle     Peer Address

C3560#
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Routerconfigs not work

Post by noname »

slava75 wrote:This script works without errors :)
Hmm, then, please check (again) your configurations in "Router Configs" menu.
Especially,
- "IP Address" and "Authentication Account" in 'Devices' tab
- All settings in 'Authentication' tab
slava75
Posts: 7
Joined: Tue Nov 15, 2011 6:00 pm

Re: Routerconfigs not work

Post by slava75 »

All options are made according to the documentation. To be mistaken there it is difficult. The command a telnet isn't carried out. tcpdump doesn't fix any package to a switch. Can be a problem eth0 has IP no address? At me are lifted subinterfeises (eth0.3, eth0.4)??
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Routerconfigs not work

Post by noname »

slava75 wrote:Can be a problem eth0 has IP no address? At me are lifted subinterfeises (eth0.3, eth0.4)??
Sorry I'm not sure about that.

Once again..
If you executed the above test script as poller user (e.g. cactiuser) or web server user (e.g. nobody, apache),
does it work fine?
slava75
Posts: 7
Joined: Tue Nov 15, 2011 6:00 pm

Re: Routerconfigs not work

Post by slava75 »

Has inserted in crones a line

Code: Select all

*/5 * * * * cacti php /etc/cacti/test_backup.php > /var/log/testcacti.log

Code: Select all

cat /var/log/testcacti.log

Warning: session_start(): open(/var/lib/php/session/sess_4ii6ek3hh5tl0l2vbtm0dt6ji2, O_RDWR) failed: Permission denied (13) in /etc/cacti/include/global.php on line 151

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /etc/cacti/include/global.php:151) in /etc/cacti/include/global.php on line 151

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /etc/cacti/include/global.php:151) in /etc/cacti/include/global.php on line 151
............

User Access Verification

Username: .. ........'...xxxx
Password:

C3560>en
Password:
C3560#
Result: 0

Result: show users
    Line       User       Host(s)              Idle       Location
*  1 vty 0     xxxxx      idle                 00:00:00 xxx.xxx.xxx.xxx

  Interface      User        Mode                     Idle     Peer Address

C3560#

Warning: Unknown: open(/var/lib/php/session/sess_4ii6ek3hh5tl0l2vbtm0dt6ji2, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0

noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Routerconfigs not work

Post by noname »

Try this: (added "2>&1")

Code: Select all

*/5 * * * * cacti php /etc/cacti/test_backup.php > /var/log/testcacti.log 2>&1
If same result is recorded, it (=telnet by PHP) seems to work.. There might be another reasons.
I'm not sure whether the above warnings about session affected your problem.
slava75
Posts: 7
Joined: Tue Nov 15, 2011 6:00 pm

Re: Routerconfigs not work

Post by slava75 »

I too think that function (=telnet PHP) works, it is strange why doesn't work in the general context
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest