[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Un peu HS] Affcher l'adresse IP sous SuperKaramba



Bonsoir

J'utilise un thème de superkaramba et je voudrais afficher mon IP mais ça ne marche pas

Voici la ligne qui doit donner l'IP

text x=80 y=200 sensor=program program="/sbin/ip addr show eth0 | grep 'inet ' | cut -d t -f2 | cut -d / -f1 | cut -b 2-" color=255,255,255 font="Neuropol" fontsize=11

J'ai aussi trouvé un autre petit programme que voici

#!/usr/bin/perl

$net = `/sbin/ifconfig | grep 'eth0'`;
if (length($net))
{
	$net = `/sbin/ifconfig eth0 | grep 'inet addr'`;
	if (!length($net))
	{
	   $net = `/sbin/ifconfig eth0 | grep 'inet end.'`;
	}
	if (length($net))
	{
	   chop($net);
	   @netip = split/:/,$net;
	   $netip[1] =~ /(\d{1,3}).(\d{1,3}).(\d{1,3}).(\d{1,3})/;
	   $ip = $1 .".". $2 .".". $3 .".". $4;
	   print "". $ip ."\n";
	}
	else
	{
	   print "Not Found\n";
	}
}
else
{
   print "Error\n";
}

La première ligne me donne l'adresse mac de ma carte réseau mais rien pour les autres ligne de recherche avec ifconfig.

Je voudrais bien un peu d'aide si quelqu'un a une idée sur ce petit problème.

merci


--
Cyrille Maiche

Debian Etch 2.6.15

------------------------------------
http://clcr94.clg.ac-creteil.fr
------------------------------------



Reply to: