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
1
Installation / Re: nedi on ubuntu server 14.04 - no backups
« on: July 22, 2014, 10:01:41 AM »
Hi All,
I've migrated from ubuntu 12.04 64bits to Ubuntu 14.04 64bits, and i have de same problem.
I've search a lot and i find a workarround. I've modify the file "inc/libcli.pm" at line 488 like this:
Code: [Select]
#my $inlog  = $main::opt{'d'}?'input.log':'';
#my $outlog = $main::opt{'d'}?'output.log':'';
my $inlog  = 'input.log';
my $outlog = 'output.log';

I hope this help for correctly correct this problem.

Bye
Richard

2
Discovery / Re: vrfName disappeared
« on: February 10, 2014, 10:49:07 AM »
Hi,
Remo, i confirm that the problem was in the VSS.def.


Tx
richard

3
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

4
Discovery / Re: vrfName disappeared
« on: February 07, 2014, 10:24:39 AM »
Hi,
For a complete information i've a nedi 1.0.7 running in production, i'm testing 1.0.9 for prod replacement, so i can compare the result.

In the networks table, it seems that all network are not report.

I've test the oid 1.3.6.1.3.118.1.2.1.1.6 against our VSS and it work fine.

I've run a nei.pl -va and i did not find any reference at all to VRF.

it appear like if the vrfname collect was never called.

Tx
richard

5
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

6
Discovery / Re: vrfName disappeared
« on: February 05, 2014, 12:35:53 PM »
Hi remo,

for information in the table «networks», the fields «vrfname» and «status» are set to NULL for all records.

What can i do to fix it ?
Is there a way i can help you ?

Tx
Richard

7
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

8
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

9
Other / Re: IP address management
« on: March 16, 2012, 12:27:52 PM »
Code: [Select]
<?php
/*
#============================================================================
# Program: Topology-Networks.php
# Programmer: Remo Rickli
#
# DATE COMMENT
# -----------------------------------------------------------
# 04/07/07 initial version.
# 30/08/07 implemented CSS scheme
# 20/09/07 implemented language support
*/

$printable 1;

include_once (
"inc/header.php");
include_once (
"inc/libdev.php");
include_once (
"inc/libdb-rl.php");

$_GET sanitize($_GET);
$sta = isset($_GET['sta']) ? $_GET['sta'] : "";
$stb = isset($_GET['stb']) ? $_GET['stb'] : "";
$ina = isset($_GET['ina']) ? $_GET['ina'] : "";
$inb = isset($_GET['inb']) ? $_GET['inb'] : "";
$opa = isset($_GET['opa']) ? $_GET['opa'] : "";
$opb = isset($_GET['opb']) ? $_GET['opb'] : "";
$cop = isset($_GET['cop']) ? $_GET['cop'] : "";
$ord = isset($_GET['ord']) ? $_GET['ord'] : "";
$col = isset($_GET['col']) ? $_GET['col'] : array('vrfname','network','mask','devices','population');

$cols = array( "vrfname"=>"Vrf",
"network"=>"Network",
"mask"=>$msklbl,
"devices"=>"Devices",
"population"=>$poplbl
);
?>

<h1><?=$netlbl?> <?=$lstlbl?></h1>
<form method="get" name="list" action="<?=$self?>.php">
<table class="content"><tr class="<?=$modgroup[$self]?>1">
<th width="80"><a href="<?=$self?>.php"><img src="img/32/<?=$selfi?>.png"></a></th>
<th valign="top"><?=$cndlbl?> A<p>
<SELECT size="1" name="ina">
<?
//foreach ($cols as $k => $v){
       //echo "<option value=\"$k\"".( ($ina == $k)?"selected":"").">$v\n";
       echo "<option value=\"vrfname\"".( ($ina == 'vrfname')?"selected":"").">Vrf\n";
       echo "<option value=\"network\"".( ($ina == 'network')?"selected":"").">Network\n";
//}
?>
</SELECT>
<SELECT size="1" name="opa">
<? selectbox("oper",$opa);?>
</SELECT>
<p>
<input type="text" name="sta" value="<?=$sta?>" size="20">
</th>
<th valign="top"><?=$dislbl?><p>
<SELECT MULTIPLE name="col[]" size=4>
<?
foreach ($cols as $k => $v){
       echo "<option value=\"$k\"".((in_array($k,$col))?"selected":"").">$v\n";
}
?>
</SELECT>
</th>
<th width="80"><input type="submit" value="<?=$sholbl?>"></th>
</tr></table></form><p>
<?
if ($ina){
?>
<table class="content"><tr class="<?=$modgroup[$self]?>2">
<?
foreach($col as $h){
ColHead($h);
}
echo "</tr>\n";

$link = @DbConnect($dbhost,$dbuser,$dbpass,$dbname);
$query = GenQuery2('networks','x',"group_concat(distinct vrfname) as vrfname,ifip&mask as network, mask as mask,group_concat(distinct concat(device,' (',ifname,')')) as devices",$ord,'',array($ina,''),array($opa,''),array($sta,''),array('')  );
//$query = "SELECT group_concat(distinct vrfname) as vrfname,ifip&mask as network, mask as mask,group_concat(distinct concat(device,' (',ifname,')')) as devices FROM networks GROUP BY inet_ntoa(ifip&mask) ".($ord ? "ORDER BY $ord" : '');
$res = @DbQuery($query,$link);
if($res){
$row = 0;
while( ($m = @DbFetchArray($res)) ){
if ($row % 2){$bg = "txta"; $bi = "imga";}else{$bg = "txtb"; $bi = "imgb";}
$row++;
echo "<tr class=\"$bg\">";
if(in_array("vrfname",$col)){echo "<td>{$m['vrfname']}</td>\n";}
if(in_array("network",$col)){echo "<td>".long2ip($m['network'])."</td>";}
if(in_array("mask",$col)){echo "<td>".long2ip($m['mask'])."</td>";}
if(in_array("devices",$col)){echo "<td>{$m['devices']}</td>";}
if(in_array("population",$col)){echo "<td><a href=\"Reports-Interfaces.php?ina=devip&opa=regexp&sta=".long2ip($m['network'])."%2F".substr_count(decbin($m['mask']),'1')."&rep[]=pop&lim=10&do=Show\"><img src=\"img/16/nods.png\"></a></td>";}
echo "</tr>\n";
}
@DbFreeResult($res);
}else{
print @DbError($link);
}
?>
</table>
<table class="content">
<!--<tr class="<?=$modgroup[$self]?>2"><td><?=$row?> <?=$vallbl?><br> (<?=$query?>)<br>(<?=$query2?>)</td></tr>-->
<tr class="<?=$modgroup[$self]?>2"><td><?=$row?> <?=$vallbl?><br> (<?=$query?>)</td></tr>
</table>
<?
}
include_once ("inc/footer.php");
?>

---

Code: [Select]
<?php
//===============================
// mySQL functions.
//===============================

function GenQuery2($tab,$do='s',$col='*',$ord='',$lim='',$in=array(),$op=array(),$st=array(),$co=array() ,$leftkey=array()){

if($do == 'i'){
return "INSERT INTO $tab ("implode(',',$in) .") VALUES (\""implode('","',$st) ."\")";
}elseif($do == 'u'){
if( $in[0] ){
$x 0;
foreach ($in as $c){
if($c){$s[]="$c=\"$st[$x]\"";}
$x++;
}
return "UPDATE $tab SET "implode(',',$s) ." WHERE $col=\"$ord\"";
}
}elseif($do ==  't'){
$lt = ($tab)?"LIKE \"$tab\"":"";
return "SHOW TABLES $lt";
}elseif($do == 'c'){
return "SHOW COLUMNS FROM $tab";
}else{
$l = ($lim) ? "LIMIT $lim"";
if($ord == 'ifname'){
$od "ORDER BY device,SUBSTRING_INDEX(ifname, '/', 1), SUBSTRING_INDEX(ifname, '/', -1)*1+0";
}elseif($ord == 'ifname desc'){
$od "ORDER BY device desc,SUBSTRING_INDEX(ifname, '/', 1), SUBSTRING_INDEX(ifname, '/', -1)*1+0";
}elseif($ord){
$od "ORDER BY $ord";
}else{
$od "";
}
if( isset($st[0]) and $st[0] != ""  ){
$w "WHERE";
$x 0;
do{
$cop = isset($co[$x]) ? $co[$x] : "";
if($op[$x]){
$c $in[$x];
$v $st[$x];
$o $op[$x];
if( preg_match("/^(firstseen|lastseen|time|i[fp]update)$/",$c) and !preg_match("/^[0-9]+$/",$v) ){
$v strtotime($v);
}elseif($c == 'mac'){
$v preg_replace("/[.:-]/",""$v);
}elseif($c == 'ips'||$c=='network'){
$c "inet_ntoa(ifip&mask)";
}elseif(preg_match("/^(origip|ip)$/",$c) and !preg_match('/^[0-9]+$/',$v) ){
if( strstr($v,'/') ){
list($ip$prefix) = explode('/'$v);
$dip sprintf("%u"ip2long($ip));
$dmsk 0xffffffff << (32 $prefix);
$dnet sprintf("%u"ip2long($ip) & $dmsk );
$c "$c & $dmsk";
$v $dnet;
}else{
$v sprintf("%u"ip2long($v));
}
}
if( strpos($op[$x],'CI') ){
$c "LCASE($in[$x])";
$o substr($op[$x],0,-2);
}
if(strpos($op[$x],'exp') and $v == '' ){$v '.';}
$w .= $c $o \"$v\" $cop";
}
$x++;
}while($cop);
}elseif( isset($co[0]) and $co[0] != "" ){
$w "WHERE $in[0] $co[0] $in[1]";
}else{
$w "";
}
if($do == 'd'){
return "DELETE FROM $tab $w $od $l";
}elseif($do == 'g'){
return "SELECT $col,count(*) FROM  $tab $w GROUP BY $col $od $l";
}elseif($do == 'a'){
return "SELECT ".(($col != '*')?"$col,":"")."count(*),avg($lim) as avg FROM  $tab $w".(($col != '*')?"GROUP BY $col":"").$od";
}elseif($do == 'm'){
return "SELECT ".(($col != '*')?"$col,":"")."count(*),sum($lim) as sum FROM  $tab $w".(($col != '*')?"GROUP BY $col":"").$od;";
}elseif($do == 'x'){
return "SELECT ".(($col != '*')?"$col":"")." FROM  $tab $w  GROUP BY inet_ntoa(ifip&mask)  ".(($od!='') ? "$od""ORDER BY vrfname");
}elseif($do == 'z'){
return "SELECT ".(($col != '*')?"$col":"")." FROM  $tab $w  GROUP BY vlanid  ".(($od!='') ? "$od""ORDER BY vlanid");
}else{
if (is_array($tab)){
$inner_str $tab[0]." t0";
for($i=1$i<count($tab); $i++){
$ii $i-1;
$inner_str .= " INNER JOIN {$tab[$i]} t$i ON t0.{$leftkey[$ii]}=t$i.{$leftkey[$ii]}";
}
return "SELECT $col FROM $inner_str $w $od $l";
}else{
return "SELECT $col FROM $tab $w $od $l";
}
}
}
}
?>


10
Other / Re: IP address management
« on: March 16, 2012, 09:57:29 AM »
hello paolo,
By testing some new thing i've made few mistakes.

Here is the patch:
Code: [Select]
diff --git a/html/Reports-Networks.php b/html/Reports-Networks.php
index b4f7950..4fa1ea9 100644
--- a/html/Reports-Networks.php
+++ b/html/Reports-Networks.php
@@ -77,8 +77,8 @@ if ($ina){
        echo "</tr>\n";
 
        $link   = @DbConnect($dbhost,$dbuser,$dbpass,$dbname);
-       $query  = GenQuery2('networks','x',"group_concat(distinct vrfname) as vrfname,inet_ntoa(ifip&mask) as network, inet_ntoa(mask) as mask,group_concat(distinct c
-       $query  = "SELECT group_concat(distinct vrfname) as vrfname,ifip&mask as network, mask as mask,group_concat(distinct concat(device,' (',ifname,')')) as device
+       $query  = GenQuery2('networks','x',"group_concat(distinct vrfname) as vrfname,ifip&mask as network, mask as mask,group_concat(distinct concat(device,' (',ifna
+       //$query        = "SELECT group_concat(distinct vrfname) as vrfname,ifip&mask as network, mask as mask,group_concat(distinct concat(device,' (',ifname,')')) a
        $res    = @DbQuery($query,$link);
        if($res){
                $row = 0;
diff --git a/html/inc/libdb-rl.php b/html/inc/libdb-rl.php
index 5b11466..60daa88 100644
--- a/html/inc/libdb-rl.php
+++ b/html/inc/libdb-rl.php
@@ -46,7 +46,7 @@ function GenQuery2($tab,$do='s',$col='*',$ord='',$lim='',$in=array(),$op=array()
                                        }elseif($c == 'mac'){
                                                $v = preg_replace("/[.:-]/","", $v);
                                        }elseif($c == 'ips'||$c=='network'){
-                                               $c = "inet_ntoa(ip)";
+                                               $c = "inet_ntoa(ifip&mask)";
                                        }elseif(preg_match("/^(origip|ip)$/",$c) and !preg_match('/^[0-9]+$/',$v) ){
                                                if( strstr($v,'/') ){
                                                        list($ip, $prefix) = explode('/', $v);


Richard

11
Other / Re: IP address management
« on: March 15, 2012, 02:23:13 PM »
Hello,
Ooups, i forgot to delete this line.
You can detele this include line.

In case of ...
The libdb-rl.php is use only to generate the SQL query ($query) in the script.

if you want to use my original code, replace the line $query= .... by
Code: [Select]
$query = GenQuery2('networks','x',"group_concat(distinct vrfname) as vrfname,inet_ntoa(ifip&mask) as network, inet_ntoa(mask) as mask,group_concat(distinct concat(device,' (',ifname,')')) as devices",$ord,'',array($ina,''),array($opa,''),array($sta,''),array('')  );
here is the code of libdb-rl.php
This lib provide a modification of the function GenQuery of the standard libdb-msq.php



Code: [Select]
<?php
/*
#============================================================================
# Program: libdb-rl.php
# Programmer: Richard Lajaunie
#
*/
function GenQuery2($tab,$do='s',$col='*',$ord='',$lim='',$in=array(),$op=array(),$st=array(),$co=array() ,$leftkey=array()){

if($do == 'i'){
return "INSERT INTO $tab ("implode(',',$in) .") VALUES (\""implode('","',$st) ."\")";
}elseif($do == 'u'){
if( $in[0] ){
$x 0;
foreach ($in as $c){
if($c){$s[]="$c=\"$st[$x]\"";}
$x++;
}
return "UPDATE $tab SET "implode(',',$s) ." WHERE $col=\"$ord\"";
}
}elseif($do ==  't'){
$lt = ($tab)?"LIKE \"$tab\"":"";
return "SHOW TABLES $lt";
}elseif($do == 'c'){
return "SHOW COLUMNS FROM $tab";
}else{
$l = ($lim) ? "LIMIT $lim"";
if($ord == 'ifname'){
$od "ORDER BY device,SUBSTRING_INDEX(ifname, '/', 1), SUBSTRING_INDEX(ifname, '/', -1)*1+0";
}elseif($ord == 'ifname desc'){
$od "ORDER BY device desc,SUBSTRING_INDEX(ifname, '/', 1), SUBSTRING_INDEX(ifname, '/', -1)*1+0";
}elseif($ord){
$od "ORDER BY $ord";
}else{
$od "";
}
if( isset($st[0]) and $st[0] != ""  ){
$w "WHERE";
$x 0;
do{
$cop = isset($co[$x]) ? $co[$x] : "";
if($op[$x]){
$c $in[$x];
$v $st[$x];
$o $op[$x];
if( preg_match("/^(firstseen|lastseen|time|i[fp]update)$/",$c) and !preg_match("/^[0-9]+$/",$v) ){
$v strtotime($v);
}elseif($c == 'mac'){
$v preg_replace("/[.:-]/",""$v);
}elseif($c == 'ips'||$c=='network'){
$c "inet_ntoa(ip)";
}elseif(preg_match("/^(origip|ip)$/",$c) and !preg_match('/^[0-9]+$/',$v) ){
if( strstr($v,'/') ){
list($ip$prefix) = explode('/'$v);
$dip sprintf("%u"ip2long($ip));
$dmsk 0xffffffff << (32 $prefix);
$dnet sprintf("%u"ip2long($ip) & $dmsk );
$c "$c & $dmsk";
$v $dnet;
}else{
$v sprintf("%u"ip2long($v));
}
}
if( strpos($op[$x],'CI') ){
$c "LCASE($in[$x])";
$o substr($op[$x],0,-2);
}
if(strpos($op[$x],'exp') and $v == '' ){$v '.';}
$w .= $c $o \"$v\" $cop";
}
$x++;
}while($cop);
}elseif( isset($co[0]) and $co[0] != "" ){
$w "WHERE $in[0] $co[0] $in[1]";
}else{
$w "";
}
if($do == 'd'){
return "DELETE FROM $tab $w $od $l";
}elseif($do == 'g'){
return "SELECT $col,count(*) FROM  $tab $w GROUP BY $col $od $l";
}elseif($do == 'a'){
return "SELECT ".(($col != '*')?"$col,":"")."count(*),avg($lim) as avg FROM  $tab $w".(($col != '*')?"GROUP BY $col":"").$od";
}elseif($do == 'm'){
return "SELECT ".(($col != '*')?"$col,":"")."count(*),sum($lim) as sum FROM  $tab $w".(($col != '*')?"GROUP BY $col":"").$od;";
}elseif($do == 'x'){
return "SELECT ".(($col != '*')?"$col":"")." FROM  $tab $w  GROUP BY inet_ntoa(ifip&mask)  ".(($od!='') ? "$od""ORDER BY vrfname");
}elseif($do == 'z'){
return "SELECT ".(($col != '*')?"$col":"")." FROM  $tab $w  GROUP BY vlanid  ".(($od!='') ? "$od""ORDER BY vlanid");
}else{
if (is_array($tab)){
$inner_str $tab[0]." t0";
for($i=1$i<count($tab); $i++){
$ii $i-1;
$inner_str .= " INNER JOIN {$tab[$i]} t$i ON t0.{$leftkey[$ii]}=t$i.{$leftkey[$ii]}";
}
return "SELECT $col FROM $inner_str $w $od $l";
}else{
return "SELECT $col FROM $tab $w $od $l";
}
}
}
}
?>



bye
Richard

12
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.

13
Other / Re: IP address management
« on: March 14, 2012, 03:11:17 PM »
Hello,
In my compagny we've decide to add a new report to list all network.
Here is the code:
Code: [Select]
<?php
/*
#============================================================================
# Program: Reports-Networks.php
# Programmer: Richard Lajaunie
#
*/

$printable 1;

include_once (
"inc/header.php");
include_once (
"inc/libdev.php");
include_once (
"inc/libdb-rl.php");

$_GET sanitize($_GET);
$sta = isset($_GET['sta']) ? $_GET['sta'] : "";
$stb = isset($_GET['stb']) ? $_GET['stb'] : "";
$ina = isset($_GET['ina']) ? $_GET['ina'] : "";
$inb = isset($_GET['inb']) ? $_GET['inb'] : "";
$opa = isset($_GET['opa']) ? $_GET['opa'] : "";
$opb = isset($_GET['opb']) ? $_GET['opb'] : "";
$cop = isset($_GET['cop']) ? $_GET['cop'] : "";
$ord = isset($_GET['ord']) ? $_GET['ord'] : "";
$col = isset($_GET['col']) ? $_GET['col'] : array('vrfname','network','mask','devices','population');

$cols = array( "vrfname"=>"Vrf",
"network"=>"Network",
"mask"=>$msklbl,
"devices"=>"Devices",
"population"=>$poplbl
);
?>

<h1><?=$netlbl?> <?=$lstlbl?></h1>
<form method="get" name="list" action="<?=$self?>.php">
<table class="content"><tr class="<?=$modgroup[$self]?>1">
<th width="80"><a href="<?=$self?>.php"><img src="img/32/<?=$selfi?>.png"></a></th>
<th valign="top"><?=$cndlbl?> A<p>
<SELECT size="1" name="ina">
<?
       echo "<option value=\"vrfname\"".( ($ina == 'vrfname')?"selected":"").">Vrf\n";
       echo "<option value=\"network\"".( ($ina == 'network')?"selected":"").">Network\n";
?>
</SELECT>
<SELECT size="1" name="opa">
<? selectbox("oper",$opa);?>
</SELECT>
<p>
<input type="text" name="sta" value="<?=$sta?>" size="20">
</th>
<th valign="top"><?=$dislbl?><p>
<SELECT MULTIPLE name="col[]" size=4>
<?
foreach ($cols as $k => $v){
       echo "<option value=\"$k\"".((in_array($k,$col))?"selected":"").">$v\n";
}
?>
</SELECT>
</th>
<th width="80"><input type="submit" value="<?=$sholbl?>"></th>
</tr></table></form><p>
<?
if ($ina){
?>
<table class="content"><tr class="<?=$modgroup[$self]?>2">
<?
foreach($col as $h){
ColHead($h);
}
echo "</tr>\n";

$link = @DbConnect($dbhost,$dbuser,$dbpass,$dbname);
$query = "SELECT group_concat(distinct vrfname) as vrfname,ifip&mask as network, mask as mask,group_concat(distinct concat(device,' (',ifname,')')) as devices FROM networks GROUP BY inet_ntoa(ifip&mask) ".($ord ? "ORDER BY $ord" : '');
$res = @DbQuery($query,$link);
if($res){
$row = 0;
while( ($m = @DbFetchArray($res)) ){
if ($row % 2){$bg = "txta"; $bi = "imga";}else{$bg = "txtb"; $bi = "imgb";}
$row++;
echo "<tr class=\"$bg\">";
if(in_array("vrfname",$col)){echo "<td>{$m['vrfname']}</td>\n";}
if(in_array("network",$col)){echo "<td>".long2ip($m['network'])."</td>";}
if(in_array("mask",$col)){echo "<td>".long2ip($m['mask'])."</td>";}
if(in_array("devices",$col)){echo "<td>{$m['devices']}</td>";}
if(in_array("population",$col)){echo "<td><a href=\"Reports-Interfaces.php?ina=devip&opa=regexp&sta=".long2ip($m['network'])."%2F".substr_count(decbin($m['mask']),'1')."&rep[]=pop&lim=10&do=Show\"><img src=\"img/16/nods.png\"></a></td>";}
echo "</tr>\n";
}
@DbFreeResult($res);
}else{
print @DbError($link);
}
?>
</table>
<table class="content">
<tr class="<?=$modgroup[$self]?>2"><td><?=$row?> <?=$vallbl?><br> (<?=$query?>)</td></tr>
</table>
<?
}
include_once ("inc/footer.php");
?>


 ;)

14
Discovery / Re: VSS
« on: February 28, 2012, 02:35:10 PM »
Hi Everyone,
here is def file we use with nedi 1.0.7 :


# Definition for 1.3.6.1.4.1.9.1.896 created by Defgen 1.8 on 28.Feb 2012 (admin)

# General
SNMPv   2HC
Type   SW-C6509-VSS-IOS
Typoid   
Sysdes   
OS   IOS
Icon   c3bd
Bridge   VLX
Dispro   CDP
Serial   1.3.6.1.2.1.47.1.1.1.1.11.2
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
VLnamx   
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
IFname   1.3.6.1.2.1.31.1.1.1.1
IFalia   1.3.6.1.4.1.9.2.2.1.1.28
IFalix   
InBcast   1.3.6.1.2.1.31.1.1.1.3
InDisc   1.3.6.1.2.1.2.2.1.13
OutDisc   1.3.6.1.2.1.2.2.1.19
IFvlan   1.3.6.1.4.1.9.9.68.1.2.2.1.2
IFvlix   
IFpowr   
IFpwix   
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      


and this is the snmp configuration running ont he VSS:


interface Vlan1234
description DESCRIPTION
ip vrf forwarding VRFNAME
ip address 172.17.105.1 255.255.255.0
ip helper-address 1...1
ip helper-address 10...0
ip helper-address 2...0




snmp-server community CommunityName RW
snmp-server community public view vss-view RO
snmp-server trap-source Vlan1234
snmp-server source-interface informs Vlan1234
snmp-server location your;geographic;switch;location
snmp-server host AA.BB.CC.DD vrf VRFNAME CommunityName


and of course the Nedi machine have network access throught the firewall

I hope this help.

15
Discovery / Re: Many Perl errors during discover
« on: February 23, 2012, 09:55:24 AM »
Hello Remo,
thank you for your help.

Discovery work perfectly :D.


Pages: [1] 2