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.


Topics - richard.lajaunie

Pages: [1]
1
Discovery / pb decoding MAC wih HPVC HP VC FlexFabric 10Gb/24-Port
« on: February 07, 2014, 07:07:16 PM »
hi,
when discovering our HPVC HP VC FlexFabric 10Gb/24-Port all of the mac addresses begin with '06' like this:
Code: [Select]
BridgeFwd (SNMP) --------------------------------------------------------------
SNMP:Connect 10.10.10.10 community v2 Tout:10s MaxMS:1472
FWDS:Walking BridgeFwd (ariane)
FWDS:Walking FWD Port to IF index
FWDS:06f4ce46b9e9 no IFindex (538)
FWDS:0600195690eb no IFindex (539)
FWDS:060017a47700 no IFindex (539)

I've found that to the request oid=1.3.6.1.2.1.17.4.3.1.2
the response contain 17 fields
.1.3.6.1.2.1.17.4.3.1.2.6.0.80.86.134.25.250 = Hex-STRING: 00 50 56 86 19 FA .

so in the inc/libsnmp.pm, i find a workarround like this:
Code: [Select]
foreach my $fpo ( keys %fwdpo ){
                                my @dmac = split(/\./,$fpo);
                                if(defined $dmac[$m6]){                                                 # Ignore incomplete MACs!
                                        # Modif by Richard #
                                        if(defined $dmac[17]){
                                                $m1=12;
                                                $m2=13;
                                                $m3=14;
                                                $m4=15;
                                                $m5=16;
                                                $m6=17;
                                        }
                                        # End Modif by Richard #
                                        my $mc = sprintf "%02x%02x%02x%02x%02x%02x",$dmac[$m1],$dmac[$m2],$dmac[$m3],$dmac[$m4],$dmac[$m5],$dmac[$m6];
                                        if($mc !~ /$misc::ignoredmacs/){


I don't know if other people using HPVC HP VC FlexFabric 10Gb/24-Port have the same problems.

Tx
richard

2
GUI / Accessing to weather information behind a proxy
« on: February 05, 2014, 01:04:10 PM »
hi,
When nedi is behind a proxy, In the topology-table page when you click on the icon Weather nothing appen.
After some research, i've found that the function file_get_content try to access directly to weather server.
to correct this problem, i've made some change in the libmon.php file.

I changed all «file_get_contents» to «file_get_Content» with the command «sed -i s/file_get_contents/file_get_Content/ libmon.php»
and i add the following function:
Code: [Select]
function file_get_Content($url){
        $aContext = array(
            'http' => array(
                'proxy' => 'tcp://10.10.10.10:9999',
                'request_fulluri' => true,
            ),
        );
        $cxContext = stream_context_create($aContext);

        $sFile = file_get_contents($url, False, $cxContext);

        return $sFile;
}

Of course this just a workarround and this must correctly integrate with nedi.conf

Bye
Richard

3
Discovery / vrfName disappeared
« on: January 27, 2014, 03:34:10 PM »
Hello Remo,

i am testing 1.0.9 version and i discover that the vrf names had disappeared.
In the table Networks the column "vrfname" is empty.
Is there a new configuration or switch i've missed?

Thank you.
Richard

4
GUI / GUI small bug
« on: April 17, 2012, 06:59:35 PM »
Hi all,
In my sens there is a small bug in the Devices-Status.php page.

I create a user without 'adm' capabilities.
When this user look at one of our core switch (more than 100 links) in devices status and click on Top... link
he get "you're not authorized".
But in this he cannot view the whole list of links.

this is a very simple solution

Code: [Select]
diff --git a/html/Devices-Status.php b/html/Devices-Status.php
index 511eb98..ae57809 100755
--- a/html/Devices-Status.php
+++ b/html/Devices-Status.php
@@ -502,7 +502,13 @@ flush();
 </td><td class="helper">
 
 <h2>
+<?
+if (preg_match("/adm/",$_SESSION['group'])){
+?>
 <a href="Topology-Linked.php?dv=<?=$ud?>"><img src="img/16/ncon.png" title="Edit Links"></a>
+<? }else{ ?>
+<a href="Topology-Links.php?dv=<?=$ud?>"><img src="img/16/ncon.png" title="View Links"></a>
+<? } ?>
 Top <?=$_SESSION['lim']?> Links</h2>
 
 <?
diff --git a/html/Topology-Links.php b/html/Topology-Links.php
index e69de29..a502ea7 100644
--- a/html/Topology-Links.php
+++ b/html/Topology-Links.php
@@ -0,0 +1,72 @@
+<?
+# Program: Topology-Links.php
+# Programmer: Remo Rickli
+# Modified by: Richard Lajaunie
+
+$printable = 1;
+
+include_once ("inc/header.php");
+
+$_GET = sanitize($_GET);
+$dv = isset($_GET['dv']) ? $_GET['dv'] : "";
+$if = isset($_GET['if']) ? $_GET['if'] : "";
+$nb = isset($_GET['nb']) ? $_GET['nb'] : "";
+$ni = isset($_GET['ni']) ? $_GET['ni'] : "";
+$add = isset($_GET['add']) ? $_GET['add'] : "";
+$del = isset($_GET['del']) ? $_GET['del'] : "";
+$ddu = isset($_GET['ddu']) ? $_GET['ddu'] : "";
+$dvl = isset($_GET['dvl']) ? $_GET['dvl'] : "";
+$ndu = isset($_GET['ndu']) ? $_GET['ndu'] : "";
+$nvl = isset($_GET['nvl']) ? $_GET['nvl'] : "";
+$dbw = isset($_GET['dbw']) ? $_GET['dbw'] : "";
+$nbw = isset($_GET['nbw']) ? $_GET['nbw'] : "";
+$typ = isset($_GET['typ']) ? $_GET['typ'] : "";
+
+$lde = "Added $now by $_SESSION[user]";
+$link  = @DbConnect($dbhost,$dbuser,$dbpass,$dbname);
+?>
+<h2><?=($typ)?$typ:$dv?> - Links</h2>
+<table class="content" ><tr class="<?=$modgroup[$self]?>2">
+<th><img src="img/16/dev.png"><br>Device</th>
+<th><img src="img/16/port.png"><br>Interface</th>
+<th><img src="img/16/abc.png" title="D=Discovery Protocol,O=Oui,V=VoIP,S=static"><br><?=$typlbl?></th>
+<th><img src="img/16/tap.png"><br><?=$bwdlbl?></th>
+<th><img src="img/16/dev.png"><br><?=$neblbl?></th>
+<th><img src="img/16/port.png"><br>Interface</th>
+<th><img src="img/16/say.png"><br><?=$cmtlbl?></th>
+<th width="80"><img src="img/16/cog.png"><br><?=$cmdlbl?></th></tr>
+</tr>
+<?
+       $query  = GenQuery('links','s','*','ifname','',array('device'),array('='),array($dv));
+       $res    = @DbQuery($query,$link);
+       if($res){
+               $nli = 0;
+               $row = 0;
+               while( ($l = @DbFetchRow($res)) ){
+                       $ud = rawurlencode($l[1]);
+                       $un = rawurlencode($l[3]);
+                       if ($row % 2){$bg = "txta"; $bi = "imga";}else{$bg = "txtb"; $bi = "imgb";}
+                       $row++;
+                       echo "<tr class=\"$bg\" onmouseover=\"this.className='imga'\" onmouseout=\"this.className='$bg'\">\n";
+                       echo "<td><a href=\"Devices-Status.php?dev=$ud\"><img src=\"img/16/sys.png\"></a>\n";
+                       echo " <a href=?dv=$ud>$l[1]</a></td><td>$l[2]</td>\n";
+                       echo "<th>$l[6]</th>\n";
+                       echo "<td align=right>" . DecFix($l[5]) . "</td>\n";
+                       echo "<td><a href=\"Devices-Status.php?dev=$un\"><img src=\"img/16/sys.png\"></a>\n";
+                       echo " <a href=?dv=$un>$l[3]</a></td><td>$l[4] (Vlan$l[9] $l[8])</td><td>$l[7]</td>\n";
+                       echo "<th><a href=?del=$l[0]&dv=$ud><img src=\"img/16/bcnl.png\" onclick=\"return confirm('Link $l[0] $dellbl?');\" title=\"$l[0] $dellbl\"></
+                       $nli++;
+               }
+               @DbFreeResult($res);
+       }else{
+               print @DbError($link);
+       }
+       ?>
+</table>
+<table class="content" >
+<tr class="<?=$modgroup[$self]?>2"><td><?=$row?> Links</td></tr>
+</table>
+       <?
+//}
+include_once ("inc/footer.php");
+?>


Bye

5
Discovery / problem with backup conf
« on: March 14, 2012, 05:35:13 PM »
Hello,
I'm still testinf nedi 1.0.7 and i have some problems.

My network ingineer ask me to backup conf every 2 hour (we have about 160 switches and routers).
Each time i ran nedi.pl -pobv or nedi.pl -poBv  there is always one or more switches which backup is not complete.
????

Here some parts of nedi output:

Code: [Select]
#20120314:1517 start # ./nedi.pl -pobv
Started with relative path!
PTY :Loaded
LWP :Loaded
OUI :19777 NIC vendor entries read
RDEV:270 devices read from nedi.devices
RADDR:6744 MAC & 570 IP addresses read.
RLNK:0 links (WHERE linktype = "STAT") read from nedi.links
RUSR:6 entries (groups & 8 AND (phone != "" OR email != "")) read from nedi.users

... / ...

Discover     ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Identify     ------------------------------------------------------------------
SNMP:Connect 172.xx.xxx.x community v2 Tout:5s MaxMS:1472
IDNT:Name = SWNAME
SYS :Con= Loc=XXXX;YYYY;VVVV;ZZZZ
SYS :OS=IOS SV=78 TY=SW-C6509-VSS-IOS
DISC:no skipif policy using -S ()

... / ...

Config (CLI)   ----------------------------------------------------------------
SSH :nedi:22 Tout:5s OS:IOS EN:(.+?)#\s?$
PTY :Forking ssh -o 'StrictHostKeyChecking no' -l nedi 172.17.105.1
CLI2:Matched Password:, sending password
CLI3:Password sent
CLI8:Matched enable prompt, OK
CMD :terminal length 0:
CMD :show run
WAIT:Building configuration...
WAIT:
CONF:Current configuration : 89233 bytes
CONF:
... / ...
CONF:interface Port-channel360
CONF:1024 lines read
WCFG:Config changed by 80470 characters:
1025-  description ### xxxxxxxxxxxxxxxxx ###
1026-  switchport
... / ...
3473- !
3474-
3475- end


MLQ :admin+ SWNAME: Config changed by 80470 characters:
1025-  description ### ------------------- ###
1026-  switchport
... / ...
3473- !
3474-
3475- end

DevRRD       ------------------------------------------------------------------
... / ...
Config (CLI)   ----------------------------------------------------------------
SSH :nedi:22 Tout:5s OS:IOS EN:(.+?)#\s?$
PTY :Forking ssh -o 'StrictHostKeyChecking no' -l nedi 172.xxx.yyy.zzz
CLI2:Matched Password:, sending password
CLI3:Password sent
CLI8:Matched enable prompt, OK
CMD :terminal length 0:
CMD :show run
WAIT:Building configuration...
WAIT:
CONF:Current configuration : 19172 bytes
... / ...
CONF:!
CONF:interface FastEthernet0/22
CONF:395 lines read
WCFG:Config changed by 11692 characters:
 396-  description ### vers prise ###
...


Thank you for our help.

6
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

7
# 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


8
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;
  }

9
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');
}
?>

10
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

11
# 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

12
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

13
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]