Merge lp:~pakdel-gmail/ocsinventory-unix-agent/hpux into lp:ocsinventory-unix-agent

Proposed by Amir Pakdel
Status: Needs review
Proposed branch: lp:~pakdel-gmail/ocsinventory-unix-agent/hpux
Merge into: lp:ocsinventory-unix-agent
Diff against target: 1163 lines (+467/-409)
19 files modified
lib/Ocsinventory/Agent/Backend.pm (+1/-1)
lib/Ocsinventory/Agent/Backend/OS/Generic/Processes.pm (+2/-2)
lib/Ocsinventory/Agent/Backend/OS/HPUX.pm (+30/-11)
lib/Ocsinventory/Agent/Backend/OS/HPUX/Bios.pm (+29/-38)
lib/Ocsinventory/Agent/Backend/OS/HPUX/CPU.pm (+55/-76)
lib/Ocsinventory/Agent/Backend/OS/HPUX/Controller.pm (+1/-1)
lib/Ocsinventory/Agent/Backend/OS/HPUX/Drives.pm (+44/-48)
lib/Ocsinventory/Agent/Backend/OS/HPUX/IPv4.pm (+0/-28)
lib/Ocsinventory/Agent/Backend/OS/HPUX/Mem.pm (+0/-28)
lib/Ocsinventory/Agent/Backend/OS/HPUX/Memory.pm (+77/-79)
lib/Ocsinventory/Agent/Backend/OS/HPUX/Networks.pm (+122/-87)
lib/Ocsinventory/Agent/Backend/OS/HPUX/README (+2/-3)
lib/Ocsinventory/Agent/Backend/OS/HPUX/Slots.pm (+2/-2)
lib/Ocsinventory/Agent/Backend/OS/HPUX/Software.pm (+2/-2)
lib/Ocsinventory/Agent/Backend/OS/HPUX/Storages.pm (+1/-1)
lib/Ocsinventory/Agent/Backend/OS/HPUX/Uptime.pm (+29/-0)
lib/Ocsinventory/Agent/Backend/OS/Linux/Network/iLO.pm (+66/-0)
lib/Ocsinventory/Agent/Backend/OS/Linux/Storages.pm (+2/-2)
lib/Ocsinventory/Agent/XML/Inventory.pm (+2/-0)
To merge this branch: bzr merge lp:~pakdel-gmail/ocsinventory-unix-agent/hpux
Reviewer Review Type Date Requested Status
OCS Inventory Dev Team Pending
Review via email: mp+25581@code.launchpad.net

Description of the change

Swapped "Type" and "File System" in HP-UX/Drives

To post a comment you must log in.
Revision history for this message
Amir Pakdel (pakdel-gmail) wrote :

Any testing yet?

Revision history for this message
mortheres (mortheres) wrote :

Hi Amir,

Yes we are currently testing and specially the 'uname' command that does not works as expected.
Dwizz (ake François) has made some tests and he got unwanted outputs from the uname command on HPUX version
11.0, 11.11 and 11.23. This is the kind of outputs he got :

uname -v -> result is : U
uname -r -> result is : B.11.00

> Any testing yet?

Revision history for this message
dwizz (dwizz-donowin) wrote :

I have find the same information in the hp documentation

(in french)

for the version, they use the uname -r (extract of the documentation. I done the traduction after)

http://docs.hp.com/fr/5187-0193/ch02s04.html
Pour identifier la version du système d’exploitation installée sur votre système, entrez :
uname -r
Après avoir procédé à l’installation standard de HP-UX 11i v1.6, vous remarquerez que la commande uname identifie la version 11i sous le numéro B.11.22.

traduction:
For identification of the operating system installed on your system, press:
uname -r
After you have done standard installation of Hp-Ux 11i v1.6, you can see that the command uname indentify the version
11i under the number B.11.22

So i think the man is wrong and it's beter to put the uname -r for version in the HPUX.pm

967. By Amir Pakdel <amir@WS1524O-PAK-Linux>

iLO is Integrated Lights-Out which is Management Interface of HP ProLiant servers

Revision history for this message
mortheres (mortheres) wrote :

Hi,

Is this problem solved now ? Can I merge Amir modifications into the trunk branch ?

Kind regards,

--
Guillaume

Revision history for this message
Amir Pakdel (pakdel-gmail) wrote :

Hi,

I have changed the code to use uname -r and committed.

Best regards,

Amir

On Thu, Jun 24, 2010 at 1:18 AM, mortheres
<email address hidden>wrote:

> Hi,
>
> Is this problem solved now ? Can I merge Amir modifications into the trunk
> branch ?
>
> Kind regards,
>
> --
> Guillaume
> --
>
> https://code.launchpad.net/~pakdel-gmail/ocsinventory-unix-agent/hpux/+merge/25581<https://code.launchpad.net/%7Epakdel-gmail/ocsinventory-unix-agent/hpux/+merge/25581>
> You are the owner of lp:~pakdel-gmail/ocsinventory-unix-agent/hpux.
>

Revision history for this message
Amir Pakdel (pakdel-gmail) wrote :

LinkedIn
------------

I'd like to add you to my professional network on LinkedIn.

- Amir

Amir Pakdel
System Administrator at Karafarin Bank
Iran

Confirm that you know Amir Pakdel
https://www.linkedin.com/e/sk0pgr-gbpacn0b-15/isd/1473385750/InNVNUwB/

------
(c) 2010, LinkedIn Corporation

Unmerged revisions

967. By Amir Pakdel <amir@WS1524O-PAK-Linux>

iLO is Integrated Lights-Out which is Management Interface of HP ProLiant servers

966. By Amir Pakdel <amir@WS1524O-PAK-Linux>

Swapped "Type" and "File System" (continued)

965. By Amir Pakdel <amir@WS1524O-PAK-Linux>

Swapped "Type" and "File System"
$type needed a chomp

964. By Amir Pakdel <amir@WS1524O-PAK-Linux>

Merely minor changes

963. By Amir Pakdel <amir@WS1524O-PAK-Linux>

Checks to be able to run model
Gets UUID

962. By Amir Pakdel <amir@WS1524O-PAK-Linux>

can_run now understands "no $binary in /usr/sbin...." which may be returned in HP-UX

961. By Amir Pakdel <amir@WS1524O-PAK-Linux>

lib/Ocsinventory/Agent/Backend/OS/HPUX/Networks.pm
To get the network status (up/down) it checks both lanadmin and ifconfig.

960. By Amir Pakdel <amir@WS1524O-PAK-Linux>

lib/Ocsinventory/Agent/Backend/OS/HPUX/Uptime.pm
Performs exactly as in Linux version

959. By Amir Pakdel <amir@WS1524O-PAK-Linux>

lib/Ocsinventory/Agent/Backend/OS/HPUX* related changes:

IPV4.pm
Moved its functionality to Networks.pm so that I could get network related
information in one place (since all are TCP/IP related data)
********************************************************************************
Mem.pm
/var/adm/syslog/syslog.log might be rotated
Total physical memory and swap are measured in Memory.pm
********************************************************************************
HPUX.pm
According to "man uname":
-r: Display the current release level of the operating system.
-v: Display the current version level of the operating system.
********************************************************************************
CPU.pm
According to Inventory.pm / setHardware()
The use of setHardware() to update USERID and PROCESSOR* informations is
deprecated, please, use addUser() and addCPU() instead.

If the last line of macinfo related to CPU in HPUX versions other than B11.23 is like "Cache info:", Please uncomment the "last" for speedup
********************************************************************************
Memory.pm
#please rename addMemories to addMemory()

echo 'sc product mem;il'| /usr/sbin/cstm
cstm>sc product mem;il
                ^-- Unknown list entry. --
The list entry (mem) is undefined.

                    ^-- (InfoLog) is currently disabled. --
********************************************************************************
Networks.pm
Renamed to Networks-Perl.pm so I can add Netwoks-lanadmin.pm to be run in case it failed
It does not need "Net::IP qw(:PROC)" anymore:
 none of my servers have that and the only subroutine used is ip_iptobin

Network interface speed and gateway are implemented
********************************************************************************
End of lib/Ocsinventory/Agent/Backend/OS/HPUX* related changes
********************************************************************************

Ocsinventory::Agent::Backend::OS::Linux::Storages
Added floppy detection
********************************************************************************
package Ocsinventory::Agent::XML::Inventory;
Added SPEED to addNetwork
********************************************************************************

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/Ocsinventory/Agent/Backend.pm'
--- lib/Ocsinventory/Agent/Backend.pm 2009-12-07 15:34:33 +0000
+++ lib/Ocsinventory/Agent/Backend.pm 2010-05-27 07:07:27 +0000
@@ -27,7 +27,7 @@
2727
28 my $calling_namespace = caller(0);28 my $calling_namespace = caller(0);
29 chomp(my $binpath=`which $binary 2>/dev/null`);29 chomp(my $binpath=`which $binary 2>/dev/null`);
30 return unless -x $binpath;30 return unless $binpath !~ /no $binary in/ or -x $binpath;
31 $self->{logger}->debug(" - $binary found");31 $self->{logger}->debug(" - $binary found");
32 132 1
33 },33 },
3434
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/Generic/Processes.pm'
--- lib/Ocsinventory/Agent/Backend/OS/Generic/Processes.pm 2010-05-05 19:31:57 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/Generic/Processes.pm 2010-05-27 07:07:27 +0000
@@ -30,9 +30,9 @@
30 $os=`uname -s`;30 $os=`uname -s`;
3131
32 if ($os eq "SunOS") {32 if ($os eq "SunOS") {
33 open(PS, "ps -A -o user,pid,pcpu,pmem,vsz,rss,tty,s,stime,time,comm|");33 open(PS, "ps -A -o user,pid,pcpu,pmem,vsz,rss,tty,s,stime,time,comm 2>/dev/null |");
34 } else {34 } else {
35 open(PS, "ps aux|");35 open(PS, "ps aux 2>/dev/null |");
36 }36 }
3737
38 while ($line = <PS>) {38 while ($line = <PS>) {
3939
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/HPUX.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX.pm 2010-01-22 14:39:51 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX.pm 2010-05-27 07:07:27 +0000
@@ -4,27 +4,46 @@
4use vars qw($runAfter);4use vars qw($runAfter);
5$runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"];5$runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"];
66
7sub check { $^O =~ /hpux/ }7sub check { $^O =~ /^hpux$/ }
88
9sub run {9sub run {
10 my $params = shift;10 my $params = shift;
11 my $inventory = $params->{inventory};11 my $inventory = $params->{inventory};
12 my $OSName;12 my $OSName;
13 my $OSVersion;13 my $OSVersion;
14 my $OSComment;14 my $OSRelease;
15 my $OSLicense;
15 #my $uname_path = &_get_path('uname');16 #my $uname_path = &_get_path('uname');
16 17
17 # Operating systeminformations18 # Operating system informations
18 19 chomp($OSName = `uname -s`); #It should allways be "HP-UX"
19 chomp($OSName = `uname -s`);20 chomp($OSVersion = `uname -v`);
20 chomp($OSVersion = `uname -r`);21 chomp($OSRelease = `uname -r`);
21 chomp($OSComment = `uname -l`);22 chomp($OSLicense = `uname -l`);
23
24 # Last login informations
25 my $LastLoggedUser;
26 my $LastLogDate;
27 my @query = runcmd("last");
28
29 while ( my $tempLine = shift @query) {
30 #if ( /^reboot\s+system boot/ ) { continue } #It should never be seen above a user login entry (I hope)
31 if ( $tempLine =~ /^(\S+)\s+\S+\s+(.+\d{2}:\d{2})\s+/ ) {
32 $LastLoggedUser = $1;
33 $LastLogDate = $2;
34 last;
35 }
36 }
37
38#TODO add grep `hostname` /etc/hosts
2239
23 $inventory->setHardware({40 $inventory->setHardware({
24 OSNAME => $OSName,41 OSNAME => $OSName,
25 OSCOMMENTS => $OSComment,42 OSVERSION => $OSVersion . ' ' . $OSLicense,
26 OSVERSION => $OSVersion,43 OSCOMMENTS => $OSRelease,
27 });44 LASTLOGGEDUSER => $LastLoggedUser,
45 DATELASTLOGGEDUSER => $LastLogDate
46 });
2847
29}48}
3049
3150
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/Bios.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/Bios.pm 2010-02-25 18:36:52 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/Bios.pm 2010-05-27 07:07:27 +0000
@@ -9,7 +9,7 @@
9#9#
10###10###
1111
12sub check { $^O =~ /hpux/ }12sub check { can_run ("model") }
1313
14sub run { 14sub run {
15 my $params = shift;15 my $params = shift;
@@ -19,49 +19,40 @@
19 my $BiosDate;19 my $BiosDate;
20 my $SystemModel;20 my $SystemModel;
21 my $SystemSerial;21 my $SystemSerial;
22 my $SystemUUID;
22 23
23 24
24 $SystemModel=`model`;25 $SystemModel=`model`;
25 if ( can_run ("machinfo") )26 if ( can_run ("/usr/contrib/bin/machinfo") ) {
26 {27 foreach ( `/usr/contrib/bin/machinfo` ) {
27 foreach ( `machinfo` )28 if ( /Firmware\s+revision\s+[:=]\s+(\S+)/ ) {
28 {29 $BiosVersion = $1;
29 if ( /Firmware\s+revision\s+[:=]\s+(\S+)/ )30 } elsif ( /achine\s+serial\s+number\s+[:=]\s+(\S+)/ ) {
30 {31 $SystemSerial = $1;
31 $BiosVersion=$1;32 } elsif (/achine\s+id\s+number\s+=\s+(\S+)/) {
32 }33 $SystemUUID = uc $1;
33 elsif ( /achine\s+serial\s+number\s+[:=]\s+(\S+)/ )34 }
34 {35 }
35 $SystemSerial=$1;36 } else { #Could not run machinfo
36 }37 for ( `echo 'sc product cpu;il' | /usr/sbin/cstm | grep "PDC Firmware"` ) {
37 }38 if ( /Revision:\s+(\S+)/ ) { $BiosVersion = "PDC $1" }
38 }39 }
39 else40 for ( `echo 'sc product system;il' | /usr/sbin/cstm | grep "System Serial Number"` ) {
40 {41 if ( /:\s+(\w+)/ ) { $SystemSerial = $1 }
41 for ( `echo 'sc product cpu;il' | /usr/sbin/cstm | grep "PDC Firmware"` ) 42 }
42 {
43 if ( /Revision:\s+(\S+)/ )
44 {
45 $BiosVersion="PDC $1";
46 }
47 }
48 for ( `echo 'sc product system;il' | /usr/sbin/cstm | grep "System Serial Number"` )
49 {
50 if ( /:\s+(\w+)/ )
51 {
52 $SystemSerial=$1;
53 }
54 }
55 }43 }
5644
57 $inventory->setBios ({45 $inventory->setBios ({
58 BVERSION => $BiosVersion,46 BVERSION => $BiosVersion,
59 BDATE => $BiosDate,47 BDATE => $BiosDate,
60 BMANUFACTURER => "HP",48 BMANUFACTURER => "HP",
61 SMANUFACTURER => "HP",49 SMANUFACTURER => "HP",
62 SMODEL => $SystemModel,50 SMODEL => $SystemModel,
63 SSN => $SystemSerial,51 SSN => $SystemSerial,
64 });52 });
53 $inventory->setHardware({
54 UUID => $SystemUUID
55 });
65}56}
6657
671;581;
6859
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/CPU.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/CPU.pm 2010-02-25 18:36:52 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/CPU.pm 2010-05-27 07:07:27 +0000
@@ -11,18 +11,14 @@
11use strict;11use strict;
12use LWP::UserAgent;12use LWP::UserAgent;
1313
14sub check { $^O =~ /hpux/ }14sub check { $^O =~ /^hpux$/ }
1515
16sub run {16sub run {
17 my $params = shift;17 my $params = shift;
18 my $inventory = $params->{inventory};18 my $inventory = $params->{inventory};
1919
20 my $processort;20 my $CPUinfo = { MANUFACTURER => 'unknow', TYPE => 'unknow', SERIAL => 'No Serial Number available!', SPEED => 0 };
21 my $processorn;21 my $CPUcount;
22 my $processors="";
23 my $DeviceType;
24 my $cpuInfo;
25 my $serie;
2622
27 # Using old system HpUX without machinfo23 # Using old system HpUX without machinfo
28 # the Hpux whith machinfo will be done after24 # the Hpux whith machinfo will be done after
@@ -58,79 +54,62 @@
58 "N4000-44"=>"8500 440",54 "N4000-44"=>"8500 440",
59 "ia64 hp server rx1620"=>"itanium 1600");55 "ia64 hp server rx1620"=>"itanium 1600");
6056
61 if ( can_run ("machinfo") )57 if ( can_run ("/usr/contrib/bin/machinfo") ) {
62 {58 my @machinfo = `/usr/contrib/bin/machinfo`;
63 foreach ( `machinfo`)59 s/\s+/ /g for (@machinfo);
64 {60 foreach (@machinfo) {
65 if ( /Number of CPUs\s+=\s+(\d+)/ )61 if (/Number of CPUs = (\d+)/) {
66 {62 $CPUcount = $1;
67 $processorn=$1;63 } elsif (/processor model: \d+ (.+)$/) {
68 }64 $CPUinfo->{TYPE} = $1;
69 if ( /Clock speed\s+=\s+(\d+)\s+MHz/ )65 } elsif (/Clock speed = (\d+) MHz/) {
70 {66 $CPUinfo->{SPEED} = $1;
71 $processors=$1;67 } elsif (/vendor information =\W+(\w+)/) {
72 }68 $CPUinfo->{MANUFACTURER} = $1;
73 # Added for HPUX 11.3169 } elsif (/Cache info:/) {
74 if ( /Intel\(R\) Itanium 2 9000 series processor \((\d+\.\d+)/ )70 # last; #Not tested on versions other that B11.23
75 {71 }
76 $processors=$1*1000;72 # Added for HPUX 11.31
77 }73 if ( /Intel\(R\) Itanium 2 9000 series processor \((\d+\.\d+)/ ) {
78 if ( /(\d+)\s+logical processors/ )74 $CPUinfo->{SPEED} = $1*1000;
79 {75 }
80 $processorn=$1;76 if ( /(\d+) logical processors/ ) {
81 }77 $CPUcount = $1;
82 # end HPUX 11.3178 }
8379 # end HPUX 11.31
84 }80 }
85 }81 } else {
86 else82 chomp(my $DeviceType =`model |cut -f 3- -d/`);
87 {83 my $tempCpuInfo = $cpuInfos{"$DeviceType"};
88 chomp($DeviceType =`model |cut -f 3- -d/`);84 if ( $tempCpuInfo =~ /^(\S+)\s(\S+)/ ) {
89 my $cpuInfo = $cpuInfos{"$DeviceType"};85 $CPUinfo->{TYPE} = $1;
90 if ( "$cpuInfo" =~ /^(\S+)\s(\S+)/ ) 86 $CPUinfo->{SPEED} = $2;
91 {87 } else {
92 $processort=$1;88 for ( `echo 'sc product cpu;il' | /usr/sbin/cstm | grep "CPU Module"` ) {
93 $processors=$2;89 if ( /(\S+)\s+CPU\s+Module/ ) {
94 } 90 $CPUinfo->{TYPE} = $1;
95 else 91 }
96 {92 }
97 for ( `echo 'sc product cpu;il' | /usr/sbin/cstm | grep "CPU Module"` ) 93 for ( `echo 'itick_per_usec/D' | adb -k /stand/vmunix /dev/kmem` ) {
98 {94 if ( /tick_per_usec:\s+(\d+)/ ) {
99 if ( /(\S+)\s+CPU\s+Module/ ) 95 $CPUinfo->{SPEED} = $1;
100 {96 }
101 $processort=$1;97 }
102 }98 }
103 };
104 for ( `echo 'itick_per_usec/D' | adb -k /stand/vmunix /dev/kmem` )
105 {
106 if ( /tick_per_usec:\s+(\d+)/ )
107 {
108 $processors=$1;
109 }
110 }
111 };
112 # NBR CPU99 # NBR CPU
113 chomp($processorn=`ioscan -Fk -C processor | wc -l`);100 chomp($CPUcount=`ioscan -Fk -C processor | wc -l`);
114 #print "HP $processort A $processorn A $processors ";
115 }101 }
116102
103 my $serie;
117 chomp($serie = `uname -m`);104 chomp($serie = `uname -m`);
118 if ( $serie =~ /ia64/) 105 if ( $CPUinfo->{TYPE} eq 'unknow' and $serie =~ /ia64/) {
119 {106 $CPUinfo->{TYPE} = "Itanium"
120 $processort="Itanium"107 }
121 }108 if ( $serie =~ /9000/) {
122 if ( $serie =~ /9000/) 109 $CPUinfo->{TYPE} = "PA" . $CPUinfo->{TYPE};
123 {110 }
124 $processort="PA$processort";111
125 }112 foreach ( 1..$CPUcount ) { $inventory->addCPU($CPUinfo) }
126 $inventory->setHardware({
127
128 PROCESSORT => $processort,
129 PROCESSORN => $processorn,
130 PROCESSORS => $processors,
131 });
132
133
134}113}
135114
1361;1151;
137116
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/Controller.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/Controller.pm 2010-01-22 14:39:51 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/Controller.pm 2010-05-27 07:07:27 +0000
@@ -1,7 +1,7 @@
1package Ocsinventory::Agent::Backend::OS::HPUX::Controller;1package Ocsinventory::Agent::Backend::OS::HPUX::Controller;
2use strict;2use strict;
33
4sub check { $^O =~ /hpux/ }4sub check { can_run('ioscan') }
55
6sub run { 6sub run {
7 my $params = shift;7 my $params = shift;
88
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/Drives.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/Drives.pm 2010-01-22 14:39:51 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/Drives.pm 2010-05-27 07:07:27 +0000
@@ -1,55 +1,51 @@
1package Ocsinventory::Agent::Backend::OS::HPUX::Drives;1package Ocsinventory::Agent::Backend::OS::HPUX::Drives;
22
3sub check { $^O =~ /hpux/ }3sub check { can_run('fstyp') and can_run('grep') and can_run('bdf') }
44
5sub run {5sub run {
6 my $params = shift;6 my $params = shift;
7 my $inventory = $params->{inventory};7 my $inventory = $params->{inventory};
88
9 my $type;9 my $type;
10 my $fs;10 my $fs;
11 my $lv;11 my $lv;
12 my $total;12 my $total;
13 my $free;13 my $free;
14 14
1515 for ( `fstyp -l | grep -v nfs` ) {
16 for ( `fstyp -l | grep -v nfs` ) {16 chomp;
17 $type=$_;17 $type=$_;
18 for ( `bdf -t $type `) {18 for ( `bdf -t $type `) {
19 if ( /Filesystem/ ) { ; } ;19 next if ( /Filesystem/ );
20 if ( /^(\S+)\s(\d+)\s+(\d+)\s+(\d+)\s+(\d+%)\s+(\S+)/ ) {20 if ( /^(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+%)\s+(\S+)/ ) {
21 $lv=$1;21 $lv=$1;
22 $total=$2;22 $total=$2;
23 $free=$3;23 $free=$3;
24 $fs=$6;24 $fs=$6;
25 $inventory->addDrives({25 $inventory->addDrive({
26 FREE => $free,26 FREE => $free,
27 FILESYSTEM => $fs,27 FILESYSTEM => $type,
28 TOTAL => $total,28 TOTAL => $total,
29 TYPE => $type,29 TYPE => $fs,
30 VOLUMN => $lv,30 VOLUMN => $lv,
31 });31 })
3232 } elsif ( /^(\S+)\s/) {
33 };33 $lv=$1
34 if ( /^(\S+)\s/) {34 } elsif ( /(\d+)\s+(\d+)\s+(\d+)\s+(\d+%)\s+(\S+)/) {
35 $lv=$1;35 $total=$1;
36 };36 $free=$3;
37 if ( /(\d+)\s+(\d+)\s+(\d+)\s+(\d+%)\s+(\S+)/) {37 $fs=$5;
38 $total=$1;38 # print "fs $fs lv $lv total $total free $free type $type\n";
39 $free=$3;39 $inventory->addDrive({
40 $fs=$5;40 FREE => $free,
41 # print "fs $fs lv $lv total $total free $free type $type\n";41 FILESYSTEM => $type,
42 $inventory->addDrives({42 TOTAL => $total,
43 FREE => $free,43 TYPE => $fs,
44 FILESYSTEM => $fs,44 VOLUMN => $lv,
45 TOTAL => $total,45 })
46 TYPE => $type,46 }
47 VOLUMN => $lv,47 } # for bdf -t $type
48 });48 }
49 };
50 };
51
52 };
53}49}
5450
551;511;
5652
=== removed file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/IPv4.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/IPv4.pm 2010-02-25 18:36:52 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/IPv4.pm 1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
1package Ocsinventory::Agent::Backend::OS::HPUX::IPv4;
2
3sub check {`which ifconfig 2>&1`; ($? >> 8)?0:1
4}
5
6# Initialise the distro entry
7sub run {
8 my $params = shift;
9 my $inventory = $params->{inventory};
10 my $ip;
11 my $hostname;
12
13 if ( `hostname` =~ /(\S+)/ )
14 {
15 $hostname=$1;
16 }
17
18 for ( `grep $hostname /etc/hosts ` )
19 {
20 if ( /(^\d+\.\d+\.\d+\.\d+)\s+/ )
21 {
22 $ip=$1;
23 $inventory->setHardware({IPADDR => $ip});
24 }
25 }
26}
27
281;
290
=== removed file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/Mem.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/Mem.pm 2010-01-22 14:39:51 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/Mem.pm 1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
1package Ocsinventory::Agent::Backend::OS::HPUX::Mem;
2use strict;
3
4sub check { $^O =~ /hpux/ }
5
6sub run {
7 my $params = shift;
8 my $inventory = $params->{inventory};
9
10 my $mem;
11 my $swap;
12
13 $mem = `grep Physical /var/adm/syslog/syslog.log|tr -s " "|cut -f 7 -d " "` ;
14 if ( $mem eq "" ) {
15 $mem = `grep Physical /var/adm/syslog/OLDsyslog.log|tr -s " "|cut -f 7 -d " "` ;
16 };
17 $mem = int ($mem/1024);
18
19 $swap = `swapinfo -mdfq`;
20
21
22 $inventory->setHardware({
23 MEMORY => $mem,
24 SWAP => $swap,
25 });
26}
27
281;
290
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/Memory.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/Memory.pm 2010-02-25 18:36:52 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/Memory.pm 2010-05-27 07:07:27 +0000
@@ -1,4 +1,5 @@
1package Ocsinventory::Agent::Backend::OS::HPUX::Memory;1package Ocsinventory::Agent::Backend::OS::HPUX::Memory;
2
2use strict;3use strict;
34
4sub check { $^O =~ /hpux/ }5sub check { $^O =~ /hpux/ }
@@ -7,45 +8,48 @@
7 my $params = shift;8 my $params = shift;
8 my $inventory = $params->{inventory};9 my $inventory = $params->{inventory};
910
10 my $capacity=0;11 if ( `uname -m` =~ /ia64/ ) {
11 my $caption;12 for ( `echo 'sc product IPF_MEMORY;il' | /usr/sbin/cstm` ) {
12 my $description;13 if ( /\w+IMM\s+Location/ ) {
13 my $numslot;14 next
14 my $subnumslot;15 } elsif (/Total Configured Memory:\s(\d+)\sMB/i) {
15 my $serialnumber;16 my $TotalMemSize = $1;
16 my $type;17 my $TotalSwapSize = `swapinfo -dt | tail -n1`;
17 my @list_mem=`echo 'sc product mem;il'| /usr/sbin/cstm`;18 $TotalSwapSize =~ s/^total\s+(\d+)\s+\d+\s+\d+\s+\d+%\s+\-\s+\d+\s+\-/$1/i;
1819 $inventory->setHardware({ MEMORY => $TotalMemSize, SWAP => sprintf("%i", $TotalSwapSize/1024), });
19 my $ok=0;20 } elsif ( /(\w+IMM)\s+(\w+)\s+(\d+|\-+)\s+(\w+IMM)\s+(\w+)\s+(\d+|\-+)/ ) {
2021 $inventory->addMemory({
21 if ( `uname -m` =~ /ia64/ )22 CAPACITY => $3,
22 {23 DESCRIPTION => $1,
23 for ( `echo 'sc product IPF_MEMORY;il' | /usr/sbin/cstm` )24 CAPTION => $1 . ' ' . $2,
24 {25 SPEED => 'No Speed data vailable!',
25 if ( /\w+IMM\s+Location/ )26 TYPE => $1,
26 {27 NUMSLOTS => $2,
27 ;28 SERIALNUMBER => 'No Serial Number available!',
28 }29 });
29 elsif ( /(\w+IMM)\s+(\w+)\s+(\S+)\s+(\w+IMM)\s+(\w+)\s+(\S+)/ )30 $inventory->addMemory({
30 {31 CAPACITY => $6,
31 $inventory->addMemories({32 DESCRIPTION => $4,
32 CAPACITY => $3,33 CAPTION => $4 . ' ' . $5,
33 CAPTION => $2 ,34 SPEED => 'No Speed data vailable!',
34 NUMSLOTS => "1" ,35 TYPE => $4,
35 TYPE => $1,36 NUMSLOTS => $5,
36 });37 SERIALNUMBER => 'No Serial Number available!',
37 $inventory->addMemories({38 });
38 CAPACITY => $6,
39 CAPTION => $5 ,
40 NUMSLOTS => "1" ,
41 TYPE => $4,
42 });
43 }
44 }39 }
45 }40 }
46 else41 } else {
47 {42 my $capacity = 0;
48 for ( `echo 'sc product system;il' | /usr/sbin/cstm ` ) {43 my $caption;
44 my $description;
45 my $numslot = 1;
46 my $subnumslot;
47 my $serialnumber = 'No Serial Number available!';
48 my $type;
49 my @list_mem=`echo 'sc product mem;il'| /usr/sbin/cstm`;
50 my $ok=0;
51
52 for ( `echo 'sc product system;il' | /usr/sbin/cstm` ) {
49 if ( /FRU\sSource\s+=\s+\S+\s+\(memory/ ) {53 if ( /FRU\sSource\s+=\s+\S+\s+\(memory/ ) {
50 $ok=0;54 $ok=0;
51 #print "FRU Source memory\n";55 #print "FRU Source memory\n";
@@ -57,59 +61,53 @@
57 if ( /Extender\s+Location\s+=\s+(\S+)/ ) {61 if ( /Extender\s+Location\s+=\s+(\S+)/ ) {
58 $subnumslot=$1;62 $subnumslot=$1;
59 #print "Extended sub $subnumslot\n";63 #print "Extended sub $subnumslot\n";
60 };64 }
61 if ( /DIMMS\s+Rank\s+=\s+(\S+)/ ) {65 if ( /DIMMS\s+Rank\s+=\s+(\S+)/ ) {
62 $numslot=sprintf("%02x",$1);66 $numslot=sprintf("%02x",$1);
63 #print "Num slot $numslot\n";67 #print "Num slot $numslot\n";
64 }68 }
65 69
66 if ( /FRU\s+Name\.*:\s+(\S+)/ ) {70 if ( /FRU\s+Name\.*:\s+(\S+)/ ) {
67 if ( /(\S+)_(\S+)/ ) {71 if ( /(\S+)_(\S+)/ ) {
68 $type=$1;72 $type=$1;
69 $capacity=$2;73 $capacity=$2;
70 #print "Type $type capa $capacity\n";74 #print "Type $type capa $capacity\n";
71 }75 } elsif ( /(\wIMM)(\S+)/ ) {
72 elsif ( /(\wIMM)(\S+)/ )76 $ok=1;
73 {77 $type=$1;
74 $ok=1;78 $numslot=$2;
75 $type=$1;79 #print "Type $type numslot $numslot\n";
76 $numslot=$2;80 }
77 #print "Type $type numslot $numslot\n";
78 }
79 }81 }
80 if ( /Part\s+Number\.*:\s*(\S+)\s+/ ) {82 if ( /Part\s+Number\.*:\s*(\S+)\s+/ ) {
81 $description=$1;83 $description=$1;
82 #print "ref $description\n";84 #print "ref $description\n";
83 };85 }
84 if ( /Serial\s+Number\.*:\s*(\S+)\s+/ ) {86 if ( /Serial\s+Number\.*:\s*(\S+)\s+/ ) {
85 $serialnumber=$1;87 $serialnumber=$1;
86 if ( $ok eq 1 ) 88 if ( $ok eq 1 ) {
87 {89 if ( $capacity eq 0 ) {
88 if ( $capacity eq 0 )90 foreach ( @list_mem ) {
89 {91 if ( /\s+$numslot\s+(\d+)/ ) {
90 foreach ( @list_mem )92 $capacity=$1;
91 {93 #print "Capacity $capacity\n";
92 if ( /\s+$numslot\s+(\d+)/ )94 }
93 {
94 $capacity=$1;
95 #print "Capacity $capacity\n";
96 }
97 }
98 }95 }
99 $inventory->addMemories({96 }
100 CAPACITY => $capacity,97 $inventory->addMemory({
101 CAPTION => "Ext $subnumslot Slot $numslot" ,98 CAPACITY => $capacity,
102 DESCRIPTION => "Part Number $description",99 DESCRIPTION => "Part Number $description",
103 NUMSLOTS => "1" ,100 CAPTION => "Ext $subnumslot Slot $numslot",
104 SERIALNUMBER => $serialnumber,101 SPEED => 'No Speed data vailable!',
105 TYPE => $type,102 TYPE => $type,
106 });103 NUMSLOTS => '1',
107 $ok=0;104 SERIALNUMBER => $serialnumber,
108 $capacity=0;105 });
109 };106 $ok=0;
110 #print "Serial $serialnumber\n\n";107 $capacity=0;
111 };108 } # $ok eq 1
112 };109 } # /Serial\s+Number\.*:\s*(\S+)\s+/
110 } # echo 'sc product system;il' | /usr/sbin/cstm
113 }111 }
114112
115}113}
116114
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/Networks.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/Networks.pm 2010-02-25 18:36:52 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/Networks.pm 2010-05-27 07:07:27 +0000
@@ -1,93 +1,128 @@
1package Ocsinventory::Agent::Backend::OS::HPUX::Networks;1package Ocsinventory::Agent::Backend::OS::HPUX::Networks;
22
3sub check { can_load("Net::IP qw(:PROC)"); }3#$runMeIfTheseChecksFailed = ["Ocsinventory::Agent::Backend::OS::HPUX::Networks-Perl"];
4
5#"Net::IP qw(:PROC)" is not needed anymore
6#TODO Get driver pcislot virtualdev
7
8sub check { can_run("lanadmin") and can_run("lanscan") and can_run("netstat")
9 and can_run("ifconfig") and can_run("hostname") and can_run("uname") }
410
5sub run {11sub run {
6 my $params = shift;12 my $params = shift;
7 my $inventory = $params->{inventory};13 my $inventory = $params->{inventory};
814
9 my $name;15 my $name;
10 my $lanid;16 my $lanid;
1117 my $ipmask;
12 my $ipmask;18 my $ipgateway;
13 my $ipgateway;19 my $status;
14 my $status;20 my $macaddr;
15 my $macaddr;21 my $speed;
16 my $speed;22 my $type;
17 my $type;23 my $ipsubnet;
18 my $ipsubnet;24 my $description;
19 my $description;25 my $ipaddress;
20 my $ipaddress;26
2127 my $hostname = 'Unknown';
22 my $binip;28 if ( `hostname` =~ /(\S+)/ ) {
23 my $binmask;29 $hostname=$1
24 my $binsubnet;30 } elsif ( `uname -n` =~ /(\S+)/ ) { # It should never reach here, as `hostname` should never fail!
2531 $hostname=$1
26 for ( `lanscan -iap`) {32 }
27 # Reinit variable33
28 $name="";34 for ( `grep $hostname /etc/hosts ` ) {
29 $lanid="";35 if ( /(^\d+\.\d+\.\d+\.\d+)\s+/ ) {
30 $ipmask="";36 $inventory->setHardware({IPADDR => $1});
31 $ipgateway="";37 last;
32 $status="";38 }
33 $macaddr="";39 }
34 $speed="";40
35 $type="";41 my %gateway;
36 $ipsubnet="";42 foreach (`netstat -nrv`) {
37 $description="";43 if (/^(\S+\/\d+\.\d+\.\d+\.\d+)\s+(\d+\.\d+\.\d+\.\d+)/) {
38 $ipaddress="";44 $gateway{$1} = $2 if not defined $gateway{$1}; #Just keep the first one
3945 }
40 if ( /^(\S+)\s(\S+)\s(\S+)\s+(\S+)/) {46 }
41 $name=$2;47 if (defined ($gateway{'default/0.0.0.0'})) {
42 $macaddr=$1;48 $inventory->setHardware({
43 $lanid=$4;49 DEFAULTGATEWAY => $gateway{'default/0.0.0.0'}
4450 })
45 #print "name $name macaddr $macaddr lanid $lanid\n";51 }
46 for ( `lanadmin -g $lanid` ) {52
47 if (/Type.+=\s(.+)/) { $type = $1; };53 for ( `lanscan -iap`) {
48 if (/Description\s+=\s(.+)/) { $description = $1; };54 # Reinit variables
49 if (/Speed.+=\s(\d+)/) {55 $name="";
50 $speed = $1;56 $lanid="";
5157 $ipmask="";
52 unless ( $speed <= 1000000 ) { # in old version speed was given in Mbps58 $ipgateway="";
53 # we want speed in Mbps59 $status="";
54 $speed = $1/1000000;60 $macaddr="";
55 }61 $speed="";
56 };62 $type="";
57 if (/Operation Status.+=\s(.+)/) { $status = $1; };63 $ipsubnet="";
5864 $description="";
59 }; # for lanadmin65 $ipaddress="";
60 #print "name $name macaddr $macaddr lanid $lanid speed $speed status $status \n";66
61 for ( `ifconfig $name 2> /dev/null` ) {67 if ( /^(\S+)\s(\S+)\s(\S+)\s+(\S+)/) {
62 if ( /inet\s(\S+)\snetmask\s(\S+)\s/ ) {68 $macaddr=$1;
63 $ipaddress=$1;69 $name=$2;
64 $ipmask=$2;70 $lanid=$4;
65 if ($ipmask =~ /(..)(..)(..)(..)/) {71 if ( $macaddr =~ /^0x(..)(..)(..)(..)(..)(..)$/ ) { $macaddr = "$1:$2:$3:$4:$5:$6" }
66 $ipmask=sprintf ("%i.%i.%i.%i",hex($1),hex($2),hex($3),hex($4));72 #print "name $name macaddr $macaddr lanid $lanid\n";
67 }73 for ( `lanadmin -g $lanid` ) {
6874 if (/Type.+=\s(.+)/) { $type = $1; }
69 }; 75 if (/Description\s+=\s(.+)/) { $description = $1; }
70 }; # For ifconfig76 if (/Speed.+=\s(\d+)/) {
71 $binip = ip_iptobin ($ipaddress ,4);77 $speed = ($1 > 1000000)? $1/1000000 : $1; # in old version speed was given in Mbps and we want speed in Mbps
72 $binmask = ip_iptobin ($ipmask ,4);78 }
73 $binsubnet = $binip & $binmask;79 if (/Operation Status.+=\sdown\W/i) { $status = "Down"; } #It is not the only criteria
74 $ipsubnet = ip_bintoip($binsubnet,4);80 } # for lanadmin
7581 #print "name $name macaddr $macaddr lanid $lanid speed $speed status $status \n";
76 $inventory->addNetworks({82 for ( `ifconfig $name 2> /dev/null` ) {
7783 if ( not $status and /$name:\s+flags=.*\WUP\W/ ) { #Its status is not reported as down in lanadmin -g
78 DESCRIPTION => $description,84 $status = 'Up';
79 IPADDRESS => $ipaddress,85 }
80 IPGATEWAY => $ipgateway,86 if ( /inet\s(\S+)\snetmask\s(\S+)\s/ ) {
81 IPMASK => $ipmask,87 $ipaddress=$1;
82 IPSUBNET => $ipsubnet,88 $ipmask=$2;
83 MACADDR => $macaddr,89 if ($ipmask =~ /(..)(..)(..)(..)/) {
84 STATUS => $status,90 $ipmask=sprintf ("%i.%i.%i.%i",hex($1),hex($2),hex($3),hex($4));
85 SPEED => $speed,91 }
86 TYPE => $type,92 }
87 });93 } # For ifconfig
8894 $ipsubnet = join '.', unpack('C4C4C4C4', pack('B32',
89 }; # If95 unpack('B32', pack('C4C4C4C4', split(/\./, $ipaddress)))
90 }; # For lanscan96 & unpack('B32', pack('C4C4C4C4', split(/\./, $ipmask)))
91 }97 ));
98
99 $ipgateway = $gateway{$ipsubnet.'/'.$ipmask};
100 # replace the $ipaddress (ie IP Address of the interface itself) by the default gateway IP adress if it exists
101 if (defined($ipgateway) and $ipgateway eq $ipaddress and defined($gateway{'default/0.0.0.0'})) {
102 $ipgateway = $gateway{'default/0.0.0.0'}
103 }
104
105 #Some cleanups
106 if ( $ipaddress eq '0.0.0.0' ) { $ipaddress = "" }
107 if ( not $ipaddress and not $ipmask and $ipsubnet eq '0.0.0.0' ) { $ipsubnet = "" }
108 if ( not $status ) { $status = 'Down' }
109
110 $inventory->addNetwork({
111 DESCRIPTION => $description,
112 IPADDRESS => $ipaddress,
113 IPMASK => $ipmask,
114 IPSUBNET => $ipsubnet,
115 MACADDR => $macaddr,
116 STATUS => $status,
117 TYPE => $type,
118 SPEED => $speed,
119 IPGATEWAY => $ipgateway,
120# PCISLOT => $pcislot,
121# DRIVER => $driver,
122# VIRTUALDEV => $virtualdev,
123 });
124 } # If
125 } # For lanscan
126}
92127
931;1281;
94129
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/README'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/README 2010-01-22 14:39:51 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/README 2010-05-27 07:07:27 +0000
@@ -47,7 +47,7 @@
4747
48It will be used automaticly48It will be used automaticly
4949
50I have test the script on only n4000 system for th moment on HP-Ux 11.050I have test the script on only n4000 system for the moment on HP-Ux 11.0
51I try it on rp3440 but some informations are not in the same format51I try it on rp3440 but some informations are not in the same format
5252
53If you wish to help me, you are welwome.53If you wish to help me, you are welwome.
@@ -61,11 +61,10 @@
61 Controller.pm61 Controller.pm
62 Domains.pm62 Domains.pm
63 Drives.pm63 Drives.pm
64 IPv4.pm
65 Mem.pm
66 Memory.pm64 Memory.pm
67 Networks.pm65 Networks.pm
68 Slots.pm66 Slots.pm
69 Software.pm67 Software.pm
70 Storages.pm68 Storages.pm
69 Uptime.pm
7170
7271
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/Slots.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/Slots.pm 2010-01-22 14:39:51 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/Slots.pm 2010-05-27 07:07:27 +0000
@@ -1,7 +1,7 @@
1package Ocsinventory::Agent::Backend::OS::HPUX::Slots;1package Ocsinventory::Agent::Backend::OS::HPUX::Slots;
2use strict;2use strict;
33
4sub check { $^O =~ /hpux/ }4sub check { can_run('ioscan') }
55
6sub run { 6sub run {
7 my $params = shift;7 my $params = shift;
@@ -22,7 +22,7 @@
22 $interface=$3;22 $interface=$3;
23 $info=$4;23 $info=$4;
24 $type=$1;24 $type=$1;
25 $inventory->addSlots({25 $inventory->addSlot({
26 DESCRIPTION => "$name",26 DESCRIPTION => "$name",
27 DESIGNATION => "$interface $info",27 DESIGNATION => "$interface $info",
28 NAME => "$type",28 NAME => "$type",
2929
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/Software.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/Software.pm 2010-01-22 14:39:51 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/Software.pm 2010-05-27 07:07:27 +0000
@@ -6,7 +6,7 @@
6 # Do not run an package inventory if there is the --nosoft parameter6 # Do not run an package inventory if there is the --nosoft parameter
7 return if ($params->{params}->{nosoft});7 return if ($params->{params}->{nosoft});
88
9 $^O =~ /hpux/ 9 can_run('swlist') and can_run('grep')
10}10}
1111
12sub run {12sub run {
@@ -22,7 +22,7 @@
22 foreach $software (@softList) {22 foreach $software (@softList) {
23 chomp( $software );23 chomp( $software );
24 if ( $software =~ /^ (\S+)\s(\S+)\s(.+)/ ) {24 if ( $software =~ /^ (\S+)\s(\S+)\s(.+)/ ) {
25 $inventory->addSoftwares({25 $inventory->addSoftware({
26 'NAME' => $1 ,26 'NAME' => $1 ,
27 'VERSION' => $2 ,27 'VERSION' => $2 ,
28 'COMMENTS' => $3 ,28 'COMMENTS' => $3 ,
2929
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/Storages.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/Storages.pm 2010-02-25 18:36:52 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/Storages.pm 2010-05-27 07:07:27 +0000
@@ -1,6 +1,6 @@
1package Ocsinventory::Agent::Backend::OS::HPUX::Storages;1package Ocsinventory::Agent::Backend::OS::HPUX::Storages;
22
3sub check { $^O =~ /hpux/ }3sub check { can_run('ioscan') and can_run('cut') and can_run('pvdisplay') and can_run('diskinfo') }
44
5sub run {5sub run {
6 my $params = shift;6 my $params = shift;
77
=== added file 'lib/Ocsinventory/Agent/Backend/OS/HPUX/Uptime.pm'
--- lib/Ocsinventory/Agent/Backend/OS/HPUX/Uptime.pm 1970-01-01 00:00:00 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/HPUX/Uptime.pm 2010-05-27 07:07:27 +0000
@@ -0,0 +1,29 @@
1package Ocsinventory::Agent::Backend::OS::HPUX::Uptime;
2use strict;
3
4sub check { can_run("uptime") and can_run ("uname") }
5
6sub run {
7 my $params = shift;
8 my $inventory = $params->{inventory};
9
10 # Uptime
11 my $uptime = `uptime`;
12 my $seconds = 0;
13 if ( $uptime =~ /.*\sup\s((\d+)\sdays\D+)?(\d{1,2}):(\d{1,2}).*/ ) {
14 $seconds += $2 * 24 * 3600;
15 $seconds += $3 * 3600;
16 $seconds += $4 * 60;
17 }
18
19 # Uptime conversion
20 my ($UYEAR, $UMONTH , $UDAY, $UHOUR, $UMIN, $USEC) = (gmtime ($seconds))[5,4,3,2,1,0];
21
22 # Write in ISO format
23 $uptime=sprintf "%02d-%02d-%02d %02d:%02d:%02d", ($UYEAR-70), $UMONTH, ($UDAY-1), $UHOUR, $UMIN, $USEC;
24
25 chomp(my $DeviceType =`uname -m`);
26 $inventory->setHardware({ DESCRIPTION => "$DeviceType/$uptime" });
27}
28
291
030
=== added file 'lib/Ocsinventory/Agent/Backend/OS/Linux/Network/iLO.pm'
--- lib/Ocsinventory/Agent/Backend/OS/Linux/Network/iLO.pm 1970-01-01 00:00:00 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/Linux/Network/iLO.pm 2010-05-27 07:07:27 +0000
@@ -0,0 +1,66 @@
1package Ocsinventory::Agent::Backend::OS::Linux::Network::iLO;
2
3use strict;
4use warnings;
5
6sub check {
7 return unless can_run("hponcfg") && can_load("Net::IP qw(:PROC)");
8 1;
9}
10
11sub run {
12 my $params = shift;
13 my $inventory = $params->{inventory};
14 my $logger = $params->{logger};
15
16 my $name;
17 my $ipmask;
18 my $ipgateway;
19 my $speed;
20 my $ipsubnet;
21 my $ipaddress;
22 my $status;
23# my $macaddr;
24
25 foreach (`hponcfg -aw -`) {
26 if ( /<IP_ADDRESS VALUE="([0-9.]+)"\/>/ ) {
27 $ipaddress = $1;
28 } elsif ( /<SUBNET_MASK VALUE="([0-9.]+)"\/>/ ) {
29 $ipmask = $1;
30 } elsif ( /<GATEWAY_IP_ADDRESS VALUE="([0-9.]+)"\/>/ ) {
31 $ipgateway = $1;
32 } elsif ( /<NIC_SPEED VALUE="([0-9]+)"\/>/ ) {
33 $speed = $1;
34 } elsif ( /<DNS_NAME VALUE="([^"]+)"\/>/ ) {
35 $name = $1;
36 } elsif ( /<ENABLE_NIC VALUE="(.)"\/>/ ) {
37 $status = 'Up' if $1 =~ /Y/i;
38 }
39 }
40 if ( defined($ipaddress) && defined($ipmask) ) {
41 $ipsubnet = ip_bintoip(ip_iptobin ($ipaddress ,4) & ip_iptobin ($ipmask ,4), 4);
42 }
43
44 #Some cleanups
45 if ( $ipaddress eq '0.0.0.0' ) { $ipaddress = "" }
46 if ( not $ipaddress and not $ipmask and $ipsubnet eq '0.0.0.0' ) { $ipsubnet = "" }
47 if ( not $status ) { $status = 'Down' }
48
49 $inventory->addNetwork({
50 DESCRIPTION => 'Management Interface - HP iLO',
51 IPADDRESS => $ipaddress,
52 IPMASK => $ipmask,
53 IPSUBNET => $ipsubnet,
54 STATUS => $status,
55 TYPE => 'Ethernet',
56 SPEED => $speed,
57 IPGATEWAY => $ipgateway,
58 MANAGEMENT => 'iLO',
59# MACADDR => $macaddr,
60# PCISLOT => $pcislot,
61# DRIVER => $driver,
62# VIRTUALDEV => $virtualdev,
63 });
64}
651;
66
067
=== modified file 'lib/Ocsinventory/Agent/Backend/OS/Linux/Storages.pm'
--- lib/Ocsinventory/Agent/Backend/OS/Linux/Storages.pm 2009-08-04 11:46:48 +0000
+++ lib/Ocsinventory/Agent/Backend/OS/Linux/Storages.pm 2010-05-27 07:07:27 +0000
@@ -129,7 +129,7 @@
129 my $value;129 my $value;
130 foreach my $line (`lshal`) {130 foreach my $line (`lshal`) {
131 chomp $line;131 chomp $line;
132 if ( $line =~ s{^udi = '/org/freedesktop/Hal/devices/storage.*}{}) {132 if ( $line =~ s{^udi = '/org/freedesktop/Hal/devices/(storage|legacy_floppy|block).*}{}) {
133 $in = 1;133 $in = 1;
134 %temp = ();134 %temp = ();
135 } elsif ($in == 1 and $line =~ s{^\s+(\S+) = (.*) \s*\((int|string|bool|string list|uint64)\)}{} ) {135 } elsif ($in == 1 and $line =~ s{^\s+(\S+) = (.*) \s*\((int|string|bool|string list|uint64)\)}{} ) {
@@ -216,7 +216,7 @@
216 my ($manufacturer, $model, $media, $firmware, $serialnumber, $capacity, $partitions, $description);216 my ($manufacturer, $model, $media, $firmware, $serialnumber, $capacity, $partitions, $description);
217 foreach (glob ("/sys/block/*")) {# /sys fs style217 foreach (glob ("/sys/block/*")) {# /sys fs style
218 $partitions->{$1} = undef218 $partitions->{$1} = undef
219 if (/^\/sys\/block\/([sh]d[a-z])$/)219 if (/^\/sys\/block\/([sh]d[a-z]|fd\d)$/)
220 }220 }
221 foreach (`fdisk -l`) {# call fdisk to list partitions221 foreach (`fdisk -l`) {# call fdisk to list partitions
222 chomp;222 chomp;
223223
=== modified file 'lib/Ocsinventory/Agent/XML/Inventory.pm'
--- lib/Ocsinventory/Agent/XML/Inventory.pm 2010-03-24 20:28:01 +0000
+++ lib/Ocsinventory/Agent/XML/Inventory.pm 2010-05-27 07:07:27 +0000
@@ -497,6 +497,7 @@
497 my $status = $args->{STATUS};497 my $status = $args->{STATUS};
498 my $type = $args->{TYPE};498 my $type = $args->{TYPE};
499 my $virtualdev = $args->{VIRTUALDEV};499 my $virtualdev = $args->{VIRTUALDEV};
500 my $speed = $args->{SPEED};
500501
501# return unless $ipaddress;502# return unless $ipaddress;
502503
@@ -515,6 +516,7 @@
515 STATUS => [$status?$status:''],516 STATUS => [$status?$status:''],
516 TYPE => [$type?$type:''],517 TYPE => [$type?$type:''],
517 VIRTUALDEV => [$virtualdev?$virtualdev:''],518 VIRTUALDEV => [$virtualdev?$virtualdev:''],
519 SPEED => [$speed?$speed:''],
518520
519 };521 };
520}522}

Subscribers

People subscribed via source and target branches