Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Thu Jun 22, 2017 7:05 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 100 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author Message
 Post subject:
PostPosted: Wed Apr 14, 2010 11:24 am 
Offline
Cacti User

Joined: Wed May 27, 2009 5:10 pm
Posts: 124
I would like this command to work but it doesnt follow.
Code:
// If HP skip re-connecting to the device and causing a false positive
         if ($value !="HP") {
              $result = $telnet->Connect($device['ipaddress'], $info['username'], $info['password'], $info['enablepw'], $devicetype);
                     $debug = $telnet->debug;
         $telnet->DoCommand($devicetype['enable'], $result);
         $debug .= $result;
         //echo $result;
         $telnet->DoCommand($info['password'], $result);
         $debug .= $result;
         //echo $result;
         $telnet->DoCommand($devicetype['copytftp'], $result);
         $debug .= $result;
         echo $result;
         $telnet->DoCommand($tftpserver, $result);
         $debug .= $result;
         echo $result;
         $telnet->DoCommand($filename, $result);
         $debug .= $result;
         echo $result;


it gives up after logging in and will not enter the commands:

1) enable
2) user password

any ideas? :cry:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2010 2:08 pm 
Offline
Cacti User

Joined: Wed Feb 20, 2008 5:02 pm
Posts: 60
What do you mean it doesnt follow?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2010 2:13 pm 
Offline
Cacti User

Joined: Wed May 27, 2009 5:10 pm
Posts: 124
It doesn't follow that rule set. I put an enable command in there and it doesn't run it at all.
I've tried setting the device as auto detect and cisco ios without change.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2010 2:17 pm 
Offline
Cacti User

Joined: Wed Feb 20, 2008 5:02 pm
Posts: 60
A little ways up you should see:
Code:
        $telnet = new PHPTelnet();


Near the bottom of the file is that PHPTelnet class. Do you have the code after the
Code:
                                        # Get > to show we are at the command prompt and ready to input the en command
comment in that class that looks for the different cisco prompts?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 23, 2010 11:44 am 
Offline
Cacti User

Joined: Wed May 27, 2009 5:10 pm
Posts: 124
It has that code. Not sure how to fix this :/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 23, 2010 12:23 pm 
Offline
Cacti User

Joined: Wed Feb 20, 2008 5:02 pm
Posts: 60
Youre still running it from the command line? If so does it eventually error out or just hang forever or what? It ought to work fine. I have updated code if you'd like to try it. (I've now extended it to work with HP and Foundry devices)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 23, 2010 12:51 pm 
Offline
Cacti User

Joined: Wed May 27, 2009 5:10 pm
Posts: 124
It gets to the enable prompt and doesn't go any further. The command you mentioned above where it looks for the enable prompt is there, but I couldn't say why it is not finding the enable prompt :/
Thanks for the update Ill give it a try when I'm near a computer next.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 23, 2010 1:02 pm 
Offline
Cacti User

Joined: Wed Feb 20, 2008 5:02 pm
Posts: 60
Yeah, I'd run it from cli using php /cactipath/plugins/routerconfigs/router-download.php and watch it til it completes. Ive removed some of the echo stuff from the script (cause I didnt need it) and as such the debug information isnt always useful. When it finishes it'll either say failed or success and why. Post that.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 26, 2010 6:01 am 
Offline
Cacti User

Joined: Wed May 27, 2009 5:10 pm
Posts: 124
Code:
[root@localhost ~]# php /var/www/html/plugins/routerconfigs/router-download.php
Processing asa
PHP Notice:  Undefined index:  enablepw in /var/www/html/plugins/routerconfigs/functions.php on line 337

Notice: Undefined index:  enablepw in /var/www/html/plugins/routerconfigs/functions.php on line 337
PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/plugins/routerconfigs/functions.php on line 127

Warning: Invalid argument supplied for foreach() in /var/www/html/plugins/routerconfigs/functions.php on line 127
PHP Notice:  Undefined variable: result in /var/www/html/plugins/routerconfigs/functions.php on line 140

Notice: Undefined variable: result in /var/www/html/plugins/routerconfigs/functions.php on line 140
PHP Notice:  Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 142

Notice: Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 142
ÿûÿûÿûÿû

User Access Verification

Username: admin
Password: **********
Type help or '?' for a list of available commands.
ASA-01> Login failed333PHP Notice:  Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 207

Notice: Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 207
Saving Debug
Processing switch
PHP Notice:  Undefined index:  enablepw in /var/www/html/plugins/routerconfigs/functions.php on line 337

Notice: Undefined index:  enablepw in /var/www/html/plugins/routerconfigs/functions.php on line 337
PHP Notice:  Undefined variable: result in /var/www/html/plugins/routerconfigs/functions.php on line 140

Notice: Undefined variable: result in /var/www/html/plugins/routerconfigs/functions.php on line 140
ÿûÿûÿýÿý

User Access Verification

Username: ÿþ ÿúÿðÿþ'ÿýadmin
Password:

3750-1>Login failed333Saving Debug
04/26/2010 10:58:39 AM - RouterConfigs: Poller[0] -1272279345 seconds
0 devices backed up successfully.
2 devices failed to backup.

These devices failed to backup
--------------------------------
asa - Login failed
switch - Login failed
[root@localhost ~]#


Here is the complete output under the command line. Thanks for helping.. I've tried to get it working myself but any changes I make to the functions.php either don't work or run or I get a blank page with a php syntax error when I load the page..


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 26, 2010 9:18 am 
Offline
Cacti User

Joined: Wed Feb 20, 2008 5:02 pm
Posts: 60
It almost looks like theres a syntax error in functions that while not severe enough to cause it to not run, has made it unaware of the enablepw variable. Back that file up and try this one out of the box from the command line again and post the results if you would.


Attachments:
functions.txt [28.49 KiB]
Downloaded 441 times
Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 26, 2010 9:30 am 
Offline
Cacti User

Joined: Wed May 27, 2009 5:10 pm
Posts: 124
Here is the CLI output with the new functions:
Code:
[root@localhost ~]# php /var/www/html/plugins/routerconfigs/router-download.php
Processing asa
PHP Notice:  Undefined index:  enablepw in /var/www/html/plugins/routerconfigs/functions.php on line 337

Notice: Undefined index:  enablepw in /var/www/html/plugins/routerconfigs/functions.php on line 337
PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/plugins/routerconfigs/functions.php on line 127

Warning: Invalid argument supplied for foreach() in /var/www/html/plugins/routerconfigs/functions.php on line 127
PHP Notice:  Undefined variable: result in /var/www/html/plugins/routerconfigs/functions.php on line 140

Notice: Undefined variable: result in /var/www/html/plugins/routerconfigs/functions.php on line 140
PHP Notice:  Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 142

Notice: Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 142
ÿûÿûÿûÿû

User Access Verification

Username: admin
Password: **********
Type help or '?' for a list of available commands.
ASA-01> Login failed333PHP Notice:  Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 207

Notice: Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 207
Saving Debug
Processing switch
PHP Notice:  Undefined index:  enablepw in /var/www/html/plugins/routerconfigs/functions.php on line 337

Notice: Undefined index:  enablepw in /var/www/html/plugins/routerconfigs/functions.php on line 337
PHP Notice:  Undefined variable: result in /var/www/html/plugins/routerconfigs/functions.php on line 140

Notice: Undefined variable: result in /var/www/html/plugins/routerconfigs/functions.php on line 140
ÿûÿûÿýÿý

User Access Verification

Username: ÿþ ÿúÿðÿþ'ÿýadmin
Password:

3750-1>Login failed333Saving Debug
04/26/2010 02:26:15 PM - RouterConfigs: Poller[0] -1272291801 seconds
0 devices backed up successfully.
2 devices failed to backup.

These devices failed to backup
--------------------------------
asa - Login failed
switch - Login failed
[root@localhost ~]#



Where does it get the enablepw info from?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 26, 2010 12:59 pm 
Offline
Cacti User

Joined: Wed Feb 20, 2008 5:02 pm
Posts: 60
Right below this comment (//If non-cisco use PHPTelnetHP class vs standard
) is a select statement that's then run through a foreach and if block. Let's add the following to it: (underneath the foreach and then its opening brace)

Code:
echo "value is $value";
Then run it again and post the output. I just want to make sure that the select is functioning as expected. After that run well throw some additional echos in to see whats breaking and why.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2010 6:29 am 
Offline
Cacti User

Joined: Wed May 27, 2009 5:10 pm
Posts: 124
I do not have that line but there is one similar:
Code:
//If HP use PHPTelnetHP class vs standard
   echo "value is $value";


I put the echo as above and here is the output:

Code:
[root@localhost ~]# php /var/www/html/plugins/routerconfigs/router-download.php
Processing asa
PHP Notice:  Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 126

Notice: Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 126
value is PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/plugins/routerconfigs/functions.php on line 1

Warning: Invalid argument supplied for foreach() in /var/www/html/plugins/routerconfigs/functions.php on line 128
PHP Notice:  Undefined variable: result in /var/www/html/plugins/routerconfigs/functions.php on line 141

Notice: Undefined variable: result in /var/www/html/plugins/routerconfigs/functions.php on line 141
PHP Notice:  Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 143

Notice: Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 143
ÿûÿûÿûÿû

User Access Verification

Username: admin
Password:
Username: Login failed333PHP Notice:  Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 208

Notice: Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 208
Saving Debug
Processing switch
PHP Notice:  Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 126

Notice: Undefined variable: value in /var/www/html/plugins/routerconfigs/functions.php on line 126
value is PHP Notice:  Undefined variable: result in /var/www/html/plugins/routerconfigs/functions.php on line 141

Notice: Undefined variable: result in /var/www/html/plugins/routerconfigs/functions.php on line 141
ÿûÿûÿýÿý

User Access Verification

Username: ÿþ ÿúÿðÿþ'ÿýadmin
Password:

% Authentication failed

Username:
% Username:  timeout expired!Login failed333Saving Debug
04/27/2010 11:26:48 AM - RouterConfigs: Poller[0] -1272367436 seconds
0 devices backed up successfully.
2 devices failed to backup.

These devices failed to backup
--------------------------------
asa - Login failed
switch - Login failed
[root@localhost ~]#


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 27, 2010 9:57 am 
Offline
Cacti User

Joined: Wed Feb 20, 2008 5:02 pm
Posts: 60
Strange, I dont see that echo in your output. It looks like the select is what's breaking. (select being the if $value == "HP" line) For some reason it looks like it's not executing that if block. Underneath the if $value == HP line add in a
Code:
echo "are we here?";
and rerun it. Let's see if that shows up in the output.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 28, 2010 8:59 am 
Offline
Cacti User

Joined: Wed May 27, 2009 5:10 pm
Posts: 124
Hmm. I cannot see that line but I can see these lines:
Code:
//end class use
      if ($result == 0) {
// If HP skip re-connecting to the device and causing a false positive
         if ($value !="HP") {


I'm wondering what PHP version you are using, sicne I'm not using the latest. I'm using the CactiEZ pre-built software. I have just started a fresh with your original final functions.php file and it doesnt work then so it isnt breaking because of any thing I have done, but I am wondering if it's because of the php version I am using.
I'll try upgrading, and if I don't break everything else in the process I'll re-try and see what happens.
In the meantime, since I have two servers I can pursue both simultaneously - I just cannot see the == HP line, unless you mean != HP

Thanks again


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 100 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group