Welcome, Guest. Please login or register.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - richard.lajaunie

Pages: 1 [2]
16
Discovery / Many Perl errors during discover
« on: February 22, 2012, 05:56:33 PM »
Hello,
I have just (4 days) install nedi 1.0.7 on an Ubuntu 10.04 LTS.
When i execute a nedi.pl command many errors appears:

./nedi.pl -vpob -a 10.1.xx.yy
Started with relative path!
PTY :Not available
LWP :Loaded
OUI :19777 NIC vendor entries read
RDEV:275 devices read from nedi.devices
RADDR:6809 MAC & 564 IP addresses read.
RLNK:0 links (WHERE linktype = "STAT") read from nedi.links
Use of uninitialized value in substitution (s///) at ./inc/libdb-msq.pm line 1405.
RUSR:5 entries (groups & 8 AND (phone != "" OR email != "")) read from nedi.users
SEED:10.1.45.14 added for discovery
MAIN:1 thread, 1st from Wed Feb 22 17:24:18 2012 seems ok adding this one
UPDT:system SET value=value+1 WHERE name="threads"
...
...
Config (CLI)   ----------------------------------------------------------------
TEL :nedi:23 Tout:2s OS:SANOS EN:(.+?)#\s?$
CLI2:Matched login: , sending username
CLI3:Username nedi sent
CLI3:Matched Password:, sending password
CLI3:Password sent
CLI8:Matched enable prompt, OK
CMD :terminal length 0:
CMD :show running-config
Use of uninitialized value in regexp compilation at ./inc/libcli-iopty.pm line 815.
WAIT:
Use of uninitialized value in regexp compilation at ./inc/libcli-iopty.pm line 815.
WAIT:!Command: show running-config

One error for a line of configuration and at the end :

WAIT:no system default switchport shutdown
Use of uninitialized value in regexp compilation at ./inc/libcli-iopty.pm line 815.
WAIT:
Use of uninitialized value $misc::curcfg[0] in concatenation (.) or string at ./inc/libcli-iopty.pm line 826.
ERR :No config ()

Also in the same run :

Config (CLI)   ----------------------------------------------------------------
TEL :nedi:23 Tout:2s OS:SANOS EN:(.+?)#\s?$
CLI2:Matched login: , sending username
CLI3:Username nedi sent
CLI3:Matched Password:, sending password
CLI3:Password sent
CLI8:Matched enable prompt, OK
CMD :terminal length 0:
CMD :show running-config
Use of uninitialized value in regexp compilation at ./inc/libcli-iopty.pm line 815.
WAIT:
Use of uninitialized value in regexp compilation at ./inc/libcli-iopty.pm line 815.
...
...
Use of uninitialized value in regexp compilation at ./inc/libcli-iopty.pm line 815.
WAIT:
Use of uninitialized value $misc::curcfg[0] in concatenation (.) or string at ./inc/libcli-iopty.pm line 826.
ERR :No config ()

and finaly when i start moni.pl or syslog.pl i have this error:
Use of uninitialized value in substitution (s///) at ./inc/libdb-msq.pm line 1405.

Thank you for your help.
Richard

17
Discovery / Re: Cisco 6506 with VSS
« on: June 25, 2010, 09:50:26 AM »
Hi,
Our IOS is Cisco IOS Software, s72033_rp Software (s72033_rp-ADVIPSERVICESK9-M), Version 12.2(33)SXI3

Here is our configuration that work for us:



logging host <HOST IP> vrf <VRF>

snmp-server engineID local 8000000903000008E3FFFD90
snmp-server view vss-view system.1.0 included
snmp-server view vss-view system.2.0 included
snmp-server view vss-view sysUpTime.0 included
snmp-server view vss-view system.4.0 included
snmp-server view vss-view system.5.0 included
snmp-server view vss-view system.6.0 included

snmp-server view vss-view system.7.0 included
snmp-server view vss-view ifDescr included
snmp-server view vss-view ifType included
snmp-server view vss-view ifSpeed included
snmp-server view vss-view ifPhysAddress included
snmp-server view vss-view ifAdminStatus included
snmp-server view vss-view ifInOctets included
snmp-server view vss-view ifInErrors included
snmp-server view vss-view ifOutErrors included

snmp-server view vss-view ipAddrEntry.2 included
snmp-server view vss-view ipRouteEntry.7 included
snmp-server view vss-view ipNetToMediaEntry.2 included
snmp-server view vss-view ifDescr.34 included
snmp-server view vss-view ifDescr.68 included
snmp-server view vss-view ifDescr.102 included
snmp-server view vss-view ifDescr.136 included
snmp-server view vss-view ifDescr.170 included
snmp-server view vss-view ifDescr.204 included

snmp-server view vss-view ifDescr.238 included
snmp-server view vss-view ifDescr.272 included
snmp-server view vss-view ifDescr.306 included
snmp-server view vss-view ifDescr.341 included
snmp-server view vss-view ifDescr.375 included
snmp-server view vss-view ifDescr.434 included
snmp-server view vss-view ifAdminStatus.34 included
snmp-server view vss-view ifAdminStatus.68 included
snmp-server view vss-view ifAdminStatus.102 included

snmp-server view vss-view ifAdminStatus.136 included
snmp-server view vss-view ifAdminStatus.170 included
snmp-server view vss-view ifAdminStatus.204 included
snmp-server view vss-view ifAdminStatus.238 included
snmp-server view vss-view ifAdminStatus.272 included
snmp-server view vss-view ifAdminStatus.306 included
snmp-server view vss-view ifAdminStatus.341 included
snmp-server view vss-view ifAdminStatus.375 included
snmp-server view vss-view ifAdminStatus.434 included

snmp-server view vss-view ipCidrRouteEntry.4 included
snmp-server view vss-view ifName included
snmp-server view vss-view lsystem.73.0 included
snmp-server view vss-view ifName.34 included
snmp-server view vss-view ifName.68 included
snmp-server view vss-view ifName.102 included
snmp-server view vss-view ifName.136 included
snmp-server view vss-view ifName.170 included
snmp-server view vss-view ifName.204 included

snmp-server view vss-view ifName.238 included
snmp-server view vss-view ifName.272 included
snmp-server view vss-view ifName.306 included
snmp-server view vss-view ifName.341 included
snmp-server view vss-view ifName.375 included
snmp-server view vss-view ifName.434 included
snmp-server view vss-view entPhysicalEntry.7 included
snmp-server view vss-view lifEntry.28 included
snmp-server view vss-view entPhysicalEntry.11.2 included

snmp-server view vss-view cisco.5.1.4.1.1.10 included
snmp-server view vss-view cdpCacheEntry included
snmp-server view vss-view vmMembershipEntry.2 included
snmp-server view vss-view managementDomainEntry.2.1 included
snmp-server view vss-view managementDomainEntry.3.1 included
snmp-server view vss-view vtpVlanEntry.4.1 included
snmp-server view vss-view cpmCPUTotalTable.1.8.1 included
snmp-server view vss-view vtpVlanEntry.4.1.98 included
snmp-server view vss-view vtpVlanEntry.4.1.207 included

snmp-server view vss-view vtpVlanEntry.4.1.893 included
snmp-server community <COMMUNITY> RW
snmp-server community public view vss-view RO
snmp-server trap-source Vlan201
snmp-server source-interface informs Vlan201
snmp-server location S-------------
snmp-server host 10.1.40.13 vrf ADMIN <COMMUNITY>


ATTENTION:
For each snmp query on the VSS, the PRIMARY switch will request the SECONDARY switch for that query. If there is a misconfiguration or problems in communication or errors on the VSL link the VSS will respond after a long long time or not.


18
# Definition for 1.3.6.1.4.1.9.1.873 created by Defgen 1.5 on 5.Mar 10 9:30 (admin)

# General
SNMPv   2HC
Type   ME-3400-24FS-A
OS   IOS
Icon   w2bn
Bridge   VLX
Dispro   CDP
Serial   1.3.6.1.4.1.9.3.6.3.0
Bimage   1.3.6.1.4.1.9.2.1.73.0

# Vlan Specific
VLnams   1.3.6.1.4.1.9.9.46.1.3.1.1.4.1
VTPdom   1.3.6.1.4.1.9.9.46.1.2.1.1.2.1
VTPmod   1.3.6.1.4.1.9.9.46.1.2.1.1.3.1

# Interfaces
IFalia   1.3.6.1.4.1.9.2.2.1.1.28
IFalix   
IFvlan   1.3.6.1.4.1.9.9.68.1.2.2.1.2
IFvlix   
IFdupl   1.3.6.1.4.1.9.9.87.1.4.1.1.32
IFduix   1.3.6.1.4.1.9.9.87.1.4.1.1.25
Halfdp   2
Fulldp   1

# Modules
Modesc   
Moclas   
Movalu   
Moslot   1.3.6.1.4.1.9.5.1.3.1.1.1
Modhw   1.3.6.1.4.1.9.5.1.3.1.1.18
Modsw   1.3.6.1.4.1.9.5.1.3.1.1.20
Modfw   1.3.6.1.4.1.9.5.1.3.1.1.19
Modser   1.3.6.1.4.1.9.5.1.3.1.1.26
Momodl   1.3.6.1.4.1.9.5.1.3.1.1.17

# RRD Graphing
CPUutl   1.3.6.1.4.1.9.9.109.1.1.1.1.5.1
Temp   
MemCPU   1.3.6.1.4.1.9.9.48.1.1.1.6.1
Custom   MemIO   1.3.6.1.4.1.9.9.48.1.1.1.6.2


19
Definition Files / Def for Cisco MD S9124 under SAN-OS
« on: February 23, 2010, 06:58:09 PM »
Hello,
I continue integrating SAN switches, this time is for MDS 9124.

So, first the def. file and at the end a diff style of the modifcation in the libcli-netssh.pl.
This diff was made against the original 1.0.5 libcli-netssh.pl

Remo, i will check the new libcli in 1.0.6 version


# Definition for 1.3.6.1.4.1.9.12.3.1.3.587 created by Defgen 1.5 on 16.Feb 10 18:34 (admin)

# General
SNMPv   2HC
Type   MDS-9124
OS   SAN-OS
Icon   w3rd
Bridge   VLX
Dispro   CDP
Serial   1.3.6.1.2.1.47.1.1.1.1.11.22
Bimage   1.3.6.1.4.1.9.9.195.1.2.1.3.22

# Vlan Specific
VLnams   
VTPdom   
VTPmod   

# Interfaces
IFalia   1.3.6.1.2.1.31.1.1.1.18
IFalix   1.3.6.1.2.1.2.2.1.1
IFvlan   
IFvlix   
IFdupl   
IFduix   
Halfdp   
Fulldp   

# Modules
Modesc   1.3.6.1.2.1.47.1.1.1.1.2
Moclas   1.3.6.1.2.1.47.1.1.1.1.5
Movalu   9
Moslot   1.3.6.1.2.1.47.1.1.1.1.7
Modhw   1.3.6.1.2.1.47.1.1.1.1.8
Modsw   1.3.6.1.2.1.47.1.1.1.1.9
Modfw   1.3.6.1.2.1.47.1.1.1.1.10
Modser   1.3.6.1.2.1.47.1.1.1.1.11
Momodl   1.3.6.1.2.1.47.1.1.1.1.13

# RRD Graphing
CPUutl   
Temp   
MemCPU   
Custom      


Code: [Select]
--- ../download/nedi/inc/libcli-netssh.pl 2009-12-08 18:13:54.000000000 +0100
+++ ../cci/dublin/opt/nedi/inc/libcli-netssh.pl 2010-02-17 12:40:07.000000000 +0100
@@ -56,6 +56,17 @@
 $cmd{'IOS-fv'}{'conf'} = 'show run';
 $cmd{'IOS-fv'}{'page'} = 'terminal pager 0';
 $cmd{'IOS-fv'}{'paus'} = '0.3';
+
+$cmd{'NX-OS'}{'prom'} = '/.+?[#>]\s?$/';
+$cmd{'NX-OS'}{'conf'} = 'show run';
+$cmd{'NX-OS'}{'page'} = 'terminal length 0';
+$cmd{'NX-OS'}{'paus'} = '0.3';
+
+$cmd{'SAN-OS'}{'prom'} = '/.+?[#>]\s?$/';
+$cmd{'SAN-OS'}{'conf'} = 'show run';
+$cmd{'SAN-OS'}{'page'} = 'terminal length 0';
+$cmd{'SAN-OS'}{'paus'} = '0.3';
+
 $cmd{'CatOS'}{'prom'} = '/.+[#>]\s?\(enable\)\s*$/';
 $cmd{'CatOS'}{'conf'} = 'show conf';
 $cmd{'CatOS'}{'page'} = 'set length 0';
@@ -159,8 +170,14 @@
  print "-OK" if $main::opt{d};
  return 0;
  }else{
- print "Te";
- return 1;
+ ($pre, $block) = $_[0]->waitfor('/#\s{0,1}$|\(enable\)\s{0,1}$/');    # between the password entry and the prompt there's some text display so we have to wait the prompt
+ if ($block =~ /#\s{0,1}$|\(enable\)\s{0,1}$/){ # Make sure we are enabled now
+ print "-OK" if $main::opt{d};
+ return 0;
+ }else{
+ print "Te";
+ return 1;
+ }
  }
  }
 }
@@ -426,8 +443,8 @@
  }
  foreach my $line (@run){
  $line =~ s/[\r\n]//g;
- if ($line =~ /^(Running|Current|PIX|FWSM|ASA|Building)\s|^begin$|\*\*\* CORE|<config>/){$go = 1}
- if ($go and $line !~ /--More--|^$/){ # --More-- should only be seen on Cat1900s
+ if ($line =~ /^(version|!Command:|Running|Current|PIX|FWSM|ASA|Building)\s|^begin$|\*\*\* CORE|<config>/){$go = 1}
+ if ($go and $line !~ /--More--|^$/ and $line !~ /^!Time:\s/){ # --More-- should only be seen on Cat1900s
  print "\n CFG:$line" if $main::opt{v};
  push @misc::curcfg,$line;
  }

20
GUI / New GUI modification proposition
« on: February 23, 2010, 06:40:35 PM »
Hello,

In my compagny, we have a maintenance contact for all of our cisco devices.
We have decided that only active devices on the network will appear in this contract.
We've decided to make a review every three month for update the list of devices in the contract.

So for ease this review, i've made a page: Reports-Inventory. This page make a list of
all active devices with some informations and, at the end, a list of modules for these devices.

I also had a pdf export function with the html2pdf library from http://html2pdf.fr/

P.S.: because i do not find a way to make an evolution of the GenQuery function, i use literral query
P.S.: this page work for multiple manufacturer, not only Cisco

I hope this is useful.
Please post any comments on the forum.

Richard.

Code: [Select]
<?php
//===============================
// Report Contract Inventory.
// [b]Export in PDF format with html2pdf library from http://html2pdf.fr/[/b]
//===============================
session_start(); 
if( isset(
$_GET['export']) and $_GET['export']=='pdf'){
//like header.php
ini_set("memory_limit","128M"); # Enterprise network support
$self preg_replace("/.*\/(.+).php/","$1",$_SERVER['SCRIPT_NAME']);
require_once ('inc/libmisc.php');
if(isset ($_SESSION['group']) ){
ReadConf($_SESSION['group']);
}else{
echo "<script>document.location.href='index.php?goto=".rawurlencode($_SERVER["REQUEST_URI"])."';</script>\n";
die;
}
require_once ("inc/libdb-msq.php");
//start capture for pdf conversion
ob_start();
echo "<link href=\"themes/{$_SESSION['theme']}.css\" type=\"text/css\" rel=\"stylesheet\">";
// special tag for html2pdf
echo "<page orientation=\"paysage\" footer=\"\" style=\"font-size: 8px\">";
}else{
//stabdard header
include_once ("inc/header.php");
}
if (isset(
$_GET['os']) and is_array($_GET['os'])) $os $_GET['os']; 
// Connect Database
$link = @DbConnect($dbhost,$dbuser,$dbpass,$dbname);
if( !isset(
$_GET['export']) and $_GET['export']!='pdf'){
?>

<h1>Contract Review</h1>
<form method="get" action="<?=$self?>.php">
<table class="content">
<tr class="<?=$modgroup[$self]?>1">
<th>
<center><table>
<tr><td>Operating System</td>
<td><select multiple name="os[]" size=2>
<option value="ALL">ALL</option>
<?php
$query "select distinct os from devices where os!='-'";
$res = @DbQuery($query,$link);
while( $dev = @DbFetchArray($res) ){
echo "<option value=\"{$dev['os']}\" ".((in_array($dev['os'], $os))? "selected" "") .">{$dev['os']}</option>\n";
}
@DbFreeResult($res);
?>

</select>
</td></tr>
</table></center>
</th>
<th width=80>
<input type="submit" name="submit" value="<?=$shobtn?>">
<input type="submit" name="export" value="pdf">
</th>
</tr>
</table>
</form>
<?php
}
if (!isset(
$_GET['export']) and !isset($_GET['submit'])){
include_once ("inc/footer.php");
exit;
}
// make sql filter for each OS
$osfilter '';
if (isset(
$_GET['os'])){
foreach ($os as $selectedos){
if ($selectedos != 'ALL'$osfilter .= "and d.os = '$selectedos' ";
}
 }
 
// Query number of devices ( count devices that have serial number and devices serial like stock serial and device state active )
$query "select count(*) as cpt 
from devices d, stock s 
where
d.serial !='-' 
and d.serial regexp s.serial 
and s.state = 100 
$osfilter
order by d.services,d.name"
;
$res = @DbQuery($query,$link);
$cpt  = @DbFetchArray($res);
// Query data from active devices
$query "select d.name,d.serial,d.type,d.bootimage,d.location,d.description, inet_ntoa(d.ip) as ip  
from devices d, stock s 
where
d.serial !='-' 
and 
d.serial regexp s.serial 
and s.state = 100 
$osfilter
order by d.services,d.name"
;
$res = @DbQuery($query,$link);
if(
$res){
echo "<table class=\"content\" CELLSPACING=2 COLS=4 RULES=NONE BORDER=0>";
echo "<tr><td colspan=5 align=center style='font-size: 20px; color: white'>Inventaire des Mat&eacute;riels:  {$cpt['cpt']} unit&egrave;s au ".date("d-m-Y").".</td></tr>";
while( $dev = @DbFetchArray($res) ){
// retreive links of device
$liens '';
$query2 "SELECT concat('<b style=\'color: green\'>',ifname, '</b> --> [', neighbour, ' - ', nbrifname, ']') as link 
FROM links 
where 
device='
{$dev['name']}
order by device,ifname"
;
$res2 DbQuery($query2,$link);
while($links DbFetchArray($res2)){
$liens .= ",  {$links['link']}";
}
$liens substr($liens3);
echo <<<TABLE
<tr>
<th class="imga" ROWSPAN=3 VALIGN=MIDDLE width=130 nowrap>
{$dev['name']}
</th>
<td class="imgb" width=100 nowrap>
<b>Type|</b>&nbsp;
{$dev['type']}
</td>
<td class="imgb" width=150 nowrap>
<b>Serial|</b>&nbsp;
{$dev['serial']}
</td>
<td class="imgb" width=160 nowrap>
<b>Boot Image|</b>&nbsp;
{$dev['bootimage']}
</td>
<td class="imgb" width=300 nowrap>
<b>Location|</b>&nbsp;
{$dev['location']}
</td>
</tr>
<tr>
<td class="imgb" colspan=4 align=left width=730 >
<b>Description|&nbsp;</b>
{$dev['description']}
</td>
</tr>
<tr>
<td class="imgb" >
<b>Adresse|&nbsp;</b> <i style="color: red">
{$dev['ip']}</i>
</td>
<td class="imgb" colspan=3 align=left width=730 >
<b>Liens|&nbsp;</b>
{$liens}
</td>
</tr>
<tr><td height="0px"></td></tr>

TABLE;
}
}

// if pdf export
if ($_GET['export']=='pdf'){
// special tag for html2pdf
echo "</table></page><br><br><page orientation=\"paysage\" footer=\"\" style=\"font-size: 8px\">";
}else{
echo "</table><br><br>";
}
//quey number of module : count modules that is not present in devices list and have a serial number and slot not a number
// for exemple in devices list appear one switch for a stack with a serial number in modules appear other switches that compose the stack
$query "select count(*) as cpt 
from devices d, stock s, modules m 
where
d.serial = s.serial
and d.name = m.device
and d.serial != m.serial
and m.serial !='-'
and m.serial !=''
and s.state=100
and m.slot not regexp '^[:digit:]'
and m.model != '-'  
$osfilter 
order by d.name, m.description"
;
$res = @DbQuery($query,$link);
$cpt = @DbFetchArray($res);

//query data for modules
$query="select m.device as name, m.model as type, m.serial as serial, m.hw as hw, m.fw as fw, m.description as description
from devices d, stock s, modules m 
where
d.serial = s.serial
and d.name = m.device
and d.serial != m.serial
and m.serial !='-'
and m.serial !=''
and s.state=100
and m.slot not regexp '^[:digit:]'
and m.model != '-'  
$osfilter 
order by d.name, m.description"
;

$res = @DbQuery($query,$link);
if(
$res){
echo "<table class=\"content\" CELLSPACING=2 COLS=4 RULES=NONE BORDER=0>";
echo "<tr><td colspan=5 align=center style='font-size: 20px; color: white'>Inventaire des Modules:  {$cpt['cpt']} unit&egrave;s au ".date("d-m-Y").".</td></tr>";
while( $dev = @DbFetchArray($res) ){
echo <<<TABLE
<tr>
<th class="imga" ROWSPAN=2 VALIGN=MIDDLE width=130 nowrap>
{$dev['name']}
</th>
<td class="imgb" width=100 nowrap>
<b>Type|</b>&nbsp;
{$dev['type']}
</td>
<td class="imgb" width=150 nowrap>
<b>Serial|</b>&nbsp;
{$dev['serial']}
</td>
<td class="imgb" width=160 nowrap>
<b>Hardware Version|</b>&nbsp;
{$dev['hw']}
</td>
<td class="imgb" width=300 nowrap>
<b>Firmware Version|</b>&nbsp;
{$dev['fw']}
</td>
</tr>
<tr>
<td class="imgb" colspan=4 align=left width=730 >
<b>Description|&nbsp;</b>
{$dev['description']}
</td>
</tr>
<tr><td height="0px"></td></tr>

TABLE;
}
}

echo 
"</table>";

if (
$_GET['export']!='pdf'){
include_once ("inc/footer.php");
}else{
echo "</page>";
//end of capture
$content ob_get_clean();
// conversion HTML => PDF
//use your own path
require_once("/var/www/html2pdf/html2pdf.class.php");
$html2pdf = new HTML2PDF('P','A4','fr');
// $html2pdf->setModeDebug();
$html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
$html2pdf->Output('Devices_Inventory.pdf');
}
?>

21
Hello,
Recently, our admins transmit the control all the fiber switch we have,
and i ask to my self if Nedi could do the job? Of course it does, with some little modifications
So this is the first part of the integration

First de Def file for the MDS 9124e under Nexus OS
Second ,at the end, a diff style of the modifcation in the libcli-netssh.pl



# Definition for 1.3.6.1.4.1.9.12.3.1.3.606 created by Defgen 1.5 on 12.Feb 10 12:18 (admin)

# General
SNMPv   2HC
Type   DS-HP-FC-K9
OS   NX-OS
Icon   w3rd
Bridge   VLX
Dispro   CDP
Serial   1.3.6.1.2.1.47.1.1.1.1.11.22
Bimage   1.3.6.1.4.1.9.9.195.1.2.1.3.22

# Vlan Specific
VLnams   
VTPdom   
VTPmod   

# Interfaces
IFalia   1.3.6.1.2.1.31.1.1.1.18
IFalix   1.3.6.1.2.1.2.2.1.1
IFvlan   
IFvlix   
IFdupl   
IFduix   
Halfdp   
Fulldp   

# Modules
Modesc   1.3.6.1.2.1.47.1.1.1.1.2
Moclas   1.3.6.1.2.1.47.1.1.1.1.5
Movalu   9
Moslot   1.3.6.1.2.1.47.1.1.1.1.7
Modhw   1.3.6.1.2.1.47.1.1.1.1.8
Modsw   1.3.6.1.2.1.47.1.1.1.1.9
Modfw   1.3.6.1.2.1.47.1.1.1.1.10
Modser   1.3.6.1.2.1.47.1.1.1.1.11
Momodl   1.3.6.1.2.1.47.1.1.1.1.13

# RRD Graphing
CPUutl   
Temp   
MemCPU   
Custom      



--- ../download/nedi/inc/libcli-netssh.pl   2009-12-08 18:13:54.000000000 +0100
+++ ../cci/dublin/opt/nedi/inc/libcli-netssh.pl   2010-02-16 12:21:24.000000000 +0100
@@ -56,6 +56,12 @@
 $cmd{'IOS-fv'}{'conf'} = 'show run';
 $cmd{'IOS-fv'}{'page'} = 'terminal pager 0';
 $cmd{'IOS-fv'}{'paus'} = '0.3';
+
+$cmd{'NX-OS'}{'prom'} = '/.+?[#>]\s?$/';
+$cmd{'NX-OS'}{'conf'} = 'show run';
+$cmd{'NX-OS'}{'page'} = 'terminal length 0';
+$cmd{'NX-OS'}{'paus'} = '0.3';
+
 $cmd{'CatOS'}{'prom'} = '/.+[#>]\s?\(enable\)\s*$/';
 $cmd{'CatOS'}{'conf'} = 'show conf';
 $cmd{'CatOS'}{'page'} = 'set length 0';
@@ -159,8 +165,14 @@
          print "-OK" if $main::opt{d};
          return 0;         
       }else{
-         print "Te";
-         return 1;
+         ($pre, $block) = $_[0]->waitfor('/#\s{0,1}$|\(enable\)\s{0,1}$/');    # between the password entry and the prompt there's some text display so we have to wait the prompt
+         if ($block =~ /#\s{0,1}$|\(enable\)\s{0,1}$/){         # Make sure we are enabled now
+            print "-OK" if $main::opt{d};
+            return 0;         
+         }else{
+            print "Te";
+            return 1;
+         }
       }
    }
 }
@@ -426,8 +438,8 @@
    }
    foreach my $line (@run){
       $line =~ s/[\r\n]//g;
-      if ($line =~ /^(Running|Current|PIX|FWSM|ASA|Building)\s|^begin$|\*\*\* CORE|<config>/){$go = 1}
-      if ($go and $line !~ /--More--|^$/){                  # --More-- should only be seen on Cat1900s
+      if ($line =~ /^(!Command:|Running|Current|PIX|FWSM|ASA|Building)\s|^begin$|\*\*\* CORE|<config>/){$go = 1}
+      if ($go and $line !~ /--More--|^$/ and $line !~ /^!Time:\s/){                  # --More-- should only be seen on Cat1900s
          print "\n CFG:$line" if $main::opt{v};
          push @misc::curcfg,$line;
       }


Hope this is usefull an din the way of Nedi
Richard

22
Definition Files / Re: Def for 6509 with VSS (1.3.6.1.4.1.9.1.896)
« on: February 09, 2010, 06:05:17 PM »
OOoops,

I forgot to tell that i was force to setup the timeout value in nedi.conf to 45 secondes.
Our VSS take very long time to answer snmp query, don't know why!!

Bye

23
Definition Files / Re: Def for 6509 with VSS (1.3.6.1.4.1.9.1.896)
« on: February 09, 2010, 06:01:17 PM »
Hello,
Today we have fire up our VSS and this is the def file i use:

# Definition for 1.3.6.1.4.1.9.1.896 created by Defgen 1.5 on 9.Feb 10 15:16 (admin)

# General
SNMPv   2HC
Type    SW-C6509-VSS-IOS
OS      IOS
Icon    c3bd
Bridge  VLX
Dispro  CDP
Serial
Bimage  1.3.6.1.4.1.9.2.1.73.0

# Vlan Specific
VLnams  1.3.6.1.4.1.9.9.46.1.3.1.1.4.1
VTPdom  1.3.6.1.4.1.9.9.46.1.2.1.1.2.1
VTPmod  1.3.6.1.4.1.9.9.46.1.2.1.1.3.1

# Interfaces
IFalia  1.3.6.1.4.1.9.2.2.1.1.28
IFalix
IFvlan  1.3.6.1.4.1.9.9.68.1.2.2.1.2
IFvlix
IFdupl  1.3.6.1.4.1.9.5.1.4.1.1.10
IFduix
Halfdp  1
Fulldp  2

# Modules
Modesc  1.3.6.1.2.1.47.1.1.1.1.2
Moclas  1.3.6.1.2.1.47.1.1.1.1.5
Movalu  9
Moslot  1.3.6.1.2.1.47.1.1.1.1.7
Modhw   1.3.6.1.2.1.47.1.1.1.1.8
Modsw   1.3.6.1.2.1.47.1.1.1.1.9
Modfw   1.3.6.1.2.1.47.1.1.1.1.10
Modser  1.3.6.1.2.1.47.1.1.1.1.11
Momodl  1.3.6.1.2.1.47.1.1.1.1.13

# RRD Graphing
CPUutl  1.3.6.1.4.1.9.9.109.1.1.1.1.8.1
Temp
MemCPU  1.3.6.1.4.1.9.9.48.1.1.1.6.1
Custom     

hop this is useful

Bye

24
# Definition for 1.3.6.1.4.1.9.1.948 created by Defgen 1.5 on 5.Jan 10 9:46 (admin)

# General
SNMPv   2HC
Type   WS-CBS3120G-S
OS   IOS
Icon   w2bn
Bridge   VLX
Dispro   CDP
Serial   1.3.6.1.4.1.9.3.6.3.0
Bimage   1.3.6.1.4.1.9.2.1.73.0

# Vlan Specific
VLnams   1.3.6.1.4.1.9.9.46.1.3.1.1.4.1
VTPdom   1.3.6.1.4.1.9.9.46.1.2.1.1.2.1
VTPmod   1.3.6.1.4.1.9.9.46.1.2.1.1.3.1

# Interfaces
IFalia   1.3.6.1.4.1.9.5.1.4.1.1.4
IFalix   1.3.6.1.4.1.9.5.1.4.1.1.11
IFvlan   1.3.6.1.4.1.9.9.68.1.2.2.1.2
IFvlix   
IFdupl   1.3.6.1.4.1.9.5.1.4.1.1.10
IFduix   1.3.6.1.4.1.9.5.1.4.1.1.11
Halfdp   1
Fulldp   2

# Modules
Modesc   
Moclas   
Movalu   
Moslot   1.3.6.1.4.1.9.5.1.3.1.1.1
Modhw   1.3.6.1.4.1.9.5.1.3.1.1.18
Modsw   1.3.6.1.4.1.9.5.1.3.1.1.20
Modfw   1.3.6.1.4.1.9.5.1.3.1.1.19
Modser   1.3.6.1.4.1.9.5.1.3.1.1.26
Momodl   1.3.6.1.4.1.9.5.1.3.1.1.17

# RRD Graphing
CPUutl   1.3.6.1.4.1.9.9.109.1.1.1.1.5.1
Temp   
MemCPU   1.3.6.1.4.1.9.9.48.1.1.1.6.1
Custom   MemIO   1.3.6.1.4.1.9.9.48.1.1.1.6.2

25
GUI / GUI: little modif in monitoring-messages.php
« on: January 05, 2010, 03:37:01 PM »
hello,
Happy new year!!!!

Just a little proposition to stop the countdown in the monitoring-messages.php
To do this I propose to had this javascript function

function stop_countdown(id){
   window.clearInterval(id);
   document.getElementById('ctr').setAttribute('class', 'blk');
}

and modif the <span> tag like this

<span class="grn" id="ctr" width="20" onClick="stop_countdown(interval);"><?=$timer?></span>

Stopping the count down is very help for me when i'm analizing some log ....

Bye

26
GUI / GUI Modifications proposition
« on: June 12, 2009, 10:34:05 AM »
Hi ALL!
First, i want to thank all of you for this very great soft.
I'm network administrator in a medium size company.
We are 2 network admin and about 10 technicians for the maintainance for 2 sites.
We're using Nedi for about six month and it's very usefull.

For a more user friendly GUI i've made some modifications of the GUI code.
i would like to present these and why i've made it.

We have 2 Nedi servers and for each update i had to reproduce the display setting for
Devices-List and Nodes-List. So i decide move these parameters in nedi.conf
Here is the code modifications i've made:

Nedi.conf
#To define what columns to display in Devices-List and Nodes-List
devicesDisplay  name    ip      serial  os      location        firstseen       lastseen
orderDevDisplay name
nodesDisplay    name    ip      ifnamel mac     vlanid  firstseen       lastseen
orderNoDisplay  ip

Libmisc.php after line 75
elseif ($v[0] == "devicesDisplay")   {for($ii=1;$ii<count($v);$ii++){$devicesDisplay[] = $v[$ii];}}
elseif ($v[0] == "orderDevDisplay")    {$orderDevDisplay = $v[1];}
elseif ($v[0] == "nodesDisplay")   {for($ii=1;$ii<count($v);$ii++){$nodesDisplay[] = $v[$ii];}}
elseif ($v[0] == "orderNoDisplay")    {$orderNoDisplay = $v[1];}

Devices-List.php
line 31: $ord = isset($_GET['ord']) ? $_GET['ord'] : $orderDevDisplay;
line 32: $col = isset($_GET['col']) ? $_GET['col'] : $devicesDisplay;

Nodes-List.php
line 33: $ord = isset($_GET['ord']) ? $_GET['ord'] : $orderNoDisplay;
line 34: $col = isset($_GET['col']) ? $_GET['col'] : $nodesDisplay;


In our normal activitie whe have intensive use of the Nodes-List page and very often
we switch from this page to Devices-Status page. To ease this switching i've add a link
in the Nodes-List page for each node in the list, in the column  ifname .

Nodes-List.php
line 187: echo "<td><a href=\"Devices-Status.php?dev=$ud\"><img src=\"img/16/swit.png\"></a><a href=\"?ina=device&opa==&sta=$ud&ord=ifname\">$n[6]</a>";


In our company we have classified the Ip Addresses by nodes types.
By example, printers have 1.xx.200.yy type address, Pc 1.xx.150.yy type address,
specials Pc 1.xx.250.yy type address, etc... So to retrieve specific type of node in the
Nodes-List.php page we have to search Ip Addresses in the RegExp way:

Nodes-List.php
after line 37: "ips"=>"IP String $adrlbl",

libdb-msq.php
after line 103: }elseif($c == 'ips'){
         $c = "inet_ntoa(ip)";


To avoid the need of switching between Devices-Status.php and Devices-Config.php to view
a specific interface configuration, i create a page that Pop-Up on a click on  ifname  column:

Devices-Status.php
line 559: echo "<td><a href=\"javascript:void()\" onclick=\"window.open('Devices-PopConf.php?device=$shd&ifname=$in','Help','menubar=no,location=no,width=800,height=500,scrollbars');\"><b>$in</b></a></td>\n";

Devices-PopConf.php (specific to cisco at this time)
<?php
session_start();
require_once ('inc/libmisc.php');
if(isset ($_SESSION['group']) ){
   ReadConf($_SESSION['group']);
}else{
   echo "<script>document.location.href='index.php?goto=".rawurlencode($_SERVER["REQUEST_URI"])."';</script>\n";
   die;
}
require_once ("languages/$_SESSION[lang]/gui.php");
require_once ("inc/libdb-" . strtolower($backend) . ".php");

$_GET = sanitize($_GET);

$arr_ifabr = array('/Et/', '/Fa/', '/Gi/', '/Te/', '/Vl/', '/Po/', '/Lo/');
$arr_iflong = array('Ethernet', 'FastEthernet', 'GigabitEthernet', 'TenGigabitEthernet', 'Vlan', 'Port-channel', 'Loopback');
$ifnum = preg_replace("/(\\w{2})(\\d\\/\\d)/", "$2", $_GET['ifname']);
$iftype = preg_replace($arr_ifabr, $arr_iflong, $_GET['ifname']);
$iftype = preg_replace("/(\\w{2}\\d\\/\\d)(-\\w*)/", "$1", $iftype);

if ($_GET['device']){
   $clink  = @DbConnect($dbhost,$dbuser,$dbpass,$dbname);
   $cquery = "SELECT substring_index(substr(config,position('interface $iftype' in config)), '!', 1) FROM configs where device='{$_GET['device']}'";
   $cres   = @DbQuery($cquery,$clink);
   if ( @DbNumRows($cres) == 1) {
           $caho = @DbFetchRow($cres);
   }
   @DbFreeResult($cres);
}

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=<?=$charset?>">
<link href="themes/<?=$_SESSION[theme]?>.css" type="text/css" rel="stylesheet">
</head>
<body>
<h1><?=$_GET['device']?></h1>
<div class="net1">
<h2>Port Configuration of <?=$_GET['ifname']?></h2>
</div>
<div class="net2 code">
<b></b>
<font size="+0"><? echo $caho[0]; ?></font>
<table>
<td><? echo "<img src=inc/drawrrd.php?dv={$_GET['device']}&if%5B%5D={$_GET['ifname']}&s=4&t=trf>\n"; ?></td>
<td><? echo "<img src=inc/drawrrd.php?dv={$_GET['device']}&if%5B%5D={$_GET['ifname']}&s=4&t=err>\n"; ?></td>
</table>
</div>
</body>
</html>


Voila!
That's all for today.
I hope these modifications will be agreed and inserted in the project.

P.S. : Soon, i will publish some modification for integration of Hirschmann MICE MS20 switches....
P.S. : excuse my poor english writing, i'm not very comfortable whis it.

Pages: 1 [2]