source: ocsinventory-agent/trunk/fuentes/lib/Ocsinventory/Agent/Backend/OS/Linux/Network/IPv4.pm @ 468

Last change on this file since 468 was 468, checked in by mabarracus, 4 years ago

Copyt trusty code

File size: 413 bytes
Line 
1package Ocsinventory::Agent::Backend::OS::Linux::Network::IPv4;
2
3sub check {
4  return unless can_run ("ifconfig");
5  1;
6}
7
8# Initialise the distro entry
9sub run {
10  my $params = shift;
11  my $common = $params->{common};
12  my @ip;
13  foreach (`ifconfig`){
14    if(/^\s*inet add?r\s*:\s*(\S+)/){
15      ($1=~/127.+/)?next:push @ip, $1
16    };
17  }
18
19  my $ip=join "/", @ip;
20
21  $common->setHardware({IPADDR => $ip});
22}
23
241;
Note: See TracBrowser for help on using the repository browser.