pax_global_header 0000666 0000000 0000000 00000000064 13327377321 0014522 g ustar 00root root 0000000 0000000 52 comment=86c44e3fa02f1d5b4902991e7edb1f76ee3c2da8
UnixAgent-2.4.2/ 0000775 0000000 0000000 00000000000 13327377321 0013431 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/.github/ 0000775 0000000 0000000 00000000000 13327377321 0014771 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/.github/Contributing.md 0000664 0000000 0000000 00000012310 13327377321 0017757 0 ustar 00root root 0000000 0000000
OCS Inventory
Some Links:
Ask question |
Installation |
Website
# OCS Inventory Contributing Guidelines
## Pull Request Process
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Add your changes: `git add folder/file1.php`
4. Commit your changes: `git commit -m 'Add some feature'`
5. Push to the branch: `git push origin my-new-feature`
6. Submit a pull request !
## Pull Request Informations
When contributing, please open an issue before or contact the team using mail. This will prevent all the duplicate of work.
Also, check if your contribution is not already in the roadmap or affiliated to an issue.
If you are contributing on a small scale (translation, a few line modification), you don't need open an issue or contact the team but you will need to explain what you've done in the Pull Request comment and provide as accurate commit messages as possible.
Cf. Commits Messages Name Informations
If you need to discuss about a big change or need some help of our team during the development of your contribution,
we can use other communication method like Telegram, IRC, Skype.
## Commits Messages Name Informations
Try to create as accurate as possible commit messages.
This will help us to speed up the review process and to reduce the misunderstanding (which can lead to a Pull Request to be rejected)
There is no commit messages convention but here are some examples :
1. Create as short as possible commit name
2. One commit for one modification
3. Always leave the second commit line blank
If it seems difficult to summarize what your commit does, it may be because it includes several logical changes or bug fixes, and are better split up into several commits using `git add -p`.
## Code of Conduct
### Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
### Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
### Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
### Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at `contact@ocsinventory-ng.org` . All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
### Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
UnixAgent-2.4.2/.github/ISSUE_TEMPLATE.md 0000664 0000000 0000000 00000000566 13327377321 0017505 0 ustar 00root root 0000000 0000000 *It's hard to solve a problem when important details are missing, that why we added this template, to help you and us.*
### General informations
Operating system :
Perl version :
### OCS Inventory informations
Unix agent version :
### Problem's description
*Describe your problem here*
### Inventory log file ( optional )
*Use github cloud or trusted upload website*
UnixAgent-2.4.2/.github/PULL_REQUEST_TEMPLATE.md 0000664 0000000 0000000 00000002030 13327377321 0020565 0 ustar 00root root 0000000 0000000 ## Must read before submitting
Please, take a look to our contributing guidelines before submitting your pull request.
There's some simple rules that will help us to speed up the review process and avoid any misunderstanding
[Contributors GuideLines](https://github.com/OCSInventory-NG/OCSInventory-ocsreports/blob/master/.github/Contributing.md)
## Status
**READY/IN DEVELOPMENT/HOLD**
## Description
A few sentences describing the overall goals of the pull request's commits.
## Related Issues
Put here all the related issues link
## Todos
- [ ] Tests
- [ ] Documentation
## Test environment
If some tests has been already made, please give us your test environment' specs
#### General informations
Operating system :
Perl version :
#### OCS Inventory informations
Unix agent version :
## Deploy Notes
Notes regarding deployment the contained body of work. These should note any dependencies changes,
logical changes, etc.
1.
## Impacted Areas in Application
List general components of the application that this PR will affect:
*
UnixAgent-2.4.2/.gitignore 0000664 0000000 0000000 00000000757 13327377321 0015432 0 ustar 00root root 0000000 0000000 # Mac OS Specific dir
.DS_Store
build/
*.old
# Iceberg specific dir
tools/macosx/installer_gui/iceberg/OCSNG.app/
tools/macosx/installer_gui/iceberg/ocscontact
tools/macosx/installer_gui/iceberg/plugins/
# Ignore darwin perl lib if un tar from script repository
tools/macosx/scripts/darwin-perl-lib/
# Xcworkspace and user data
project.xcworkspace/
xcuserdata/
# perl Makefile.PL
/MYMETA.json
/MYMETA.yml
/Makefile
/ipdiscover
/run-postinst
# make
/blib/
/pm_to_blib
# make dist
/*.tar.gz
UnixAgent-2.4.2/AUTHORS 0000664 0000000 0000000 00000000660 13327377321 0014503 0 ustar 00root root 0000000 0000000 Maintainer:
Frank Bourdeau
Former maintainers:
Guillaume PROTET
Gonéri LE BOUDER
Based on the legacy OCS Linux agent (Copyright (C) 2005-2008 Pascal DANEK )
Copyright 2006-2018 OCS Inventory contributors
Website: http://www.ocsinventory-ng.org
Please read THANKS to get the list of the contributors
UnixAgent-2.4.2/Changes 0000664 0000000 0000000 00000143454 13327377321 0014737 0 ustar 00root root 0000000 0000000 Revision history for Ocsinventory::Agent
2.4.2
* Fix warning argument freebsd isn't numeric
* Fix Debian repository
* Update manifest
* Fix name and url in Repository
* Fix for Ubuntu and older Debian version
* Merge PR #141,#135,#143
* Fix spelling errors
* Add arcconf for Adaptec
* Fix issue #124
* Replace hpacucli with ssacli
* Merge PR #144,#145,#146,#147,#148,#150
* Make use of EDID utilities optional on modern kernels
* Fallback to mainboard serial if bios serial is not available
* Merge PR #152, #156, #158, #159
* Fix issue for ipdiscover
* Indicate god value for memory
* Use now Parse::EDID module to retrieve monitor infomrations
* Merge PR #161, #163, #164, #165, #169, #170, #172, #173, #174
2.4.1
* Add the date of installation for debian/ubuntu packages
* Add support for zfs
* Rewrite cpu bsd
* Fix some bugs on Repository/Deb.pm file
* Ipmi.pm : fix fatal typo
* Bios.pm : fix "invalid" message
* UUID.pm : fix "invalid" message
* Virtualization : fix for Proxmox
* Fix for vlans
* Fix virsh out
2.4
* Add test to switch 'waitpid command' according to OS
* change bazar revision number to git revision number
* ipdiscover: fix default latency
* Ignore files which are created during installation
* Fix and improve comments in module.conf
* Fix some typos
* Update MANIFEST
* Fix code which disables SSL certificate verification
* Fix storage parameters from smartctl
* Fix markdown syntax and typo in README.md
* Use pkg command on Solaris 11 to create the Software Inventory
* Upgraded memconf to v3.14 (support for SPARC T7-4 and S7-2)
* New feature: repositories inventory
* Fix problem line 280
* Issues corrections
* Retrieve info for apfs formatted drive
* correct df check for AIX
* Fix regexp for listing network interfaces on macOS
* Update Mem.pm
* Update Agent.pm
2.3
* Suppress functions can_run, can_load, can_read from Backend. Those from Common.pm are now used
* Update libraries snapshot for release
2.2
* Suppress reference message to support "No support detected. Registration key: N/A"
* Linux storages now supports Megacli raid
* Merge Mysteq PR "centos-release is the correct file to check"
* Merge XANI PR "read edid from sysfs, fallback to old method if no monitor is found"
* Fix bugs in Network.pm and IP.pm files (OS Linux)
* Correction for usb inventory
* Retrieve Docker container informations
* Update memconf command to last revision
* Add enhancement support for Xen xl command (xm command already present)
2.2rc1
* Update memconf command to last revision
* Fix Bug #1466748 Interface Detection Infiniband MAC wrong
* Fix Bug #1423905 Failed HTTP auth if password contains # character
* Fix syntax error in BSDpkg.pm file
* HPUX/Solaris: use --nosoftware instead of --nosoft
* Correction of graphics resolution
* Retrieve speed and duplex from a different way
* Enhancement: unix agent can now report battery inventory
* Enhancement: unified agent can retrieve lxc container
* Suppress --nosoft option
* Fix Bug #1440626 Typo error in Alpha/CPU.pm
* Fix Bug #1438719 pkg_list has been deprecated on FreeBSD so no software inventory is gathered on those systems
* Fix Bug #1438021 Support s390x processors
* Fix Bug #1436702 Wrong disk size
* Fix Bug #1435675 AIX typo error in Hardware.pm
* Fix Bug #1431844 données de HDD SAS/SAN manquantes AIX 5.3, 6.1 et 7.1
* Fix Bug #1420073 Linux/Archs/i386/CPU.pm reports incorrect CPU information
* Fix Bug #1409671 PROCESSORS bad value on PowerPC arch
* Fix Bug #1405167 Presentation of OS Name and OS Version
* Fix Bug #1389255 Nombre d'interfaces recherchees
* Fix Bug #1376787 [UNIX Agent] Feature request: report Fusion-io cards
* Fix Bug #1364123 created script perl for xenserver
* Fix Bug #1350240 --nosoftware does'nt work on aix
* Fix Bug #1342038 Wrong data for cores on Unix Agent 2.1.1
* Fix Bug #1322088 CPU show 0 on VM libvirt
* Fix Bug #1319683 libvirt VM partial detection
* Fix Bug #1293588 CPU on Ubuntu may not be detected because of `arch` command and Dumper reference
* Fix Bug #1246427 CentOS Linux 6 not identified
* Fix Bug #1201734 Hyper-V virtual machines not recognized as "Virtual Machine" by agent
* Fix Bug #1159742 Ipmi.pm does not load Net::IP at the right place
* Fix Bug #1064296 ipv4 handling fix
2.1.1
* Add number of socket in Linux/Archs/i386/CPU.pm
* Add hyperthreading support in Linux/Archs/i386/CPU.pm
* Fix Bug #1312830 about missing CPU information
* Update memconf command to last revision
* Add new file to detect Oracle distro
* Fix CPU.pm which couldn't retrieve multi socket processors
* Fix Bug #1045356 about regression in ifconfig parsing
* Fix a mistake in tag in 6876.xml
* Move lib/Ocsinventory/Oracle and lib/Ocsinventory/Apache directories in lib/Ocsinventory/agent/Modules directory
* Fix a mistake in Hooks.pm which makes Download.pm and Snmp.pm not loaded by agent
* Fix problem on path of arch command
* Fix debug trace in CPU.pm
* Fix a translation mistake in MacOSX agent French installer
2.1
* Fix #Bug 1272425 about status of libvirt virtual machines not reported
* Fix blueprint about installation date in the report of the installed software
* Fix blueprint about UUID value in the hardware Table
* Fix Bug #1247190 about default gateway as gateway for all interfaces under Linux
* Add new screen code for edid (PTS)
* Add new module to retrieve Nvidia cards
* Add new module to retrieve virtual machines on vmware workstation
* Return corrected values for storage under Fedora 19
* Fix Bug #1247190 about default gateway as gateway for all interfaces under Linux
* Add new screen code for edid (PTS)
* Add new module to retrieve Nvidia cards
* Add new file to detect CentOS distro
* Add new module to retrieve virtual machines on vmware workstation
* Return corrected values for storage under Fedora 19
* Fix Bug #1206514 about enhancing modules loading to allow directories
* Fix a bug in Common.pm about processes data marked as virtualmachines data
* Fix Bug #1216935 about Mac user agent not generating UUID
* Fix Bug #1237682 about RPM.pm INSTALLDATE format not always accepted by MySQL
* Retrieve the speed of network card
* Add a new log message when unable to scan a SNMP devices in Snmp.pm
* Fix problem about IP address tests in Snmp.pm
* Remove "-pP" option passed to nmap in Snmp.pm
* New module to retrieve NetApp devices using SNMP
* New module to retrieve Sun devices using SNMP
* Add new value to BIOS.pm
* Fix bugs in CUPS.pm and Usb.pm files
* Retrieve new values for CPU
* Update memconf command to latest version
* Fix bugs about usb in Lsusb.pm and Common.pm
* Add retrieve of usb connected devices
* Fix Bug #1198088 about wrong data for processors under 2.1 RC1
* Fix bug about SNMP v3 in 9.pm
* Fix bug about custom network scanning in Snmp.pm
* Add retrieve of video memory size
* Fix Bug #1169675 about error message about SSL_verify_mode of SSL_VERIFY_NONE under Fedora 18
2.1rc1
* Fix Bug #1095989 about a bad regex in Libvirt.pm
* Fix Bug #1032393 about softwares bot inventoried vi dpkg-query
* Add custom SNMP MIBs XML copy from sources in postinst.pl
* Getting monitor serial number in MacOS/Video.pm
* Add a new configuration option for SSL certificate check in MacOSX agent installer
* Add new screen codes for edid
* Fix Bug ##1117110 about missing number of CPU socket
* Add availibility to reforce a package deployment
* Code rewrite in Common.pm to prevent sending empty XML tags to OCS server
* Fix Bug #1086086 about uses of initialized value in Snmp.pm
* Fix Bug #1087270 about zombie processes when running in daemon mode
* Fix Bug #1086078 about use of initialized value
* Fix Bug #1070788 about zip packages support
* Fix Bug #1045356 about ifconfig parsing issue (Fedora >=17)
* New availability to scan custom network with SNMP using a network address received from server
* Fix Bug #1049626 about Qemu virtualization not detected on proxmox
* Fix Bug #1040197 about VLAN interface AIX support
* Add detect CPU architecture
* AIX memory module change
* Add many informations about CPU (l2cachesize, status, socket designation, cores number)
* Fix Bug #882574 about parsing of dmidecode fails on SMBIOS warning
* Fix Bug #984699 about the Output of 'ps' in VirtualBox module is displayed in stdout
* Fix Bug #571655 about the Wrong Sys:Syslog usage
* Retrieve family, serial number, number of processors, clockrate for BSDsystems
* New module for inventoring Oracle databases
* Multiples monitors patch added
* Fix Bug #1023670 about memconf not working with HP-UX 11.31
* New version of Gentoo.pm
* New Backend/Virtualization/Parallels.pm module for Parallels virtual machines inventory
* Plugin Processes moved as module
* Fix Bug #911492 about Freebsd Storage drives not being reported
* Fix Bug #911491 about Freebsd CPU info not reporting properly
* Fix Bug #873377 about Installed packages on Gentoo
* Add OS/Linux/LVM.pm module for Logical Volume Manager support
* New Snmp/231.pm module for Fujistu devices
* postinst.pl can now be launched in non-interactive mode using new "--nowizard" launch option
* Adding all the configuration options as launching arguments in postinst.pl
* Adding new interactive questions about "debug", "logfile", "ssl" and "ca" configuration options in postinst.pl
* Download.pm uses LWP useragent initiated by Network.pm for SSL checks
* Download.pm uses LWP useragent initiated by Network.pm for info and frags files downloads
* Network.pm can use LWP version 6 SSL useragent options
* New --ca configuration option to specify a CA certificate path for SSL certificate checks
* New --ssl configuration option to enable/disable SSL certificate checks
* Customize SNMP scans using a special XML format received from server
* Getting network devices MAC address during SNMP scans
* Availibity to scan any networks SNMP devices using nmap or ping scans
* SNMP v3 available for SNMP scans
* Add new --ssl configuration option to enable or disable certificate check during SSL communications
* Change 'SERIAL' field name and add checksum for inventory XML CPUS section
* Now getting MANUFACTURER and SERIALNUMBER in Snmp/3375.pm
* Add new fields in setSnmpLoadBalancer() method in Common.pm
* Fix Bug #1085020 about ERR_ALREADY_IN_HISTORY message that should be success
* Fix bug with SNMP cartridges and trays in Common.pm
* Add new MacOS/Controller.pm module to get controllers inventory under MacOSX
* Add new MacOS/Slots.pm module to get slots inventory under MacOSX
* Add missing DESCRIPTION field in addController() in Common.pm
* Set debug and lazy options to 0, in generated ocsinventory-agent.cfg file by macOSX graphic installer, if check boxes are not selected
* Add a new configuration option to set lazy mode in MacOSX graphic installer
* Improve MacOSX postinstall script to able to deploy MacOSX agent using NetInstall
2.0.5
* Fix Bug #953968 about MacOSX OCSNG.app crash under MacOSX 10.4 64 bits
* Fix bug about illegal hexadecimal digit in Snmp/Host_Resources_Mib.pm
* Fix segfault and buffer overflow bugs in ipdiscover.c
* Improve OCS MacOSX agent internationalization support
* Back to previous pane after wrong OCS server address warning in MacOSX installer
2.0.4
* Improve memory slots detection under MacOSX 10.7 in MacOS/Mem.pm
* Force OCSNG.app to become the topmost window in tools/macosx/ocsng_app-xcode/main.m
* Fix Bug #901570 about wrong printer name if no printer found in MacOS/Printers.pm
* Solving CPU and memories inventory detection under MacOSX Snow Leopard and MacOSX Lion
* Modifying MacOSX backend files to use the new Mac::Sysprole Perl module version
* Fix Bug #887534 about invalid CREATEDATE in lib/Ocsinventory/Agent/Backend/OS/Linux/Drives.pm
2.0.3
* Fix Bug #881406 about security issue due to snmp_com.txt file which is no longer used
* Fix Bug #874269 about wrong conversion if hard drive >= TB in MacOS/Storages.pm
* Fix Bug #879487 about a misplaced object release in ocs_agent_configPane.m
2.0.2
* Fix bug on "Debug Mode" checkbox in MacoSX installer
* Fix bug while sending ERR_DOWNLOAD_INFO message in Donwload.pm
* Fix Bug #856161 about installer problems on MacOSX Tiger
2.0.1
* New SNMP data using If_Mib.pm: IP address, netmask, gateway and routing informations
* Use the "public" SNMP community if no community defined in OCS server configuration
* Various bug fixes in Snmp.pm
* New 2.0 MacOSX integration
* Bug #798428 about standalone agent building
* Change variable names to lowercase in Snmp/3375.pm
* Fix a closedir omission in Solaris/Packages.pm
* Modify releases tarball name when building it using make dist command
* Various patches for CPU, Bios and Drives detection for HPUX systems
* Fix Bug #781732 about a missing chomp() in Processes.pm
2.0
* Fix Bug #778692 about using authentication when sending messages in Download.pm
* Patch from Yoann Le Bihan for Solaris zones support
* Fix Bug #586321 about wrong version comparison in Vmsystem.pm
* Bug #772436 about download end message report in Download.pm
* Display support log received from PROLOG
* Various patches for Snmp/9.pm module (Cisco)
* Add --nolocal option to desactivate local mode even if it is set in config file or command line
* Fix Bug #767290 about /etc/sysconfig/ocsinventory-agent server settings ignore (only for Redhat like distributions)
* Only inventory vitualmachines which have an UUID in VirtualBox.pm to prevent inventoring USB devices or shared folders as virtualmachines
2.0rc4
* Complety clean the disastrous treatments of accountinfos while receiving it from server,storing it in file and adding it in inventory
* Fix UTF8 problems due to XML::Simple::XMLIn()
2.0rc3
* Fix Bug #720635 about lspci usage on old Linux distributions
* Fix Bug #720626 about Gentoo packages with hyphen in their names
* Fix a bug with the use of pacman tool on ArchLinux. We now launch the real packages manager instead of the famous game ;) ;)
* Avoid perl errors when no answer from OCS server
* Enhance logging in Snmp.pm and Download.pm when disabling this modules (local mode or prerequisites not OK)
* Patches from Bernhard Denner to enhance CPU and memry detection on old SUN solaris workstations
* Patch from Bernhard Denner to enhance dhcp-leases files detection on Linux systems
2.0rc2
* Add a new cleanXml() subroutine in Common.pm to clean non printable characters in both standard inventory and SNMP inventory
* Various patches for Snmp/9.pm module (Cisco)
* Add a new addSnmpCPU() subroutine in Common.pm
* Disabling Download.pm if agent running in local mode
2.0rc1
* Add download_start_handler to check if Net::SSLeay can be load and disable Download.pm if not
* Add Net::SNMP optional dependency in README file.
* Delete Win32 from backend
* Various patches for 9.pm and If_Mib.pm to enhance ethernet ports speed display (Françs Mermet)
* New SNMP modules for Juniper, Futjitsu and F5 vendors (Françs Mermet)
* Fix Bug #682689 about missing data for disk when can't run lshal command (Bernhard Denner)
* Add a warning message about user privacy in man page for --scan-homedirs option
* Various patches for 8072.pm an If_Mib.pm (Françs Mermet)
* Change timeout for Backend modules from 180 to 600 seconds
* Change timeout for Backend modules from 180 to 600 seconds
* Back on the ipdiscover binary from the old OCS Linux Agent to make network scans lighter than Nmap. Ipdiscover binary is only available under Linux systems
* Use LaunchDaemons instead of LaunchAgents in MacOSX package
* Fix SSL errors if no URL is given by the server in Snmp.pm
* Do SNMP scans and treatments only if asked by the server
* Delete some useless logs in debug for SNMP constructors and standard MIBs modules
* Change oid_value in snmp_info subroutine in Printer_Mib.pm
* New SNMP 2620.pm module for Checkpoint Software Technologies constructor (Françs Mermet)
* Add new "DEVICEPORT" and "DEVICETYPE" fields in addSnmpnetwork() in Common.pm
* 311.pm and 8072.pm use setSnmpComputer() to set the type of SNMP device
* Add a new addSnmpInput() subroutine in Common.pm
* Fix a bug in addSnmpSwitch subroutine in Common.pm
* Replace SetSnmpSwitch() subroutine by SetSnmpSwitchInfos() in Common.pm
* Set right fields for AddSnmpSwitch() subroutine in Common.pm
* Fix various bug on snmp_oid_run subroutine for constructors and standard MIB modules
* Fix various mistakes and missing fields in snmp subroutines in Common.pm
* Fix a warning due to deprecated syntax in 3ware.pm
* Fix a warning due to deprecated syntax in 3ware.pm
* Fix a catastrophic performance issue by preventing to run sysctl at every line of demidecode output to get CPU informations on BSD systems
* Snmp.pm now download snmp_com.txt file to get informations about SNMP communities for scans using HTTPS
* New subroutines called "getHttpFile" and "getHttpsFile" in Network.pm to download files easily using HTTP or HTTPS.
* Fix bugs and minor mistakes in Common.pm and If_Mib.pm
* Add Lenovo EDID for monitors (Adam Buchbinder)
* Disabling Snmp.pm if agent running in local mode
* Fix a warning if network interface is down in Ipdiscover.pm
* Enhance inventory initialization for a better modularity
* Local mode can now use the "inventory_handler" hook
* Various patches for SNMP constructors or standard MIB module (Françs Mermet)
* Prevent a bug in using Default.pm (Françs Mermet)
* Add "ACR" and "EPI" EDID ID for monitors (Adam Buchbinder)
* Fix Bug #597752 about TYPE and VOLUMN fiels reversal for BSD systems.
* Fix Bug #612515 to report network interface that don't have an IP address (Mick K)
* Don't take care of host with no MAC address in Nmap.pm
* Add the SOFTWARE field in addSnmpCard subroutine
* Enhance Printer_Mib.pm to add information about printer status and printer error state
* Snmp.pm now use Default.pm to launch standard MIB modules by default (Françs Mermet)
* Upgrade several SNMP contructors/standard MIB modules
* Add a new SNMP constructor module for Lexmark
* Add a new SNMP module for the standard Entity MIB.
* Add a new SNMP module to load standard MIB modules by default
* Add new subroutines for SNMP XML feeding for informations about switches, network cards, blades, firewalls etc....
* Correct a log mistacke in Printer_Mib.pm
* New 11.pm module to enable SNMP scans on HP devices
* Get the SNMP device MACADDR from PROLOG resp to generate the SNMPDEVICEID in Snmp.pm
* Add new subroutines in Common.pm for special SNMP XML feed or SNMP special treatments
* New Printer_Mib.pm module to get SNMP printers informations
2.0 alpha Tue, 27 Jul 2010 22:27:27 +0100
* Snmp.pm use flushXMLTags() from Common.pm to flush the content of $common->{xmltags}
* Modifying the inventory backend to use functions from Common.pm instead of Inventory.pm
* New Snmp.pm for SNMP scans integration. It comes with its constructors modules to enhance scans results (a lot of beers to Françs Mermet to thank himfor his help)
* Modifying postinst.pl to include Ocsinventory::Agent::Modules::Snmp
* Agent.pm : add $logger object in Ocsinventory::Agent::Common instantiation
* Common.pm : adding the can_run(), can_load(), can_read() and runcmdi() generic methods. Adding the use of the $logger object
* Common.pm : add a new field 'TYPE' in setSnmpCommons()
* Agent.pm now uses the new Networks.pm methods and add the $network object in the $context hash
* Networks.pm now gives generic methods to send a XML to OCS server and receive a XML from OCS server
* New addInput() method in Common.pm to add mouses and keyboards in inventory
* Donwload.pm now use 'get_path' and 'already_in_array' functions from the new Common.pm
* Common.pm : Replace the former Common.pm by a new one. Common.pm now give a lot of methods for other agent modules
* Agent.pm : instanciate Ocsinventory::Agent::Common object and add a reference to it in $context
* Use of the Nmap::Parser perl module to correct the very buggy Nmap implementation for Ipdiscover
* Various patches for Solaris support (Lucas MASSE)
* Fix the network speed data oblivion in Inventory.pm. The network speed can now be added in Network.pm of the several OS backends
* Put the prolog_reader hook run at the right place to avoid an error if the agent failed to reach the server
* Enhance dom0 support for Xen support (Guillaume ROUSSE)
* Add bios informations for Xen PV hosts (Guillaume ROUSSE)
* Fix Bug #552727 about getting processes that are running in Solaris (Emengao)
* Add the availiability to disable a module using start_handler hook
* Debug and code cleaning in Download.pm
* Fix Bug #552097
* Add XML::SAX::Expat module include
* Replace {REQUEST} and {ADM} by {xmlroot} in xml handling for a better and better readability
* Remove text about Win32 port in the README file
* Correct a bug in Hooks.pm to pass inventory or prolog to modules
* Add headers for the modules logs
* Correct a bug in postinst.pl when removing the old Linux agent
* Ocsinventory::Agent::Option:: namespace is now Ocsinventory::Agent::Modules::
* Modules now use Perl's object system
* Hooks are now methods and not simple subroutines
* Hook.pm is now Hooks.pm
* Use of a new context hash in Agent.pm
* CompatibilityLayer.pm is now Hook.pm
* Calling hooks only in Agent.pm
* Update HPUX support (Francois Mermet)
* Verify ID value received by server in Download.pm
* Verify the network syntax in Nmap.pm
* Replace an hard coded pattern in Linux/devices.pm
* Removing non posix cp option in Download.pm
* Upgrade to memconf V2.13
* Add an in contrib example of script to identify specific software (Simon CLARA)
* An example of script to use tarball to identify installed software
* HP-UX: initial support, tested on RP3440
* Solaris/Network: support Zone
* Solaris: use regex to identify CPU class
* Improve the README about non-interactive installation
* MacOSX: Correctly identify the CPU frequency on MacOSX 1.6 French
1.1.2.1 Tue, 12 Oct 2010 19:42:41 +0100
* Fix a secutiry bug due to the use of ExtUtils::Installed in Backend.pm.
See http://bugs.debian.org/590879 and http://www.debian.org/security/2009/dsa-1828
for more informations.
Thanks to Remi Collet for his report.
1.1.2 Sun, 27 Dec 2009 17:24:43 +0100
* Avoid problem with dmidecode -V output on RHEL3.9 (Remi COLLET)
* Fix internal --delaytime handling. That's seconds, not hours!
* Download.pm: improve a error message
1.1.1 Mon, 21 Dec 2009 22:38:12 +0100
* NETWORKS/VIRTUALDEV should be 1 or 0
* FreeBSD: Fix CPU detection (David DURIEUX)
* Virtualization::Qemu, fix kvm detection
* Don't run brctl if it's not installed
* Various wording fixes (Vincent KNECHT)
* Improve README (Barius DRUBECK)
* Get serial number from ext4 partition if ext4dev driver is used
* LP: #494908 Agent fails to retrieve info file when a package is
activated only with the server name (Pascal DANEK)
* LP: #495398 Fix RedHat version detection (Stéane URBANOVSKI)
* LP: #490774 Fix PowerPC CPU detection on Linux, thanks darkpep for
the bug report
1.1 Fri, 06 Nov 2009 16:07:08 +0100
* addMemorie() renamed to addMemories(), this had been broken during
the addMemories() . addMemory() transition
* Debug mode: msg "check function failed" changed to "ignored" since
the fails may be wanted by the check() function
* CompatibilityLayer: $self->{params} changed to $self->{config},
this restore the debug mode in Download.pm
* Continue XML::Inventory functions name clean up. Rename:
- addSlots() calls to addSlot()
- addMemories() calls to addMemory()
* Move ocsinventory-agent POD documentation frol Ocsinventory::Agent
to the ocsinventory-agent shell script. So now the manpage has the
correct name
* Fix RPM output parsing (Remi COLLET)
* VMWareESX: avoid breakage is VM has spaces in its name
(Christian Michallek)
* Try to detect kvm --uuid value
* Makefile.PL, check for Net::SSLeay
* Move Ocsinventory::Agent in a .pm and add a wrapper script to load
in order to by able to process --devlib
* Parallels.pm: doesn't use sudo anymore and check for
--scan-homedirs
* Prune 'Mac OS X' from the version on Mac + typo fixes (Scott HANNAHS)
* POD doc, add a paragraph about the config file
* LP: #462529, Fix EDID screen detection, thanks Sergio MERINO
* Use boolean for networks/virtualdev
* Generic/Screen: chomp uuencode output
* Generic/Screen: HSD code for "Hanns.G" (Remi COLLET)
* postinst.pl, put user $PATH in /etc/cron.d/ocsinventory-agent
1.1_beta1 Fri, 18 Sep 2009 11:54:12 +0200
* Can use Net::CUPS to find the default printer
* AIX: Hide procfs in Filesystem
* OS::Linux::Storages, correctly retrieve the serial (Vladimir ELISSEEV)
* load $http_proxy env settings and --proxy option is available
* Add OS::Linux::Distro::NonLSB::ArchLinux (Julien SAFAR)
* New Backend OS::Generic::Processes
* Linux/BSD: detect DNS servers config
* Solaris: Better output for $OSVErsion (Vladimir ELISSEEV)
* Solaris: Sun Fire T1000 patches for memory (Vladimir ELISSEEV)
* Solaris: memory SPARC Enterprise T5220 (Vladimir ELISSEEV)
* Solaris: CPU SPARC Enterprise T5220 (Vladimir ELISSEEV)
* Solaris: CPU SPARC Enterprise T5220 (Vladimir ELISSEEV)
* Linux: split the /proc/cpuinfo parsing depending on the arch
* Linux: drop Linux::Controllers which is duplicated with
Generic::Lspci::Controllers (Vladimir ELISSEEV)
* AIX: Various fixes in Memory.pm (Sebastien DAGNICOURT)
* AIX: Storages.pm, Virtual disks support and fixes (Sebastien DAGNICOURT)
* Backend.pm: Bump the default timeout from 30 to 180 secondes
* Agent/XML/Inventory: Fix when version == 0, bug found by neisen
* AIX: device type adjustment (Sebastien DAGNICOURT)
* Solaris: Sun-Fire-V440 support (Sebastien DAGNICOURT)
* Add a missing space if the name banner in --debug mode
* Agent/XML/Inventory.pm: Add FROM and INSTALLDATE fields in software
list and LASTLOGGEDUSER DATELASTLOGGEDUSER
in HARDWARE (Nicolas EISEN)
* Initialize etcdir key even if there is no config file
* CompatibilityLayer: correctly set $debug
* CompatibilityLayer: better log messages
* getOptionInfoByName return an array ref now
* rename getOptionInfoByName to getOptionsInfoByName
* --debug print the XML on STDERR
* Rename the params key to config to avoid ambiguity
with $params
* set HARDWARE/DEFAULTGATEWAY (Nicolas EISEN)
* RPM: collect the install date and the size (Nicolas EISEN)
* Linux: Collect LASTLOGGEDUSER and DATELASTLOGGEDUSER (Nicolas EISEN)
* DPKG: collect the Installed-Size (Nicolas EISEN)
* Linux: Collect the ext{2,3,4} and xfs serial number
* Linux: Collect the ext{2,3,4} creation date
* Add a warning when no certificat is found
* Turns off alarm once it's backend run is finish
* Fix the IPMI module detection
* Linux: Store the PCISLOT and the driver name
* NETWORKDS, only store Networks with an address
* Linux: detect virtual network device
* Linux: Store CONTROLLERS/DRIVER and CONTROLLERS/PCISLOT
* Linux: Collects xfs, ext{2,3,4} and vfat label
* runs the backend module from main() it's possible to
reuse the Backend object.
* Linux: filter non standard MAC address returned by ifconfig like
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 mac
* Linux: Fix the Uptime check()
* Preliminary libvirt support
* Partial rewrite of the Download.pm backend
* Add a warning if the user is no root, thanks Nicolas EISEN and
Sylvain LUCE
* SPARC-Enterprise M4000 and M5000 support (Sylvain LUCE)
* Libvirt: collect VCPU info (Philippe LIBAT)
* Add Virtualization::Xen module (Philippe LIBAT)
* Solaris: add a warning if memconf is not in $PATH
* Switch the XML content from ISO-8859-1 to UTF-8, BTW we force
LC_ALL=C...
* Fix the history flood in Download.pm (Pascal DANEK)
https://sourceforge.net/tracker/index.php?func=detail&aid=2806585&group_id=58373&atid=487492
* Stores PCIID in CONTROLLERS/PCIID
* Storage the monitor EDID string in BASE64 and UUENCODE
* Linux: Storages: reorganize the code base and use lshal
* Linux: Drives, complete inforamtions with lshal (Nicolas EISEN)
* Linux: fix the PowerPC CPU detection
https://sourceforge.net/tracker/?func=detail&atid=487492&aid=2043221&group_id=58373
* Warns the user during the install process if one of
the recommended module is not installed
* Update out copy of memconf, thanks WeatherDave who notified the new
revision and of course Tom Schmidt who do a great job
* MacOSX: Avoid a scalar used has hash ref error, thanks Adadov
* Save VIDEOS/MEMORY and VIDEOS/RESOLUTION
* MacOSX: Correctilly detect Up/Down network interfaces
(David OLIVIER)
* AddNetwork() doesn't ignore network with no IP address
(David OLIVIER)
* add --backend-collect-timeout parameter (Nicolas EISEN)
* MacOSX: convert the IP mask from hex (David OLIVIER)
* MacOSX: add a workaround to avoid Mac::SysProfile failure on
MacOSX 10.5.7 (David OLIVIER)
* Add Virtualization::VirtualBox module (Nicolas EISEN)
* Add Virtualization::Qemu module (Nicolas EISEN)
* Add Virtualization::Vmsystem module (Nicolas EISEN)
* Better smartctl detection (Nicolas EISEN)
* optimization and vm users detection Virtualization::VirtualBox (Nicolas EISEN)
* Add Virtualization::VmwareFusion module (Walid NOUH)
* Don't use hdparm prior 9.2.2 anymore to avoid crap in kernel log, see
http://forums.ocsinventory-ng.org/viewtopic.php?pid=20768
* Correctly detect ipmitool
* Solaris: i86pc Memory support (Jean-Françs BOUCHER)
* Solaris Zone support (Maurizio BERTABONI)
* Always send tag, even if server already has one
* Add the byHand software collect method (Séstien DAGNICOURT)
* add logging to can_read(), can_load() and can_run()
* use addUser() instead of setHardware()
* Add the runcmd() in the Backend modules
1.0.1 Sun, 22 Mar 2009 20:48:49 +0100
* Fix a typo in Ocsinventory::Agent::Backend::OS::AIX::Memory
1.0 Sun, 22 Mar 2009 20:14:26 +0100
* Hide warning messages when tw_cli or hpacucli are not present on CentOS
* Avoid unnecessary about missing 'http://' in local mode
* Ipmi.pm: use can_run do detect ipmitool
* LSB.pm: properly use can_run
* Avoid a warning in CompatibilityLayer.pm in local mode
* Improve the README file
* Avoid a warning at runtime if rpm is not correctly installed
* BSD: Detect AMD64 arch (David DURIEUX)
* HP.pm: force detection even if slot 1 is 0 (Remi COLLET)
* HP.pm minor clean up + indentation
* HP.pm send the $model as NAME to avoid NAME == 'unknown' (Remi COLLET)
* New backend module ServeRaid for IBM ServeRAID card (Remi COLLET)
* Linux::Storages, fix the hdparm call (Remi COLLET)
* OS::Generic::Dmidecode::Bios, fix for RHEL2 dmidecode (Remi COLLET)
* launch backend modules with a 30sec timeout
* post-inst.pl: use prompt() from ExtUtils::MakeMaker to avoid
unexpected error with cpan
* avoid the "No LSB modules are available." warning message
* Backend: --debug print a warning when arun() function is not found
* Fix the Debian/Ubuntu detection for non lsb system
* postinst.pl also drops /etc/cron.d/ocsinventory-client if the user
wants to drop the old linux_agent
* Backend::OS::Solaris::Memory: use the Logger instead of "print"
* Solaris: Drop unwanted spaces around OSVERSION and STORAGES/DESCRIPTION
* Solaris: Avoid warning if the user can't use fstyp
* MANIFEST.SKIP: ignore .git/ and .gitignore
* add a workaround for http://rt.cpan.org/Ticket/Display.html?id=38067
* build-perl-tree.sh use cpanp and perl 5.10 now
* Backend.pm: do a eval around require File::Find
* Add a workaround to find the backend modules for PAR::Packer
* Backend.pm: internal change, now do eval 'use $pmodule' instead of require
* fix serialnum detection in Lsilogic.pm and Adaptec.pm (Edouard GAMIN)
* Makefile.PL: drop wait(), not used
* Makefile.PL: fix a syntax error
* add tools/makedist.sh to document the workaround used to avoid
http://rt.cpan.org/Public/Bug/Display.html?id=43060
* Fix --logfile=/somewhere.log, see
http://forums.ocsinventory-ng.org/viewtopic.php?id=3092
* tools/build-perl-tree.sh, add a new script
* Don't print ugly error if next_timefile can't be saved
* OS::Linux::Domains, improve the way it deals with multiple
domaine entries (Remi COLLET)
* AIX: Record the last memory Slot (Wilfried BRUNKEN)
http://sourceforge.net/tracker/?func=detail&atid=487492&aid=2350694&group_id=58373
* Bump 0.0.10 to 1.0 because it's the first release to be officially part
of the OCSInventory distribution
0.0.10beta2 Wed, 24 Sep 2008 23:41:21 +0200
* README: add a not about the $PATH varible on Solaris.
* Added extra section support for backends (Pascal DANEK)
* Fix the way submodules are disabled with $runMeIfTheseChecksFailed
* Linux: Use lsb_release if presents to detect the OS, this will fix
the Ubuntu detection
* Hide a Perl warning if the agent is run by the user want the last_state
file is missing
* Add Ipmi backend module (Jean PARPAILLON)
* Drop the control characters from the inventory XML
https://sourceforge.net/tracker/index.php?func=detail&aid=2100606&group_id=58373&atid=487492
* Apply a little change in standalone.sh that may fix the ParserDetails.ini problem,
thanks tharoun
0.0.10beta1 Thu, 04 Sep 2008 18:16:49 +0200
* Fix a "ocs server name" => URI side effect (Pascal DANEK)
* Download::Store: used absolute path to "cp" on STORE action (Pascal DANEK)
* Download::Store: set -dpR flags to "cp" (Pascal DANEK)
* Solaris: Replaced hostid in serialnumber by real serialnumber (Nicolas DORFSMAN)
(SUNWsneep becomes mandatory on sparc)
* Solaris: Return only one IP address (trying to guess which one corresponds to hostname) (Nicolas DORFSMAN)
* Solaris: return disks SERIALNUMBER and FIRMWARE as XML fields (Nicolas DORFSMAN)
* Redirection and stderr issue on Solaris (Nicolas DORFSMAN)
- Removed close of stderr fd
- Modified lspci and screen check() to avoid pollution of stdout/stderr
* fix the previous changelog entry, the 0.0.9.1 fix had been done by Nicolas DORFSMAN
* postinst.pl checks for MANIFEST present
* improve the backend module detection by also scanning the symlinked directory
* add the --devlib flag to load ./lib only if wanted and remove '.' from the directory to scan
with File::Find.
* import the can_run, can_load and can_read functions in the Backend modules
* the backend module can have no check function, in this case OCS assume it's ok
* apply a patch by Etienne GUILLAUMONT to fix CPU detection on AIX 4
* standalone.sh checks PAR::Packer presence now
* only inventory installed .deb
* postinst.pl: accept another vardir if the first one was invalide
https://sourceforge.net/tracker/?func=detail&atid=487492&aid=1961771&group_id=58373
* postinst.pl Download.pm correctly activated in modules.conf if the user needs it
* add MacOSX support thanks to Wes YOUNG (Wes YOUNG)
- Added tools/darwin/ support scripts/code for OS X enterprise deployment
* add the follow_skip==2 flag to File::Find in Backend.pm so it doesn't detect the same
file two time
* import of backend module for RAID controller on Linux (3ware, Adaptec, HP and Lsilogic)
(Edouard GAMIN)
* remove a warning in Debug mod, if a backend module has no run() function
* don't crash in Daemon mode if the server is unreachable (Wes YOUNG)
* Net::IP is just (strongly) suggested now
* fix --basevardir so it really accepts a parameter, thanks Gubluts from the forum who
pointed out the bug
* postinst.pl use which to find ocsinventory-agent location
* Makefile.PL, Perl 5.6 doesn't have Config::config_re, I call it from an eval now
* Added --delaytime option as commandline / .cfg file adjustable (Wes YOUNG)
* standalone.sh, don't use grep -v since it's not POSIX
* doesn't die if Storable.pm is missing like with perl 5.6
* avoid a warning with gzip -h on AIX if Compress::Zlib is missing
* README: depends on Perl 5.8
* README: On solaris the Makefile needs gmake
* README: Add a note about crontab and PATH
* Linux: redirect hdparm error to /dev/null
* postinst.pl yes/no questions have a default value now
* postinst.pl fix a bug in the import of the old ocsinv.adm
https://sourceforge.net/tracker/index.php?func=detail&aid=1991668&group_id=58373&atid=487492
* postinst.pl doesn't create two vardir directories anymore
* do not print a wrning is --nosoftware is used. Thanks Knarfling and Remi who pointed the issue
out.
http://forums.ocsinventory-ng.org/viewtopic.php?pid=12569
* fix the POD documentation, some mistakes were detected by Perl 5.10's perldoc.
* the agent doesn't crash anymore if ocsinv.adm or ocsinv.conf is corrupted
* Makefile.pl: install memconf on Solaris
* Solaris: apply patches to use memconf for CPU, Drives and Memory (Christoph HALMES)
0.0.9.2 04/18/2008 Bug fix
* Add /ocsinventory in the server path if the user enter just the hostname
https://sourceforge.net/tracker/?func=detail&atid=487492&aid=1945865&group_id=58373
0.0.9.1 04/03/2008 Bug fix
* fix a error in the previous release that was forcing the local mode (Nicolas DORFSMAN)
https://sourceforge.net/tracker/?func=detail&atid=487492&aid=1945863&group_id=58373
0.0.9 04/01/2008 April Fool release!
* Added fallback for --lazy if no prolog freq was found and server error (Pascal DANEK)
* Fixed accountinfos handling bugs (Pascal DANEK)
* Changed --wait behaviour (--wait=number_of_seconds || "server") (Pascal DANEK)
* PROLOG_FREQ is handled in prolog phase (Pascal DANEK)
* the random value for file_nexttime is computed only if prolog_freq has changed since last prolog (Pascal DANEK)
* import the documentation documentation by adding a description of the
agent and pointer to the official website
* --nosoft option renamed to --nosoftware, --nosoft still works but with a warning
* add --basevardir to be able to use a specific place to store the var file
* add the --lazy parameter: send an inventory only if the a random delay between 0 and PROLOG_FREQ had been run over. Useful for package maintainer (Remi COLLET)
* return 1 to the shell if the agent failed to contact the server
* postinst.pl asks for the basevardir
* postinst.pl write the modules.conf
* OS::Linux::Network::Networks, correctly reset the ipaddress before every loop so
now a network can't have the address of the previous one
* rename the key $params->{conffile} to $params->{accountconfig}
* fix the way accountinfo information are stored
* improve (a bit) tools/standalone.sh to avoid error if people launch it
from the tools directory
* --server is ignore if --local is in use
* adjust Backend::OS::Generic::Screen to be able to use monitor-edid with DVI link (Remi COLLET)
* OS::Linux::Storages, add NEC as a know manufacturer add assume the manifacturer is Seagate if
the model doesn't match the others and begin with ST (rjhill)
* fix the CPU detection on Linux Sparc64 and ARM (Linksys NSLU2)
* improve the Solaris version detection by reading the /etc/release file (Nicolas DORFSMAN)
* Solaris: fix the MAC addresses when the leading zeros is missing (Jean-Jacques MICHEL)
* Solaris: Add publisher is possible in the software list (Nicolas DORFSMAN)
* Solaris: improve the hard drive detection (Nicolas DORFSMAN)
* postinst.pl can remove the previous linux_agent
* postinst.pl reuse linux_agent old config file to set the default server and tag
* return the SERIALNUMBER and the FIRMWARE on Linux with hdparm, the feature is not supported
yet by the server (egamin)
0.0.8.1 02/20/2008
* postinst.pl, correctly save the realm, do not override the password
* Added "CAPTION" field to memory (Pascal DANEK)
* Fix a bug with "NUMSLOTS" memory field (Pascal DANEK)
* improve the parsing of the config file to accept quote and spaces in the value
* postinst.pl save the configfile with 0600 right since the server
password maybe be stored in it
* standalone.sh doesn't scan the inc/ directory anymore
* remove the BUNDLE packages which seem to break the install process
* change Solaris::CPU to use psrinfo -v to get the CPUs which works fine on x86
* fix a path error in Ocsinventory::LoggerBackend::File (Remi COLLET)
* fix: don't send the inventory if the server doesn't need it (Remi COLLET)
0.0.8 02/05/2008
* fix the deviceid and old_deviceid handling (Pascal DANEK)
* fix a debug message in Network.pm (Pascal DANEK)
* different fixes on Compress.pm (Pascal DANEK)
* fix an event message name in Option/Download.pm (Pascal DANEK)
* fix the Compatibility Layer with prolog_read hook (Pascal DANEK)
* merge PowerPC and PC code to detect the CPU and improve/fix the regex
* looks for config file in /etc/ocsinventory /usr/local/etc/ocsinventory and
/etc/ocsinventory-agent
* add a pod documentation about the different config files and directories
* Compress::Zlib is required but recommended now. In fact, you need it with
ocs server prior 1.02
0.0.7.2 01/16/2008
* fix the post installation script to avoid invalid cron time
0.0.7.1 01/14/2008
* add setup.sh in the MANIFEST.SKIP to keep it out of the tarball
0.0.7 01/13/2008
* Ocsinventory::Agent::AccountInfo does not warn accountinfofile if runned in debug mode
without root privilege
* fix params->{etcdir} to /etc/ocsinventory, /etc/ocsinventory-agent/modules.conf must be moved
to /etc/ocsinventory/modules.conf
* Solaris: Improve the CPU detection (Olivier ROUSSY)
* AIX: Return the directory with the AIX package name (Olivier ROUSSY)
* Ocsinventory::Agent::XML::Inventory can now write software inventory
value of FILESIZE, FOLDER and PUBLISHER
* processChecksum() and feedInventory() are called by Ocsinventory::Agent::XML::Inventory
directly now
* the server responses are not parsed in the main script anymore
* do not create an inventory if the server doesnn't need it
* new parameters for the backend modules (run and check functions):
- prologresp, the Ocsinventory::Agent::XML::Response::Prolog object returned by
the prolog
- storage: an hashref stored on the harddrive at the end of the execution of the module
* a backend module without a run function is accepted now
* Inventory.pm: add addIpDiscoverEntry() to add host from the same network
* @runMeIfTheseChecksFailed: new optional setting for Backend module
* Ipdiscover is now a backend module and nmap can be used instead of ipdiscover
* --nosoft disable the Ocsinventory::Agent::Backend::OS::Generic::Packaging modules
* Remove the deprecated modules Ocsinventory::Agent::Option::Ipdiscover and
Ocsinventory::Agent::Option::Update
* the check function of the backend accepts the same parameter than the run function
* Linux::Archs::I386 regex are more robust
* perldoc documentation for the ocsinventory-agent command
* minor improvment on the Makefile.PL
* change the way --server parameter is read. Now we can have a full URL, --remotedir
is now useless
* fix: correctly load the last_state
* improve the Makefile.PL by using inc::Module::Install and adding new check
* add a --version parameter and improve the --help
* come with bundled dependency to simply the build process
* fix the login/passwd/realm authentification
* remove Agent/Pid.pm, I've to prepare a better system to keep the pid first
* try to read the config in /usr/local/etc/ocsinventory/ocsinventory-agent.cfg if the
standard one is missing
0.0.6.2 07/16/2007 Bug fix release
* remove a debug "die" in the code
0.0.6.1 06/12/2007 Bug fix release
* Fix an undef value in Ocsinventory::Agent::Backend::OS::BSD::Mem
* AIX: retrieve correctly the MAC address of some FibberChannel card
* now standalone.sh will try to find every module before the build to
avoid unexplicated error
0.0.6 06/07/2007
* Enable "verbose" is debug is turned on
* AIX: Ocsinventory::Agent::Backend::OS::AIX::Networks rewrote
* AIX: Memory.pm, remove the spaces from the end of the DESCRIPTION
* add standalone.sh, a script designed to prepare a stand-alone binary of the agent
* AIX: Retrieve all the gateway of every subnet instead of just the default one
* Config.pm renamed to AccountConfig.pm
* New flag: --stdout to print the inventory directly on STDOUT
* If the use want write on the system var directory, the agent create one in
~/.ocsinventory/var
* The agent setting can be preinitialised with /etc/ocsinventory/ocsinventory-agent.cfg or
~/ocsinventory/ocsinventory-agent.cfg.
* remove two debug messages printed during accountinfo rewrite and the
daemon starting process
* remove a stupid check in Ocsinventory::Agent::AccountConfig, the
accountconfig file was not written unless the file was already present
* add a recMkdir function in ocsinventory-agent to create directory recursivly
* do not process checksum in local mode
0.0.5 04/17/2007
* AIX: use lslpp -c -l to find installed packages
* AIX: fixes on CPU.pm, Networks.pm and Memory.pm
* AIX: fetch the serial number with lscfg unless it was found with lsvpd
* add the .ocs extension to local written files
* with --local flag: don't not warn if last_state doesn't exit
* Solaris: retrieve installed package
* downgrade some message important from info to debug
* read screen serial number in the EDID (DDC screen)
* Xorg.pm replaced by Screen.pm
* Screen.pm all the data are read from EDID now
* Initial Linux PPC support (tested in Debian Etch).
thanks Walid Nouh for the hardware
* Apply patch by Remi Collet to fix an issue with Linux distro detection and Perl 5.6.1
* Turn of STDERR during the module execution to avoid useless message (e.g: foo: not found)
use --debug to turn them back
* If the system side vardir can't be created. The agent try to create one in ~/.ocs-inventory-agent
* Add a THANKS file
0.0.4 03/20/2007
* use of gzip when Compress:Zlib is not avalaible. OCS server 1.01 and
prior are not supported.
* dmidecode parsing improved
* lspci stuffs moved to generic
* Linux: find Wifi connection
* fix: pass correctly the logger to the modules
* don't write the last_state if the connexion failed
* Deals correctly with the accountinfo if it's internaly stored in a
array ref
* BSD support by Thierry Lacoste
UnixAgent-2.4.2/LICENSE 0000664 0000000 0000000 00000043103 13327377321 0014437 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
UnixAgent-2.4.2/MANIFEST.SKIP 0000775 0000000 0000000 00000000412 13327377321 0015327 0 ustar 00root root 0000000 0000000 CVS/
.git
.bzr
^00
^.gitignore$
^.cvsignore$
.svn
.merge
^blib
^_build
^Build$
^cover_db
^nytprof
^Makefile(\.old)?$
^MANIFEST\.
^MYMETA\.
^pm_to_blib$
^run-postinst
~$
\.bak$
\.old$
\.sw[a-z]$
\.#
\.swp
^Ocsinventory-agent.*
/tarballs/
^setup.sh
.*\.tmp
var/
UnixAgent-2.4.2/META.yml 0000775 0000000 0000000 00000001643 13327377321 0014711 0 ustar 00root root 0000000 0000000 ---
abstract: 'Ocs-Inventory unified Agent for UNIX, Linux and MacOSX'
author:
- 'OCS Inventory Team'
build_requires:
ExtUtils::MakeMaker: 6.59
configure_requires:
ExtUtils::MakeMaker: 6.59
distribution_type: module
dynamic_config: 1
generated_by: 'Module::Install version 1.19'
license: gpl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Ocsinventory-Unix-Agent
no_index:
directory:
- inc
recommends:
Compress::Zlib: 0
Net::IP: 0
Nvidia::ml: 0
Proc::Daemon: 0
Proc::PID::File: 0
requires:
Digest::MD5: 0
File::Temp: 0
LWP: 0
XML::Simple: 0
perl: 5.6.0
resources:
homepage: http://www.ocsinventory-ng.org
bugtracker: https://github.com/OCSInventory-NG/UnixAgent/issues
repository: https://github.com/OCSInventory-NG/UnixAgent
irc: irc://irc.freenode.net/#ocsinventory-ng
license: http://opensource.org/licenses/gpl-license.php
version: 2.4.2
UnixAgent-2.4.2/Makefile.PL 0000775 0000000 0000000 00000011507 13327377321 0015412 0 ustar 00root root 0000000 0000000 BEGIN {
# Avoid installation issue introduced by perl 5.24.1 removing '.' path from
# @INC to avoid possible module injection in normal running perl scripts
push @INC, '.' if ( $^V && $^V gt 'v5.24' );
}
use inc::Module::Install;
use English qw(-no_match_vars);
use Config;
require 'lib/Ocsinventory/Agent/Config.pm';
# Hack to be able to run a post install script
sub MY::postamble
{
my $re;
$re = '
install :: all pure_install doc_install
$(NOECHO) $(NOOP)';
$re .= "\n\t[ ! -f run-postinst ] || $^X postinst.pl\n";
return $re;
}
my $version = $Ocsinventory::Agent::Config::VERSION;
name 'Ocsinventory-Unix-Agent';
include 'Module::AutoInstall';
abstract 'OCS Inventory unified Agent for UNIX, Linux and MacOSX';
license 'gpl';
repository 'https://github.com/OCSInventory-NG/UnixAgent/';
version $version;
perl_version '5.006';
authors 'OCS Inventory Team';
# mandatory dependencies
requires 'Digest::MD5' => undef;
requires 'XML::Simple' => undef;
requires 'LWP' => undef;
requires 'File::Temp' => undef;
requires 'Data::UUID' => undef;
requires 'Net::IP' => undef;
recommends 'IO::Socket::SSL' => undef;
recommends 'Compress::Zlib' => undef;
recommends 'Proc::Daemon' => undef;
recommends 'Proc::PID::File' => undef;
# deployement or https communication
recommends 'Crypt::SSLeay' => undef;
recommends 'LWP::Protocol::https' => undef;
# inventory
recommends 'Net::CUPS' => undef;
recommends 'Parse::EDID' => undef;
recommends 'Nvidia::ml' => undef;
# network
recommends 'Net::SNMP' => undef;
recommends 'Net::Netmask' => undef;
recommends 'Net::Ping' => undef;
recommends 'Nmap::Parser' => undef;
resources
bugtracker => 'https://github.com/OCSinventory-NG/Unixagent/issues',
homepage => 'http://www.ocsinventory-ng.org',
IRC => 'irc://irc.freenode.net/#ocsinventory-ng',
repository => 'https://github.com/OCSinventory-NG/Unixagent';
install_script 'ocsinventory-agent';
# We want a release bundled with the needed dependency to be able to
# prepare a standalone binary with PAR::Packer
if ($ENV{OCS_BUNDLE_RELEASE}) {
foreach my $module (qw/Archive::Zip HTML::Parser LWP URI XML::NamespaceSupport Net::IP Net::Netmask HTML::Tagset Proc::Daemon Module::ScanDeps PAR::Packer AutoLoader PAR PAR::Dist File::Remove YAML::Tiny Getopt::ArgvFile ExtUtils::Install ExtUtils::ParseXS XML::SAX XML::Simple/) {
bundle $module;
requires $module;
}
}
#Ugly hack to include ipdiscover binary compilation and install for Linux systems
if ($^O =~ /^linux$/i && can_cc()) {
my $cc=$Config::Config{cc};
system("$cc resources/ipdiscover/ipdiscover.c -o ipdiscover");
if (-f 'ipdiscover') {
install_script 'ipdiscover';
}
}
if (defined ($ENV{PERL_AUTOINSTALL}) || defined ($ENV{PERL_AUTOINSTALL})) {
unlink 'run-postinst';
} else {
open POSTINST, '>run-postinst' or die $!;
close POSTINST;
}
if (!can_use('Compress::Zlib')) {
print "Please install Compress::Zlib if you use an OCS server prior 1.02.\n";
}
if (!can_use('Crypt::SSLeay')) {
print "Please install Crypt::SSLeay if you want to use SSL.\n";
}
if (!can_use('Net::SSLeay')) {
print "Please install Net::SSLeay if you want to use the software deployment.\n";
}
if (!can_run('ipdiscover') && !can_run('nmap')) {
print "Please install nmap ";
print "or ipdiscover " if $^O =~ /^linux$/i;
print "if you want to use the network ".
"discover feature.\n";
}
if (!can_use('Net::IP')) {
print "Net::IP is strongly recommended since it's required to retrieve "
."network information\n";
}
if (!can_use('Net::Netmask')) {
print "Net::Netmask is strongly recommended since it's required to retrieve "
."snmp information\n";
}
if (!can_use('Proc::Daemon') || !can_use('Proc::PID::File')) {
print "Please install Proc::Daemon and Proc::PID::File if you ".
"want to use the daemon mode.\n";
}
if (!can_use('Nvidia::ml')){
print "Nvidia::ml is recommended if you want to retrieve "
."memory, speed, bios information for Nvidia cards.\n";
}
my $archname;
eval { # config_re is not available on Perl 5.6
my @t = Config::config_re('archname');
$archname = $t[0];
};
if ($^O =~ /(linux|bsd)/i && (!$archname ||$archname =~ /(i[3456x]86|x86_64|amd64)/i)) {
foreach (qw/dmidecode lspci/) {
if (!can_run($_)) {
print "\n";
print "[WARNING] $_ is needed if you want a complete inventory on x86 and AMD64/x86_64.\n";
print "\n";
}
}
}
if ($^O =~ /^darwin$/ && !can_use('Mac::SysProfile')) {
print "\n";
print "[WARNING] Mac::SysProfile are needed on MacOS to detect most of the device information.\n";
print "\n";
requires 'Mac::SysProfile' => undef;
}
# memconf is needed by Solaris backend module
if ($^O =~ /^solaris$/i) {
install_script 'memconf';
}
#for i in inc/BUNDLES/* ; do rm -rf `basename $i` ;done`
#auto_install;
WriteAll;
UnixAgent-2.4.2/README.md 0000664 0000000 0000000 00000013154 13327377321 0014714 0 ustar 00root root 0000000 0000000
OCS Inventory UnixAgent
Some Links:
Ask question |
Installation |
Website |
OCS Professional
Ocsinventory-Agent is an agent for ocsinventory NG. It supports Linux,
Solaris and AIX. *BSD support is in progress.
Prerequisites
- Perl 5.8 minimum
#### The following modules are needed:
- Digest::MD5
- XML::Simple
- Net::IP optional, it is only needed to compute the network information
- LWP
- Mac::SysProfile 0.0.5 : this module is need on MacOSX to collect the device informations.
- To get SSL communications working (for packages deployment or HTTPS communications to OCS server), you need these modules:
- Crypt::SSLeay if you use LWP prior to version 6
- LWP::Protocol::https if you use LWP version 6 or more
- Net::CUPS is used to detect the printer
- Net::SNMP to scan network devices using SNMP
- To enhance SNMP feature with custom networks scans, you need these modules:
- Net::Netmask
- Net::Ping or Nmap::Parser
- Data::UUID is used to create a unique id for every machine
- Parse::EDID is used to inventory monitor and will replace monitor-edid from Mandriva.
#### The following commands are needed:
- dmidecode on Linux and *BSD (i386, amd64, ia64) => dmidecode is required to read the BIOS stats.
- lspci on Linux and *BSD (pciutils package) => lspci is required to list PCI devices.
- sneep on Solaris/sparc, you must install sneep and record the Serial Number with it (download it from http://www.sun.com/download/products.xml?id=4304155a)
- To get the serial number of the screen you will need one of these tools:
- monitor-edid from Mandriva is needed to fetch the monitor. A package is available in Fedora repository. information http://wiki.mandriva.com/en/Tools/monitor-edid
- get-edid from the read-edid package
- ipmitool if you want to collect information about IPMI
- Nmap (v3.90 or superior) to scan network devices for Ipdiscover
#### The following PERL modules are optional:
- Proc::Daemon Daemon mode
- Proc::PID::File brings the pid file support if Proc::Daemon is installed
- nvidia::ml brings you some informations on Nvidia Graphic Cards such as memory size, cpu speed, bios version and driver version.
- Compress::Zlib
#### The following module is needed if you plan to prepare a tarball or install directly from the Bazaar devel branch. (See SOURCES below.):
- Module::Install
Build / Install
Once the archive is unpacked, use these commands:
```
perl Makefile.PL
make
make install
```
If you want to turn off the interactive post install script, just do (instead of perl Makefile.PL)
```
PERL_AUTOINSTALL=1 perl Makefile.PL
```
You can also run the agent from the tarball directory. In this case, use the `--devlib` flag to load the library from the local directory.
You need to launch the agent with root privilege. For debugging you can try to launch it with the `-l` flag:
Ex: `ocsinventory-agent -l /tmp --debug`
It's also possible to run directly from the tarball directory:
`sudo ./ocsinventory-agent --devlib --server http://foo/ocsinventory`
Note
Solaris:
- Sun Studio seems to be needed to build the dependency.
- The generated Makefile needs gmake to be exectuted
- The default installation will install the binary in /usr/perl5/5.XXXXX/bin, set your $PATH variable according to that.
Crontab:
- If you use crontab to launch the agent you'll probably have to redefine the PATH. For example, just add something like: `PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin` At the beginning of the cron file.
## Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Add your changes: `git add folder/file1.php`
4. Commit your changes: `git commit -m 'Add some feature'`
5. Push to the branch: `git push origin my-new-feature`
6. Submit a pull request !
## License
OCS Inventory is GPLv2 licensed
The memconf script is maintained by Tom Schmidt
http://www.4schmidts.com/memconf.html
Copyright © 1996-2017 Tom Schmidt
memconf is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Ocsinventory::Agent::Backend::Virtualization::Vmsystem uses code from imvirt:
Authors:
Thomas Liske
Copyright Holder:
2008 (C) IBH IT-Service GmbH [http://www.ibh.de/]
License: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Ocsinventory::Agent::Backend::OS::Linux::Storages::Adaptec uses code from Parse-Arcconf:
https://github.com/kumy/Parse-Arcconf
License and Copyright:
Copyright (C) 2012 Mathieu Alorent
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information.
UnixAgent-2.4.2/THANKS 0000664 0000000 0000000 00000004433 13327377321 0014350 0 ustar 00root root 0000000 0000000 Olivier ANDREOTTI: AIX, Solaris patches
Thierry LACOSTE: BSD portage
Didier LIROULET: Installation script
Remi COLLET: bug fixes and Fedora/RedHat maintainer
Walid NOUH: gave access to PowerPC hardware to help the portage
Olivier ROUSSY: minor patches
Dennis CABOOTER: FreeBSD maintainer
Pierre CHIFFLIER: Debian maintainer
Nicolas DORFSMAN: Solaris patches
Jean-Jacques MICHEL: Solaris patches
Etienne GUILLAUMONT: AIX4 CPU detection
Wes YOUNG: MacOSX support and patches
Edouard GAMIN: RAID devices support for Linux
Christoph HALMES: Solaris patches
Jean PARPAILLON: IPMI backends and patches
David DURIEUX: AMD64 detection on BSD systems
Wilfried BRUNKEN: patch for memory detection on AIX
Vladimir ELISSEEV: various patches
Julien SAFAR: ArchLinux support
Damien MAURAN: MacOSX packaging, doc and support
Sebastien DAGNICOURT: AIX and Solaris patches
Nicolas EISEN: patches
Sylvain LUCE: Sun M5000 and M4000 support
Philippe LIBAT: patchs and Xen support
David OLIVIER: MacOSX patches
Jean-François BOUCHER: Solaris patch
Scott HANNAHS: MacOSX patches
Maurizio Bertaboni: Solaris Zone support
Scott HANNAHS: patch
Sergio MERINO: patch
Vincent KNECHT: wording patch
Barius DRUBECK: documentation patch
Stéphane URBANOVSKI: patch
Jerome LEBASE: Solaris patches
François MERMET: HP-UX support and SNMP integration
Dmitry ILYIN: Patches
Guillaume ROUSSE: various patches for Xen support
Lucas MASSE: various patches for Solaris support
Adam BUCHBINDER: various patches
Bernhard Denner: various patches
Yoann Le Bihan: Solaris patches
Andreas Xenos: MacOSX patches and Parallels support
Francois Laupetre: LVM modules
Christophe Borivant
Viper233: patch monitor edid
Alexandre Bossot: oracle module
Javier Barroso: VLAN interface on AIX
Yves GUIMARD: download.pm patch for zip files
Marco Tizzoni: Host_Resources_Mib.pm and Agent.pm patches
Matthias Vedrines: patch + various modules
Trois Six: patch
DerJoern: patch
Serge Roux: patch
Guillaume Lecerf: Xen support
Mikkel Paulson: patch
XANI: patch
Philippe Beaumont: patch
lhchin: patch
pilch-cit: patch
lj6: patch
nerijus: patch
GSponda: patch
JHeidinga: patch
Unrankar: patch
jfcoz: patch
xalasys-luc: patch
stweil: patch
ivmaks: patches
MikaelUranker: patches
nnn-dev: patches
jmechnich: patches
matt335672: patches
temperatur: patch
RudyLaurent: patches
guimard: patches
UnixAgent-2.4.2/contrib/ 0000775 0000000 0000000 00000000000 13327377321 0015071 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/contrib/Tarballs.pm 0000664 0000000 0000000 00000002746 13327377321 0017204 0 ustar 00root root 0000000 0000000 # Write by Simon CLARA 2010-01-25
#
# The complete name of the package
# the path MUST be valid or the package won't be loaded
package Ocsinventory::Agent::Backend::OS::Generic::Tarballs;
use strict;
# I need to declare $runAfter because of the strict mode
use vars qw($runAfter);
# The package must be run after OS::Generic
$runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"];
# This is the check function. The agent runs it just once the module is loaded.
# If the function return false, the module and its children are not executed
# eg: OS::Linux and OS::Linux::* won't executed if this run() function return
# false
# Check if we are on a linux server
sub check { $^O =~ /^linux$/ }
# uncomment this if you want check for FreeBSD server
# sub check {can_run("pkg_info")}
# its the main function of the script, it's called during the hardware inventory
sub run {
my $params = shift;
# I need to get the inventory object to update it
my $inventory = $params->{inventory};
# our software are in /usr/local/src/
foreach (`ls /usr/local/src/*.{bz2,tar.gz}`){
/^(\/.*\/)(\S+)-(\d+\S*)(\.tar.gz|\.bz2)$/i;
my $name = $2;
my $version = $3;
my $comments = "Software in /usr/local/src/ \n".`$2 --version`;
# and I updated the information collected
$inventory->addSoftwares({
COMMENTS => $comments,
NAME => $name,
VERSION => $version
});
}
}
1;
UnixAgent-2.4.2/etc/ 0000775 0000000 0000000 00000000000 13327377321 0014204 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/etc/cron.d/ 0000775 0000000 0000000 00000000000 13327377321 0015367 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/etc/cron.d/ocsinventory-agent 0000664 0000000 0000000 00000001252 13327377321 0021150 0 ustar 00root root 0000000 0000000 #
# File generated by OCS Inventory NG Unified Unix Agent setup
#
################################################################################
#
# OCS Inventory NG Unified Unix Agent
#
# Copyleft 2007 Didier LIROULET
# Web: http://www.ocsinventory-ng.org
#
# This code is open source and may be copied and modified as long as the source
# code is always made freely available.
# Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################
#
# Launch OCS Inventory NG Agent once a day under root account, at HH:MM
#
MM HH * * * root /usr/bin/ocsinventory-agent > /dev/null 2>&1
UnixAgent-2.4.2/etc/default/ 0000775 0000000 0000000 00000000000 13327377321 0015630 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/etc/default/ocsinventory-agent 0000664 0000000 0000000 00000000023 13327377321 0021404 0 ustar 00root root 0000000 0000000 SERVER="localhost"
UnixAgent-2.4.2/etc/init.d/ 0000775 0000000 0000000 00000000000 13327377321 0015371 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/etc/init.d/ocsinventory-agent 0000775 0000000 0000000 00000010401 13327377321 0021151 0 ustar 00root root 0000000 0000000 #! /bin/sh
### BEGIN INIT INFO
# Provides: ocs-inventory-agent
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OCS-Inventory Agent
# Description: This script launches OCS Agent as daemon
### END INIT INFO
# Author: Gonéri Le Bouder
#
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="OCS Inventory Agent"
NAME=ocsinventory-agent
DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
DAEMON_ARGS="-d -s $SERVER"
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:
UnixAgent-2.4.2/etc/logrotate.d/ 0000775 0000000 0000000 00000000000 13327377321 0016426 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/etc/logrotate.d/ocsinventory-agent 0000664 0000000 0000000 00000001354 13327377321 0022212 0 ustar 00root root 0000000 0000000 #
# File generated by OCS Inventory NG Unified Unix Agent setup
#
################################################################################
#
# OCS Inventory NG Unified Unix Agent
#
# Copyleft 2007 Didier LIROULET
# Web: http://www.ocsinventory-ng.org
#
# This code is open source and may be copied and modified as long as the source
# code is always made freely available.
# Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################
#
# Rotate OCS Inventory NG agent logs daily, only if not empty
# Save 7 days old logs under compressed mode
PATH_TO_LOG_DIRECTORY/*.log {
daily
rotate 7
compress
notifempty
missingok
}
UnixAgent-2.4.2/etc/ocsinventory-agent/ 0000775 0000000 0000000 00000000000 13327377321 0020042 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/etc/ocsinventory-agent/modules.conf 0000664 0000000 0000000 00000000433 13327377321 0022361 0 ustar 00root root 0000000 0000000 # This list of modules will be loaded by the agent at run time.
# To check its syntax do:
# $perl modules.conf
# You must have NO error, else the content will be ignored.
use Ocsinventory::Agent::Modules::Download;
use Ocsinventory::Agent::Modules::Snmp;
# DO NOT REMOVE the 1;
1;
UnixAgent-2.4.2/etc/ocsinventory-agent/softwares/ 0000775 0000000 0000000 00000000000 13327377321 0022057 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/etc/ocsinventory-agent/softwares/example.sh 0000775 0000000 0000000 00000000710 13327377321 0024047 0 ustar 00root root 0000000 0000000 #! /bin/bash
# This is an example script for the byHand software collect method
#
# You can create your own script to detect the installed software
# and install them in /etc/ocsinventory/softwares
#
#ligne=$(ls --version| head -n 1)
#
#soft=$(echo $ligne | cut -f1 -d'('| sed 's/ //')
#vendor=$(echo $ligne | cut -f2 -d'('| cut -f1 -d')')
#version=$(echo $ligne | cut -f2 -d'('| cut -f2 -d')'|sed 's/ //')
#
#echo "$vendor#$soft#$version#simple test"
#
#
UnixAgent-2.4.2/inc/ 0000775 0000000 0000000 00000000000 13327377321 0014202 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/inc/Module/ 0000775 0000000 0000000 00000000000 13327377321 0015427 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/inc/Module/AutoInstall.pm 0000664 0000000 0000000 00000063016 13327377321 0020232 0 ustar 00root root 0000000 0000000 #line 1
package Module::AutoInstall;
use strict;
use Cwd ();
use File::Spec ();
use ExtUtils::MakeMaker ();
use vars qw{$VERSION};
BEGIN {
$VERSION = '1.14';
}
# special map on pre-defined feature sets
my %FeatureMap = (
'' => 'Core Features', # XXX: deprecated
'-core' => 'Core Features',
);
# various lexical flags
my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $InstallDepsTarget, $HasCPANPLUS );
my (
$Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps,
$UpgradeDeps
);
my ( $PostambleActions, $PostambleActionsNoTest, $PostambleActionsUpgradeDeps,
$PostambleActionsUpgradeDepsNoTest, $PostambleActionsListDeps,
$PostambleActionsListAllDeps, $PostambleUsed, $NoTest);
# See if it's a testing or non-interactive session
_accept_default( $ENV{AUTOMATED_TESTING} or ! -t STDIN );
_init();
sub _accept_default {
$AcceptDefault = shift;
}
sub _installdeps_target {
$InstallDepsTarget = shift;
}
sub missing_modules {
return @Missing;
}
sub do_install {
__PACKAGE__->install(
[
$Config
? ( UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} )
: ()
],
@Missing,
);
}
# initialize various flags, and/or perform install
sub _init {
foreach my $arg (
@ARGV,
split(
/[\s\t]+/,
$ENV{PERL_AUTOINSTALL} || $ENV{PERL_EXTUTILS_AUTOINSTALL} || ''
)
)
{
if ( $arg =~ /^--config=(.*)$/ ) {
$Config = [ split( ',', $1 ) ];
}
elsif ( $arg =~ /^--installdeps=(.*)$/ ) {
__PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) );
exit 0;
}
elsif ( $arg =~ /^--upgradedeps=(.*)$/ ) {
$UpgradeDeps = 1;
__PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) );
exit 0;
}
elsif ( $arg =~ /^--default(?:deps)?$/ ) {
$AcceptDefault = 1;
}
elsif ( $arg =~ /^--check(?:deps)?$/ ) {
$CheckOnly = 1;
}
elsif ( $arg =~ /^--skip(?:deps)?$/ ) {
$SkipInstall = 1;
}
elsif ( $arg =~ /^--test(?:only)?$/ ) {
$TestOnly = 1;
}
elsif ( $arg =~ /^--all(?:deps)?$/ ) {
$AllDeps = 1;
}
}
}
# overrides MakeMaker's prompt() to automatically accept the default choice
sub _prompt {
goto &ExtUtils::MakeMaker::prompt unless $AcceptDefault;
my ( $prompt, $default ) = @_;
my $y = ( $default =~ /^[Yy]/ );
print $prompt, ' [', ( $y ? 'Y' : 'y' ), '/', ( $y ? 'n' : 'N' ), '] ';
print "$default\n";
return $default;
}
# the workhorse
sub import {
my $class = shift;
my @args = @_ or return;
my $core_all;
print "*** $class version " . $class->VERSION . "\n";
print "*** Checking for Perl dependencies...\n";
my $cwd = Cwd::getcwd();
$Config = [];
my $maxlen = length(
(
sort { length($b) <=> length($a) }
grep { /^[^\-]/ }
map {
ref($_)
? ( ( ref($_) eq 'HASH' ) ? keys(%$_) : @{$_} )
: ''
}
map { +{@args}->{$_} }
grep { /^[^\-]/ or /^-core$/i } keys %{ +{@args} }
)[0]
);
# We want to know if we're under CPAN early to avoid prompting, but
# if we aren't going to try and install anything anyway then skip the
# check entirely since we don't want to have to load (and configure)
# an old CPAN just for a cosmetic message
$UnderCPAN = _check_lock(1) unless $SkipInstall || $InstallDepsTarget;
while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
my ( @required, @tests, @skiptests );
my $default = 1;
my $conflict = 0;
if ( $feature =~ m/^-(\w+)$/ ) {
my $option = lc($1);
# check for a newer version of myself
_update_to( $modules, @_ ) and return if $option eq 'version';
# sets CPAN configuration options
$Config = $modules if $option eq 'config';
# promote every features to core status
$core_all = ( $modules =~ /^all$/i ) and next
if $option eq 'core';
next unless $option eq 'core';
}
print "[" . ( $FeatureMap{ lc($feature) } || $feature ) . "]\n";
$modules = [ %{$modules} ] if UNIVERSAL::isa( $modules, 'HASH' );
unshift @$modules, -default => &{ shift(@$modules) }
if ( ref( $modules->[0] ) eq 'CODE' ); # XXX: bugward compatibility
while ( my ( $mod, $arg ) = splice( @$modules, 0, 2 ) ) {
if ( $mod =~ m/^-(\w+)$/ ) {
my $option = lc($1);
$default = $arg if ( $option eq 'default' );
$conflict = $arg if ( $option eq 'conflict' );
@tests = @{$arg} if ( $option eq 'tests' );
@skiptests = @{$arg} if ( $option eq 'skiptests' );
next;
}
printf( "- %-${maxlen}s ...", $mod );
if ( $arg and $arg =~ /^\D/ ) {
unshift @$modules, $arg;
$arg = 0;
}
# XXX: check for conflicts and uninstalls(!) them.
my $cur = _version_of($mod);
if (_version_cmp ($cur, $arg) >= 0)
{
print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
push @Existing, $mod => $arg;
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
else {
if (not defined $cur) # indeed missing
{
print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n";
}
else
{
# no need to check $arg as _version_cmp ($cur, undef) would satisfy >= above
print "too old. ($cur < $arg)\n";
}
push @required, $mod => $arg;
}
}
next unless @required;
my $mandatory = ( $feature eq '-core' or $core_all );
if (
!$SkipInstall
and (
$CheckOnly
or ($mandatory and $UnderCPAN)
or $AllDeps
or $InstallDepsTarget
or _prompt(
qq{==> Auto-install the }
. ( @required / 2 )
. ( $mandatory ? ' mandatory' : ' optional' )
. qq{ module(s) from CPAN?},
$default ? 'y' : 'n',
) =~ /^[Yy]/
)
)
{
push( @Missing, @required );
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
elsif ( !$SkipInstall
and $default
and $mandatory
and
_prompt( qq{==> The module(s) are mandatory! Really skip?}, 'n', )
=~ /^[Nn]/ )
{
push( @Missing, @required );
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
else {
$DisabledTests{$_} = 1 for map { glob($_) } @tests;
}
}
if ( @Missing and not( $CheckOnly or $UnderCPAN) ) {
require Config;
my $make = $Config::Config{make};
if ($InstallDepsTarget) {
print
"*** To install dependencies type '$make installdeps' or '$make installdeps_notest'.\n";
}
else {
print
"*** Dependencies will be installed the next time you type '$make'.\n";
}
# make an educated guess of whether we'll need root permission.
print " (You may need to do that as the 'root' user.)\n"
if eval '$>';
}
print "*** $class configuration finished.\n";
chdir $cwd;
# import to main::
no strict 'refs';
*{'main::WriteMakefile'} = \&Write if caller(0) eq 'main';
return (@Existing, @Missing);
}
sub _running_under {
my $thing = shift;
print <<"END_MESSAGE";
*** Since we're running under ${thing}, I'll just let it take care
of the dependency's installation later.
END_MESSAGE
return 1;
}
# Check to see if we are currently running under CPAN.pm and/or CPANPLUS;
# if we are, then we simply let it taking care of our dependencies
sub _check_lock {
return unless @Missing or @_;
if ($ENV{PERL5_CPANM_IS_RUNNING}) {
return _running_under('cpanminus');
}
my $cpan_env = $ENV{PERL5_CPAN_IS_RUNNING};
if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) {
return _running_under($cpan_env ? 'CPAN' : 'CPANPLUS');
}
require CPAN;
if ($CPAN::VERSION > '1.89') {
if ($cpan_env) {
return _running_under('CPAN');
}
return; # CPAN.pm new enough, don't need to check further
}
# last ditch attempt, this -will- configure CPAN, very sorry
_load_cpan(1); # force initialize even though it's already loaded
# Find the CPAN lock-file
my $lock = MM->catfile( $CPAN::Config->{cpan_home}, ".lock" );
return unless -f $lock;
# Check the lock
local *LOCK;
return unless open(LOCK, $lock);
if (
( $^O eq 'MSWin32' ? _under_cpan() : == getppid() )
and ( $CPAN::Config->{prerequisites_policy} || '' ) ne 'ignore'
) {
print <<'END_MESSAGE';
*** Since we're running under CPAN, I'll just let it take care
of the dependency's installation later.
END_MESSAGE
return 1;
}
close LOCK;
return;
}
sub install {
my $class = shift;
my $i; # used below to strip leading '-' from config keys
my @config = ( map { s/^-// if ++$i; $_ } @{ +shift } );
my ( @modules, @installed, @modules_to_upgrade );
while (my ($pkg, $ver) = splice(@_, 0, 2)) {
# grep out those already installed
if (_version_cmp(_version_of($pkg), $ver) >= 0) {
push @installed, $pkg;
if ($UpgradeDeps) {
push @modules_to_upgrade, $pkg, $ver;
}
}
else {
push @modules, $pkg, $ver;
}
}
if ($UpgradeDeps) {
push @modules, @modules_to_upgrade;
@installed = ();
@modules_to_upgrade = ();
}
return @installed unless @modules; # nothing to do
return @installed if _check_lock(); # defer to the CPAN shell
print "*** Installing dependencies...\n";
return unless _connected_to('cpan.org');
my %args = @config;
my %failed;
local *FAILED;
if ( $args{do_once} and open( FAILED, '.#autoinstall.failed' ) ) {
while () { chomp; $failed{$_}++ }
close FAILED;
my @newmod;
while ( my ( $k, $v ) = splice( @modules, 0, 2 ) ) {
push @newmod, ( $k => $v ) unless $failed{$k};
}
@modules = @newmod;
}
if ( _has_cpanplus() and not $ENV{PERL_AUTOINSTALL_PREFER_CPAN} ) {
_install_cpanplus( \@modules, \@config );
} else {
_install_cpan( \@modules, \@config );
}
print "*** $class installation finished.\n";
# see if we have successfully installed them
while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
if ( _version_cmp( _version_of($pkg), $ver ) >= 0 ) {
push @installed, $pkg;
}
elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) {
print FAILED "$pkg\n";
}
}
close FAILED if $args{do_once};
return @installed;
}
sub _install_cpanplus {
my @modules = @{ +shift };
my @config = _cpanplus_config( @{ +shift } );
my $installed = 0;
require CPANPLUS::Backend;
my $cp = CPANPLUS::Backend->new;
my $conf = $cp->configure_object;
return unless $conf->can('conf') # 0.05x+ with "sudo" support
or _can_write($conf->_get_build('base')); # 0.04x
# if we're root, set UNINST=1 to avoid trouble unless user asked for it.
my $makeflags = $conf->get_conf('makeflags') || '';
if ( UNIVERSAL::isa( $makeflags, 'HASH' ) ) {
# 0.03+ uses a hashref here
$makeflags->{UNINST} = 1 unless exists $makeflags->{UNINST};
} else {
# 0.02 and below uses a scalar
$makeflags = join( ' ', split( ' ', $makeflags ), 'UNINST=1' )
if ( $makeflags !~ /\bUNINST\b/ and eval qq{ $> eq '0' } );
}
$conf->set_conf( makeflags => $makeflags );
$conf->set_conf( prereqs => 1 );
while ( my ( $key, $val ) = splice( @config, 0, 2 ) ) {
$conf->set_conf( $key, $val );
}
my $modtree = $cp->module_tree;
while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
print "*** Installing $pkg...\n";
MY::preinstall( $pkg, $ver ) or next if defined &MY::preinstall;
my $success;
my $obj = $modtree->{$pkg};
if ( $obj and _version_cmp( $obj->{version}, $ver ) >= 0 ) {
my $pathname = $pkg;
$pathname =~ s/::/\\W/;
foreach my $inc ( grep { m/$pathname.pm/i } keys(%INC) ) {
delete $INC{$inc};
}
my $rv = $cp->install( modules => [ $obj->{module} ] );
if ( $rv and ( $rv->{ $obj->{module} } or $rv->{ok} ) ) {
print "*** $pkg successfully installed.\n";
$success = 1;
} else {
print "*** $pkg installation cancelled.\n";
$success = 0;
}
$installed += $success;
} else {
print << ".";
*** Could not find a version $ver or above for $pkg; skipping.
.
}
MY::postinstall( $pkg, $ver, $success ) if defined &MY::postinstall;
}
return $installed;
}
sub _cpanplus_config {
my @config = ();
while ( @_ ) {
my ($key, $value) = (shift(), shift());
if ( $key eq 'prerequisites_policy' ) {
if ( $value eq 'follow' ) {
$value = CPANPLUS::Internals::Constants::PREREQ_INSTALL();
} elsif ( $value eq 'ask' ) {
$value = CPANPLUS::Internals::Constants::PREREQ_ASK();
} elsif ( $value eq 'ignore' ) {
$value = CPANPLUS::Internals::Constants::PREREQ_IGNORE();
} else {
die "*** Cannot convert option $key = '$value' to CPANPLUS version.\n";
}
push @config, 'prereqs', $value;
} elsif ( $key eq 'force' ) {
push @config, $key, $value;
} elsif ( $key eq 'notest' ) {
push @config, 'skiptest', $value;
} else {
die "*** Cannot convert option $key to CPANPLUS version.\n";
}
}
return @config;
}
sub _install_cpan {
my @modules = @{ +shift };
my @config = @{ +shift };
my $installed = 0;
my %args;
_load_cpan();
require Config;
if (CPAN->VERSION < 1.80) {
# no "sudo" support, probe for writableness
return unless _can_write( MM->catfile( $CPAN::Config->{cpan_home}, 'sources' ) )
and _can_write( $Config::Config{sitelib} );
}
# if we're root, set UNINST=1 to avoid trouble unless user asked for it.
my $makeflags = $CPAN::Config->{make_install_arg} || '';
$CPAN::Config->{make_install_arg} =
join( ' ', split( ' ', $makeflags ), 'UNINST=1' )
if ( $makeflags !~ /\bUNINST\b/ and eval qq{ $> eq '0' } );
# don't show start-up info
$CPAN::Config->{inhibit_startup_message} = 1;
# set additional options
while ( my ( $opt, $arg ) = splice( @config, 0, 2 ) ) {
( $args{$opt} = $arg, next )
if $opt =~ /^(?:force|notest)$/; # pseudo-option
$CPAN::Config->{$opt} = $arg;
}
if ($args{notest} && (not CPAN::Shell->can('notest'))) {
die "Your version of CPAN is too old to support the 'notest' pragma";
}
local $CPAN::Config->{prerequisites_policy} = 'follow';
while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
MY::preinstall( $pkg, $ver ) or next if defined &MY::preinstall;
print "*** Installing $pkg...\n";
my $obj = CPAN::Shell->expand( Module => $pkg );
my $success = 0;
if ( $obj and _version_cmp( $obj->cpan_version, $ver ) >= 0 ) {
my $pathname = $pkg;
$pathname =~ s/::/\\W/;
foreach my $inc ( grep { m/$pathname.pm/i } keys(%INC) ) {
delete $INC{$inc};
}
my $rv = do {
if ($args{force}) {
CPAN::Shell->force( install => $pkg )
} elsif ($args{notest}) {
CPAN::Shell->notest( install => $pkg )
} else {
CPAN::Shell->install($pkg)
}
};
$rv ||= eval {
$CPAN::META->instance( 'CPAN::Distribution', $obj->cpan_file, )
->{install}
if $CPAN::META;
};
if ( $rv eq 'YES' ) {
print "*** $pkg successfully installed.\n";
$success = 1;
}
else {
print "*** $pkg installation failed.\n";
$success = 0;
}
$installed += $success;
}
else {
print << ".";
*** Could not find a version $ver or above for $pkg; skipping.
.
}
MY::postinstall( $pkg, $ver, $success ) if defined &MY::postinstall;
}
return $installed;
}
sub _has_cpanplus {
return (
$HasCPANPLUS = (
$INC{'CPANPLUS/Config.pm'}
or _load('CPANPLUS::Shell::Default')
)
);
}
# make guesses on whether we're under the CPAN installation directory
sub _under_cpan {
require Cwd;
require File::Spec;
my $cwd = File::Spec->canonpath( Cwd::getcwd() );
my $cpan = File::Spec->canonpath( $CPAN::Config->{cpan_home} );
return ( index( $cwd, $cpan ) > -1 );
}
sub _update_to {
my $class = __PACKAGE__;
my $ver = shift;
return
if _version_cmp( _version_of($class), $ver ) >= 0; # no need to upgrade
if (
_prompt( "==> A newer version of $class ($ver) is required. Install?",
'y' ) =~ /^[Nn]/
)
{
die "*** Please install $class $ver manually.\n";
}
print << ".";
*** Trying to fetch it from CPAN...
.
# install ourselves
_load($class) and return $class->import(@_)
if $class->install( [], $class, $ver );
print << '.'; exit 1;
*** Cannot bootstrap myself. :-( Installation terminated.
.
}
# check if we're connected to some host, using inet_aton
sub _connected_to {
my $site = shift;
return (
( _load('Socket') and Socket::inet_aton($site) ) or _prompt(
qq(
*** Your host cannot resolve the domain name '$site', which
probably means the Internet connections are unavailable.
==> Should we try to install the required module(s) anyway?), 'n'
) =~ /^[Yy]/
);
}
# check if a directory is writable; may create it on demand
sub _can_write {
my $path = shift;
mkdir( $path, 0755 ) unless -e $path;
return 1 if -w $path;
print << ".";
*** You are not allowed to write to the directory '$path';
the installation may fail due to insufficient permissions.
.
if (
eval '$>' and lc(`sudo -V`) =~ /version/ and _prompt(
qq(
==> Should we try to re-execute the autoinstall process with 'sudo'?),
((-t STDIN) ? 'y' : 'n')
) =~ /^[Yy]/
)
{
# try to bootstrap ourselves from sudo
print << ".";
*** Trying to re-execute the autoinstall process with 'sudo'...
.
my $missing = join( ',', @Missing );
my $config = join( ',',
UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} )
if $Config;
return
unless system( 'sudo', $^X, $0, "--config=$config",
"--installdeps=$missing" );
print << ".";
*** The 'sudo' command exited with error! Resuming...
.
}
return _prompt(
qq(
==> Should we try to install the required module(s) anyway?), 'n'
) =~ /^[Yy]/;
}
# load a module and return the version it reports
sub _load {
my $mod = pop; # method/function doesn't matter
my $file = $mod;
$file =~ s|::|/|g;
$file .= '.pm';
local $@;
return eval { require $file; $mod->VERSION } || ( $@ ? undef: 0 );
}
# report version without loading a module
sub _version_of {
my $mod = pop; # method/function doesn't matter
my $file = $mod;
$file =~ s|::|/|g;
$file .= '.pm';
foreach my $dir ( @INC ) {
next if ref $dir;
my $path = File::Spec->catfile($dir, $file);
next unless -e $path;
require ExtUtils::MM_Unix;
return ExtUtils::MM_Unix->parse_version($path);
}
return undef;
}
# Load CPAN.pm and it's configuration
sub _load_cpan {
return if $CPAN::VERSION and $CPAN::Config and not @_;
require CPAN;
# CPAN-1.82+ adds CPAN::Config::AUTOLOAD to redirect to
# CPAN::HandleConfig->load. CPAN reports that the redirection
# is deprecated in a warning printed at the user.
# CPAN-1.81 expects CPAN::HandleConfig->load, does not have
# $CPAN::HandleConfig::VERSION but cannot handle
# CPAN::Config->load
# Which "versions expect CPAN::Config->load?
if ( $CPAN::HandleConfig::VERSION
|| CPAN::HandleConfig->can('load')
) {
# Newer versions of CPAN have a HandleConfig module
CPAN::HandleConfig->load;
} else {
# Older versions had the load method in Config directly
CPAN::Config->load;
}
}
# compare two versions, either use Sort::Versions or plain comparison
# return values same as <=>
sub _version_cmp {
my ( $cur, $min ) = @_;
return -1 unless defined $cur; # if 0 keep comparing
return 1 unless $min;
$cur =~ s/\s+$//;
# check for version numbers that are not in decimal format
if ( ref($cur) or ref($min) or $cur =~ /v|\..*\./ or $min =~ /v|\..*\./ ) {
if ( ( $version::VERSION or defined( _load('version') )) and
version->can('new')
) {
# use version.pm if it is installed.
return version->new($cur) <=> version->new($min);
}
elsif ( $Sort::Versions::VERSION or defined( _load('Sort::Versions') ) )
{
# use Sort::Versions as the sorting algorithm for a.b.c versions
return Sort::Versions::versioncmp( $cur, $min );
}
warn "Cannot reliably compare non-decimal formatted versions.\n"
. "Please install version.pm or Sort::Versions.\n";
}
# plain comparison
local $^W = 0; # shuts off 'not numeric' bugs
return $cur <=> $min;
}
# nothing; this usage is deprecated.
sub main::PREREQ_PM { return {}; }
sub _make_args {
my %args = @_;
$args{PREREQ_PM} = { %{ $args{PREREQ_PM} || {} }, @Existing, @Missing }
if $UnderCPAN or $TestOnly;
if ( $args{EXE_FILES} and -e 'MANIFEST' ) {
require ExtUtils::Manifest;
my $manifest = ExtUtils::Manifest::maniread('MANIFEST');
$args{EXE_FILES} =
[ grep { exists $manifest->{$_} } @{ $args{EXE_FILES} } ];
}
$args{test}{TESTS} ||= 't/*.t';
$args{test}{TESTS} = join( ' ',
grep { !exists( $DisabledTests{$_} ) }
map { glob($_) } split( /\s+/, $args{test}{TESTS} ) );
my $missing = join( ',', @Missing );
my $config =
join( ',', UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} )
if $Config;
$PostambleActions = (
($missing and not $UnderCPAN)
? "\$(PERL) $0 --config=$config --installdeps=$missing"
: "\$(NOECHO) \$(NOOP)"
);
my $deps_list = join( ',', @Missing, @Existing );
$PostambleActionsUpgradeDeps =
"\$(PERL) $0 --config=$config --upgradedeps=$deps_list";
my $config_notest =
join( ',', (UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config}),
'notest', 1 )
if $Config;
$PostambleActionsNoTest = (
($missing and not $UnderCPAN)
? "\$(PERL) $0 --config=$config_notest --installdeps=$missing"
: "\$(NOECHO) \$(NOOP)"
);
$PostambleActionsUpgradeDepsNoTest =
"\$(PERL) $0 --config=$config_notest --upgradedeps=$deps_list";
$PostambleActionsListDeps =
'@$(PERL) -le "print for @ARGV" '
. join(' ', map $Missing[$_], grep $_ % 2 == 0, 0..$#Missing);
my @all = (@Missing, @Existing);
$PostambleActionsListAllDeps =
'@$(PERL) -le "print for @ARGV" '
. join(' ', map $all[$_], grep $_ % 2 == 0, 0..$#all);
return %args;
}
# a wrapper to ExtUtils::MakeMaker::WriteMakefile
sub Write {
require Carp;
Carp::croak "WriteMakefile: Need even number of args" if @_ % 2;
if ($CheckOnly) {
print << ".";
*** Makefile not written in check-only mode.
.
return;
}
my %args = _make_args(@_);
no strict 'refs';
$PostambleUsed = 0;
local *MY::postamble = \&postamble unless defined &MY::postamble;
ExtUtils::MakeMaker::WriteMakefile(%args);
print << "." unless $PostambleUsed;
*** WARNING: Makefile written with customized MY::postamble() without
including contents from Module::AutoInstall::postamble() --
auto installation features disabled. Please contact the author.
.
return 1;
}
sub postamble {
$PostambleUsed = 1;
my $fragment;
$fragment .= <<"AUTO_INSTALL" if !$InstallDepsTarget;
config :: installdeps
\t\$(NOECHO) \$(NOOP)
AUTO_INSTALL
$fragment .= <<"END_MAKE";
checkdeps ::
\t\$(PERL) $0 --checkdeps
installdeps ::
\t$PostambleActions
installdeps_notest ::
\t$PostambleActionsNoTest
upgradedeps ::
\t$PostambleActionsUpgradeDeps
upgradedeps_notest ::
\t$PostambleActionsUpgradeDepsNoTest
listdeps ::
\t$PostambleActionsListDeps
listalldeps ::
\t$PostambleActionsListAllDeps
END_MAKE
return $fragment;
}
1;
__END__
#line 1197
UnixAgent-2.4.2/inc/Module/Install.pm 0000664 0000000 0000000 00000032744 13327377321 0017405 0 ustar 00root root 0000000 0000000 #line 1
package Module::Install;
# For any maintainers:
# The load order for Module::Install is a bit magic.
# It goes something like this...
#
# IF ( host has Module::Install installed, creating author mode ) {
# 1. Makefile.PL calls "use inc::Module::Install"
# 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install
# 3. The installed version of inc::Module::Install loads
# 4. inc::Module::Install calls "require Module::Install"
# 5. The ./inc/ version of Module::Install loads
# } ELSE {
# 1. Makefile.PL calls "use inc::Module::Install"
# 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install
# 3. The ./inc/ version of Module::Install loads
# }
use 5.006;
use strict 'vars';
use Cwd ();
use File::Find ();
use File::Path ();
use vars qw{$VERSION $MAIN};
BEGIN {
# All Module::Install core packages now require synchronised versions.
# This will be used to ensure we don't accidentally load old or
# different versions of modules.
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
$VERSION = '1.14';
# Storage for the pseudo-singleton
$MAIN = undef;
*inc::Module::Install::VERSION = *VERSION;
@inc::Module::Install::ISA = __PACKAGE__;
}
sub import {
my $class = shift;
my $self = $class->new(@_);
my $who = $self->_caller;
#-------------------------------------------------------------
# all of the following checks should be included in import(),
# to allow "eval 'require Module::Install; 1' to test
# installation of Module::Install. (RT #51267)
#-------------------------------------------------------------
# Whether or not inc::Module::Install is actually loaded, the
# $INC{inc/Module/Install.pm} is what will still get set as long as
# the caller loaded module this in the documented manner.
# If not set, the caller may NOT have loaded the bundled version, and thus
# they may not have a MI version that works with the Makefile.PL. This would
# result in false errors or unexpected behaviour. And we don't want that.
my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
unless ( $INC{$file} ) { die <<"END_DIE" }
Please invoke ${\__PACKAGE__} with:
use inc::${\__PACKAGE__};
not:
use ${\__PACKAGE__};
END_DIE
# This reportedly fixes a rare Win32 UTC file time issue, but
# as this is a non-cross-platform XS module not in the core,
# we shouldn't really depend on it. See RT #24194 for detail.
# (Also, this module only supports Perl 5.6 and above).
eval "use Win32::UTCFileTime" if $^O eq 'MSWin32' && $] >= 5.006;
# If the script that is loading Module::Install is from the future,
# then make will detect this and cause it to re-run over and over
# again. This is bad. Rather than taking action to touch it (which
# is unreliable on some platforms and requires write permissions)
# for now we should catch this and refuse to run.
if ( -f $0 ) {
my $s = (stat($0))[9];
# If the modification time is only slightly in the future,
# sleep briefly to remove the problem.
my $a = $s - time;
if ( $a > 0 and $a < 5 ) { sleep 5 }
# Too far in the future, throw an error.
my $t = time;
if ( $s > $t ) { die <<"END_DIE" }
Your installer $0 has a modification time in the future ($s > $t).
This is known to create infinite loops in make.
Please correct this, then run $0 again.
END_DIE
}
# Build.PL was formerly supported, but no longer is due to excessive
# difficulty in implementing every single feature twice.
if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" }
Module::Install no longer supports Build.PL.
It was impossible to maintain duel backends, and has been deprecated.
Please remove all Build.PL files and only use the Makefile.PL installer.
END_DIE
#-------------------------------------------------------------
# To save some more typing in Module::Install installers, every...
# use inc::Module::Install
# ...also acts as an implicit use strict.
$^H |= strict::bits(qw(refs subs vars));
#-------------------------------------------------------------
unless ( -f $self->{file} ) {
foreach my $key (keys %INC) {
delete $INC{$key} if $key =~ /Module\/Install/;
}
local $^W;
require "$self->{path}/$self->{dispatch}.pm";
File::Path::mkpath("$self->{prefix}/$self->{author}");
$self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self );
$self->{admin}->init;
@_ = ($class, _self => $self);
goto &{"$self->{name}::import"};
}
local $^W;
*{"${who}::AUTOLOAD"} = $self->autoload;
$self->preload;
# Unregister loader and worker packages so subdirs can use them again
delete $INC{'inc/Module/Install.pm'};
delete $INC{'Module/Install.pm'};
# Save to the singleton
$MAIN = $self;
return 1;
}
sub autoload {
my $self = shift;
my $who = $self->_caller;
my $cwd = Cwd::getcwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
my $pwd = Cwd::getcwd();
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
unless ($$sym =~ s/([^:]+)$//) {
# XXX: it looks like we can't retrieve the missing function
# via $$sym (usually $main::AUTOLOAD) in this case.
# I'm still wondering if we should slurp Makefile.PL to
# get some context or not ...
my ($package, $file, $line) = caller;
die <<"EOT";
Unknown function is found at $file line $line.
Execution of $file aborted due to runtime errors.
If you're a contributor to a project, you may need to install
some Module::Install extensions from CPAN (or other repository).
If you're a user of a module, please contact the author.
EOT
}
my $method = $1;
if ( uc($method) eq $method ) {
# Do nothing
return;
} elsif ( $method =~ /^_/ and $self->can($method) ) {
# Dispatch to the root M:I class
return $self->$method(@_);
}
# Dispatch to the appropriate plugin
unshift @_, ( $self, $1 );
goto &{$self->can('call')};
};
}
sub preload {
my $self = shift;
unless ( $self->{extensions} ) {
$self->load_extensions(
"$self->{prefix}/$self->{path}", $self
);
}
my @exts = @{$self->{extensions}};
unless ( @exts ) {
@exts = $self->{admin}->load_all_extensions;
}
my %seen;
foreach my $obj ( @exts ) {
while (my ($method, $glob) = each %{ref($obj) . '::'}) {
next unless $obj->can($method);
next if $method =~ /^_/;
next if $method eq uc($method);
$seen{$method}++;
}
}
my $who = $self->_caller;
foreach my $name ( sort keys %seen ) {
local $^W;
*{"${who}::$name"} = sub {
${"${who}::AUTOLOAD"} = "${who}::$name";
goto &{"${who}::AUTOLOAD"};
};
}
}
sub new {
my ($class, %args) = @_;
delete $INC{'FindBin.pm'};
{
# to suppress the redefine warning
local $SIG{__WARN__} = sub {};
require FindBin;
}
# ignore the prefix on extension modules built from top level.
my $base_path = Cwd::abs_path($FindBin::Bin);
unless ( Cwd::abs_path(Cwd::getcwd()) eq $base_path ) {
delete $args{prefix};
}
return $args{_self} if $args{_self};
$args{dispatch} ||= 'Admin';
$args{prefix} ||= 'inc';
$args{author} ||= ($^O eq 'VMS' ? '_author' : '.author');
$args{bundle} ||= 'inc/BUNDLES';
$args{base} ||= $base_path;
$class =~ s/^\Q$args{prefix}\E:://;
$args{name} ||= $class;
$args{version} ||= $class->VERSION;
unless ( $args{path} ) {
$args{path} = $args{name};
$args{path} =~ s!::!/!g;
}
$args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm";
$args{wrote} = 0;
bless( \%args, $class );
}
sub call {
my ($self, $method) = @_;
my $obj = $self->load($method) or return;
splice(@_, 0, 2, $obj);
goto &{$obj->can($method)};
}
sub load {
my ($self, $method) = @_;
$self->load_extensions(
"$self->{prefix}/$self->{path}", $self
) unless $self->{extensions};
foreach my $obj (@{$self->{extensions}}) {
return $obj if $obj->can($method);
}
my $admin = $self->{admin} or die <<"END_DIE";
The '$method' method does not exist in the '$self->{prefix}' path!
Please remove the '$self->{prefix}' directory and run $0 again to load it.
END_DIE
my $obj = $admin->load($method, 1);
push @{$self->{extensions}}, $obj;
$obj;
}
sub load_extensions {
my ($self, $path, $top) = @_;
my $should_reload = 0;
unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) {
unshift @INC, $self->{prefix};
$should_reload = 1;
}
foreach my $rv ( $self->find_extensions($path) ) {
my ($file, $pkg) = @{$rv};
next if $self->{pathnames}{$pkg};
local $@;
my $new = eval { local $^W; require $file; $pkg->can('new') };
unless ( $new ) {
warn $@ if $@;
next;
}
$self->{pathnames}{$pkg} =
$should_reload ? delete $INC{$file} : $INC{$file};
push @{$self->{extensions}}, &{$new}($pkg, _top => $top );
}
$self->{extensions} ||= [];
}
sub find_extensions {
my ($self, $path) = @_;
my @found;
File::Find::find( sub {
my $file = $File::Find::name;
return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is;
my $subpath = $1;
return if lc($subpath) eq lc($self->{dispatch});
$file = "$self->{path}/$subpath.pm";
my $pkg = "$self->{name}::$subpath";
$pkg =~ s!/!::!g;
# If we have a mixed-case package name, assume case has been preserved
# correctly. Otherwise, root through the file to locate the case-preserved
# version of the package name.
if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) {
my $content = Module::Install::_read($subpath . '.pm');
my $in_pod = 0;
foreach ( split /\n/, $content ) {
$in_pod = 1 if /^=\w/;
$in_pod = 0 if /^=cut/;
next if ($in_pod || /^=cut/); # skip pod text
next if /^\s*#/; # and comments
if ( m/^\s*package\s+($pkg)\s*;/i ) {
$pkg = $1;
last;
}
}
}
push @found, [ $file, $pkg ];
}, $path ) if -d $path;
@found;
}
#####################################################################
# Common Utility Functions
sub _caller {
my $depth = 0;
my $call = caller($depth);
while ( $call eq __PACKAGE__ ) {
$depth++;
$call = caller($depth);
}
return $call;
}
# Done in evals to avoid confusing Perl::MinimumVersion
eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
sub _read {
local *FH;
open( FH, '<', $_[0] ) or die "open($_[0]): $!";
binmode FH;
my $string = do { local $/; };
close FH or die "close($_[0]): $!";
return $string;
}
END_NEW
sub _read {
local *FH;
open( FH, "< $_[0]" ) or die "open($_[0]): $!";
binmode FH;
my $string = do { local $/; };
close FH or die "close($_[0]): $!";
return $string;
}
END_OLD
sub _readperl {
my $string = Module::Install::_read($_[0]);
$string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
$string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s;
$string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg;
return $string;
}
sub _readpod {
my $string = Module::Install::_read($_[0]);
$string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
return $string if $_[0] =~ /\.pod\z/;
$string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg;
$string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg;
$string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg;
$string =~ s/^\n+//s;
return $string;
}
# Done in evals to avoid confusing Perl::MinimumVersion
eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@;
sub _write {
local *FH;
open( FH, '>', $_[0] ) or die "open($_[0]): $!";
binmode FH;
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
}
close FH or die "close($_[0]): $!";
}
END_NEW
sub _write {
local *FH;
open( FH, "> $_[0]" ) or die "open($_[0]): $!";
binmode FH;
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
}
close FH or die "close($_[0]): $!";
}
END_OLD
# _version is for processing module versions (eg, 1.03_05) not
# Perl versions (eg, 5.8.1).
sub _version {
my $s = shift || 0;
my $d =()= $s =~ /(\.)/g;
if ( $d >= 2 ) {
# Normalise multipart versions
$s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg;
}
$s =~ s/^(\d+)\.?//;
my $l = $1 || 0;
my @v = map {
$_ . '0' x (3 - length $_)
} $s =~ /(\d{1,3})\D?/g;
$l = $l . '.' . join '', @v if @v;
return $l + 0;
}
sub _cmp {
_version($_[1]) <=> _version($_[2]);
}
# Cloned from Params::Util::_CLASS
sub _CLASS {
(
defined $_[0]
and
! ref $_[0]
and
$_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s
) ? $_[0] : undef;
}
1;
# Copyright 2008 - 2012 Adam Kennedy.
UnixAgent-2.4.2/inc/Module/Install/ 0000775 0000000 0000000 00000000000 13327377321 0017035 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/inc/Module/Install/Base.pm 0000664 0000000 0000000 00000002257 13327377321 0020253 0 ustar 00root root 0000000 0000000 #line 1
package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
$VERSION = '1.14';
}
# Suspend handler for "redefined" warnings
BEGIN {
my $w = $SIG{__WARN__};
$SIG{__WARN__} = sub { $w };
}
#line 42
sub new {
my $class = shift;
unless ( defined &{"${class}::call"} ) {
*{"${class}::call"} = sub { shift->_top->call(@_) };
}
unless ( defined &{"${class}::load"} ) {
*{"${class}::load"} = sub { shift->_top->load(@_) };
}
bless { @_ }, $class;
}
#line 61
sub AUTOLOAD {
local $@;
my $func = eval { shift->_top->autoload } or return;
goto &$func;
}
#line 75
sub _top {
$_[0]->{_top};
}
#line 90
sub admin {
$_[0]->_top->{admin}
or
Module::Install::Base::FakeAdmin->new;
}
#line 106
sub is_admin {
! $_[0]->admin->isa('Module::Install::Base::FakeAdmin');
}
sub DESTROY {}
package Module::Install::Base::FakeAdmin;
use vars qw{$VERSION};
BEGIN {
$VERSION = $Module::Install::Base::VERSION;
}
my $fake;
sub new {
$fake ||= bless(\@_, $_[0]);
}
sub AUTOLOAD {}
sub DESTROY {}
# Restore warning handler
BEGIN {
$SIG{__WARN__} = $SIG{__WARN__}->();
}
1;
#line 159
UnixAgent-2.4.2/inc/Module/Install/Can.pm 0000664 0000000 0000000 00000006773 13327377321 0020111 0 ustar 00root root 0000000 0000000 #line 1
package Module::Install::Can;
use strict;
use Config ();
use ExtUtils::MakeMaker ();
use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
$VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
# check if we can load some module
### Upgrade this to not have to load the module if possible
sub can_use {
my ($self, $mod, $ver) = @_;
$mod =~ s{::|\\}{/}g;
$mod .= '.pm' unless $mod =~ /\.pm$/i;
my $pkg = $mod;
$pkg =~ s{/}{::}g;
$pkg =~ s{\.pm$}{}i;
local $@;
eval { require $mod; $pkg->VERSION($ver || 0); 1 };
}
# Check if we can run some command
sub can_run {
my ($self, $cmd) = @_;
my $_cmd = $cmd;
return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
next if $dir eq '';
require File::Spec;
my $abs = File::Spec->catfile($dir, $cmd);
return $abs if (-x $abs or $abs = MM->maybe_command($abs));
}
return;
}
# Can our C compiler environment build XS files
sub can_xs {
my $self = shift;
# Ensure we have the CBuilder module
$self->configure_requires( 'ExtUtils::CBuilder' => 0.27 );
# Do we have the configure_requires checker?
local $@;
eval "require ExtUtils::CBuilder;";
if ( $@ ) {
# They don't obey configure_requires, so it is
# someone old and delicate. Try to avoid hurting
# them by falling back to an older simpler test.
return $self->can_cc();
}
# Do we have a working C compiler
my $builder = ExtUtils::CBuilder->new(
quiet => 1,
);
unless ( $builder->have_compiler ) {
# No working C compiler
return 0;
}
# Write a C file representative of what XS becomes
require File::Temp;
my ( $FH, $tmpfile ) = File::Temp::tempfile(
"compilexs-XXXXX",
SUFFIX => '.c',
);
binmode $FH;
print $FH <<'END_C';
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
int main(int argc, char **argv) {
return 0;
}
int boot_sanexs() {
return 1;
}
END_C
close $FH;
# Can the C compiler access the same headers XS does
my @libs = ();
my $object = undef;
eval {
local $^W = 0;
$object = $builder->compile(
source => $tmpfile,
);
@libs = $builder->link(
objects => $object,
module_name => 'sanexs',
);
};
my $result = $@ ? 0 : 1;
# Clean up all the build files
foreach ( $tmpfile, $object, @libs ) {
next unless defined $_;
1 while unlink;
}
return $result;
}
# Can we locate a (the) C compiler
sub can_cc {
my $self = shift;
my @chunks = split(/ /, $Config::Config{cc}) or return;
# $Config{cc} may contain args; try to find out the program part
while (@chunks) {
return $self->can_run("@chunks") || (pop(@chunks), next);
}
return;
}
# Fix Cygwin bug on maybe_command();
if ( $^O eq 'cygwin' ) {
require ExtUtils::MM_Cygwin;
require ExtUtils::MM_Win32;
if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) {
*ExtUtils::MM_Cygwin::maybe_command = sub {
my ($self, $file) = @_;
if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) {
ExtUtils::MM_Win32->maybe_command($file);
} else {
ExtUtils::MM_Unix->maybe_command($file);
}
}
}
}
1;
__END__
#line 236
UnixAgent-2.4.2/inc/Module/Install/Fetch.pm 0000664 0000000 0000000 00000004640 13327377321 0020430 0 ustar 00root root 0000000 0000000 #line 1
package Module::Install::Fetch;
use strict;
use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
$VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
sub get_file {
my ($self, %args) = @_;
my ($scheme, $host, $path, $file) =
$args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
if ( $scheme eq 'http' and ! eval { require LWP::Simple; 1 } ) {
$args{url} = $args{ftp_url}
or (warn("LWP support unavailable!\n"), return);
($scheme, $host, $path, $file) =
$args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
}
$|++;
print "Fetching '$file' from $host... ";
unless (eval { require Socket; Socket::inet_aton($host) }) {
warn "'$host' resolve failed!\n";
return;
}
return unless $scheme eq 'ftp' or $scheme eq 'http';
require Cwd;
my $dir = Cwd::getcwd();
chdir $args{local_dir} or return if exists $args{local_dir};
if (eval { require LWP::Simple; 1 }) {
LWP::Simple::mirror($args{url}, $file);
}
elsif (eval { require Net::FTP; 1 }) { eval {
# use Net::FTP to get past firewall
my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600);
$ftp->login("anonymous", 'anonymous@example.com');
$ftp->cwd($path);
$ftp->binary;
$ftp->get($file) or (warn("$!\n"), return);
$ftp->quit;
} }
elsif (my $ftp = $self->can_run('ftp')) { eval {
# no Net::FTP, fallback to ftp.exe
require FileHandle;
my $fh = FileHandle->new;
local $SIG{CHLD} = 'IGNORE';
unless ($fh->open("|$ftp -n")) {
warn "Couldn't open ftp: $!\n";
chdir $dir; return;
}
my @dialog = split(/\n/, <<"END_FTP");
open $host
user anonymous anonymous\@example.com
cd $path
binary
get $file $file
quit
END_FTP
foreach (@dialog) { $fh->print("$_\n") }
$fh->close;
} }
else {
warn "No working 'ftp' program available!\n";
chdir $dir; return;
}
unless (-f $file) {
warn "Fetching failed: $@\n";
chdir $dir; return;
}
return if exists $args{size} and -s $file != $args{size};
system($args{run}) if exists $args{run};
unlink($file) if $args{remove};
print(((!exists $args{check_for} or -e $args{check_for})
? "done!" : "failed! ($!)"), "\n");
chdir $dir; return !$?;
}
1;
UnixAgent-2.4.2/inc/Module/Install/Include.pm 0000664 0000000 0000000 00000001045 13327377321 0020756 0 ustar 00root root 0000000 0000000 #line 1
package Module::Install::Include;
use strict;
use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
$VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
sub include {
shift()->admin->include(@_);
}
sub include_deps {
shift()->admin->include_deps(@_);
}
sub auto_include {
shift()->admin->auto_include(@_);
}
sub auto_include_deps {
shift()->admin->auto_include_deps(@_);
}
sub auto_include_dependent_dists {
shift()->admin->auto_include_dependent_dists(@_);
}
1;
UnixAgent-2.4.2/inc/Module/Install/Makefile.pm 0000664 0000000 0000000 00000032100 13327377321 0021104 0 ustar 00root root 0000000 0000000 #line 1
package Module::Install::Makefile;
use strict 'vars';
use ExtUtils::MakeMaker ();
use Module::Install::Base ();
use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
$VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
sub Makefile { $_[0] }
my %seen = ();
sub prompt {
shift;
# Infinite loop protection
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing or non-interactive session, always use defaults
if ( ($ENV{AUTOMATED_TESTING} or -! -t STDIN) and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
}
}
# Store a cleaned up version of the MakeMaker version,
# since we need to behave differently in a variety of
# ways based on the MM version.
my $makemaker = eval $ExtUtils::MakeMaker::VERSION;
# If we are passed a param, do a "newer than" comparison.
# Otherwise, just return the MakeMaker version.
sub makemaker {
( @_ < 2 or $makemaker >= eval($_[1]) ) ? $makemaker : 0
}
# Ripped from ExtUtils::MakeMaker 6.56, and slightly modified
# as we only need to know here whether the attribute is an array
# or a hash or something else (which may or may not be appendable).
my %makemaker_argtype = (
C => 'ARRAY',
CONFIG => 'ARRAY',
# CONFIGURE => 'CODE', # ignore
DIR => 'ARRAY',
DL_FUNCS => 'HASH',
DL_VARS => 'ARRAY',
EXCLUDE_EXT => 'ARRAY',
EXE_FILES => 'ARRAY',
FUNCLIST => 'ARRAY',
H => 'ARRAY',
IMPORTS => 'HASH',
INCLUDE_EXT => 'ARRAY',
LIBS => 'ARRAY', # ignore ''
MAN1PODS => 'HASH',
MAN3PODS => 'HASH',
META_ADD => 'HASH',
META_MERGE => 'HASH',
PL_FILES => 'HASH',
PM => 'HASH',
PMLIBDIRS => 'ARRAY',
PMLIBPARENTDIRS => 'ARRAY',
PREREQ_PM => 'HASH',
CONFIGURE_REQUIRES => 'HASH',
SKIP => 'ARRAY',
TYPEMAPS => 'ARRAY',
XS => 'HASH',
# VERSION => ['version',''], # ignore
# _KEEP_AFTER_FLUSH => '',
clean => 'HASH',
depend => 'HASH',
dist => 'HASH',
dynamic_lib=> 'HASH',
linkext => 'HASH',
macro => 'HASH',
postamble => 'HASH',
realclean => 'HASH',
test => 'HASH',
tool_autosplit => 'HASH',
# special cases where you can use makemaker_append
CCFLAGS => 'APPENDABLE',
DEFINE => 'APPENDABLE',
INC => 'APPENDABLE',
LDDLFLAGS => 'APPENDABLE',
LDFROM => 'APPENDABLE',
);
sub makemaker_args {
my ($self, %new_args) = @_;
my $args = ( $self->{makemaker_args} ||= {} );
foreach my $key (keys %new_args) {
if ($makemaker_argtype{$key}) {
if ($makemaker_argtype{$key} eq 'ARRAY') {
$args->{$key} = [] unless defined $args->{$key};
unless (ref $args->{$key} eq 'ARRAY') {
$args->{$key} = [$args->{$key}]
}
push @{$args->{$key}},
ref $new_args{$key} eq 'ARRAY'
? @{$new_args{$key}}
: $new_args{$key};
}
elsif ($makemaker_argtype{$key} eq 'HASH') {
$args->{$key} = {} unless defined $args->{$key};
foreach my $skey (keys %{ $new_args{$key} }) {
$args->{$key}{$skey} = $new_args{$key}{$skey};
}
}
elsif ($makemaker_argtype{$key} eq 'APPENDABLE') {
$self->makemaker_append($key => $new_args{$key});
}
}
else {
if (defined $args->{$key}) {
warn qq{MakeMaker attribute "$key" is overridden; use "makemaker_append" to append values\n};
}
$args->{$key} = $new_args{$key};
}
}
return $args;
}
# For mm args that take multiple space-separated args,
# append an argument to the current list.
sub makemaker_append {
my $self = shift;
my $name = shift;
my $args = $self->makemaker_args;
$args->{$name} = defined $args->{$name}
? join( ' ', $args->{$name}, @_ )
: join( ' ', @_ );
}
sub build_subdirs {
my $self = shift;
my $subdirs = $self->makemaker_args->{DIR} ||= [];
for my $subdir (@_) {
push @$subdirs, $subdir;
}
}
sub clean_files {
my $self = shift;
my $clean = $self->makemaker_args->{clean} ||= {};
%$clean = (
%$clean,
FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_),
);
}
sub realclean_files {
my $self = shift;
my $realclean = $self->makemaker_args->{realclean} ||= {};
%$realclean = (
%$realclean,
FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_),
);
}
sub libs {
my $self = shift;
my $libs = ref $_[0] ? shift : [ shift ];
$self->makemaker_args( LIBS => $libs );
}
sub inc {
my $self = shift;
$self->makemaker_args( INC => shift );
}
sub _wanted_t {
}
sub tests_recursive {
my $self = shift;
my $dir = shift || 't';
unless ( -d $dir ) {
die "tests_recursive dir '$dir' does not exist";
}
my %tests = map { $_ => 1 } split / /, ($self->tests || '');
require File::Find;
File::Find::find(
sub { /\.t$/ and -f $_ and $tests{"$File::Find::dir/*.t"} = 1 },
$dir
);
$self->tests( join ' ', sort keys %tests );
}
sub write {
my $self = shift;
die "&Makefile->write() takes no arguments\n" if @_;
# Check the current Perl version
my $perl_version = $self->perl_version;
if ( $perl_version ) {
eval "use $perl_version; 1"
or die "ERROR: perl: Version $] is installed, "
. "but we need version >= $perl_version";
}
# Make sure we have a new enough MakeMaker
require ExtUtils::MakeMaker;
if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) {
# This previous attempted to inherit the version of
# ExtUtils::MakeMaker in use by the module author, but this
# was found to be untenable as some authors build releases
# using future dev versions of EU:MM that nobody else has.
# Instead, #toolchain suggests we use 6.59 which is the most
# stable version on CPAN at time of writing and is, to quote
# ribasushi, "not terminally fucked, > and tested enough".
# TODO: We will now need to maintain this over time to push
# the version up as new versions are released.
$self->build_requires( 'ExtUtils::MakeMaker' => 6.59 );
$self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 );
} else {
# Allow legacy-compatibility with 5.005 by depending on the
# most recent EU:MM that supported 5.005.
$self->build_requires( 'ExtUtils::MakeMaker' => 6.36 );
$self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 );
}
# Generate the MakeMaker params
my $args = $self->makemaker_args;
$args->{DISTNAME} = $self->name;
$args->{NAME} = $self->module_name || $self->name;
$args->{NAME} =~ s/-/::/g;
$args->{VERSION} = $self->version or die <<'EOT';
ERROR: Can't determine distribution version. Please specify it
explicitly via 'version' in Makefile.PL, or set a valid $VERSION
in a module, and provide its file path via 'version_from' (or
'all_from' if you prefer) in Makefile.PL.
EOT
if ( $self->tests ) {
my @tests = split ' ', $self->tests;
my %seen;
$args->{test} = {
TESTS => (join ' ', grep {!$seen{$_}++} @tests),
};
} elsif ( $Module::Install::ExtraTests::use_extratests ) {
# Module::Install::ExtraTests doesn't set $self->tests and does its own tests via harness.
# So, just ignore our xt tests here.
} elsif ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) {
$args->{test} = {
TESTS => join( ' ', map { "$_/*.t" } grep { -d $_ } qw{ t xt } ),
};
}
if ( $] >= 5.005 ) {
$args->{ABSTRACT} = $self->abstract;
$args->{AUTHOR} = join ', ', @{$self->author || []};
}
if ( $self->makemaker(6.10) ) {
$args->{NO_META} = 1;
#$args->{NO_MYMETA} = 1;
}
if ( $self->makemaker(6.17) and $self->sign ) {
$args->{SIGN} = 1;
}
unless ( $self->is_admin ) {
delete $args->{SIGN};
}
if ( $self->makemaker(6.31) and $self->license ) {
$args->{LICENSE} = $self->license;
}
my $prereq = ($args->{PREREQ_PM} ||= {});
%$prereq = ( %$prereq,
map { @$_ } # flatten [module => version]
map { @$_ }
grep $_,
($self->requires)
);
# Remove any reference to perl, PREREQ_PM doesn't support it
delete $args->{PREREQ_PM}->{perl};
# Merge both kinds of requires into BUILD_REQUIRES
my $build_prereq = ($args->{BUILD_REQUIRES} ||= {});
%$build_prereq = ( %$build_prereq,
map { @$_ } # flatten [module => version]
map { @$_ }
grep $_,
($self->configure_requires, $self->build_requires)
);
# Remove any reference to perl, BUILD_REQUIRES doesn't support it
delete $args->{BUILD_REQUIRES}->{perl};
# Delete bundled dists from prereq_pm, add it to Makefile DIR
my $subdirs = ($args->{DIR} || []);
if ($self->bundles) {
my %processed;
foreach my $bundle (@{ $self->bundles }) {
my ($mod_name, $dist_dir) = @$bundle;
delete $prereq->{$mod_name};
$dist_dir = File::Basename::basename($dist_dir); # dir for building this module
if (not exists $processed{$dist_dir}) {
if (-d $dist_dir) {
# List as sub-directory to be processed by make
push @$subdirs, $dist_dir;
}
# Else do nothing: the module is already present on the system
$processed{$dist_dir} = undef;
}
}
}
unless ( $self->makemaker('6.55_03') ) {
%$prereq = (%$prereq,%$build_prereq);
delete $args->{BUILD_REQUIRES};
}
if ( my $perl_version = $self->perl_version ) {
eval "use $perl_version; 1"
or die "ERROR: perl: Version $] is installed, "
. "but we need version >= $perl_version";
if ( $self->makemaker(6.48) ) {
$args->{MIN_PERL_VERSION} = $perl_version;
}
}
if ($self->installdirs) {
warn qq{old INSTALLDIRS (probably set by makemaker_args) is overridden by installdirs\n} if $args->{INSTALLDIRS};
$args->{INSTALLDIRS} = $self->installdirs;
}
my %args = map {
( $_ => $args->{$_} ) } grep {defined($args->{$_} )
} keys %$args;
my $user_preop = delete $args{dist}->{PREOP};
if ( my $preop = $self->admin->preop($user_preop) ) {
foreach my $key ( keys %$preop ) {
$args{dist}->{$key} = $preop->{$key};
}
}
my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
$self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile');
}
sub fix_up_makefile {
my $self = shift;
my $makefile_name = shift;
my $top_class = ref($self->_top) || '';
my $top_version = $self->_top->VERSION || '';
my $preamble = $self->preamble
? "# Preamble by $top_class $top_version\n"
. $self->preamble
: '';
my $postamble = "# Postamble by $top_class $top_version\n"
. ($self->postamble || '');
local *MAKEFILE;
open MAKEFILE, "+< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
eval { flock MAKEFILE, LOCK_EX };
my $makefile = do { local $/; };
$makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
$makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
$makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g;
$makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m;
$makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m;
# Module::Install will never be used to build the Core Perl
# Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks
# PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist
$makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m;
#$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;
# Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well.
$makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g;
# XXX - This is currently unused; not sure if it breaks other MM-users
# $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;
seek MAKEFILE, 0, SEEK_SET;
truncate MAKEFILE, 0;
print MAKEFILE "$preamble$makefile$postamble" or die $!;
close MAKEFILE or die $!;
1;
}
sub preamble {
my ($self, $text) = @_;
$self->{preamble} = $text . $self->{preamble} if defined $text;
$self->{preamble};
}
sub postamble {
my ($self, $text) = @_;
$self->{postamble} ||= $self->admin->postamble;
$self->{postamble} .= $text if defined $text;
$self->{postamble}
}
1;
__END__
#line 544
UnixAgent-2.4.2/inc/Module/Install/Metadata.pm 0000664 0000000 0000000 00000050107 13327377321 0021116 0 ustar 00root root 0000000 0000000 #line 1
package Module::Install::Metadata;
use strict 'vars';
use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
$VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
my @boolean_keys = qw{
sign
};
my @scalar_keys = qw{
name
module_name
abstract
version
distribution_type
tests
installdirs
};
my @tuple_keys = qw{
configure_requires
build_requires
requires
recommends
bundles
resources
};
my @resource_keys = qw{
homepage
bugtracker
repository
};
my @array_keys = qw{
keywords
author
};
*authors = \&author;
sub Meta { shift }
sub Meta_BooleanKeys { @boolean_keys }
sub Meta_ScalarKeys { @scalar_keys }
sub Meta_TupleKeys { @tuple_keys }
sub Meta_ResourceKeys { @resource_keys }
sub Meta_ArrayKeys { @array_keys }
foreach my $key ( @boolean_keys ) {
*$key = sub {
my $self = shift;
if ( defined wantarray and not @_ ) {
return $self->{values}->{$key};
}
$self->{values}->{$key} = ( @_ ? $_[0] : 1 );
return $self;
};
}
foreach my $key ( @scalar_keys ) {
*$key = sub {
my $self = shift;
return $self->{values}->{$key} if defined wantarray and !@_;
$self->{values}->{$key} = shift;
return $self;
};
}
foreach my $key ( @array_keys ) {
*$key = sub {
my $self = shift;
return $self->{values}->{$key} if defined wantarray and !@_;
$self->{values}->{$key} ||= [];
push @{$self->{values}->{$key}}, @_;
return $self;
};
}
foreach my $key ( @resource_keys ) {
*$key = sub {
my $self = shift;
unless ( @_ ) {
return () unless $self->{values}->{resources};
return map { $_->[1] }
grep { $_->[0] eq $key }
@{ $self->{values}->{resources} };
}
return $self->{values}->{resources}->{$key} unless @_;
my $uri = shift or die(
"Did not provide a value to $key()"
);
$self->resources( $key => $uri );
return 1;
};
}
foreach my $key ( grep { $_ ne "resources" } @tuple_keys) {
*$key = sub {
my $self = shift;
return $self->{values}->{$key} unless @_;
my @added;
while ( @_ ) {
my $module = shift or last;
my $version = shift || 0;
push @added, [ $module, $version ];
}
push @{ $self->{values}->{$key} }, @added;
return map {@$_} @added;
};
}
# Resource handling
my %lc_resource = map { $_ => 1 } qw{
homepage
license
bugtracker
repository
};
sub resources {
my $self = shift;
while ( @_ ) {
my $name = shift or last;
my $value = shift or next;
if ( $name eq lc $name and ! $lc_resource{$name} ) {
die("Unsupported reserved lowercase resource '$name'");
}
$self->{values}->{resources} ||= [];
push @{ $self->{values}->{resources} }, [ $name, $value ];
}
$self->{values}->{resources};
}
# Aliases for build_requires that will have alternative
# meanings in some future version of META.yml.
sub test_requires { shift->build_requires(@_) }
sub install_requires { shift->build_requires(@_) }
# Aliases for installdirs options
sub install_as_core { $_[0]->installdirs('perl') }
sub install_as_cpan { $_[0]->installdirs('site') }
sub install_as_site { $_[0]->installdirs('site') }
sub install_as_vendor { $_[0]->installdirs('vendor') }
sub dynamic_config {
my $self = shift;
my $value = @_ ? shift : 1;
if ( $self->{values}->{dynamic_config} ) {
# Once dynamic we never change to static, for safety
return 0;
}
$self->{values}->{dynamic_config} = $value ? 1 : 0;
return 1;
}
# Convenience command
sub static_config {
shift->dynamic_config(0);
}
sub perl_version {
my $self = shift;
return $self->{values}->{perl_version} unless @_;
my $version = shift or die(
"Did not provide a value to perl_version()"
);
# Normalize the version
$version = $self->_perl_version($version);
# We don't support the really old versions
unless ( $version >= 5.005 ) {
die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
}
$self->{values}->{perl_version} = $version;
}
sub all_from {
my ( $self, $file ) = @_;
unless ( defined($file) ) {
my $name = $self->name or die(
"all_from called with no args without setting name() first"
);
$file = join('/', 'lib', split(/-/, $name)) . '.pm';
$file =~ s{.*/}{} unless -e $file;
unless ( -e $file ) {
die("all_from cannot find $file from $name");
}
}
unless ( -f $file ) {
die("The path '$file' does not exist, or is not a file");
}
$self->{values}{all_from} = $file;
# Some methods pull from POD instead of code.
# If there is a matching .pod, use that instead
my $pod = $file;
$pod =~ s/\.pm$/.pod/i;
$pod = $file unless -e $pod;
# Pull the different values
$self->name_from($file) unless $self->name;
$self->version_from($file) unless $self->version;
$self->perl_version_from($file) unless $self->perl_version;
$self->author_from($pod) unless @{$self->author || []};
$self->license_from($pod) unless $self->license;
$self->abstract_from($pod) unless $self->abstract;
return 1;
}
sub provides {
my $self = shift;
my $provides = ( $self->{values}->{provides} ||= {} );
%$provides = (%$provides, @_) if @_;
return $provides;
}
sub auto_provides {
my $self = shift;
return $self unless $self->is_admin;
unless (-e 'MANIFEST') {
warn "Cannot deduce auto_provides without a MANIFEST, skipping\n";
return $self;
}
# Avoid spurious warnings as we are not checking manifest here.
local $SIG{__WARN__} = sub {1};
require ExtUtils::Manifest;
local *ExtUtils::Manifest::manicheck = sub { return };
require Module::Build;
my $build = Module::Build->new(
dist_name => $self->name,
dist_version => $self->version,
license => $self->license,
);
$self->provides( %{ $build->find_dist_packages || {} } );
}
sub feature {
my $self = shift;
my $name = shift;
my $features = ( $self->{values}->{features} ||= [] );
my $mods;
if ( @_ == 1 and ref( $_[0] ) ) {
# The user used ->feature like ->features by passing in the second
# argument as a reference. Accommodate for that.
$mods = $_[0];
} else {
$mods = \@_;
}
my $count = 0;
push @$features, (
$name => [
map {
ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_
} @$mods
]
);
return @$features;
}
sub features {
my $self = shift;
while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) {
$self->feature( $name, @$mods );
}
return $self->{values}->{features}
? @{ $self->{values}->{features} }
: ();
}
sub no_index {
my $self = shift;
my $type = shift;
push @{ $self->{values}->{no_index}->{$type} }, @_ if $type;
return $self->{values}->{no_index};
}
sub read {
my $self = shift;
$self->include_deps( 'YAML::Tiny', 0 );
require YAML::Tiny;
my $data = YAML::Tiny::LoadFile('META.yml');
# Call methods explicitly in case user has already set some values.
while ( my ( $key, $value ) = each %$data ) {
next unless $self->can($key);
if ( ref $value eq 'HASH' ) {
while ( my ( $module, $version ) = each %$value ) {
$self->can($key)->($self, $module => $version );
}
} else {
$self->can($key)->($self, $value);
}
}
return $self;
}
sub write {
my $self = shift;
return $self unless $self->is_admin;
$self->admin->write_meta;
return $self;
}
sub version_from {
require ExtUtils::MM_Unix;
my ( $self, $file ) = @_;
$self->version( ExtUtils::MM_Unix->parse_version($file) );
# for version integrity check
$self->makemaker_args( VERSION_FROM => $file );
}
sub abstract_from {
require ExtUtils::MM_Unix;
my ( $self, $file ) = @_;
$self->abstract(
bless(
{ DISTNAME => $self->name },
'ExtUtils::MM_Unix'
)->parse_abstract($file)
);
}
# Add both distribution and module name
sub name_from {
my ($self, $file) = @_;
if (
Module::Install::_read($file) =~ m/
^ \s*
package \s*
([\w:]+)
[\s|;]*
/ixms
) {
my ($name, $module_name) = ($1, $1);
$name =~ s{::}{-}g;
$self->name($name);
unless ( $self->module_name ) {
$self->module_name($module_name);
}
} else {
die("Cannot determine name from $file\n");
}
}
sub _extract_perl_version {
if (
$_[0] =~ m/
^\s*
(?:use|require) \s*
v?
([\d_\.]+)
\s* ;
/ixms
) {
my $perl_version = $1;
$perl_version =~ s{_}{}g;
return $perl_version;
} else {
return;
}
}
sub perl_version_from {
my $self = shift;
my $perl_version=_extract_perl_version(Module::Install::_read($_[0]));
if ($perl_version) {
$self->perl_version($perl_version);
} else {
warn "Cannot determine perl version info from $_[0]\n";
return;
}
}
sub author_from {
my $self = shift;
my $content = Module::Install::_read($_[0]);
if ($content =~ m/
=head \d \s+ (?:authors?)\b \s*
([^\n]*)
|
=head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s*
.*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s*
([^\n]*)
/ixms) {
my $author = $1 || $2;
# XXX: ugly but should work anyway...
if (eval "require Pod::Escapes; 1") {
# Pod::Escapes has a mapping table.
# It's in core of perl >= 5.9.3, and should be installed
# as one of the Pod::Simple's prereqs, which is a prereq
# of Pod::Text 3.x (see also below).
$author =~ s{ E<( (\d+) | ([A-Za-z]+) )> }
{
defined $2
? chr($2)
: defined $Pod::Escapes::Name2character_number{$1}
? chr($Pod::Escapes::Name2character_number{$1})
: do {
warn "Unknown escape: E<$1>";
"E<$1>";
};
}gex;
}
elsif (eval "require Pod::Text; 1" && $Pod::Text::VERSION < 3) {
# Pod::Text < 3.0 has yet another mapping table,
# though the table name of 2.x and 1.x are different.
# (1.x is in core of Perl < 5.6, 2.x is in core of
# Perl < 5.9.3)
my $mapping = ($Pod::Text::VERSION < 2)
? \%Pod::Text::HTML_Escapes
: \%Pod::Text::ESCAPES;
$author =~ s{ E<( (\d+) | ([A-Za-z]+) )> }
{
defined $2
? chr($2)
: defined $mapping->{$1}
? $mapping->{$1}
: do {
warn "Unknown escape: E<$1>";
"E<$1>";
};
}gex;
}
else {
$author =~ s{E}{<}g;
$author =~ s{E}{>}g;
}
$self->author($author);
} else {
warn "Cannot determine author info from $_[0]\n";
}
}
#Stolen from M::B
my %license_urls = (
perl => 'http://dev.perl.org/licenses/',
apache => 'http://apache.org/licenses/LICENSE-2.0',
apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1',
artistic => 'http://opensource.org/licenses/artistic-license.php',
artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php',
lgpl => 'http://opensource.org/licenses/lgpl-license.php',
lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php',
lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html',
bsd => 'http://opensource.org/licenses/bsd-license.php',
gpl => 'http://opensource.org/licenses/gpl-license.php',
gpl2 => 'http://opensource.org/licenses/gpl-2.0.php',
gpl3 => 'http://opensource.org/licenses/gpl-3.0.html',
mit => 'http://opensource.org/licenses/mit-license.php',
mozilla => 'http://opensource.org/licenses/mozilla1.1.php',
open_source => undef,
unrestricted => undef,
restrictive => undef,
unknown => undef,
);
sub license {
my $self = shift;
return $self->{values}->{license} unless @_;
my $license = shift or die(
'Did not provide a value to license()'
);
$license = __extract_license($license) || lc $license;
$self->{values}->{license} = $license;
# Automatically fill in license URLs
if ( $license_urls{$license} ) {
$self->resources( license => $license_urls{$license} );
}
return 1;
}
sub _extract_license {
my $pod = shift;
my $matched;
return __extract_license(
($matched) = $pod =~ m/
(=head \d \s+ L(?i:ICEN[CS]E|ICENSING)\b.*?)
(=head \d.*|=cut.*|)\z
/xms
) || __extract_license(
($matched) = $pod =~ m/
(=head \d \s+ (?:C(?i:OPYRIGHTS?)|L(?i:EGAL))\b.*?)
(=head \d.*|=cut.*|)\z
/xms
);
}
sub __extract_license {
my $license_text = shift or return;
my @phrases = (
'(?:under )?the same (?:terms|license) as (?:perl|the perl (?:\d )?programming language)' => 'perl', 1,
'(?:under )?the terms of (?:perl|the perl programming language) itself' => 'perl', 1,
'Artistic and GPL' => 'perl', 1,
'GNU general public license' => 'gpl', 1,
'GNU public license' => 'gpl', 1,
'GNU lesser general public license' => 'lgpl', 1,
'GNU lesser public license' => 'lgpl', 1,
'GNU library general public license' => 'lgpl', 1,
'GNU library public license' => 'lgpl', 1,
'GNU Free Documentation license' => 'unrestricted', 1,
'GNU Affero General Public License' => 'open_source', 1,
'(?:Free)?BSD license' => 'bsd', 1,
'Artistic license 2\.0' => 'artistic_2', 1,
'Artistic license' => 'artistic', 1,
'Apache (?:Software )?license' => 'apache', 1,
'GPL' => 'gpl', 1,
'LGPL' => 'lgpl', 1,
'BSD' => 'bsd', 1,
'Artistic' => 'artistic', 1,
'MIT' => 'mit', 1,
'Mozilla Public License' => 'mozilla', 1,
'Q Public License' => 'open_source', 1,
'OpenSSL License' => 'unrestricted', 1,
'SSLeay License' => 'unrestricted', 1,
'zlib License' => 'open_source', 1,
'proprietary' => 'proprietary', 0,
);
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s#\s+#\\s+#gs;
if ( $license_text =~ /\b$pattern\b/i ) {
return $license;
}
}
return '';
}
sub license_from {
my $self = shift;
if (my $license=_extract_license(Module::Install::_read($_[0]))) {
$self->license($license);
} else {
warn "Cannot determine license info from $_[0]\n";
return 'unknown';
}
}
sub _extract_bugtracker {
my @links = $_[0] =~ m#L<(
https?\Q://rt.cpan.org/\E[^>]+|
https?\Q://github.com/\E[\w_]+/[\w_]+/issues|
https?\Q://code.google.com/p/\E[\w_\-]+/issues/list
)>#gx;
my %links;
@links{@links}=();
@links=keys %links;
return @links;
}
sub bugtracker_from {
my $self = shift;
my $content = Module::Install::_read($_[0]);
my @links = _extract_bugtracker($content);
unless ( @links ) {
warn "Cannot determine bugtracker info from $_[0]\n";
return 0;
}
if ( @links > 1 ) {
warn "Found more than one bugtracker link in $_[0]\n";
return 0;
}
# Set the bugtracker
bugtracker( $links[0] );
return 1;
}
sub requires_from {
my $self = shift;
my $content = Module::Install::_readperl($_[0]);
my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg;
while ( @requires ) {
my $module = shift @requires;
my $version = shift @requires;
$self->requires( $module => $version );
}
}
sub test_requires_from {
my $self = shift;
my $content = Module::Install::_readperl($_[0]);
my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
while ( @requires ) {
my $module = shift @requires;
my $version = shift @requires;
$self->test_requires( $module => $version );
}
}
# Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
# numbers (eg, 5.006001 or 5.008009).
# Also, convert double-part versions (eg, 5.8)
sub _perl_version {
my $v = $_[-1];
$v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e;
$v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e;
$v =~ s/(\.\d\d\d)000$/$1/;
$v =~ s/_.+$//;
if ( ref($v) ) {
# Numify
$v = $v + 0;
}
return $v;
}
sub add_metadata {
my $self = shift;
my %hash = @_;
for my $key (keys %hash) {
warn "add_metadata: $key is not prefixed with 'x_'.\n" .
"Use appopriate function to add non-private metadata.\n" unless $key =~ /^x_/;
$self->{values}->{$key} = $hash{$key};
}
}
######################################################################
# MYMETA Support
sub WriteMyMeta {
die "WriteMyMeta has been deprecated";
}
sub write_mymeta_yaml {
my $self = shift;
# We need YAML::Tiny to write the MYMETA.yml file
unless ( eval { require YAML::Tiny; 1; } ) {
return 1;
}
# Generate the data
my $meta = $self->_write_mymeta_data or return 1;
# Save as the MYMETA.yml file
print "Writing MYMETA.yml\n";
YAML::Tiny::DumpFile('MYMETA.yml', $meta);
}
sub write_mymeta_json {
my $self = shift;
# We need JSON to write the MYMETA.json file
unless ( eval { require JSON; 1; } ) {
return 1;
}
# Generate the data
my $meta = $self->_write_mymeta_data or return 1;
# Save as the MYMETA.yml file
print "Writing MYMETA.json\n";
Module::Install::_write(
'MYMETA.json',
JSON->new->pretty(1)->canonical->encode($meta),
);
}
sub _write_mymeta_data {
my $self = shift;
# If there's no existing META.yml there is nothing we can do
return undef unless -f 'META.yml';
# We need Parse::CPAN::Meta to load the file
unless ( eval { require Parse::CPAN::Meta; 1; } ) {
return undef;
}
# Merge the perl version into the dependencies
my $val = $self->Meta->{values};
my $perl = delete $val->{perl_version};
if ( $perl ) {
$val->{requires} ||= [];
my $requires = $val->{requires};
# Canonize to three-dot version after Perl 5.6
if ( $perl >= 5.006 ) {
$perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e
}
unshift @$requires, [ perl => $perl ];
}
# Load the advisory META.yml file
my @yaml = Parse::CPAN::Meta::LoadFile('META.yml');
my $meta = $yaml[0];
# Overwrite the non-configure dependency hashes
delete $meta->{requires};
delete $meta->{build_requires};
delete $meta->{recommends};
if ( exists $val->{requires} ) {
$meta->{requires} = { map { @$_ } @{ $val->{requires} } };
}
if ( exists $val->{build_requires} ) {
$meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } };
}
return $meta;
}
1;
UnixAgent-2.4.2/inc/Module/Install/Scripts.pm 0000664 0000000 0000000 00000001121 13327377321 0021015 0 ustar 00root root 0000000 0000000 #line 1
package Module::Install::Scripts;
use strict 'vars';
use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
$VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
sub install_script {
my $self = shift;
my $args = $self->makemaker_args;
my $exe = $args->{EXE_FILES} ||= [];
foreach ( @_ ) {
if ( -f $_ ) {
push @$exe, $_;
} elsif ( -d 'script' and -f "script/$_" ) {
push @$exe, "script/$_";
} else {
die("Cannot find script '$_'");
}
}
}
1;
UnixAgent-2.4.2/inc/Module/Install/Win32.pm 0000664 0000000 0000000 00000003557 13327377321 0020307 0 ustar 00root root 0000000 0000000 #line 1
package Module::Install::Win32;
use strict;
use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
$VERSION = '1.14';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
# determine if the user needs nmake, and download it if needed
sub check_nmake {
my $self = shift;
$self->load('can_run');
$self->load('get_file');
require Config;
return unless (
$^O eq 'MSWin32' and
$Config::Config{make} and
$Config::Config{make} =~ /^nmake\b/i and
! $self->can_run('nmake')
);
print "The required 'nmake' executable not found, fetching it...\n";
require File::Basename;
my $rv = $self->get_file(
url => 'http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe',
ftp_url => 'ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe',
local_dir => File::Basename::dirname($^X),
size => 51928,
run => 'Nmake15.exe /o > nul',
check_for => 'Nmake.exe',
remove => 1,
);
die <<'END_MESSAGE' unless $rv;
-------------------------------------------------------------------------------
Since you are using Microsoft Windows, you will need the 'nmake' utility
before installation. It's available at:
http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe
or
ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe
Please download the file manually, save it to a directory in %PATH% (e.g.
C:\WINDOWS\COMMAND\), then launch the MS-DOS command line shell, "cd" to
that directory, and run "Nmake15.exe" from there; that will create the
'nmake.exe' file needed by this module.
You may then resume the installation process described in README.
-------------------------------------------------------------------------------
END_MESSAGE
}
1;
UnixAgent-2.4.2/inc/Module/Install/WriteAll.pm 0000664 0000000 0000000 00000002670 13327377321 0021123 0 ustar 00root root 0000000 0000000 #line 1
package Module::Install::WriteAll;
use strict;
use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
$VERSION = '1.14';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
sub WriteAll {
my $self = shift;
my %args = (
meta => 1,
sign => 0,
inline => 0,
check_nmake => 1,
@_,
);
$self->sign(1) if $args{sign};
$self->admin->WriteAll(%args) if $self->is_admin;
$self->check_nmake if $args{check_nmake};
unless ( $self->makemaker_args->{PL_FILES} ) {
# XXX: This still may be a bit over-defensive...
unless ($self->makemaker(6.25)) {
$self->makemaker_args( PL_FILES => {} ) if -f 'Build.PL';
}
}
# Until ExtUtils::MakeMaker support MYMETA.yml, make sure
# we clean it up properly ourself.
$self->realclean_files('MYMETA.yml');
if ( $args{inline} ) {
$self->Inline->write;
} else {
$self->Makefile->write;
}
# The Makefile write process adds a couple of dependencies,
# so write the META.yml files after the Makefile.
if ( $args{meta} ) {
$self->Meta->write;
}
# Experimental support for MYMETA
if ( $ENV{X_MYMETA} ) {
if ( $ENV{X_MYMETA} eq 'JSON' ) {
$self->Meta->write_mymeta_json;
} else {
$self->Meta->write_mymeta_yaml;
}
}
return 1;
}
1;
UnixAgent-2.4.2/lib/ 0000775 0000000 0000000 00000000000 13327377321 0014177 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/ 0000775 0000000 0000000 00000000000 13327377321 0016701 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent.pm 0000664 0000000 0000000 00000035405 13327377321 0020304 0 ustar 00root root 0000000 0000000 #!/usr/bin/perl
package Ocsinventory::Agent;
use strict;
use warnings;
use POSIX ":sys_wait_h";
# THIS IS AN UGLY WORKAROUND FOR
# http://rt.cpan.org/Ticket/Display.html?id=38067
use XML::Simple;
eval {XMLout("b ");};
if ($@){
no strict 'refs';
${*{"XML::SAX::"}{HASH}{'parsers'}} = sub {
return [ {
'Features' => {
'http://xml.org/sax/features/namespaces' => '1'
},
'Name' => 'XML::SAX::PurePerl'
}]
};
}
# END OF THE UGLY FIX!
require Exporter;
use Ocsinventory::Logger;
use Ocsinventory::Agent::XML::Inventory;
use Ocsinventory::Agent::XML::Prolog;
use Ocsinventory::Agent::Network;
use Ocsinventory::Agent::Backend;
use Ocsinventory::Agent::AccountConfig;
use Ocsinventory::Agent::AccountInfo;
use Ocsinventory::Agent::Config;
use Ocsinventory::Agent::Hooks;
#use Ocsinventory::Agent::Pid;
use Ocsinventory::Agent::Common;
sub run {
# Load setting from the config file
my $config = new Ocsinventory::Agent::Config;
#$params->{$_} = $config->{$_} foreach (keys %$config);
$ENV{LC_ALL} = 'C'; # Turn off localised output for commands
$ENV{LANG} = 'C'; # Turn off localised output for commands
#####################################
################ MAIN ###############
#####################################
############################
#### CLI parameters ########
############################
$config->loadUserParams();
# I close STDERR to avoid error message during the module execution
# at the beginning I was doing shell redirection:
# my @ret = `cmd 2> /dev/null`;
# but this syntax is not supported on (at least) FreeBSD and Solaris
# c.f: http://www.perlmonks.org/?node_id=571072
#my $tmp;
#open ($tmp, ">&STDERR");
#$params->{"savedstderr"} = $tmp;
#if($params->{debug}) {
# $params->{verbose} = 1;
#} else {
# close(STDERR);
#}
if ($config->{config}{logfile}) {
$config->{config}{logger} = 'File';
}
my $logger = new Ocsinventory::Logger ({
config => $config->{config}
});
my $common = new Ocsinventory::Agent::Common({
logger => $logger,
config => $config->{config},
});
# $< == $REAL_USER_ID
if ( $< ne '0' ) {
$logger->info("You should run this program as super-user.");
}
if (not $config->{config}{scanhomedirs}) {
$logger->debug("--scan-homedirs missing. Don't scan user directories");
}
if ($config->{config}{nosoftware}) {
$config->{config}{nosoftware} = 1
}
# desactivate local mode even if it is set in config file or command line
if (defined($config->{config}{nolocal})) {
undef $config->{config}{'local'};
}
# TODO put that in Ocsinventory::Agent::Config
if (!$config->{config}{'stdout'} && !$config->{config}{'local'} && $config->{config}{server} !~ /^http(|s):\/\//) {
$logger->debug("the --server passed doesn't have a protocol, assume http as default");
$config->{config}{server} = "http://".$config->{config}{server}.'/ocsinventory';
}
######################## Objects initilisation ###############################################################
# The agent can contact different servers. Each server accountconfig is
# stored in a specific file:
if (!recMkdir ($config->{config}{basevardir})) {
if (! -d $ENV{HOME}."/.ocsinventory/var") {
$logger->info("Failed to create ".$config->{config}{basevardir}." directory: $!. ".
"I'm going to use the home directory instead (~/.ocsinventory/var).");
}
$config->{config}{basevardir} = $ENV{HOME}."/.ocsinventory/var";
if (!recMkdir ($config->{config}{basevardir})) {
$logger->error("Failed to create ".$config->{config}{basedir}." directory: $!".
"The HOSTID will not be written on the harddrive. You may have duplicated ".
"entry of this computer in your OCS database");
}
$logger->debug("var files are stored in ".$config->{config}{basevardir});
}
if (defined($config->{config}{server}) && $config->{config}{server}) {
my $dir = $config->{config}{server};
$dir =~ s/\//_/g;
$config->{config}{vardir} = $config->{config}{basevardir}."/".$dir;
if (defined ($config->{config}{local}) && $config->{config}{local}) {
$logger->debug ("--server ignored since you also use --local");
$config->{config}{server} = undef;
}
} elsif (defined($config->{config}{local}) && $config->{config}{local}) {
$config->{config}{vardir} = $config->{config}{basevardir}."/__LOCAL__";
}
if (!recMkdir ($config->{config}{vardir})) {
$logger->error("Failed to create ".$config->{config}{vardir}." directory: $!");
}
if (-d $config->{config}{vardir}) {
$config->{config}{accountconfig} = $config->{config}{vardir}."/ocsinv.conf";
$config->{config}{accountinfofile} = $config->{config}{vardir}."/ocsinv.adm";
$config->{config}{last_statefile} = $config->{config}{vardir}."/last_state";
$config->{config}{next_timefile} = $config->{config}{vardir}."/next_timefile";
}
# Setting SSL CA file path if not set in configuration
unless ($config->{config}{ca}) {
$config->{config}{ca} = $config->{config}{vardir}."/cacert.pem";
}
################################################################################################################
########################## load CFG files ######################################################################
my $accountconfig = new Ocsinventory::Agent::AccountConfig({
logger => $logger,
config => $config->{config},
});
my $srv = $accountconfig->get('OCSFSERVER');
$config->{config}{server} = $srv if $srv;
$config->{config}{deviceid} = $accountconfig->get('DEVICEID');
# Should I create a new deviceID?
chomp(my $hostname = `uname -n| cut -d . -f 1`);
if ((!$config->{config}{deviceid}) || $config->{config}{deviceid} !~ /\Q$hostname\E-(?:\d{4})(?:-\d{2}){5}/) {
my ($YEAR, $MONTH , $DAY, $HOUR, $MIN, $SEC) = (localtime(time))[5,4,3,2,1,0];
$config->{config}{old_deviceid} = $config->{config}{deviceid};
$config->{config}{deviceid} =sprintf "%s-%02d-%02d-%02d-%02d-%02d-%02d", $hostname, ($YEAR+1900), ($MONTH+1), $DAY, $HOUR, $MIN, $SEC;
$accountconfig->set('DEVICEID',$config->{config}{deviceid});
}
my $accountinfo = new Ocsinventory::Agent::AccountInfo({
logger => $logger,
# TODOparams => $params,
config => $config->{config},
common => $common,
});
# --lazy
if ($config->{config}{lazy}) {
my $nexttime = (stat($config->{config}{next_timefile}))[9];
if ($nexttime && $nexttime > time) {
$logger->info("[Lazy] Must wait until ".localtime($nexttime)." exiting...");
exit 0;
}
}
if ($config->{config}{daemon}) {
$logger->debug("Time to call Proc::Daemon");
eval { require Proc::Daemon; };
if ($@) {
print "Can't load Proc::Daemon. Is the module installed?";
exit 1;
}
Proc::Daemon::Init();
$logger->debug("Daemon started");
if (isAgentAlreadyRunning({
logger => $logger,
})) {
$logger->debug("An agent is already runnnig, exiting...");
exit 1;
}
}
$logger->debug("OCS Agent initialised");
################# Now we can create a context hash #########################################################
my $context = {
installpath => $config->{config}->{vardir},
servername => $config->{config}->{server},
authuser => $config->{config}->{user},
authpwd => $config->{config}->{password},
authrealm => $config->{config}->{realm},
deviceid => $config->{config}->{deviceid},
version => $config->{VERSION},
config => $config->{config},
accountconfig => $accountconfig,
accountinfo => $accountinfo,
logger => $logger,
common => $common,
# OCS_AGENT_CMDL => "TOTO", # TODO cmd line parameter changed with the unified agent
};
################################# HERE WE GO !!! ###################################################
while (1) {
my $exitcode = 0;
my $wait;
my $child;
if ($config->{config}{daemon} || $config->{config}{wait}) {
my $serverdelay;
if(($config->{config}{wait} eq 'server') || ($config->{config}{wait}!~/^\d+$/)){
$serverdelay = $accountconfig->get('PROLOG_FREQ')*3600;
} else {
$serverdelay = $config->{config}{wait};
}
$wait = int rand($serverdelay?$serverdelay:$config->{config}{delaytime});
$logger->info("Going to sleep for $wait second(s)");
sleep ($wait);
}
# Create an hook object to use handlers of modules.
my $hooks = new Ocsinventory::Agent::Hooks($context);
# Using start_handler hook
$hooks->run({name => 'start_handler'});
#################### Local Mode #######################
if ($config->{config}{stdout} || $config->{config}{local}) {
# TODO, avoid to create Backend at two different places
my $backend = new Ocsinventory::Agent::Backend ({
context => $context,
});
my $inventory = new Ocsinventory::Agent::XML::Inventory ({
# TODO, check if the accoun{info,config} are needed in localmode
backend => $backend,
context => $context,
});
# Launching inventory
$inventory->initialise();
# Using inventory_writer hook
$hooks->run({name => 'inventory_handler'}, $inventory);
if ($config->{config}{stdout}) {
$inventory->printXML();
} elsif ($config->{config}{local}) {
$inventory->writeXML();
}
} else {
############ I've to contact the server ########################"
my $network = new Ocsinventory::Agent::Network ({
accountconfig => $accountconfig,
accountinfo => $accountinfo,
logger => $logger,
config => $config->{config},
common => $common,
});
# Adding the network object in $context
$context->{network}= $network;
my $sendInventory = 1;
my $httpresp;
my $prologresp;
if (!$config->{config}{force}) {
my $prolog = new Ocsinventory::Agent::XML::Prolog({
context => $context,
});
# Using prolog_writer hook
$hooks->run({name => 'prolog_writer'}, $prolog);
# Formatting the XML
my $prologXML = $prolog->getContent();
$httpresp = $network->sendXML({message => $prologXML});
$prologresp = $network->getXMLResp($httpresp,'Prolog');
if ($prologresp) {
# Using prolog_reader hook
$hooks->run({name => 'prolog_reader'}, $prologresp->getRawXML());
if (!$prologresp->isInventoryAsked()) {
$sendInventory = 0;
}
} else { # Failed to reach the server
if ($config->{config}{lazy}) {
# To avoid flooding a heavy loaded server
my $previousPrologFreq;
if (!($previousPrologFreq = $accountconfig->get('PROLOG_FREQ'))){
$previousPrologFreq = $config->{config}{delaytime};
$logger->info("No previous PROLOG_FREQ found - using fallback delay(".$config->{config}{delaytime}." seconds)");
} else {
$logger->info("Previous PROLOG_FREQ found ($previousPrologFreq)");
$previousPrologFreq = $previousPrologFreq*3600;
}
my $time = time + $previousPrologFreq;
utime $time,$time,$config->{config}{next_timefile};
}
exit 1 unless $config->{config}{daemon};
$sendInventory = 0;
}
}
if (!$sendInventory) {
$logger->info("Don't send the inventory");
} else { # Send the inventory!
my $backend = new Ocsinventory::Agent::Backend ({
prologresp => $prologresp,
context => $context,
});
my $inventory = new Ocsinventory::Agent::XML::Inventory ({
# TODO, check if the accoun{info,config} are needed in localmode
backend => $backend,
context => $context,
});
# Launching inventory
$inventory->initialise();
# Using inventory_writer hook
$hooks->run({name => 'inventory_handler'}, $inventory);
# Formatting the XML
my $inventoryXML = $inventory->getContent();
# Sending Inventory
$httpresp = $network->sendXML({message => $inventoryXML});
if (my $invresp = $network->getXMLResp($httpresp,'Inventory')) {
$inventory->saveLastState();
} else {
exit (1) unless $config->{config}{daemon};
}
}
}
# Using end_handler_hook
$hooks->run({name => 'end_handler'});
# Avoid zombie process
if ($^O ne 'darwin'){
do {
$child = waitpid(-1, WNOHANG);
} while $child > 0;
} else {
waitpid(-1, 0);
}
exit (0) unless $config->{config}{daemon};
}
}
##########################################
############Functions#####################
##########################################
sub recMkdir {
my $dir = shift;
my @t = split /\//, $dir;
shift @t;
return unless @t;
my $t;
foreach (@t) {
$t .= '/'.$_;
if ((!-d $t) && (!mkdir $t)) {
return;
}
}
1;
}
sub isAgentAlreadyRunning {
my $params = shift;
my $logger = $params->{logger};
# TODO add a workaround if Proc::PID::File is not installed
eval { require Proc::PID::File; };
if(!$@) {
$logger->debug('Proc::PID::File available, checking for pid file');
if (Proc::PID::File->running()) {
$logger->debug('parent process already exists');
return 1;
}
}
return 0;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/ 0000775 0000000 0000000 00000000000 13327377321 0017737 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/AccountConfig.pm 0000664 0000000 0000000 00000003614 13327377321 0023023 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::AccountConfig;
use strict;
use warnings;
# AccountConfig read and write the setting for the client given by the server
# This file will be overwrite and is not designed to be changed by the user
# DESPITE ITS NAME, ACCOUNTCONFIG IS NOT A CONFIG FILE!
sub new {
my (undef,$params) = @_;
my $self = {};
bless $self;
$self->{config} = $params->{config};
my $logger = $self->{logger} = $params->{logger};
# Configuration reading
$self->{xml} = {};
if ($self->{config}->{accountconfig}) {
if (! -f $self->{config}->{accountconfig}) {
$logger->debug ('accountconfig file: `'. $self->{config}->{accountconfig}.
" doesn't exist. I create an empty one");
$self->write();
} else {
eval {
$self->{xml} = XML::Simple::XMLin(
$self->{config}->{accountconfig},
SuppressEmpty => undef
);
};
}
}
$self;
}
sub get {
my ($self, $name) = @_;
my $logger = $self->{logger};
return $self->{xml}->{$name} if $name;
return $self->{xml};
}
sub set {
my ($self, $name, $value) = @_;
my $logger = $self->{logger};
$self->{xml}->{$name} = $value;
$self->write(); # save the change
}
sub write {
my ($self, $args) = @_;
my $logger = $self->{logger};
return unless $self->{config}->{accountconfig};
my $xml = XML::Simple::XMLout( $self->{xml} , RootName => 'CONF',
NoAttr => 1 );
my $fault;
if (!open CONF, ">".$self->{config}->{accountconfig}) {
$fault = 1;
} else {
print CONF $xml;
$fault = 1 if (!close CONF);
}
if (!$fault) {
$logger->debug ("ocsinv.conf updated successfully");
} else {
$logger->error ("Can't save setting change in `".$self->{config}->{accountconfig}."'");
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/AccountInfo.pm 0000664 0000000 0000000 00000007203 13327377321 0022507 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::AccountInfo;
use strict;
use warnings;
sub new {
my (undef,$params) = @_;
my $self = {};
bless $self;
$self->{config} = $params->{config};
$self->{logger} = $params->{logger};
$self->{common} = $params->{common};
my $logger = $self->{logger} = $params->{logger};
if ($self->{config}->{accountinfofile}) {
$logger->debug ('Accountinfo file: '. $self->{config}->{accountinfofile});
if (! -f $self->{config}->{accountinfofile}) {
$logger->info ("Accountinfo file doesn't exist. I create an empty one.");
$self->writeAccountInfoFile();
} else {
my $xmladm;
eval {
$xmladm = $self->{common}->readXml($self->{config}->{accountinfofile}, [ 'ACCOUNTINFO' ]);
};
if ($xmladm && exists($xmladm->{ACCOUNTINFO})) {
# Store the XML content in a local HASH
for(@{$xmladm->{ACCOUNTINFO}}){
if (!$_->{KEYNAME}) {
$logger->debug ("Incorrect KEYNAME in ACCOUNTINFO");
}
$self->{accountinfo}{ $_->{KEYNAME} } = $_->{KEYVALUE};
}
}
}
} else {
$logger->debug("No accountinfo file defined");
}
if ($self->{config}->{tag}) {
if ($self->{accountinfo}->{TAG}) {
$logger->debug("A TAG seems to already exist in the ocsinv.adm file. ".
"The -t parameter will be ignored. Don't forget that the TAG value ".
"will be ignored by the server unless it has OCS_OPT_ACCEPT_TAG_UPDATE_FROM_CLIENT=1.");
} else {
$self->{accountinfo}->{TAG} = $self->{config}->{tag};
}
}
$self; #Because we have already blessed the object
}
# Add accountinfo stuff to an inventory
sub setAccountInfo {
my $self = shift;
my $inventory = shift;
#my $ai = $self->getAll();
$self->{xmlroot}{'CONTENT'}{ACCOUNTINFO} = [];
my $ai = $self->{accountinfo};
return unless $ai;
foreach (keys %$ai) {
push @{$inventory->{xmlroot}{'CONTENT'}{ACCOUNTINFO}}, {
KEYNAME => [$_],
KEYVALUE => [$ai->{$_}],
};
}
}
sub writeAccountInfoFile {
my ($self, $ref) = @_;
my $logger = $self->{logger};
my $content;
$content->{ACCOUNTINFO} = [];
#We clear accountinfo to store the new one
undef $self->{accountinfo};
#We get values sent by server
if (ref ($ref) =~ /^ARRAY$/) {
foreach (@$ref) {
$self->{accountinfo}->{$_->{KEYNAME}} = $_->{KEYVALUE} if defined ($_->{KEYNAME}) && defined ($_->{KEYVALUE});
}
} elsif (ref ($ref) =~ /^HASH$/) {
$self->{accountinfo}->{$ref->{KEYNAME}} = $ref->{KEYVALUE} if defined ($ref->{KEYNAME}) && defined ($ref->{KEYVALUE});
} else {
$logger->debug ("Invalid parameter while writing accountinfo file");
}
#We feed our XML for accountinfo file
foreach (keys %{$self->{accountinfo}}) {
push @{$content->{ACCOUNTINFO}}, {KEYNAME => [$_], KEYVALUE =>
[$self->{accountinfo}{$_}]};
}
my $xml=XML::Simple::XMLout($content, RootName => 'ADM', XMLDecl=> '');
#We write accountinfo file
my $fault;
if (!open ADM, ">".$self->{config}->{accountinfofile}) {
$fault = 1;
} else {
print ADM $xml;
$fault = 1 unless close ADM;
}
if (!$fault) {
$logger->debug ("Account info updated successfully");
} else {
$logger->error ("Can't save account info in `".
$self->{config}->{accountinfofile});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend.pm 0000664 0000000 0000000 00000027423 13327377321 0021634 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend;
use strict;
no strict 'refs';
use warnings;
#use ExtUtils::Installed;
sub new {
my (undef, $params) = @_;
my $self = {};
$self->{accountconfig} = $params->{context}->{accountconfig};
$self->{accountinfo} = $params->{context}->{accountinfo};
$self->{config} = $params->{context}->{config};
$self->{inventory} = $params->{inventory};
$self->{common} = $params->{context}->{common};
my $logger = $self->{logger} = $params->{context}->{logger};
$self->{prologresp} = $params->{prologresp};
$self->{modules} = {};
$self->{backendSharedFuncs} = {
can_run => sub {
my $binary = shift;
my $calling_namespace = caller(0);
chomp(my $binpath=`which $binary 2>/dev/null`);
return unless -x $binpath;
$self->{logger}->debug(" - $binary found");
1
},
can_load => sub {
my $module = shift;
my $calling_namespace = caller(0);
eval "package $calling_namespace; use $module;";
# print STDERR "$module not loaded in $calling_namespace! $!: $@\n" if $@;
return if $@;
$self->{logger}->debug(" - $module loaded");
# print STDERR "$module loaded in $calling_namespace!\n";
1;
},
can_read => sub {
my $file = shift;
return unless -r $file;
$self->{logger}->debug(" - $file can be read");
1;
},
runcmd => sub {
my $cmd = shift;
return unless $cmd;
# $self->{logger}->debug(" - run $cmd");
return `$cmd`;
}
};
bless $self;
}
sub initModList {
my $self = shift;
my $logger = $self->{logger};
my $config = $self->{config};
my @dirToScan;
my @installed_mods;
my @installed_files;
# This is a workaround for PAR::Packer. Since it resets @INC
# I can't find the backend modules to load dynamically. So
# I prepare a list and include it.
eval "use Ocsinventory::Agent::Backend::ModuleToLoad;";
if (!$@) {
$logger->debug("use Ocsinventory::Agent::Backend::ModuleToLoad to get the modules ".
"to load. This should not append unless you use the standalone agent built with ".
"PAR::Packer (pp)");
push @installed_mods, @Ocsinventory::Agent::Backend::ModuleToLoad::list;
}
if ($config->{devlib}) {
# devlib enable, I only search for backend module in ./lib
push (@dirToScan, './lib');
} else {
# my ($inst) = ExtUtils::Installed->new();
# eval {@installed_files =
# $inst->files('Ocsinventory')};
# ExtUtils::Installed is nice but it needs properly installed package with
# .packlist
# This is a workaround for 'invalide' installations...
foreach (@INC) {
next if ! -d || (-l && -d readlink) || /^(\.|lib)$/;
push @dirToScan, $_;
}
}
if (@dirToScan) {
eval {require File::Find};
if ($@) {
$logger->debug("Failed to load File::Find");
} else {
# here I need to use $d to avoid a bug with AIX 5.2's perl 5.8.0. It
# changes the @INC content if i use $_ directly
# thanks to @rgs on irc.perl.org
File::Find::find(
{
wanted => sub {
push @installed_files, $File::Find::name if $File::Find::name =~ /Ocsinventory\/Agent\/Backend\/.*\.pm$/;
},
follow => 1,
follow_skip => 2
}
, @dirToScan);
}
}
foreach my $file (@installed_files) {
my $t = $file;
next unless $t =~ s!.*?(Ocsinventory/Agent/Backend/)(.*?)\.pm$!$1$2!;
my $m = join ('::', split /\//, $t);
push @installed_mods, $m;
}
if (!@installed_mods) {
$logger->info("ZERO backend module found! Is Ocsinventory-Agent ".
"correctly installed? Use the --devlib flag if you want to run the agent ".
"directly from the source directory.")
}
foreach my $m (@installed_mods) {
my @runAfter;
my @runMeIfTheseChecksFailed;
my $enable = 1;
if (exists ($self->{modules}->{$m}->{name})) {
$logger->debug($m." already loaded.");
next;
}
eval "use $m;";
if ($@) {
$logger->debug ("Failed to load $m: $@");
$enable = 0;
}
my $package = $m."::";
# Load in the module the backendSharedFuncs
# foreach my $func (keys %{$self->{backendSharedFuncs}}) {
# $package->{$func} = $self->{backendSharedFuncs}->{$func};
# }
$self->{modules}->{$m}->{name} = $m;
$self->{modules}->{$m}->{done} = 0;
$self->{modules}->{$m}->{inUse} = 0;
$self->{modules}->{$m}->{enable} = $enable;
$self->{modules}->{$m}->{checkFunc} = $package->{"check"};
$self->{modules}->{$m}->{runAfter} = $package->{'runAfter'};
$self->{modules}->{$m}->{runMeIfTheseChecksFailed} = $package->{'runMeIfTheseChecksFailed'};
# $self->{modules}->{$m}->{replace} = \@replace;
$self->{modules}->{$m}->{runFunc} = $package->{'run'};
$self->{modules}->{$m}->{mem} = {};
# Load the Storable object is existing or return undef
$self->{modules}->{$m}->{storage} = $self->retrieveStorage($m);
}
# the sort is just for the presentation
foreach my $m (sort keys %{$self->{modules}}) {
next unless $self->{modules}->{$m}->{checkFunc};
# find modules to disable and their submodules
if($self->{modules}->{$m}->{enable} &&
!$self->runWithTimeout(
$m,
$self->{modules}->{$m}->{checkFunc},
{
accountconfig => $self->{accountconfig},
accountinfo => $self->{accountinfo},
config => $self->{config},
inventory => $self->{inventory},
logger => $self->{logger},
params => $self->{params}, # Compatibiliy with agent 0.0.10 <=
prologresp => $self->{prologresp},
mem => $self->{modules}->{$m}->{mem},
storage => $self->{modules}->{$m}->{storage},
common => $self->{common},
})) {
$logger->debug ($m." ignored");
foreach (keys %{$self->{modules}}) {
$self->{modules}->{$_}->{enable} = 0 if /^$m($|::)/;
}
}
# add submodule in the runAfter array
my $t;
foreach (split /::/,$m) {
$t .= "::" if $t;
$t .= $_;
if (exists $self->{modules}->{$t} && $m ne $t) {
push @{$self->{modules}->{$m}->{runAfter}}, \%{$self->{modules}->{$t}}
}
}
}
# Remove the runMeIfTheseChecksFailed if needed
foreach my $m (sort keys %{$self->{modules}}) {
next unless $self->{modules}->{$m}->{enable};
next unless $self->{modules}->{$m}->{runMeIfTheseChecksFailed};
foreach my $condmod (@{${$self->{modules}->{$m}->{runMeIfTheseChecksFailed}}}) {
if ($self->{modules}->{$condmod}->{enable}) {
foreach (keys %{$self->{modules}}) {
next unless /^$m($|::)/ && $self->{modules}->{$_}->{enable};
$self->{modules}->{$_}->{enable} = 0;
$logger->debug ("$_ disabled because of a 'runMeIfTheseChecksFailed' in '$m'\n");
}
}
}
}
}
sub runMod {
my ($self, $params) = @_;
my $logger = $self->{logger};
my $m = $params->{modname};
my $common = $params->{common};
return if (!$self->{modules}->{$m}->{enable});
return if ($self->{modules}->{$m}->{done});
$self->{modules}->{$m}->{inUse} = 1; # lock the module
# first I run its "runAfter"
foreach (@{$self->{modules}->{$m}->{runAfter}}) {
if (!$_->{name}) {
# The name is defined during module initialisation so if I
# can't read it, I can suppose it had not been initialised.
$logger->fault ("Module `$m' need to be runAfter a module not found.".
"Please fix its runAfter entry or add the module.");
}
if ($_->{inUse}) {
# In use 'lock' is taken during the mod execution. If a module
# need a module also in use, we have provable an issue :).
$logger->fault ("Circular dependency hell with $m and $_->{name}");
}
$self->runMod({
common => $common,
modname => $_->{name},
});
}
$logger->debug ("Running $m");
if ($self->{modules}->{$m}->{runFunc}) {
$self->runWithTimeout(
$m,
$self->{modules}->{$m}->{runFunc},
{
accountconfig => $self->{accountconfig},
accountinfo => $self->{accountinfo},
config => $self->{config},
common => $common,
logger => $logger,
params => $self->{params}, # For compat with agent 0.0.10 <=
prologresp => $self->{prologresp},
mem => $self->{modules}->{$m}->{mem},
storage => $self->{modules}->{$m}->{storage},
common => $self->{common},
}
);
} else {
$logger->debug("$m has no run() function -> ignored");
}
$self->{modules}->{$m}->{done} = 1;
$self->{modules}->{$m}->{inUse} = 0; # unlock the module
$self->saveStorage($m, $self->{modules}->{$m}->{storage});
}
sub feedInventory {
my ($self, $params) = @_;
my $common = $self->{common};
my $inventory;
if ($params->{inventory}) {
$inventory = $params->{inventory};
}
if (!keys %{$self->{modules}}) {
$self->initModList();
}
my $begin = time();
foreach my $m (sort keys %{$self->{modules}}) {
die ">$m Houston!!!" unless $m;
$self->runMod ({
common => $common,
modname => $m,
});
}
# Execution time
# $common->setHardware({ETIME => time() - $begin});
$inventory->{xmlroot}->{CONTENT} = $common->{xmltags};
}
sub retrieveStorage {
my ($self, $m) = @_;
my $logger = $self->{logger};
my $storagefile = $self->{config}->{vardir}."/$m.storage";
if (!exists &retrieve) {
eval "use Storable;";
if ($@) {
$logger->debug("Storable.pm is not available, can't load Backend module data");
return;
}
}
return (-f $storagefile)?retrieve($storagefile):{};
}
sub saveStorage {
my ($self, $m, $data) = @_;
my $logger = $self->{logger};
# Perl 5.6 doesn't provide Storable.pm
if (!exists &store) {
eval "use Storable;";
if ($@) {
$logger->debug("Storable.pm is not available, can't save Backend module data");
return;
}
}
my $storagefile = $self->{config}->{vardir}."/$m.storage";
if ($data && keys (%$data)>0) {
store ($data, $storagefile) or die;
} elsif (-f $storagefile) {
unlink $storagefile;
}
}
sub runWithTimeout {
my ($self, $m, $func, $params) = @_;
my $logger = $self->{logger};
my $ret;
eval {
local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n require
my $timeout = $params->{config}{backendCollectTimeout};
alarm $timeout;
$ret = &{$func}($params);
};
alarm 0;
if ($@) {
if ($@ ne "alarm\n") {
$logger->debug("runWithTimeout(): unexpected error: $@");
} else {
$logger->debug("$m killed by a timeout.");
return;
}
} else {
return $ret;
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/ 0000775 0000000 0000000 00000000000 13327377321 0021266 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/AccessLog.pm 0000664 0000000 0000000 00000000630 13327377321 0023466 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::AccessLog;
sub run {
my $params = shift;
my $common = $params->{common};
my ($YEAR, $MONTH , $DAY, $HOUR, $MIN, $SEC) = (localtime (time))[5,4,3,2,1,0];
my $date=sprintf "%02d-%02d-%02d %02d:%02d:%02d", ($YEAR+1900), ($MONTH+1), $DAY, $HOUR, $MIN, $SEC;
$common->setAccessLog ({
USERID => 'N/A',
LOGDATE => $date
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/DeviceID.pm 0000664 0000000 0000000 00000000755 13327377321 0023247 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::DeviceID;
# Initialise the DeviceID. In fact this value is a bit specific since
# it generates in the main script.
sub run {
my $params = shift;
my $common = $params->{common};
my $config = $params->{config};
my $UsersLoggedIn = join "/", keys %user;
if ($config->{old_deviceid}) {
$common->setHardware({ OLD_DEVICEID => $config->{old_deviceid} });
}
$common->setHardware({ DEVICEID => $config->{deviceid} });
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/IpDiscover.pm 0000664 0000000 0000000 00000000423 13327377321 0023672 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::IpDiscover;
use strict;
sub check {
my $params = shift;
my $prologresp = $params->{prologresp};
my $mem = $params->{mem};
return unless ($prologresp && $prologresp->getOptionsInfoByName("IPDISCOVER"));
1;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/IpDiscover/ 0000775 0000000 0000000 00000000000 13327377321 0023335 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/IpDiscover/IpDiscover.pm 0000664 0000000 0000000 00000004163 13327377321 0025746 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::IpDiscover::IpDiscover;
use strict;
use warnings;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run ("ipdiscover");
}
sub run {
my $params = shift;
my $common = $params->{common};
my $prologresp = $params->{prologresp};
my $logger = $params->{logger};
# Let's find network interfaces and call ipdiscover on it
my $options = $prologresp->getOptionsInfoByName("IPDISCOVER");
my $ipdisc_lat;
my $network;
if ($options->[0] && exists($options->[0]->{IPDISC_LAT}) && $options->[0]->{IPDISC_LAT}) {
$ipdisc_lat = $options->[0]->{IPDISC_LAT};
}
if ($options->[0] && exists($options->[0]->{content})) {
$network = $options->[0]->{content};
} else {
return;
}
$logger->debug("Scanning the $network network");
my $legacymode;
if ( `ipdiscover` =~ /binary ver. (\d+)/ ){
if (!($1>3)) {
$legacymode = 1;
$logger->debug("ipdiscover ver.$1: legacymode");
}
}
my $ifname;
if ($common->can_run("ip")) {
foreach (`ip route`) {
if (/^default via (\d+\d.\d+\.\d+\.\d+) dev (\S+).*/) {
if ($network = $1 ){
$ifname = $2;
last;
}
}
}
} elsif ($common->can_run("route")){
foreach (`route -n`) {
if (/^(\d+\.\d+\.\d+\.\d+).*?\s(\S+)$/) {
if ($network eq $1) {
$ifname = $2;
last;
} elsif (!$ifname && $1 eq "0.0.0.0") {
$ifname = $2;
}
}
}
}
if ($ifname) {
my $cmd = "ipdiscover $ifname ";
$cmd .= $ipdisc_lat if ($ipdisc_lat && !$legacymode);
foreach (`$cmd`) {
if (/([\d\.]*)<\/I>([\w\:]*)<\/M>(\S*)<\/N><\/H>/) {
$common->addIpDiscoverEntry({
IPADDRESS => $1,
MACADDR => $2,
NAME => $3
});
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/IpDiscover/Nmap.pm 0000664 0000000 0000000 00000003775 13327377321 0024602 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::IpDiscover::Nmap;
use vars qw($runMeIfTheseChecksFailed);
$runMeIfTheseChecksFailed = ["Ocsinventory::Agent::Backend::IpDiscover::IpDiscover"];
use strict;
use warnings;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run("nmap");
return unless $common->can_load("Nmap::Parser");
# Do we have nmap 3.90 (or >)
foreach (`nmap -v 2>&1`) {
if (/^Starting Nmap (\d+)\.(\d+)/) {
my $release = $1;
my $minor = $2;
if ($release > 3 || ($release > 3 && $minor >= 90)) {
return 1;
}
}
}
0;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $prologresp = $params->{prologresp};
my $logger = $params->{logger};
# Let's find network interfaces and call ipdiscover on it
my $options = $prologresp->getOptionsInfoByName("IPDISCOVER");
my $network;
if ($options->[0] && exists($options->[0]->{content})) {
$network = $options->[0]->{content};
} else {
return;
}
unless ($network =~ /^\d+\.\d+\.\d+\.\d+$/) {
return;
}
#Let's go scanning the network and parsing the results
$logger->debug("Scanning the $network network");
my $nmaparser = new Nmap::Parser;
$nmaparser->parsescan("nmap","-sn","-PR","$network/24");
for my $host ($nmaparser->all_hosts("up")){
my $ip = $host->addr;
my $mac = $host->mac_addr;
my $hostname = $host->hostname;
if ($hostname eq 0) {
$hostname = undef; #it's better to send nothing instead of a '0'
}
if ($mac) {
$logger->debug("Host $ip found using Nmap. Adding informations in XML");
# Feeding the Inventory XML
$common->addIpDiscoverEntry({
IPADDRESS => $ip,
MACADDR => lc($mac),
NAME => $hostname,
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/ 0000775 0000000 0000000 00000000000 13327377321 0021607 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX.pm 0000664 0000000 0000000 00000001507 13327377321 0022571 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX;
use strict;
use vars qw($runAfter);
$runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"];
sub check {
my $r;
$r = 1 if $^O =~ /^aix$/;
$r;
}
sub run {
my $params = shift;
my $common = $params->{common};
my @tabOS;
my $OSName;
my $OSComment;
my $OSVersion;
my $OSLevel;
# Operating system informations
chomp($OSName=`uname -s`);
# AIX OSVersion = oslevel, OSComment=oslevel -r affiche niveau de maintenance
chomp($OSVersion=`oslevel`);
chomp($OSLevel=`oslevel -r`);
@tabOS=split(/-/,$OSLevel);
$OSComment="Maintenance Level :".@tabOS[1];
$OSVersion =~ s/(.0)*$//;
$common->setHardware({
OSNAME => "$OSName $OSVersion",
OSCOMMENTS => $OSComment,
OSVERSION => $OSLevel,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/ 0000775 0000000 0000000 00000000000 13327377321 0022230 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/CPU.pm 0000664 0000000 0000000 00000004303 13327377321 0023215 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::CPU;
use strict;
use warnings;
sub check { 1 }
# try to simulate a modern lsattr output on AIX4
sub lsattrForAIX4 {
my $device = shift;
my @lsattr;
my @lsattrtemp=`lsattr -EOl $device -a 'state:type'`;
for (@lsattrtemp) {
chomp;
my $frequency;
my (undef,$type)=split /:/;
#
# On older models, frequency is based on cpu model and uname
#
if ( $type eq "PowerPC" or $type eq "PowerPC_601" or $type eq "PowerPC_604") {
my $uname=`uname -m`;
$frequency=112000000 if ($uname=~/E1D|EAD|C1D|R04|C4D|R4D/);
$frequency=133000000 if ($uname=~/34M/);
$frequency=150000000 if ($uname=~/N4D/);
$frequency=200000000 if ($uname=~/X4M|X4D/);
$frequency=225000000 if ($uname=~/N4E|K04|K44/);
$frequency=320000000 if ($uname=~/N4F/);
$frequency=360000000 if ($uname=~/K45/);
} elsif ( $type eq "PowerPC_RS64_III" ) {
$frequency=400000000;
} elsif ( $type eq "PowerPC_620" ) {
$frequency=172000000;
} else {
$frequency=225000000;
}
push @lsattr,"$device:$frequency\n";
}
}
sub run {
my $params = shift;
my $common = $params->{common};
# TODO Need to be able to register different CPU speed!
my $processort;
my $processorn;
my $processors;
my $frequency;
my @lsdev;
my @lsattr;
#lsdev -Cc processor -F name
#lsattr -EOl proc16
my $aixversion=`uname -v`;
for (`lsdev -Cc processor -F name`){
chomp(my $device = $_);
if ( $aixversion < 5 ) {
@lsattr=lsattrForAIX4($device);
} else {
@lsattr=`lsattr -EOl $device -a 'state:type:frequency'`;
}
for (@lsattr) {
if ( ! /^#/ && /(.+):(.+):(.+)/ ) {
$processorn++;
$processort=$2;
if ( ($3 % 1000000) >= 50000){
$processors=int (($3/1000000) +1);
}
else {
$processors=int (($3/1000000));
}
}
}
}
$processort =~ s/_/ /;
$common->setHardware({
PROCESSORT => $processort,
PROCESSORN => $processorn,
PROCESSORS => $processors
});
}
1
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Controller.pm 0000664 0000000 0000000 00000001414 13327377321 0024711 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Controller;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run('lsdev');
my @lsdev = `lsdev -Cc adapter -F 'name:type:description'`;
return 1 if @lsdev;
0
}
sub run {
my $params = shift;
my $common = $params->{common};
my $name;
my $type;
my $manufacturer;
for (`lsdev -Cc adapter -F 'name:type:description'`){
chomp($_);
/^(.+):(.+):(.+)/;
my $name = $1;
my $type = $2;
my $manufacturer = $3;
$common->addController({
'NAME' => $name,
'MANUFACTURER' => $manufacturer,
'TYPE' => $type,
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Domains.pm 0000664 0000000 0000000 00000001223 13327377321 0024156 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Domains;
use strict;
sub run {
my $params = shift;
my $common = $params->{common};
my $domain;
# Domain name
open RESOLV, "/etc/resolv.conf";
while(){
if (/^(domain|search)\s+(.+)/){
$domain=$2;
chomp($domain);
}
}
# If no domain name and no workgroup name (samba), we send "WORKGROUP"
# TODO:Check if samba is present and get the windows workgroup or NT domain name
unless (defined($domain)){chomp($domain="WORKGROUP");}
$domain=~s/^.\.(.)/$1/;
$common->setHardware({
WORKGROUP => $domain
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Drives.pm 0000664 0000000 0000000 00000002106 13327377321 0024021 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Drives;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run("df");
1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $free;
my $filesystem;
my $total;
my $type;
my $volumn;
my @fs;
my @fstype;
#Looking for mount points and disk space
# Aix option -kP
for (`df -kP`) {
next if /^Filesystem\s*1024-blocks.*/;
if (/^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\n/) {
$type = $1;
@fs=`lsfs -c $6`;
@fstype = split /:/,$fs[1];
$filesystem = $fstype[2];
$total = sprintf("%i",($2/1024));
$free = sprintf("%i",($4/1024));
$volumn = $6;
}
next if $filesystem =~ /procfs/;
$common->addDrive({
FREE => $free,
FILESYSTEM => $filesystem,
TOTAL => $total,
TYPE => $type,
VOLUMN => $volumn
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Hardware.pm 0000664 0000000 0000000 00000003723 13327377321 0024330 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Hardware;
use strict;
sub check { 1 }
# NOTE:
# Q: SSN can also use `uname -n`? What is the best?
# A: uname -n since it doesn't need root priv
sub run {
my $params = shift;
my $common = $params->{common};
# Using "type 0" section
my( $SystemSerial , $SystemModel, $SystemManufacturer, $BiosManufacturer, $BiosVersion, $BiosDate);
# lsvpd
my @lsvpd = `lsvpd`;
# Remove * (star) at the beginning of lines
s/^\*// for (@lsvpd);
# Search Firmware Hard
my $flag=0;
my $fw;
for (@lsvpd){
if (/^DS Platform Firmware/) { $flag=1 };
if ( ($flag) && /^RM (.+)/) {$fw=$1;chomp($fw);$fw =~ s/(\s+)$//g;last};
}
$flag=0;
for (@lsvpd){
if (/^DS System Firmware/) { $flag=1 };
if ( ($flag) && /^RM (.+)/) {$BiosVersion=$1;chomp($BiosVersion);$BiosVersion =~ s/(\s+)$//g;last};
}
$flag=0;
for (@lsvpd){
if (/^DS System VPD/) { $flag=1 };
if ( ($flag) && /^TM (.+)/) {$SystemModel=$1;chomp($SystemModel);$SystemModel =~ s/(\s+)$//g;};
if ( ($flag) && /^SE (.+)/) {$SystemSerial=$1;chomp($SystemSerial);$SystemSerial =~ s/(\s+)$//g;};
if ( ($flag) && /^FC .+/) {$flag=0;last}
}
# Fetch the serial number like prtconf do
if (! $SystemSerial) {
$flag=0;
foreach (`lscfg -vpl sysplanr00`) {
if ($flag) {
if (/\.+(\S*?)$/) {
$SystemSerial = $1;
}
last;
} else {
$flag = 1 if /\s+System\ VPD/;
}
}
}
$BiosManufacturer='IBM';
$SystemManufacturer='IBM';
$BiosVersion .= "(Firmware :".$fw.")";
# Writing data
$common->setBios ({
SMANUFACTURER => $SystemManufacturer,
SMODEL => $SystemModel,
SSN => $SystemSerial,
BMANUFACTURER => $BiosManufacturer,
BVERSION => $BiosVersion,
BDATE => $BiosDate,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/IPv4.pm 0000664 0000000 0000000 00000001102 13327377321 0023342 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::IPv4;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("ifconfig")
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my @ip;
# Looking for ip addresses with ifconfig, except loopback
# AIX need -a option
for (`ifconfig -a`){#ifconfig in the path
# AIX ligne inet
if(/^\s*inet\s+(\S+).*/){($1=~/127.+/)?next:push @ip, $1};
}
$ip=join "/", @ip;
$common->setHardware({IPADDR => $ip});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/LVM.pm 0000664 0000000 0000000 00000007302 13327377321 0023226 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::LVM;
use strict;
use vars qw($runAfter);
$runAfter = ["Ocsinventory::Agent::Backend::OS::AIX::Drives"];
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run ("lspv") || $common->can_run('lsvg') || $common->can_run('lslv');
1
}
my $line;
sub run {
my $params = shift;
my $common = $params->{common};
my @physvol;
my @volgrp;
my $format;
my $total;
my $total_pps;
my $free;
my $free_pps;
my $lps;
my $volume_name;
my $volume_size;
my $volume_uuid;
my $status;
my $vg_name;
my $type;
use constant MB => (1024*1024);
# We retrieve the disk list
foreach my $line (`lspv`) {
chomp;
my $name = split(/\s+/, $line);
push @physvol, $name;
}
foreach my $nom (@physvol) {
foreach my $line (`lspv $nom`){
if ($line =~ /PHYSICAL VOLUME:\s+(\S+)/) {
$format = "AIX PV";
}
if ($line =~ /PV STATE:\ss+(\S+)/) {
$status = $1;
}
if ($line =~ /FREE PPs:\s+(\d+)/) {
$free_pps = $1;
}
if ($line =~ /TOTAL PPs:\s+(\d+)/) {
$total_pps = $1;
}
if ($line =~ /VOLUME GROUP:\s+(\S+)/) {
$vg_name = "VG $1";
}
if ($line =~ /PP SIZE:\s+(\d+)/) {
$volume_size = $1;
}
if ($line =~ /PV IDENTIFIER:\s+(\S+)/) {
$volume_uuid = $1;
}
if ($volume_size){
$total = $total_pps * $volume_size;
$free = $free_pps * $volume_size;
}
$common->addDrive({
FREE => $free,
FILESYSTEM => $format,
TOTAL => $total,
TYPE => "DISK",
VOLUMN => $status,
SERIAL => $volume_uuid
});
}
}
foreach my $nom (@physvol) {
foreach my $line (`lslv $nom`){
if ($line =~ /LV IDENTIFIER:\s+(\S+)/) {
$volume_uuid = $1;
}
if ($line =~ /LV STATE:\s+(\S+)/) {
$status = $1;
}
if ($line =~ /PP SIZE:\s+(\d+)/) {
$volume_size = $1;
}
if ($line =~ /LPs:\s+(\d+)/) {
$lps = $1;
}
if ($line =~ /TYPE:\s+(\S+)/) {
$type = $1;
}
$total = $lps * $volume_size;
$common->addDrive({
FREE => "",
FILESYSTEM => "",
TOTAL => $total,
TYPE => $type,
VOLUMN => $status,
SERIAL => $volume_uuid
});
}
}
# We retrieve the disk list
foreach my $line (`lsvg`) {
chomp;
my $name = split(/\s+/, $line);
push @volgrp, $name;
}
foreach my $nom (@volgrp) {
foreach my $line (`lsvg $nom`){
if ($line =~ /VG IDENTIFIER:\s+(\S+)/) {
$volume_uuid = $1;
}
if ($line =~ /VG STATE:\s+(\S+)/) {
$status = $1;
}
if ($line =~ /TOTAL PPs:\s+(\d+)/) {
$volume_size = $1;
}
if ($line =~ /FREE PPs:\s+(\d+)/) {
$free = $1;
}
$common->addDrive({
FREE => $free,
FILESYSTEM => "",
TOTAL => $volume_size,
TYPE => "AIX VG",
VOLUMN => $status,
SERIAL => $volume_uuid
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Mem.pm 0000664 0000000 0000000 00000001607 13327377321 0023310 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Mem;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run("lsdev");
return unless $common->can_run("which");
return unless $common->can_run("lsattr");
}
sub run {
my $params = shift;
my $common = $params->{common};
my $memory;
my $swap;
# Memory informations
# lsdev -Cc memory -F 'name' -t totmem
# lsattr -EOlmem0
my (@lsdev, @lsattr, @grep);
$memory=0;
@lsdev=`lsdev -Cc memory -F 'name' -t totmem`;
for (@lsdev){
$memory += `lsattr -a size -F value -El$_`;
}
# Paging Space
@grep=`lsps -s`;
for (@grep){
if ( ! /^Total/){
/^\s*(\d+)\w*\s+\d+.+/;
$swap=$1;
}
}
$common->setHardware({
MEMORY => $memory,
SWAP => $swap
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Memory.pm 0000664 0000000 0000000 00000003556 13327377321 0024047 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Memory;
use strict;
sub check { 1 } # TODO create a better check here
sub run {
my $params = shift;
my $common = $params->{common};
my $capacity;
my $description;
my $numslots;
my $speed;
my $type;
my $n;
my $serial;
my $mversion;
my $caption;
my $flag=0;
#lsvpd
my @lsvpd = `lsvpd`;
# Remove * (star) at the beginning of lines
s/^\*// for (@lsvpd);
$numslots = -1;
for (@lsvpd){
if (/^DS Memory DIMM/){
$description = $_;
$flag=1; (defined($n))?($n++):($n=0);
$description =~ s/DS //;
$description =~ s/\n//;
}
if((/^SZ (.+)/) && ($flag)) {$capacity = $1;}
if((/^PN (.+)/) && ($flag)) {$type = $1;}
# localisation slot dans type
if((/^YL\s(.+)/) && ($flag)) {$caption = "Slot ".$1;}
if((/^SN (.+)/) && ($flag)) {$serial = $1;}
if((/^VK (.+)/) && ($flag)) {$mversion = $1};
#print $numslots."\n";
# On rencontre un champ FC alors c'est la fin pour ce device
if ((/^FC .+/) && ($flag)) {
$flag=0;
$numslots = $numslots +1;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
NUMSLOTS => $numslots,
VERSION => $mversion,
TYPE => $type,
SERIALNUMBER=> $serial,
});
}
}
#$numslots = $numslots +1;
# End of Loop
# The last *FC ???????? missing
# $common->addMemory({
# CAPACITY => $capacity,
# DESCRIPTION => $description,
# CAPTION => $caption,
# NUMSLOTS => $numslots,
# VERSION => $mversion,
# TYPE => $type,
# SERIALNUMBER=> $serial,
#});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Modems.pm 0000664 0000000 0000000 00000001067 13327377321 0024016 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Modems;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("lsdev")
}
sub run {
my $params = shift;
my $common = $params->{common};
for (`lsdev -Cc adapter -F 'name:type:description'`){
if (/modem/i && /\d+\s(.+):(.+)$/){
my $name = $1;
my $description = $2;
$common->addModems({
'DESCRIPTION' => $description,
'NAME' => $name,
});
}
}
}
1
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Networks.pm 0000664 0000000 0000000 00000010021 13327377321 0024374 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Networks;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_load("Net::IP qw(:PROC)");
}
sub run {
my $params = shift;
my $common = $params->{common};
my %info;
my $ifname;
foreach (`lscfg -v -l en*`) {
$ifname = "en".$1 if /^\s+ent(\d+)\s+\S+\s+(.+)/;
if ($ifname) {
$info{$ifname}{type} = $2;
$info{$ifname}{status} = "Down"; # default is down
if (/Network Address\.+(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})/) {
$info{$ifname}{macaddr} = "$1:$2:$3:$4:$5:$6"
}
}
}
# Retrieve VLAN information on AIX
# Only tested on AIX 6.1
my $pifname;
foreach (`lsdev`) {
if (/^ent(\d+).*VLAN$/) {
$ifname = "en".$1;
$pifname = "ent".$1;
$info{$ifname}{type} = "VLAN";
$info{$ifname}{status} = "Down";
foreach (`entstat -d $ifname`) {
if (/Hardware Address:\s+(.+)$/) {
$info{$ifname}{macaddr}="$1";
last;
}
}
foreach (`lsattr -El $pifname`) {
if (/^vlan_tag_id\s+(\d+)/) {
$info{$ifname}{type}.="$1";
}
}
}
}
# uncomment if you prefere verbose information about the link
# e.g: 0xe8120000:0xe80c0000:741:3:512:1024:8192:Auto_Negotiation:2048:no:0x000000000000:10000:10:1000:yes:yes:no:no:yes:2048
# etherchannel interfaces
# my @lsdev=`lsdev -Cc adapter -s pseudo -t ibm_ech`;
# foreach (`lsdev -Cc adapter`) {
# next unless /^ent(\d*)\s*(\w*)\s*.*/;
# my $ifname = "en".$1;
# my $tmpifname = "ent".$1;
# #@lsattr=`lsattr -EOl $1 -a 'adapter_names mode netaddr'`;
# foreach (`lsattr -EOl $tmpifname`) {
# if (/(.+):(.+):(.*)/) {
# $info{$ifname}{type}="EtherChannel with : ".$1." (mode :".$2.", ping :".$3.")";
# }
# }
# $info{$ifname}{status} = 'Down'; # The same
# }
foreach (split / /,`ifconfig -l`) {
# AIX: network interface naming is enX
if (/^(en\d+)/) {
my $ifname = $1;
foreach (`lsattr -E -l $ifname`) {
$info{$ifname}{ip} = $1 if /^netaddr \s*([\d*\.?]*).*/i;
$info{$ifname}{netmask} = $1 if /^netmask\s*([\d*\.?]*).*/i;
$info{$ifname}{status} = $1 if /^state\s*(\w*).*/i;
}
}
}
# Looking for the gateways
# AIX: the route command doesn't exist. We use netstat -rn instead
foreach (`netstat -rn`) {
if (/\S+\s+(\S+)\s+\S+\s+\S+\s+\S+\s+(\S+)/) {
my $ifname = $2;
my $gateway = $1;
if (exists ($info{$ifname})) {
$info{$ifname}{gateway} = $gateway;
}
}
}
foreach my $ifname (sort keys %info) {
my $description = $ifname;
my $type = $info{$ifname}{type};
my $macaddr = $info{$ifname}{macaddr};
my $status = $info{$ifname}{status};
my $ipaddress = $info{$ifname}{ip};
my $ipmask = $info{$ifname}{netmask};
my $gateway = $info{$ifname}{gateway};
my $ipdhcp = "No";
my $ipsubnet;
$status = "Down" unless $ipaddress;
# Retrieving ip of the subnet for each interface
if ($ipmask and $ipaddress) {
# To retrieve the subnet for this iface
my $binip = &ip_iptobin ($ipaddress ,4);
my $binmask = &ip_iptobin ($ipmask ,4);
my $subnet = $binip & $binmask;
$ipsubnet = ip_bintoip($subnet,4);
}
$common->addNetwork({
DESCRIPTION => $description,
IPADDRESS => $ipaddress,
IPDHCP => $ipdhcp,
IPGATEWAY => $gateway,
IPMASK => $ipmask,
IPSUBNET => $ipsubnet,
MACADDR => $macaddr,
STATUS => $status,
TYPE => $type,
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Slots.pm 0000664 0000000 0000000 00000002027 13327377321 0023673 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Slots;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("lsdev")
}
sub run {
my $params = shift;
my $common = $params->{common};
my $description;
my $designation;
my $name;
my $status;
my @slot;
my $flag=0;
@slot=`lsdev -Cc bus -F 'name:description'`;
for (@slot){
/^(.+):(.+)/;
$name = $1;
$status = 'available';
$designation = $2;
$flag=0;
my @lsvpd = `lsvpd`;
s/^\*// for (@lsvpd);
for (@lsvpd){
if ((/^AX $name/) ) {$flag=1}
if ((/^YL (.+)/) && ($flag)){
$description = $2;
}
if ((/^FC .+/) && $flag) {$flag=0;last}
}
$common->addSlot({
DESCRIPTION => $description,
DESIGNATION => $designation,
NAME => $name,
STATUS => $status,
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Software.pm 0000664 0000000 0000000 00000001452 13327377321 0024362 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Software;
use strict;
use warnings;
sub check {
my $params = shift;
my $common = $params->{common};
# Do not run an package inventory if there is the --nosoftware parameter
return if ($params->{config}->{nosoftware});
return unless $common->can_run("lslpp");
1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my @list;
my $buff;
foreach (`lslpp -c -l`) {
my @entry = split /:/,$_;
next unless (@entry);
next unless ($entry[1]);
next if $entry[1] =~ /^device/;
$common->addSoftware({
'COMMENTS' => $entry[6],
'FOLDER' => $entry[0],
'NAME' => $entry[1],
'VERSION' => $entry[2],
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Sounds.pm 0000664 0000000 0000000 00000001121 13327377321 0024034 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Sounds;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("lsdev")
}
sub run {
my $params = shift;
my $common = $params->{common};
for (`lsdev -Cc adapter -F 'name:type:description'`){
if (/audio/i){
if (/^\S+\s([^:]+):\s*(.+?)(?:\(([^()]+)\))?$/i){
$common->addSound({
'DESCRIPTION' => $3,
'MANUFACTURER' => $2,
'NAME' => $1,
});
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Storages.pm 0000664 0000000 0000000 00000017776 13327377321 0024377 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Storages;
use strict;
#use warning;
sub check {
`which lsdev 2>&1`;
return if($? >> 8)!=0;
`which lsattr 2>&1`;
($? >> 8)?0:1}
sub run {
my $params = shift;
my $common = $params->{common};
my(@disques, $device, $model, $capacity, $description, $manufacturer, $n, $i, $flag, @rep, @scsi, @values, @lsattr, $FRU, $status);
#lsvpd
my @lsvpd = `lsvpd`;
s/^\*// for (@lsvpd);
#FCP MPIO FC 2145 disks. IBM SDDPCM MPIO Storwize
@scsi= ();
@lsattr= ();
$n=0;
@scsi=`lsdev -Cc disk -s fcp -F 'name:description'`;
for (@scsi){
chomp $scsi[$n];
/^(.+):(.+)/;
$device=$1;
$description=$2;
@lsattr=`lspv $device 2>&1`;
for (@lsattr){
if ( ! ( /^0516-320.*/ ) ){
if (/TOTAL PPs:/ ) {
($capacity,$model) = split(/\(/, $_);
($capacity,$model) = split(/ /,$model);
}
} else{
$capacity=0;
}
}
$common->addStorages({
MANUFACTURER => "FCP",
MODEL => "MPIO Disk",
DESCRIPTION => $description,
TYPE => 'disk',
NAME => $device,
DISKSIZE => $capacity
});
$n++;
}
# SAS disks
$n=0;
@scsi=`lsdev -Cc disk -s sas -F 'name:description'`;
for (@scsi){
chomp $scsi[$n];
/^(.+):(.+)/;
$device=$1;
$description=$2;
@lsattr=`lsattr -EOl $device -a 'size_in_mb'`;
for (@lsattr){
if (! /^#/ ){
$capacity=$_;
chomp($capacity);$capacity =~ s/(\s+)$//;
}
}
for (@lsvpd){
if (/^AX $device/){$flag=1}
if ((/^MF (.+)/) && $flag){$manufacturer=$1;chomp($manufacturer);$manufacturer =~ s/(\s+)$//;}
if ((/^TM (.+)/) && $flag){$model=$1;chomp($model);$model =~ s/(\s+)$//;}
if ((/^FN (.+)/) && $flag){$FRU=$1;chomp($FRU);$FRU =~ s/(\s+)$//;$manufacturer .= ",FRU number :".$FRU}
if ((/^FC .+/) && $flag) {$flag=0;last}
}
$common->addStorages({
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => $description,
TYPE => 'disk',
NAME => $device,
DISKSIZE => $capacity
});
$n++;
}
#SCSI disks
$n=0;
@scsi=`lsdev -Cc disk -s scsi -F 'name:description'`;
for (@scsi){
chomp $scsi[$n];
/^(.+):(.+)/;
$device=$1;
$description=$2;
@lsattr=`lsattr -EOl $device -a 'size_in_mb'`;
for (@lsattr){
if (! /^#/ ){
$capacity= $_;
chomp($capacity);$capacity =~ s/(\s+)$//;
}
}
for (@lsvpd){
if(/^AX $device/){$flag=1}
if ((/^MF (.+)/) && $flag){$manufacturer=$1;chomp($manufacturer);$manufacturer =~ s/(\s+)$//;}
if ((/^TM (.+)/) && $flag){$model=$1;chomp($model);$model =~ s/(\s+)$//;}
if ((/^FN (.+)/) && $flag){$FRU=$1;chomp($FRU);$FRU =~ s/(\s+)$//;$manufacturer .= ",FRU number :".$FRU}
if ((/^FC .+/) && $flag) {$flag=0;last}
}
$common->addStorages({
NAME => $device,
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => $description,
TYPE => 'disk',
DISKSIZE => $capacity
});
$n++;
}
#Virtual disks
@scsi= ();
@lsattr= ();
$n=0;
@scsi=`lsdev -Cc disk -s vscsi -F 'name:description'`;
for (@scsi){
chomp $scsi[$n];
/^(.+):(.+)/;
$device=$1;
$description=$2;
@lsattr=`lspv $device 2>&1`;
for (@lsattr){
if ( ! ( /^0516-320.*/ ) ) {
if (/TOTAL PPs:/ ) {
($capacity,$model) = split(/\(/, $_);
($capacity,$model) = split(/ /,$model);
}
} else {
$capacity=0;
}
}
$common->addStorages({
MANUFACTURER => "VIO Disk",
MODEL => "Virtual Disk",
DESCRIPTION => $description,
TYPE => 'disk',
NAME => $device,
DISKSIZE => $capacity
});
$n++;
}
#CDROM
@scsi= ();
@lsattr= ();
@scsi=`lsdev -Cc cdrom -s scsi -F 'name:description:status'`;
$i=0;
for (@scsi){
chomp $scsi[$i];
/^(.+):(.+):(.+)/;
$device=$1;
$status=$3;
$description=$2;
$capacity="";
if (($status =~ /Available/)){
@lsattr=`lsattr -EOl $device -a 'size_in_mb'`;
for (@lsattr){
if (! /^#/ ){
$capacity= $_;
chomp($capacity);$capacity =~ s/(\s+)$//;
}
}
$description = $scsi[$n];
for (@lsvpd){
if(/^AX $device/){$flag=1}
if ((/^MF (.+)/) && $flag){$manufacturer=$1;chomp($manufacturer);$manufacturer =~ s/(\s+)$//;}
if ((/^TM (.+)/) && $flag){$model=$1;chomp($model);$model =~ s/(\s+)$//;}
if ((/^FN (.+)/) && $flag){$FRU=$1;chomp($FRU);$FRU =~ s/(\s+)$//;$manufacturer .= ",FRU number :".$FRU}
if ((/^FC .+/) && $flag) {$flag=0;last}
}
$common->addStorages({
NAME => $device,
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => $description,
TYPE => 'cd',
DISKSIZE => $capacity
});
$n++;
}
$i++;
}
#TAPE
@scsi= ();
@lsattr= ();
@scsi=`lsdev -Cc tape -s scsi -F 'name:description:status'`;
$i=0;
for (@scsi){
chomp $scsi[$i];
/^(.+):(.+):(.+)/;
$device=$1;
$status=$3;
$description=$2;
$capacity="";
if (($status =~ /Available/)){
@lsattr=`lsattr -EOl $device -a 'size_in_mb'`;
for (@lsattr){
if (! /^#/ ){
$capacity= $_;
chomp($capacity);$capacity =~ s/(\s+)$//;
}
}
for (@lsvpd){
if(/^AX $device/){$flag=1}
if ((/^MF (.+)/) && $flag){$manufacturer=$1;chomp($manufacturer);$manufacturer =~ s/(\s+)$//;}
if ((/^TM (.+)/) && $flag){$model=$1;chomp($model);$model =~ s/(\s+)$//;}
if ((/^FN (.+)/) && $flag){$FRU=$1;chomp($FRU);$FRU =~ s/(\s+)$//;$manufacturer .= ",FRU number :".$FRU}
if ((/^FC .+/) && $flag) {$flag=0;last}
}
$common->addStorages({
NAME => $device,
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => $description,
TYPE => 'tape',
DISKSIZE => $capacity
});
$n++;
}
$i++;
}
#Disquette
@scsi= ();
@lsattr= ();
@scsi=`lsdev -Cc diskette -F 'name:description:status'`;
$i=0;
for (@scsi){
chomp $scsi[$i];
/^(.+):(.+):(.+)/;
$device=$1;
$status=$3;
$description=$2;
$capacity="";
if (($status =~ /Available/)){
@lsattr=`lsattr -EOl $device -a 'fdtype'`;
for (@lsattr){
if (! /^#/ ){
$capacity= $_;
chomp($capacity);$capacity =~ s/(\s+)$//;
}
}
# On le force en retour taille disquette non affichable
$capacity ="";
$common->addStorages({
NAME => $device,
MANUFACTURER => 'N/A',
MODEL => 'N/A',
DESCRIPTION => $description,
TYPE => 'floppy',
DISKSIZE => ''
});
$n++;
}
$i++;
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Users.pm 0000664 0000000 0000000 00000000762 13327377321 0023674 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Users;
sub check {
# Useless check for a posix system i guess
my @who = `who 2>/dev/null`;
return 1 if @who;
return;
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my %user;
# Logged on users
for (`who`){
$user{$1} = 1 if /^(\S+)./;
}
my $UsersLoggedIn = join "/", keys %user;
$common->setHardware ({ USERID => $UsersLoggedIn });
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/AIX/Videos.pm 0000664 0000000 0000000 00000001073 13327377321 0024020 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::AIX::Videos;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("lsdev");
}
sub run {
my $params = shift;
my $common = $params->{common};
for (`lsdev -Cc adapter -F 'name:type:description'`){
if (/graphics|vga|video/i){
if (/^\S+\s([^:]+):\s*(.+?)(?:\(([^()]+)\))?$/i){
$common->addVideo({
'CHIPSET' => $1,
'NAME' => $2,
});
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD.pm 0000664 0000000 0000000 00000002120 13327377321 0022550 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD;
use strict;
use vars qw($runAfter);
$runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"];
sub check { $^O =~ /freebsd|openbsd|netbsd|gnukfreebsd|gnuknetbsd/ }
sub run {
my $params = shift;
my $common = $params->{common};
my $OSName;
my $OSComment;
my $OSVersion;
my $OSLevel;
my $OSArchi;
# Operating system informations
chomp($OSName=`uname -s`);
chomp($OSVersion=`uname -r`);
chomp($OSArchi=`uname -p`);
# Retrieve the origin of the kernel configuration file
my ($date, $origin, $kernconf);
for (`sysctl -n kern.version`) {
$date = $1 if /^\S.*\#\d+:\s*(.*)/;
($origin,$kernconf) = ($1,$2) if /^\s+(.+):(.+)$/;
}
$kernconf =~ s/\/.*\///; # remove the path
$OSComment = $kernconf." (".$date.")\n".$origin;
# if there is a problem use uname -v
chomp($OSComment=`uname -v`) unless $OSComment;
$common->setHardware({
OSNAME => $OSName." ".$OSArchi,
OSCOMMENTS => $OSComment,
OSVERSION => $OSVersion,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/ 0000775 0000000 0000000 00000000000 13327377321 0022217 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/Archs/ 0000775 0000000 0000000 00000000000 13327377321 0023257 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/Archs/Alpha.pm 0000664 0000000 0000000 00000003154 13327377321 0024645 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::Archs::Alpha;
use strict;
sub check{
my $arch;
chomp($arch=`sysctl -n hw.machine`);
$arch eq "alpha";
}
sub run {
my $params = shift;
my $common = $params->{common};
my ($SystemSerial, $SystemModel, $SystemManufacturer, $BiosManufacturer, $BiosVersion, $BiosDate);
my ($processort, $processorn, $processors);
### Get system model with "sysctl hw.model"
#
# example on *BSD
# hw.model = AlphaStation 255 4/232
chomp($SystemModel=`sysctl -n hw.model`);
$SystemManufacturer = "DEC";
### Get processor type and speed in dmesg
#
# NetBSD: AlphaStation 255 4/232, 232MHz, s/n
# cpu0 at mainbus0: ID 0 (primary), 21064A-2
# OpenBSD: AlphaStation 255 4/232, 232MHz
# cpu0 at mainbus0: ID 0 (primary), 21064A-2 (pass 1.1)
# FreeBSD: AlphaStation 255 4/232, 232MHz
# CPU: EV45 (21064A) major=6 minor=2
for (`dmesg`) {
if (/^cpu[^:]*:\s*(.*)$/i) { $processort = $1; }
if (/$SystemModel,\s*(\S+)\s*MHz.*$/) { $processors = $1; }
}
# number of procs with sysctl (hw.ncpu)
chomp($processorn=`sysctl -n hw.ncpu`);
# Writing data
$common->setBios ({
SMANUFACTURER => $SystemManufacturer,
SMODEL => $SystemModel,
SSN => $SystemSerial,
BMANUFACTURER => $BiosManufacturer,
BVERSION => $BiosVersion,
BDATE => $BiosDate,
});
$common->setHardware({
PROCESSORT => $processort,
PROCESSORN => $processorn,
PROCESSORS => $processors
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/Archs/I386.pm 0000664 0000000 0000000 00000003042 13327377321 0024245 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::Archs::I386;
# for i386 in case dmidecode is not available
use strict;
sub check{
my $arch;
chomp($arch=`sysctl -n hw.machine`);
return if (($arch ne "i386") && ($arch ne "amd64"));
# dmidecode must not be present
`dmidecode 2>&1`;
return if ($? >> 8)==0;
1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my ($SystemSerial , $SystemModel, $SystemManufacturer, $BiosManufacturer, $BiosVersion, $BiosDate);
my ($processort , $processorn , $processors);
# use hw.machine for the system model
# TODO see if we can do better
chomp($SystemModel=`sysctl -n hw.machine`);
# number of procs with sysctl (hw.ncpu)
chomp($processorn=`sysctl -n hw.ncpu`);
# proc type with sysctl (hw.model)
chomp($processort=`sysctl -n hw.model`);
# XXX quick and dirty _attempt_ to get proc speed through dmesg
for (`dmesg`){
my $tmp;
if (/^cpu\S*\s.*\D[\s|\(]([\d|\.]+)[\s|-]mhz/i) { # XXX unsure
$tmp = $1;
$tmp =~ s/\..*//;
$processors=$tmp;
last
}
}
# Writing data
$common->setBios ({
SMANUFACTURER => $SystemManufacturer,
SMODEL => $SystemModel,
SSN => $SystemSerial,
BMANUFACTURER => $BiosManufacturer,
BVERSION => $BiosVersion,
BDATE => $BiosDate,
});
$common->setHardware({
PROCESSORT => $processort,
PROCESSORN => $processorn,
PROCESSORS => $processors
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/Archs/Sgimips.pm 0000664 0000000 0000000 00000004010 13327377321 0025223 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::Archs::Sgimips;
use strict;
sub check{
my $arch;
chomp($arch=`sysctl -n hw.machine`);
$arch =~ m/^sgi/;
}
sub run {
my $params = shift;
my $common = $params->{common};
my ($SystemSerial , $SystemModel, $SystemManufacturer, $BiosManufacturer, $BiosVersion, $BiosDate);
my ($processort , $processorn , $processors );
### Get system model with "sysctl hw.model"
#
# example on NetBSD
# hw.model = SGI-IP22
# example on OpenBSD
# hw.model=SGI-O2 (IP32)
chomp($SystemModel=`sysctl -n hw.model`);
$SystemManufacturer = "SGI";
### Get processor type and speed in dmesg
#
# Examples of dmesg output :
#
# I) Indy
# a) NetBSD
# mainbus0 (root): SGI-IP22 [SGI, 6906e152], 1 processor
# cpu0 at mainbus0: MIPS R4400 CPU (0x450) Rev. 5.0 with MIPS R4010 FPC Rev. 0.0
# int0 at mainbus0 addr 0x1fbd9880: bus 75MHz, CPU 150MHz
#
# II) O2
# a) NetBSD
# mainbus0 (root): SGI-IP32 [SGI, 8], 1 processor
# cpu0 at mainbus0: MIPS R5000 CPU (0x2321) Rev. 2.1 with built-in FPU Rev. 1.0
# b) OpenBSD
# mainbus0 (root)
# cpu0 at mainbus0: MIPS R5000 CPU rev 2.1 180 MHz with R5000 based FPC rev 1.0
# cpu0: cache L1-I 32KB D 32KB 2 way, L2 512KB direct
for (`dmesg`) {
if (/$SystemModel\s*\[\S*\s*(\S*)\]/) { $SystemSerial = $1; }
if (/cpu0 at mainbus0:\s*(.*)$/) { $processort = $1; }
if (/CPU\s*.*\D(\d+)\s*MHz/) { $processors = $1; }
}
# number of procs with sysctl (hw.ncpu)
chomp($processorn=`sysctl -n hw.ncpu`);
# Writing data
$common->setBios ({
SMANUFACTURER => $SystemManufacturer,
SMODEL => $SystemModel,
SSN => $SystemSerial,
BMANUFACTURER => $BiosManufacturer,
BVERSION => $BiosVersion,
BDATE => $BiosDate,
});
$common->setHardware({
PROCESSORT => $processort,
PROCESSORN => $processorn,
PROCESSORS => $processors
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/Archs/Sparc.pm 0000664 0000000 0000000 00000005631 13327377321 0024672 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::Archs::Sparc;
use strict;
sub check{
my $arch;
chomp($arch=`sysctl -n hw.machine`);
$arch =~ /^sparc/;
}
sub run {
my $params = shift;
my $common = $params->{common};
my( $SystemSerial , $SystemModel, $SystemManufacturer, $BiosManufacturer,
$BiosVersion, $BiosDate);
my ( $processort , $processorn , $processors );
### Get system serial with "sysctl kern.hostid"
#
# sysctl -n kern.hostid gives e.g. 0x807b65c on NetBSD
# and 2155570635 on OpenBSD; we keep the hex form
chomp ($SystemSerial = `sysctl -n kern.hostid`);
if ( $SystemSerial =~ /^\d*$/ ) { # convert to NetBSD format
$SystemSerial = sprintf ("0x%x",$SystemSerial);
}
$SystemSerial =~ s/^0x//; # remove 0x to make it appear as in the firmware
### Get system model and processor type in dmesg
#
# cannot use "sysctl hw.model" to get SystemModel
# because it gives only the CPU on OpenBSD/sparc64
#
# Examples of dmesg output :
#
# I) SPARC
# a) NetBSD
# mainbus0 (root): SUNW,SPARCstation-20: hostid 72362bb1
# cpu0 at mainbus0: TMS390Z50 v0 or TMS390Z55 @ 50 MHz, on-chip FPU
# b) OpenBSD
# mainbus0 (root): SUNW,SPARCstation-20
# cpu0 at mainbus0: TMS390Z50 v0 or TMS390Z55 @ 50 MHz, on-chip FPU
#
# II) SPARC64
# a) NetBSD
# mainbus0 (root): SUNW,Ultra-1: hostid 807b65cb
# cpu0 at mainbus0: SUNW,UltraSPARC @ 166.999 MHz, version 0 FPU
# b) OpenBSD
# mainbus0 (root): Sun Ultra 1 SBus (UltraSPARC 167MHz)
# cpu0 at mainbus0: SUNW,UltraSPARC @ 166.999 MHz, version 0 FPU
# c) FreeBSD
# cpu0: Sun Microsystems UltraSparc-I Processor (167.00 MHz CPU)
for (`dmesg`) {
if (/^mainbus0 \(root\):\s*(.*)$/) { $SystemModel = $1; }
if (/^cpu[^:]*:\s*(.*)$/i) { $processort = $1 unless $processort; }
}
$SystemModel || chomp ($SystemModel = `sysctl -n hw.model`); # for FreeBSD
$SystemManufacturer = "SUN";
# some cleanup
$SystemModel =~ s/SUNW,//;
$SystemModel =~ s/[:\(].*$//;
$SystemModel =~ s/^\s*//;
$SystemModel =~ s/\s*$//;
$processort =~ s/SUNW,//;
$processort =~ s/^\s*//;
$processort =~ s/\s*$//;
# number of procs with "sysctl hw.ncpu"
chomp($processorn=`sysctl -n hw.ncpu`);
# XXX quick and dirty _attempt_ to get proc speed
if ( $processort =~ /(\d+)(\.\d+|)\s*mhz/i ) { # possible decimal point
$processors = sprintf("%.0f", "$1$2"); # round number
}
# Writing data
$common->setBios ({
SMANUFACTURER => $SystemManufacturer,
SMODEL => $SystemModel,
SSN => $SystemSerial,
BMANUFACTURER => $BiosManufacturer,
BVERSION => $BiosVersion,
BDATE => $BiosDate,
});
$common->setHardware({
PROCESSORT => $processort,
PROCESSORN => $processorn,
PROCESSORS => $processors
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/CPU.pm 0000664 0000000 0000000 00000002030 13327377321 0023177 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::CPU;
use strict;
sub check {
return unless -r "/dev/mem";
1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $os;
my $processort;
my $processorn;
my $processors;
my $family;
my $manufacturer;
my $serial;
chomp($os = `uname -s`);
if ($os eq "FreeBSD") {
$processors = `sysctl -n hw.clockrate`;
} else {
$processors = `sysctl -n hw.cpuspeed`;
}
$processorn = `sysctl -n hw.ncpu`;
$processort = `sysctl -n hw.model`;
$family = `sysctl -n hw.machine`;
$serial = `sysctl -n hw.serialno`;
chomp($processort);
if ($processort =~ /Intel/) {
$manufacturer = "Intel";
}
if ($processort =~ /Advanced Micro|AMD/) {
$manufacturer = "AMD";
}
$common->addCPU({
CPUARCH => $family,
MANUFACTURER => $manufacturer,
CORES => $processorn,
TYPE => $processort,
SPEED => $processors,
SERIAL => $serial
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/Domains.pm 0000664 0000000 0000000 00000002106 13327377321 0024146 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::Domains;
use strict;
sub check {
my $hostname;
chomp ($hostname = `hostname`);
my @domain = split (/\./, $hostname);
shift (@domain);
return 1 if @domain;
-f "/etc/resolv.conf"
}
sub run {
my $params = shift;
my $common = $params->{common};
my $domain;
my %domain;
my @dns_list;
my $dns;
my $hostname;
chomp ($hostname = `hostname`);
my @domain = split (/\./, $hostname);
shift (@domain);
$domain = join ('.',@domain);
open RESOLV, "/etc/resolv.conf" or warn;
while(){
if (/^nameserver\s+(\S+)/i) {
push(@dns_list,$1);
} elsif (!$domain) {
$domain{$2} = 1 if (/^(domain|search)\s+(.+)/);
}
}
close RESOLV;
if (!$domain) {
$domain = join "/", keys %domain;
}
$dns=join("/",@dns_list);
# If no domain name, we send "WORKGROUP"
$domain = 'WORKGROUP' unless $domain;
$common->setHardware({
WORKGROUP => $domain,
DNS => $dns
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/Drives.pm 0000664 0000000 0000000 00000001617 13327377321 0024016 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::Drives;
use strict;
sub run {
my $params = shift;
my $common = $params->{common};
my $free;
my $filesystem;
my $total;
my $type;
my $volumn;
for my $t ("ffs","ufs","zfs") {
# OpenBSD has no -m option so use -k to obtain results in kilobytes
for (`df -P -t $t -k`){
if (/^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\n/){
$volumn = $1;
$filesystem = $t;
$total = sprintf("%i",$2/1024);
$free = sprintf("%i",$4/1024);
$type = $6;
$common->addDrive({
FREE => $free,
FILESYSTEM => $filesystem,
TOTAL => $total,
TYPE => $type,
VOLUMN => $volumn
});
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/IPv4.pm 0000664 0000000 0000000 00000001061 13327377321 0023335 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::IPv4;
sub check {
my @ifconfig = `ifconfig -a 2>/dev/null`;
return 1 if @ifconfig;
return;
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my @ip;
# Looking for ip addresses with ifconfig, except loopback
# *BSD need -a option
foreach (`ifconfig -a`){
if (/^\s*inet\s+(\S+)/){
($1=~/127.+/)?next:push @ip, $1
};
}
my $ip=join "/", @ip;
$common->setHardware({IPADDR => $ip});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/Mem.pm 0000664 0000000 0000000 00000001332 13327377321 0023272 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::Mem;
use strict;
sub check {
`which sysctl 2>&1`;
return 0 if($? >> 8);
`which swapctl 2>&1`;
return 0 if($? >> 8);
1;
};
sub run {
my $params = shift;
my $common = $params->{common};
my $PhysicalMemory;
my $SwapFileSize;
# Swap
my @bsd_swapctl= `swapctl -sk`;
for (@bsd_swapctl){
$SwapFileSize=$1 if /total:\s*(\d+)/i;
}
# RAM
chomp($PhysicalMemory=`sysctl -n hw.physmem`);
$PhysicalMemory=$PhysicalMemory/1024;
# Send it to inventory object
$common->setHardware({
MEMORY => sprintf("%i",$PhysicalMemory/1024),
SWAP => sprintf("%i", $SwapFileSize/1024),
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/Networks.pm 0000664 0000000 0000000 00000006774 13327377321 0024407 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::Networks;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("ifconfig") && $common->can_load("Net::IP qw(:PROC)")
}
sub _ipdhcp {
my $if = shift;
my $path;
my $ipdhcp;
my $leasepath;
foreach ( # XXX BSD paths
"/var/db/dhclient.leases.%s",
"/var/db/dhclient.leases",
# Linux path for some kFreeBSD based GNU system
"/var/lib/dhcp3/dhclient.%s.leases",
"/var/lib/dhcp3/dhclient.%s.leases",
"/var/lib/dhcp/dhclient.leases") {
$leasepath = sprintf($_,$if);
last if (-e $leasepath);
}
return undef unless -e $leasepath;
if (open DHCP, $leasepath) {
my $lease;
my $dhcp;
my $expire;
# find the last lease for the interface with its expire date
while(){
$lease = 1 if(/lease\s*{/i);
$lease = 0 if(/^\s*}\s*$/);
if ($lease) { #inside a lease section
if(/interface\s+"(.+?)"\s*/){
$dhcp = ($1 =~ /^$if$/);
}
#Server IP
if(/option\s+dhcp-server-identifier\s+(\d{1,3}(?:\.\d{1,3}){3})\s*;/
and $dhcp){
$ipdhcp = $1;
}
if (/^\s*expire\s*\d\s*(\d*)\/(\d*)\/(\d*)\s*(\d*):(\d*):(\d*)/
and $dhcp) {
$expire=sprintf "%04d%02d%02d%02d%02d%02d",$1,$2,$3,$4,$5,$6;
}
}
}
close DHCP or warn;
chomp (my $currenttime = `date +"%Y%m%d%H%M%S"`);
undef $ipdhcp unless $currenttime <= $expire;
} else {
warn "Can't open $leasepath\n";
}
return $ipdhcp;
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my $description;
my $ipaddress;
my $ipgateway;
my $ipmask;
my $ipsubnet;
my $macaddr;
my $status;
my $type;
# Looking for the gateway
# 'route show' doesn't work on FreeBSD so we use netstat
# XXX IPV4 only
for (`netstat -nr -f inet`){
$ipgateway=$1 if /^default\s+(\S+)/i;
}
my @ifconfig = `ifconfig -a`; # -a option required on *BSD
# first make the list available interfaces
# too bad there's no -l option on OpenBSD
my @list;
foreach (@ifconfig){
# skip loopback, pseudo-devices and point-to-point interfaces
next if /^(lo|fwe|vmnet|sit|pflog|pfsync|enc|strip|plip|sl|ppp)\d+/;
if (/^(\S+):/) { push @list , $1; } # new interface name
}
# for each interface get it's parameters
foreach $description (@list) {
$ipaddress = $ipmask = $macaddr = $status = $type = undef;
# search interface infos
@ifconfig = `ifconfig $description`;
foreach (@ifconfig){
$ipaddress = $1 if /inet (\S+)/i;
$ipmask = $1 if /netmask\s+(\S+)/i;
$macaddr = $2 if /(address:|ether|lladdr)\s+(\S+)/i;
$status = 1 if /addNetwork({
DESCRIPTION => $description,
IPADDRESS => $ipaddress,
IPDHCP => _ipdhcp($description),
IPGATEWAY => ($status?$ipgateway:undef),
IPMASK => $ipmask,
IPSUBNET => ($status?$ipsubnet:undef),
MACADDR => $macaddr,
STATUS => $status?"Up":"Down",
TYPE => $type
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/Storages.pm 0000664 0000000 0000000 00000004040 13327377321 0024342 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::Storages;
use strict;
sub check { -x '/usr/local/bin/smartctl'; }
sub run {
my $params = shift;
my $common = $params->{common};
my @values;
my $devlist;
my $osname = `uname -s`;
if (chomp($osname) eq "FreeBSD") {
$devlist = `/sbin/sysctl -n kern.disks`;
} else {
$devlist = `/sbin/sysctl -n hw.disknames`;
}
chomp($devlist);
my @devices = split( /\s+/, $devlist );
for my $dev (@devices) {
open( CMD, "smartctl -i /dev/$dev |" );
my ( $manufacturer, $serialnumber, $model, $size, $firmware, $type, $desc, $luwwnid );
while () {
chomp();
if (/^Vendor:\s+|^Model Family:\s+/i) {
$manufacturer = ( split( /:\s+/, $_ ) )[1];
}
if (/^Product:\s+|^Device Model:\s+/i) {
$model = ( split( /:\s+/, $_ ) )[1];
}
if (/^Serial number:\s+/i) {
$serialnumber = ( split( /:\s+/, $_ ) )[1];
}
if (/^User Capacity:\s+/i) {
s/,//g;
my $out = ( split( /:\s+/, $_ ) )[1];
$size = ( split( ' ', $out ) )[0] / ( 1024 * 1024 );
}
if (/^Revision:\s+|^Firmware Version:\s+/) {
$firmware = ( split( /:\s+/, $_ ) )[1];
}
if (/^Device type:\s+/) { $type = ( split( /:\s+/, $_ ) )[1]; }
if (/^Transport protocol:\s+/) {
$desc = ( split( /:\s+/, $_ ) )[1];
}
if (/^LU WWN Device Id:\s+/) {
$luwwnid = ( split( /:\s+/, $_ ) )[1];
}
}
$common->addStorages({
NAME => $dev,
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => $desc,
TYPE => $type,
DISKSIZE => $size,
SERIALNUMBER => $serialnumber,
FIRMWARE => $firmware,
SCSI_UNID => $luwwnid,
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/Sys.pm 0000664 0000000 0000000 00000000405 13327377321 0023332 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::Sys;
#$LunchAfter = "Ocsinventory::Agent::Backend::OS::Linux::VirtualFs::Sys";
sub check {
foreach (`mount`) {
return 1 if (/type\ sysfs/);
}
return;
}
sub run {
# Hum?
return "";
}
1
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/BSD/Uptime.pm 0000664 0000000 0000000 00000001605 13327377321 0024022 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::BSD::Uptime;
use strict;
sub check {
my $boottime = `sysctl -n kern.boottime 2>/dev/null`;
return 1 if $boottime;
return;
}
sub run {
my $params = shift;
my $common = $params->{common};
chomp (my $boottime = `sysctl -n kern.boottime`);
$boottime = $1 if $boottime =~ /sec\s*=\s*(\d+)/;
chomp (my $currenttime = `date +%s`);
my $uptime = $currenttime - $boottime;
# Uptime conversion
my ($UYEAR, $UMONTH , $UDAY, $UHOUR, $UMIN, $USEC) = (gmtime ($uptime))[5,4,3,2,1,0];
# Write in ISO format
$uptime=sprintf "%02d-%02d-%02d %02d:%02d:%02d", ($UYEAR-70), $UMONTH, ($UDAY-1), $UHOUR, $UMIN, $USEC;
chomp(my $DeviceType =`uname -m`);
# TODO$h->{'CONTENT'}{'HARDWARE'}{'DESCRIPTION'} = [ "$DeviceType/$uptime" ];
$common->setHardware({ DESCRIPTION => "$DeviceType/$uptime" });
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic.pm 0000664 0000000 0000000 00000000120 13327377321 0023512 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic;
use strict;
sub run {}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/ 0000775 0000000 0000000 00000000000 13327377321 0023163 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode.pm 0000664 0000000 0000000 00000000376 13327377321 0025404 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Dmidecode;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return unless -r "/dev/mem";
return unless $common->can_run("dmidecode");
1;
}
sub run {}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/ 0000775 0000000 0000000 00000000000 13327377321 0025040 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/Batteries.pm 0000664 0000000 0000000 00000004601 13327377321 0027321 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Dmidecode::Batteries;
use strict;
sub run {
my $params = shift;
my $common = $params->{common};
my $dmidecode = `dmidecode`; # TODO retrieve error
# some versions of dmidecode do not separate items with new lines
# so add a new line before each handle
$dmidecode =~ s/\nHandle/\n\nHandle/g;
my @dmidecode = split (/\n/, $dmidecode);
# add a new line at the end
push @dmidecode, "\n";
s/^\s+// for (@dmidecode);
my $flag;
my $location;
my $manufacturer;
my $manufacturedate;
my $serialnumber;
my $name;
my $chemistry;
my $designcapacity;
my $designvoltage;
my $sbdsversion;
my $maxerror;
my $oemspecific;
my $numslot;
foreach (@dmidecode) {
if (/dmi type 22,/i) { # beginning of Memory Device section
$flag = 1;
$numslot++;
} elsif ($flag && /^$/) { # end of section
$flag = 0;
$common->addBatteries({
LOCATION => $location,
MANUFACTURER => $manufacturer,
MANUFACTUREDATE => $manufacturedate,
SERIALNUMBER => $serialnumber,
NAME => $name,
CHEMISTRY => $chemistry,
DESIGNCAPACITY => $designcapacity,
DESIGNVOLTAGE => $designvoltage,
SBDSVERSION => $sbdsversion,
MAXERROR => $maxerror,
OEMSPECIFIC => $oemspecific,
});
$location = $manufacturer = $manufacturedate = $serialnumber = $name = $chemistry = $designcapacity = $designvoltage = $sbdsversion = $maxerror = $oemspecific = undef;
} elsif ($flag) { # in the section
$location = $1 if /^Location:\s*(\S+)/i;
$manufacturer = $1 if /^Manufacturer:\s*(.+)/i;
$manufacturedate = $1 if /^Manufacture Date:\s*(.+)/i;
$serialnumber = $1 if /^Serial Number:\s*(.+)/i;
$name = $1 if /^Name:\s*(.+)/i;
$chemistry = $1 if /^Chemistry:\s*(.+)/i;
$designcapacity = $1 if /^Design Capacity:\s*(.+)/i;
$designvoltage = $1 if /^Design Voltage:\s*(.+)/i;
$sbdsversion = $1 if /^SBDS Version:\s*(.+)/i;
$maxerror = $1 if /^Maximum Error:\s*(.+)/i;
$oemspecific = $1 if /^OEM-specific Information:\s*(.+)/i;
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/Bios.pm 0000664 0000000 0000000 00000006325 13327377321 0026300 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Dmidecode::Bios;
use strict;
sub run {
my $params = shift;
my $common = $params->{common};
# Parsing dmidecode output
# Using "type 0" section
my( $SystemSerial , $SystemModel, $SystemManufacturer, $BiosManufacturer,
$BiosVersion, $BiosDate, $AssetTag, $MotherboardManufacturer, $MotherboardModel, $MotherboardSerial, $Type );
#System DMI
$SystemManufacturer = `dmidecode -s system-manufacturer`;
$SystemModel = `dmidecode -s system-product-name`;
$SystemSerial = `dmidecode -s system-serial-number`;
$AssetTag = `dmidecode -s chassis-asset-tag`;
$Type = `dmidecode -s chassis-type`;
chomp($SystemModel);
$SystemModel =~ s/^(#.*\n)+//g;
$SystemModel =~ s/Invalid.*$//g;
chomp($SystemManufacturer);
$SystemManufacturer =~ s/^(#.*\n)+//g;
$SystemManufacturer =~ s/Invalid.*$//g;
chomp($SystemSerial);
$SystemSerial =~ s/^(#.*\n)+//g;
$SystemSerial =~ s/Invalid.*$//g;
# System serial number can be filled with whitespace (e.g. Intel NUC)
$SystemSerial =~ s/^\s+|\s+$//g;
chomp($AssetTag);
$AssetTag =~ s/^(#.*\n)+//g;
$AssetTag =~ s/Invalid.*$//g;
chomp($Type);
$Type =~ s/^(#.*\n)+//g;
$Type =~ s/Invalid.*$//g;
#Motherboard DMI
$MotherboardManufacturer = `dmidecode -s baseboard-manufacturer`;
$MotherboardModel = `dmidecode -s baseboard-product-name`;
$MotherboardSerial = `dmidecode -s baseboard-serial-number`;
chomp($MotherboardModel);
$MotherboardModel =~ s/^(#.*\n)+//g;
$MotherboardModel =~ s/Invalid.*$//g;
chomp($MotherboardManufacturer);
$MotherboardManufacturer =~ s/^(#.*\n)+//g;
$MotherboardManufacturer =~ s/Invalid.*$//g;
chomp($MotherboardSerial);
$MotherboardSerial =~ s/^(#.*\n)+//g;
$MotherboardSerial =~ s/Invalid.*$//g;
#BIOS DMI
$BiosManufacturer = `dmidecode -s bios-vendor`;
$BiosVersion = `dmidecode -s bios-version`;
$BiosDate = `dmidecode -s bios-release-date`;
chomp($BiosManufacturer);
$BiosManufacturer =~ s/^(#.*\n)+//g;
$BiosManufacturer =~ s/Invalid.*$//g;
chomp($BiosVersion);
$BiosVersion =~ s/^(#.*\n)+//g;
$BiosVersion =~ s/Invalid.*$//g;
chomp($BiosDate);
$BiosDate =~ s/^(#.*\n)+//g;
$BiosDate =~ s/Invalid.*$//g;
# If serial number is empty, assign mainboard serial (e.g Intel NUC)
if (!$SystemSerial) {
$SystemSerial = $MotherboardSerial;
}
# Some bioses don't provide a serial number so I check for CPU ID (e.g: server from dedibox.fr)
my @cpu;
if (!$SystemSerial || $SystemSerial =~ /^0+$/) {
@cpu = `dmidecode -t processor`;
for (@cpu){
if (/ID:\s*(.*)/i){
$SystemSerial = $1;
}
}
}
# Writing data
$common->setBios ({
ASSETTAG => $AssetTag,
SMANUFACTURER => $SystemManufacturer,
SMODEL => $SystemModel,
SSN => $SystemSerial,
BMANUFACTURER => $BiosManufacturer,
BVERSION => $BiosVersion,
BDATE => $BiosDate,
MMANUFACTURER => $MotherboardManufacturer,
MMODEL => $MotherboardModel,
MSN => $MotherboardSerial,
TYPE => $Type,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/Memory.pm 0000664 0000000 0000000 00000007423 13327377321 0026654 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Dmidecode::Memory;
use strict;
sub run {
my $params = shift;
my $common = $params->{common};
my $dmidecode;
my @dmidecode;
my %dmidecode;
my $capacity;
my $speed;
my $type;
my $numslot;
my $serialnumber;
my $manufacturer;
my $caption;
my $description;
# DMI type 17
$dmidecode = `dmidecode -t 17`;
@dmidecode = split (/Handle\s/i, $dmidecode);
shift @dmidecode;
$numslot = 0;
foreach (@dmidecode) {
$capacity = $speed = $type = $serialnumber = $manufacturer = $caption = $description = 0;
$caption = $1 if /\s\sLocator:\s([\w\d_\-\s#]+)\n/i;
$speed = $1 if /Speed:\s([\w\d]+)/i;
$type = $1 if /Type:\s([\s\w]+)\n/i;
$description = $1 if /Type\sDetail:\s([\s\w]+)\n/i;
$manufacturer = $1 if /Manufacturer:\s([\w\d\-\_\s]+)\n/i;
$serialnumber = $1 if /Serial\sNumber:\s([\w\d\-\_\s]+)\n/i;
if (/Size:\s(\d+)\s(MB|GB|TB|MByte|GByte|TByte)/i) {
if($2 eq "MB" or $2 eq "MByte") {
$capacity = $1;
}
elsif($2 eq "GB" or $2 eq "GByte") {
$capacity = $1*1024;
}
elsif($2 eq "TB" or $2 eq "TByte") {
$capacity = $1*1024*1024;
}
}
if (/DMI type 17/i) {
$dmidecode{$numslot}{caption} = $caption ? $caption : "";
$dmidecode{$numslot}{description} = $description ? $description : "";
$dmidecode{$numslot}{speed} = $speed ? $speed : "";
$dmidecode{$numslot}{type} = $type ? $type : "";
$dmidecode{$numslot}{manufacturer} = $manufacturer ? $manufacturer : "";
$dmidecode{$numslot}{serialnumber} = $serialnumber ? $serialnumber : "";
$dmidecode{$numslot}{capacity} = $capacity ? $capacity : "";
$numslot++;
}
}
# DMI type 6 if type 17 is not available
if (!$numslot) {
$dmidecode = `dmidecode -t 6`; # TODO retrieve error
@dmidecode = split (/Handle\s/i, $dmidecode);
shift @dmidecode;
$numslot = 0;
foreach (@dmidecode) {
$capacity = $speed = $type = $caption = 0;
$caption = $1 if /Socket Designation:\s([\w\d_\-\s#]+)\n/i;
$capacity = $1 if /Installed\sSize:\s(\d+)/i;
$speed = $1 if /Speed:\s([\w\d]+)/i;
$type = $1 if /Type:\s([\s\w]+)\n/i;
if (/Size:\s(\d+)\s(MB|GB|TB|MByte|GByte|TByte)/i) {
if($2 eq "MB" or $2 eq "MByte") {
$capacity = $1;
}
elsif($2 eq "GB" or $2 eq "GByte") {
$capacity = $1*1024;
}
elsif($2 eq "TB" or $2 eq "TByte") {
$capacity = $1*1024*1024;
}
}
if (/DMI type 6/i) {
$dmidecode{$numslot}{caption} = $caption ? $caption : "";
$dmidecode{$numslot}{description} = $description ? $description : "";
$dmidecode{$numslot}{speed} = $speed ? $speed : "";
$dmidecode{$numslot}{type} = $type ? $type : "";
$dmidecode{$numslot}{capacity} = $capacity ? $capacity : "";
$numslot++;
}
}
}
foreach (sort {$a <=> $b} keys %dmidecode) {
$common->addMemory({
CAPACITY => $dmidecode{$_}{capacity},
SPEED => $dmidecode{$_}{speed},
TYPE => $dmidecode{$_}{type},
MANUFACTURER => $dmidecode{$_}{manufacturer},
SERIALNUMBER => $dmidecode{$_}{serialnumber},
NUMSLOTS => $_,
CAPTION => $dmidecode{$_}{caption},
DESCRIPTION => $dmidecode{$_}{description},
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/Ports.pm 0000664 0000000 0000000 00000002443 13327377321 0026510 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Dmidecode::Ports;
use strict;
sub run {
my $params = shift;
my $common = $params->{common};
my $dmidecode = `dmidecode`; # TODO retrieve error
# some versions of dmidecode do not separate items with new lines
# so add a new line before each handle
$dmidecode =~ s/\nHandle/\n\nHandle/g;
my @dmidecode = split (/\n/, $dmidecode);
# add a new line at the end
push @dmidecode, "\n";
s/^\s+// for (@dmidecode);
my $flag;
my $caption;
my $description;
my $name;
my $type;
foreach (@dmidecode) {
if (/dmi type 8,/i) {
$flag = 1;
} elsif ($flag && /^$/){ # end of section
$flag = 0;
$common->addPorts({
CAPTION => $caption,
DESCRIPTION => $description,
NAME => $name,
TYPE => $type,
});
$caption = $description = $name = $type = undef;
} elsif ($flag) {
$caption = $1 if /^external connector type\s*:\s*(.+)/i;
$description = $1 if /^internal connector type\s*:\s*(.+)/i;
$name = $1 if /^internal reference designator\s*:\s*(.+)/i;
$type = $1 if /^port type\s*:\s*(.+)/i;
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/Slots.pm 0000664 0000000 0000000 00000002351 13327377321 0026503 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Dmidecode::Slots;
use strict;
sub run {
my $params = shift;
my $common = $params->{common};
my $dmidecode = `dmidecode`;
# some versions of dmidecode do not separate items with new lines
# so add a new line before each handle
$dmidecode =~ s/\nHandle/\n\nHandle/g;
my @dmidecode = split (/\n/, $dmidecode);
# add a new line at the end
push @dmidecode, "\n";
s/^\s+// for (@dmidecode);
my $flag;
my $description;
my $designation;
my $name;
my $status;
foreach (@dmidecode) {
if (/dmi type 9,/i) {
$flag=1;
} elsif ($flag && /^$/) {
$flag=0;
$common->addSlot({
DESCRIPTION => $description,
DESIGNATION => $designation,
NAME => $name,
STATUS => $status,
});
$description = $designation = $name = $status = undef;
} elsif ($flag) {
$description = $1 if /^type\s*:\s*(.+)/i;
$designation = $1 if /^id\s*:\s*(.+)/i;
$name = $1 if /^designation\s*:\s*(.+)/i;
$status = $1 if /^current usage\s*:\s*(.+)/i;
};
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/UUID.pm 0000664 0000000 0000000 00000000722 13327377321 0026145 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Dmidecode::UUID;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return $common->can_run('dmidecode')
}
sub run {
my $params = shift;
my $common = $params->{common};
my $uuid;
$uuid = `dmidecode -s system-uuid`;
chomp($uuid);
$uuid =~ s/^#+\s+$//g;
$uuid =~ s/Invalid.*$//g;
$common->setHardware({
UUID => $uuid,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Hostname.pm 0000664 0000000 0000000 00000001224 13327377321 0025276 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Hostname;
sub check {
my $params = shift;
my $common = $params->{common};
return 1 if $common->can_load ("Sys::Hostname");
return 1 if $common->can_run ("hostname");
0;
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my $hostname;
if ($common->can_load("Sys::Hostname")) {
$hostname = Sys::Hostname::hostname();
} else {
chomp ( $hostname = `hostname` ); # TODO: This is not generic.
}
$hostname =~ s/\..*//; # keep just the hostname
$common->setHardware ({NAME => $hostname});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Ipmi.pm 0000664 0000000 0000000 00000004402 13327377321 0024417 0 ustar 00root root 0000000 0000000 #
# OcsInventory agent - IPMI lan channel report
#
# Copyright (c) 2008 Jean Parpaillon
#
# The Intelligent Platform Management Interface (IPMI) specification
# defines a set of common interfaces to a computer system which system
# administrators can use to monitor system health and manage the
# system. The IPMI consists of a main controller called the Baseboard
# Management Controller (BMC) and other satellite controllers.
#
# The BMC can be fetched through client like OpenIPMI drivers or
# through the network. Though, the BMC hold a proper MAC address.
#
# This module reports the MAC address and, if any, the IP
# configuration of the BMC. This is reported as a standard NIC.
#
package Ocsinventory::Agent::Backend::OS::Generic::Ipmi;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run("ipmitool") && $common->can_load("Net::IP qw(:PROC)");
my @ipmitool = `ipmitool lan print 2> /dev/null`;
return unless @ipmitool;
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my $description;
my $ipaddress;
my $ipgateway;
my $ipmask;
my $ipsubnet;
my $macaddr;
my $status;
my $type;
foreach (`LANG=C ipmitool lan print 2> /dev/null`) {
if (/^IP Address\s+:\s+(\d+\.\d+\.\d+\.\d+)/) {
$ipaddress = $1;
}
if (/^Default Gateway IP\s+:\s+(\d+\.\d+\.\d+\.\d+)/) {
$ipgateway = $1;
}
if (/^Subnet Mask\s+:\s+(\d+\.\d+\.\d+\.\d+)/) {
$ipmask = $1;
}
if (/^MAC Address\s+:\s+([0-9a-f]{2}(:[0-9a-f]{2}){5})/) {
$macaddr = $1;
}
}
$description = 'bmc';
my $binip = &ip_iptobin ($ipaddress, 4);
my $binmask = &ip_iptobin ($ipmask, 4);
my $binsubnet = $binip & $binmask;
$ipsubnet = ip_bintoip($binsubnet, 4);
$status = 1 if $ipaddress != '0.0.0.0';
$type = 'Ethernet';
$common->addNetwork({
DESCRIPTION => $description,
IPADDRESS => $ipaddress,
IPDHCP => "",
IPGATEWAY => $ipgateway,
IPMASK => $ipmask,
IPSUBNET => $ipsubnet,
MACADDR => $macaddr,
STATUS => $status?"Up":"Down",
TYPE => $type,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Lspci.pm 0000664 0000000 0000000 00000000276 13327377321 0024600 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Lspci;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("lspci")
}
sub run {}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Lspci/ 0000775 0000000 0000000 00000000000 13327377321 0024235 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Lspci/Controllers.pm 0000664 0000000 0000000 00000003427 13327377321 0027107 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Lspci::Controllers;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("lspci")
}
sub run {
my $params = shift;
my $common = $params->{common};
my $driver;
my $name;
my $manufacturer;
my $pciid;
my $pcislot;
my $type;
my $lspci_version;
my $command = "lspci -vvv";
#We get the current lspci version
`lspci --version` =~ m/lspci\sversion\s(\d+.*)/ ;
$lspci_version=$1;
$lspci_version = $common->convertVersion($lspci_version,3);
if ($lspci_version >= 224) { #More informations since version 2.2.4
$command = "lspci -vvv -nn";
}
foreach(`$command`){
if (/^(\S+)\s+(\w+.*?):\s(.*)/) {
$pcislot = $1;
$name = $2;
$manufacturer = $3;
if ($manufacturer =~ s/ \((rev \S+)\)//) {
$type = $1;
}
$manufacturer =~ s/\ *$//; # clean up the end of the string
$manufacturer =~ s/\s+\(prog-if \d+ \[.*?\]\)$//; # clean up the end of the string
if ($manufacturer =~ s/ \[([A-z\d]+:[A-z\d]+)\]$//) {
$pciid = $1;
}
}
if ($pcislot && /^\s+Kernel driver in use: (\w+)/) {
$driver = $1;
}
if ($pcislot && /^$/) {
$common->addController({
'DRIVER' => $driver,
'NAME' => $name,
'MANUFACTURER' => $manufacturer,
'PCIID' => $pciid,
'PCISLOT' => $pcislot,
'TYPE' => $type,
});
$driver = $name = $pciid = $pcislot = $manufacturer = $type = undef;
}
}
}
1
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Lspci/Modems.pm 0000664 0000000 0000000 00000000670 13327377321 0026022 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Lspci::Modems;
use strict;
sub run {
my $params = shift;
my $common = $params->{common};
foreach(`lspci`){
if (/modem/i && /\d+\s(.+):\s*(.+)$/){
my $name = $1;
my $description = $2;
$common->addModems({
'DESCRIPTION' => $description,
'NAME' => $name,
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Lspci/Sounds.pm 0000664 0000000 0000000 00000000641 13327377321 0026047 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Lspci::Sounds;
use strict;
sub run {
my $params = shift;
my $common = $params->{common};
foreach(`lspci`){
if (/audio/i && /^\S+\s([^:]+):\s*(.+?)(?:\(([^()]+)\))?$/i){
$common->addSound({
'DESCRIPTION' => $3,
'MANUFACTURER' => $2,
'NAME' => $1,
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Lspci/Videos.pm 0000664 0000000 0000000 00000011106 13327377321 0026023 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Lspci::Videos;
use strict;
my $memory;
my $resolution;
my $chipset;
my @resolution;
my ($ret,$handle,$i,$count,$clock,$driver_version, $nvml_version, $memtotal, $serial, $bios_version, $uuid, $name);
my $reso;
#sub check {
# return unless $common->can_run("xrandr");
# return 1;
#}
sub run {
my $params = shift;
my $common = $params->{common};
if ($common->can_run("xrandr")) {
if ($common->can_run("nvidia-smi")) {
if ($common->can_load("nvidia::ml qw(:all)")){
nvmlInit();
# Retrieve driver version
($ret, $driver_version) = nvmlSystemGetDriverVersion();
die nvmlErrorString($ret) unless $ret == $nividia::ml::bindings::NVML_SUCCESS;
# Retrieve NVML version
($ret, $nvml_version) = nvmlSystemGetNVMLVersion();
die nvmlErrorString($ret) unless $ret == $nividia::ml::bindings::NVML_SUCCESS;
# How many nvidia cards are present?
($ret, $count) = nvmlDeviceGetCount();
die nvmlErrorString($ret) unless $ret == $nividia::ml::bindings::NVML_SUCCESS;
for ($i=0; $i<$count; $i++) {
($ret, $handle) = nvmlDeviceGetHandleByIndex($i);
next if $ret != $nvidia::ml::bindings::NVML_SUCCESS;
($ret, $name) = nvmlDeviceGetName($handle);
next if $ret != $nvidia::ml::bindings::NVML_SUCCESS;
($ret, $memtotal) = nvmlDeviceGetMemoryInfo($handle);
next if $ret != $nvidia::ml::bindings::NVML_SUCCESS;
$memtotal = ($memtotal->{"total"} / 1024 / 1024);
($ret, $serial) = nvmlDeviceGetSerial($handle);
next if $ret != $nvidia::ml::bindings::NVML_SUCCESS;
($ret, $bios_version) = nvmlDeviceVBiosVersion($handle);
next if $ret != $nvidia::ml::bindings::NVML_SUCCESS;
($ret, $uuid) = nvmlDeviceGetUUID($handle);
next if $ret != $nvidia::ml::bindings::NVML_SUCCESS;
}
nvmlShutdown();
my @resol= `xrandr --verbose | grep *current`;
foreach my $r (@resol){
if ($r =~ /((\d{3,4})x(\d{3,4}))/){
push(@resolution,$1);
}
}
foreach my $res (@resolution){
$reso = $res;
}
$common->addVideo({
NAME => $name,
MEMORY => $memtotal,
DRVVERSION => $driver_version,
NVMLVERSION => $nvml_version,
SPEED => $clock,
SERIAL => $serial,
VBIOS => $bios_version,
UUID => $uuid,
RESOLUTION => $reso,
});
}
} else {
foreach(`lspci`){
if(/graphics|vga|video/i && /^([0-9a-f][0-9a-f]:[0-9a-f][0-9a-f].[0-9a-f])\s([^:]+):\s*(.+?)(?:\(([^()]+)\))?$/i){
my $slot = $1;
$chipset = $2;
$name = $3;
if (defined $slot) {
my @detail = `lspci -v -s $slot`;
$memory = 0;
foreach my $m (@detail) {
if ($m =~ /.*Memory.*\s+\(.*-bit,\sprefetchable\)\s\[size=(\d*)M\]/) {
$memory += $1;
}
}
# Don't record zero memory
$memory = undef if $memory == 0;
}
my @resol= `xrandr --verbose | grep *current`;
foreach my $r (@resol){
if ($r =~ /((\d{3,4})x(\d{3,4}))/){
$resolution = $1;
}
}
$common->addVideo({
'CHIPSET' => $chipset,
'NAME' => $name,
'MEMORY' => $memory,
'RESOLUTION' => $resolution,
});
}
}
}
}
else {
foreach(`lspci`){
if(/graphics|vga|video/i && /^\S+\s([^:]+):\s*(.+?)(?:\(([^()]+)\))?$/i){
$common->addVideo({
'CHIPSET' => $1,
'NAME' => $2,
});
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Lsusb.pm 0000664 0000000 0000000 00000000276 13327377321 0024616 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Lsusb;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("lsusb")
}
sub run {}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Lsusb/ 0000775 0000000 0000000 00000000000 13327377321 0024253 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Lsusb/Usb.pm 0000664 0000000 0000000 00000003245 13327377321 0025346 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Lsusb::Usb;
use strict;
use Config;
use Data::Dumper;
my $vendor;
my $product;
my $interface;
my $bus;
my $device;
my $serial;
my $protocol;
my $id;
sub run {
my $params = shift;
my $common = $params->{common};
foreach (`lsusb`) {
if (/^Bus\s+(\d+)\sDevice\s(\d*):\sID\s(\d+):(\d+)*/i) {
next if (grep (/$4/,qw(0001 0002 0024)));
$bus=$1;
$device=$2;
#if (defined $bus && defined $device) {
my @detail = `lsusb -v -s $bus:$device 2>/dev/null`;
foreach my $d (@detail) {
if ($d =~ /^\s*iManufacturer\s*\d+\s*(.*)/i) {
$vendor = $1;
} elsif ($d =~ /^\s*iProduct\s*\d+\s*(.*)/i) {
$product = $1;
} elsif ($d =~ /^\s*iSerial\s*\d+\s(.*)/i) {
$serial = $1;
#} elsif ($d =~ /^\s*bInterfaceProtocol\s*\d\s(.*)/i) {
} elsif ($d =~ /^\s*bInterfaceClass\s*\d+\s*(.*)/i) {
#$protocol = $1 unless defined $protocol || $1 eq 'None';
$protocol = $1;
#} elsif ($d =~ /^\s*iInterface\s*\d\s(\w+)\s(.*)/i){
} elsif ($d =~ /^\s*bInterfaceSubClass\s*\d+\s(.*)/i){
$interface = $1;
}
}
# Add information to $current
$common->addUsb({
DESCRIPTION => $product,
INTERFACE => $interface,
MANUFACTURER => $vendor,
SERIAL => $serial,
TYPE => $protocol,
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging.pm 0000664 0000000 0000000 00000000411 13327377321 0025401 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Packaging;
use strict;
sub check {
my $params = shift;
# Do not run an package inventory if there is the --nosoftware parameter
return if ($params->{config}->{nosoftware});
1;
}
sub run{}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/ 0000775 0000000 0000000 00000000000 13327377321 0025047 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/BSDpkg.pm 0000664 0000000 0000000 00000002076 13327377321 0026524 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Packaging::BSDpkg;
sub check {
my $params = shift;
my $common = $params->{common};
return if ( `uname -rs` =~ /SunOS 5.11/ );
$common->can_run("pkg") || $common->can_run("pkg_info")
}
sub run {
my $params = shift;
my $common = $params->{common};
if ($common->can_run("pkg")) {
foreach(`pkg info`){
/^(\S+)-(\d+\S*)\s+(.*)/;
my $name = $1;
my $version = $2;
my $comments = $3;
$common->addSoftware({
'COMMENTS' => $comments,
'NAME' => $name,
'VERSION' => $version
});
}
} elsif ($common->can_run("pkg_info")) {
foreach(`pkg_info`){
/^(\S+)-(\d+\S*)\s+(.*)/;
my $name = $1;
my $version = $2;
my $comments = $3;
$common->addSoftware({
'COMMENTS' => $comments,
'NAME' => $name,
'VERSION' => $version
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/ByHand.pm 0000664 0000000 0000000 00000003211 13327377321 0026547 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Packaging::ByHand;
#How does it work ?
#
#Create a directory called software in place where you have your
#"modules.conf" file.
#Put your scripts in this directory.
#The scripts have to write on the STDIO with the following format :
#publisher#software#version#comment
#
use strict;
use warnings;
sub check {
return(1);
1;
}
sub run() {
my $params = shift;
my $common = $params->{common};
my $ligne;
my $soft;
my $comm;
my $version;
my $file;
my $vendor;
my $commentaire;
my @dots;
#if (!$file || !-d $file) {
foreach (@{$common->{config}{etcdir}}) {
$file = $_.'/softwares';
last if -d $file;
}
#}
my $logger = $params->{logger};
if ( opendir(my $dh, $file) ){
@dots = readdir($dh);
foreach (@dots) {
if ( -f $file."/".$_ ){
$comm = $file."/".$_;
$logger->debug("Running appli detection scripts from ".$comm);
foreach (`$comm`){
$ligne = $_;
chomp($ligne);
($vendor,$soft,$version,$commentaire) = split(/\#/,$ligne);
$common->addSoftware ({
'PUBLISHER' => $vendor,
'NAME' => $soft,
'VERSION' => $version,
'FILESIZE' => "",
'COMMENTS' => $commentaire,
'FROM' => 'ByHand'
});
}
}
}
closedir $dh;
}
1;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/Deb.pm 0000664 0000000 0000000 00000003271 13327377321 0026102 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Packaging::Deb;
use strict;
use warnings;
use File::Basename;
use File::stat;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("dpkg") }
sub run {
my $params = shift;
my $common = $params->{common};
my $size;
my $key;
my $value;
my %statinfo;
# List of files from which installation date will be extracted
my @listfile=glob('"/var/lib/dpkg/info/*.list"');
foreach my $file_list (@listfile){
my $stat=stat($file_list);
my ($year,$month,$day,$hour,$min,$sec)=(localtime($stat->mtime))[5,4,3,2,1,0];
$value=sprintf "%02d/%02d%02d %02d:%02d:%02d",($year+1900),$month,$day,$hour,$min,$sec;
$key=fileparse($file_list, ".list");
$key =~ s/(\s+):.+/$1/;
$statinfo{$key}=$value;
}
# use dpkg-query --show --showformat='${Package}|||${Version}\n'
foreach(`dpkg-query --show --showformat='\${Package}---\${Version}---\${Installed-Size}---\${Homepage}---\${Description}\n'`) {
if (/^(\S+)---(\S+)---(\S*)---(\S*)---(.*)/) {
if ($3) {
$size=$3;
} else {
$size='Unknown size';
}
$key=$1;
if (exists $statinfo{$key}) {
$common->addSoftware ({
'NAME' => $1,
'VERSION' => $2,
'FILESIZE' => $size,
'PUBLISHER' => $4,
'COMMENTS' => $5,
'INSTALLDATE' => $statinfo{$key},
'FROM' => 'deb'
});
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/Gentoo.pm 0000664 0000000 0000000 00000002217 13327377321 0026642 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Packaging::Gentoo;
use strict;
use warnings;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("equery")
}
sub run {
my $params = shift;
my $common = $params->{common};
# TODO: This had been rewrite from the Linux agent _WITHOUT_ being checked!
# New format for listing softwares with equery command (equery 0.3.0.5)
# Older version don't run with these options
my $equery_vers = `equery --version ` =~ /.*\((.*)\).*/;
$equery_vers = $1;
if ($equery_vers =~ /^0.3/) {
foreach (`equery list --format='\$cp \$fullversion' '*'`){
if (/^(.*) (.*)/) {
$common->addSoftware({
'NAME' => $1,
'VERSION' => $2,
});
}
}
} else {
# Old version of Gentoo
foreach (`equery list -i`){
if (/^([a-z]\w+-\w+\/\.*)-([0-9]+.*)/) {
$common->addSoftware({
'NAME' => $1,
'VERSION' => $2,
});
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/Pacman.pm 0000664 0000000 0000000 00000000752 13327377321 0026610 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Packaging::Pacman;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("/usr/bin/pacman")
}
sub run {
my $params = shift;
my $common = $params->{common};
foreach(`/usr/bin/pacman -Q`){
/^(\S+)\s+(\S+)/;
my $name = $1;
my $version = $2;
$common->addSoftware({
'NAME' => $name,
'VERSION' => $version
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/RPM.pm 0000664 0000000 0000000 00000003023 13327377321 0026041 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Packaging::RPM;
use strict;
use warnings;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run("rpm");
# Some time rpm is a wrapper or an alias for another
`rpm --version 2>&1`;
return if ($? >> 8)!=0;
1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my @date;
my @list;
my $buff;
foreach (`rpm -qa --queryformat "%{NAME}.%{ARCH} %{VERSION}-%{RELEASE} --%{INSTALLTIME}-- --%{SIZE}-- --%{VENDOR}-- %{SUMMARY}\n--\n" 2>/dev/null`) {
if (! /^--/) {
chomp;
$buff .= $_;
} elsif ($buff =~ s/^(\S+)\s+(\S+)\s+--(.*)--\s+--(.*)--\s+--(.*)--\s+(.*)//) {
my ($name,$version,$installdate,$filesize,$vendor,$comments) = ( $1,$2,$3,$4,$5,$6 );
@date = localtime($installdate);
$installdate = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $date[5] + 1900, $date[4] + 1, $date[3], $date[2], $date[1], $date[0]);
$common->addSoftware({
'NAME' => $name,
'VERSION' => $version,
'INSTALLDATE' => $installdate,
'FILESIZE' => $filesize,
'COMMENTS' => $comments,
'PUBLISHER' => $vendor,
'FROM' => 'rpm'
});
} else {
$logger->debug("Should never go here!");
$buff = '';
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Printers/ 0000775 0000000 0000000 00000000000 13327377321 0024771 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Printers/Cups.pm 0000664 0000000 0000000 00000002404 13327377321 0026241 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Printers::Cups;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
# If we are on a MAC, Mac::SysProfile will do the job
return if -r '/usr/sbin/system_profiler';
return unless $common->can_load("Net::CUPS") && $Net::CUPS::VERSION >= 0.60;
return 1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $cups = Net::CUPS->new();
my @destinations = $cups->getDestinations();
my $printer;
my $description;
my $port;
my $driver;
foreach (@destinations) {
$printer = $_->getName() unless $printer;
$description = $_->getDescription() unless $description;
$port = $_->getUri() unless $port;
$driver = $_->getOptionValue("printer-make-and-model") unless $driver;
# Just grab the default printer, if I use getDestinations, CUPS
# returns all the printer of the local subnet (if it can)
# TODO There is room for improvement here
$common->addPrinter({
NAME => $printer,
DESCRIPTION => $description,
PORT => $port,
DRIVER => $driver
});
$printer = $description = $port = $driver = undef;
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Repository.pm 0000664 0000000 0000000 00000000133 13327377321 0025675 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Repository;
use strict;
sub run {}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Repository/ 0000775 0000000 0000000 00000000000 13327377321 0025342 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Repository/BSD.pm 0000664 0000000 0000000 00000003477 13327377321 0026323 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Repository::BSD;
use strict;
use warnings;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run("pkg");
}
my $repo_name;
my $repo_baseurl;
my $repo_priority;
my $repo_mirror_type;
my $repo_signature_type;
my $repo_fingerprints;
my $repo_enable;
sub run {
my $params = shift;
my $common = $params->{common};
if ($^O eq 'freebsd') {
foreach my $line (`LANG=C pkg -vv 2>/dev/null`){
next if ($line =~ /^Repositories:/i);
if ($line =~ /^\s+(.*):\s\{/i){
$repo_name = $1;
} elsif ($line =~ /url\s+:\s\"(.*)\"/i) {
$repo_baseurl = $1;
} elsif ($line =~ /enabled\s+:\s(.*)\,/i){
$repo_enable = $1;
} elsif ($line =~ /priority\s+:\s(.*)\,/i) {
$repo_priority = $1;
} elsif ($line =~ /Mirror_type\s+:\s\"(.*)\"\,/i){
$repo_mirror_type = $1;
} elsif ($line =~ /signature_type\s+:\s\"(.*)\"\,/i){
$repo_signature_type = $1;
} elsif ($line =~ /fingerprints\s+:\s\"(.*)\"/i){
$repo_fingerprints = $1;
}
if ($line =~ /^ \}$/) {
$common->addRepo({
BASEURL => $repo_baseurl,
NAME => $repo_name,
ENABLED => $repo_enable,
PRIORITY => $repo_priority,
MIRROR => $repo_mirror_type,
SIGNATURE => $repo_signature_type,
FINGERPRINTS => $repo_fingerprints,
});
$repo_name = $repo_baseurl = $repo_enable = $repo_priority = $repo_mirror_type = $repo_signature_type = $repo_fingerprints = undef;
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Repository/CentOS.pm 0000664 0000000 0000000 00000004460 13327377321 0027037 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Repository::CentOS;
use strict;
use warnings;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run("yum");
}
my $repo_name;
my $repo_baseurl;
my $repo_filename;
my $repo_pkgs;
my $repo_rev;
my $repo_size;
my $repo_tag;
my $repo_updated;
my $repo_mirrors;
my $repo_expire;
my $repo_exclude;
my $repo_excluded;
my $repo_metalink;
sub run {
my $params = shift;
my $common = $params->{common};
my @repository=`LANG=C yum -v repolist 2>/dev/null`;
push @repository, "\n";
for (my $i=0;$i<$#repository;$i++){
my $line=$repository[$i];
if ($line =~ /^$/ && $repo_name && $repo_filename) {
$common->addRepo({
BASEURL => $repo_baseurl,
EXCLUDE => $repo_exclude,
EXCLUDED => $repo_excluded,
EXPIRE => $repo_expire,
FILENAME => $repo_filename,
MIRRORS => $repo_mirrors,
NAME => $repo_name,
PKGS => $repo_pkgs,
REVISION => $repo_rev,
SIZE => $repo_size,
TAG => $repo_tag,
UPDATED => $repo_updated,
});
$repo_name = $repo_baseurl = $repo_filename = $repo_pkgs = $repo_size = $repo_tag = $repo_updated = $repo_mirrors = $repo_expire = $repo_exclude = $repo_excluded = $repo_rev = $repo_metalink = undef;
}
$repo_name = $1 if ($line =~ /^Repo-name\s+:\s(.*)/i);
$repo_baseurl = $1 if ($line =~ /^Repo-baseurl\s+:\s(.*)/i);
$repo_mirrors = $1 if ($line =~ /^Repo-mirrors\s+:\s(.*)/i);
$repo_filename = $1 if ($line =~ /^Repo-filename:\s(.*)/i);
$repo_pkgs = $1 if ($line =~ /^Repo-pkgs\s+:\s(.*)/i);
$repo_rev = $1 if ($line =~ /^Repo-revision:\s(.*)/i);
$repo_size = $1 if ($line =~ /^Repo-size\s+:\s(.*)/i);
$repo_tag = $1 if ($line =~ /^Repo-tags\s+:\s(.*)/i);
$repo_updated = $1 if ($line =~ /^Repo-updated\s+:\s(.*)/i);
$repo_exclude = $1 if ($line =~ /^Repo-exclude\s+:\s(.*)/i);
$repo_excluded = $1 if ($line =~ /^Repo-excluded\s+:\s(.*)/i);
$repo_expire = $1 if ($line =~ /^Repo-expire\s+:\s(.*)/i);
$repo_metalink =$1 if ($line =~ /^Repo-metalink\s+:\s(.*)/i);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Repository/Debian.pm 0000664 0000000 0000000 00000001613 13327377321 0027063 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Repository::Debian;
use strict;
use warnings;
sub check{
my $params = shift;
my $common = $params->{common};
return unless $common->can_run("apt-cache");
}
sub run{
my $params = shift;
my $common = $params->{common};
my ($repo_name, $repo_baseurl);
my @repository=`apt-cache policy | grep -i http | awk {'print \$2 " " \$3'} | sort -u`;
push @repository, "\n";
for (my $i=0;$i<$#repository;$i++){
my $line=$repository[$i];
$repo_name=$1 if ($line =~ /\/([^\/]*)\n$/);
$repo_baseurl=$1 if ($line =~ /^(\S*)\h/);
if ($line =~ /(^.*$)/ && $repo_name && $repo_baseurl){
$common->addRepo({
NAME => $repo_name,
BASEURL => $repo_baseurl,
});
$repo_name = $repo_baseurl = undef;
}
#$repo_name=$1 if ($line =~ /.*\s(\w-?\/\w)/);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Repository/Rhel.pm 0000664 0000000 0000000 00000003167 13327377321 0026601 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Repository::Rhel;
use strict;
use warnings;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run("dnf");
}
my $repo_name;
my $repo_baseurl;
my $repo_filename;
my $repo_pkgs;
my $repo_rev;
my $repo_size;
my $repo_tag;
my $repo_updated;
sub run {
my $params = shift;
my $common = $params->{common};
my @repository=`LANG=C dnf -v repolist 2>/dev/null`;
push @repository, "\n";
for (my $i=0;$i<$#repository;$i++){
my $line=$repository[$i];
if ($line =~ /^$/ && $repo_name && $repo_filename) {
$common->addRepo({
BASEURL => $repo_baseurl,
FILENAME => $repo_filename,
NAME => $repo_name,
PACKAGES => $repo_pkgs,
REVISION => $repo_rev,
SIZE => $repo_size,
TAG => $repo_tag,
UPDATED => $repo_updated,
});
$repo_name = $repo_baseurl = $repo_filename = $repo_pkgs = $repo_rev = $repo_size = $repo_tag = $repo_updated = undef;
}
$repo_name=$1 if ($line =~ /^Repo-name\s+:\s(.*)/i);
$repo_baseurl=$1 if ($line =~ /^Repo-baseurl\s+:\s(.*)/i);
$repo_filename=$1 if ($line =~ /^Repo-filename:\s(.*)/i);
$repo_pkgs=$1 if ($line =~ /^Repo-pkgs\s+:\s(.*)/i);
$repo_rev=$1 if ($line =~ /^Repo-revision:\s(.*)/i);
$repo_size=$1 if ($line =~ /^Repo-size\s+:\s(.*)/i);
$repo_tag=$1 if ($line =~ /^Repo-tags\s+:\s(.*)/i);
$repo_updated=$1 if ($line =~ /^Repo-updated\s+:\s(.*)/i);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Screen.pm 0000664 0000000 0000000 00000014325 13327377321 0024745 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Screen;
use strict;
use utf8;
use Parse::EDID;
sub haveExternalUtils {
my $common = shift;
return $common->can_run("monitor-get-edid-using-vbe") || $common->can_run("monitor-get-edid") || $common->can_run("get-edid");
}
sub check {
my $params = shift;
my $common = $params->{common};
return unless -d "/sys/devices" || haveExternalUtils($common);
1;
}
sub _getManufacturerFromCode {
my $code = shift;
my $h = {
"ACR" => "Acer America Corp.",
"ACT" => "Targa",
"ADI" => "ADI Corporation http://www.adi.com.tw",
"AOC" => "AOC International (USA) Ltd.",
"API" => "Acer America Corp.",
"APP" => "Apple Computer, Inc.",
"ART" => "ArtMedia",
"AST" => "AST Research",
"AMW" => "AMW",
"AUO" => "AU Optronics Corporation",
"BMM" => "BMM",
"BNQ" => "BenQ Corporation",
"BOE" => "BOE Display Technology",
"CPL" => "Compal Electronics, Inc. / ALFA",
"CPQ" => "COMPAQ Computer Corp.",
"CPT" => "Chunghwa Picture Tubes, Ltd.",
"CTX" => "CTX - Chuntex Electronic Co.",
"DEC" => "Digital Equipment Corporation",
"DEL" => "Dell Computer Corp.",
"DPC" => "Delta Electronics, Inc.",
"DWE" => "Daewoo Telecom Ltd",
"ECS" => "ELITEGROUP Computer Systems",
"ENC" => "EIZO",
"EIZ" => "EIZO",
"EPI" => "Envision Peripherals, Inc.",
"FCM" => "Funai Electric Company of Taiwan",
"FUJ" => "Fujitsu",
"FUS" => "Fujitsu Siemens",
"GSM" => "LG Electronics Inc. (GoldStar Technology, Inc.)",
"GWY" => "Gateway 2000",
"HEI" => "Hyundai Electronics Industries Co., Ltd.",
"HIQ" => "Hyundai ImageQuest",
"HIT" => "Hitachi",
"HSD" => "Hannspree Inc",
"HSL" => "Hansol Electronics",
"HTC" => "Hitachi Ltd. / Nissei Sangyo America Ltd.",
"HWP" => "Hewlett Packard",
"IBM" => "IBM PC Company",
"ICL" => "Fujitsu ICL",
"IFS" => "InFocus",
"IQT" => "Hyundai",
"IVM" => "Idek Iiyama North America, Inc.",
"KFC" => "KFC Computek",
"LEN" => "Lenovo",
"LGD" => "LG Display",
"LKM" => "ADLAS / AZALEA",
"LNK" => "LINK Technologies, Inc.",
"LPL" => "LG Philips",
"LTN" => "Lite-On",
"MAG" => "MAG InnoVision",
"MAX" => "Maxdata Computer GmbH",
"MEI" => "Panasonic Comm. & Systems Co.",
"MEL" => "Mitsubishi Electronics",
"MIR" => "Miro Computer Products AG",
"MTC" => "MITAC",
"MS_" => "Panasonic",
"NAN" => "NANAO",
"NEC" => "NEC Technologies, Inc.",
"NVD" => "Fujitsu",
"NOK" => "Nokia",
"OQI" => "OPTIQUEST",
"PBN" => "Packard Bell",
"PCK" => "Daewoo",
"PDC" => "Polaroid",
"PGS" => "Princeton Graphic Systems",
"PHL" => "Philips Consumer Electronics Co.",
"PRT" => "Princeton",
"PTS" => "ProView/EMC/PTS YakumoTFT17SL",
"REL" => "Relisys",
"SAM" => "Samsung",
"SMI" => "Smile",
"SMC" => "Samtron",
"SNI" => "Siemens Nixdorf",
"SNY" => "Sony Corporation",
"SPT" => "Sceptre",
"SRC" => "Shamrock Technology",
"STN" => "Samtron",
"STP" => "Sceptre",
"TAT" => "Tatung Co. of America, Inc.",
"TOS" => "Toshiba",
"TRL" => "Royal Information Company",
"TSB" => "Toshiba, Inc.",
"UNM" => "Unisys Corporation",
"VSC" => "ViewSonic Corporation",
"WTC" => "Wen Technology",
"ZCM" => "Zenith Data Systems",
"___" => "Targa" };
return $h->{$code} if (exists ($h->{$code}) && $h->{$code});
return "Unknown manufacturer code ".$code;
}
sub getEdid {
my $raw_edid;
my $port = $_[0];
# Mandriva
$raw_edid = `monitor-get-edid-using-vbe --port $port 2>/dev/null`;
# Since monitor-edid 1.15, it's possible to retrieve EDID information
# through DVI link but we need to use monitor-get-edid
if (!$raw_edid) {
$raw_edid = `monitor-get-edid --vbe-port $port 2>/dev/null`;
}
if (!$raw_edid) {
foreach (1..5) { # Sometime get-edid return an empty string...
$raw_edid = `get-edid 2>/dev/null`;
last if (length($raw_edid) == 128 || length($raw_edid) == 256);
}
}
return unless (length($raw_edid) == 128 || length($raw_edid) == 256);
return $raw_edid;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my $raw_perl = 1;
my $verbose;
my $MonitorsDB;
my $base64;
my $uuencode;
my %found;
my @edid_list;
# first check sysfs if there are edid entries
for my $file(split(/\0/,`find /sys/devices -wholename '*/card*/edid' -print0`)) {
open(my $sys_edid_fd,'<',$file);
my $raw_edid = do { local $/; <$sys_edid_fd> };
if (length($raw_edid) == 128 || length($raw_edid) == 256 ) {
push @edid_list, $raw_edid;
}
}
# if not fall back to the old method
if (!@edid_list && haveExternalUtils($common)) {
for my $port(0..20){
my $raw_edid = getEdid($port);
if ($raw_edid){
if (length($raw_edid) == 128 || length($raw_edid) == 256) {
push @edid_list, $raw_edid;
}
}
}
}
for my $raw_edid(@edid_list) {
my $edid = parse_edid($raw_edid);
if (my $err = check_parsed_edid($edid)) {
$logger->debug("check failed: bad edid: $err");
}
my $caption = $edid->{monitor_name};
my $description = $edid->{week}."/".$edid->{year};
my $manufacturer = _getManufacturerFromCode($edid->{manufacturer_name});
my $serial = $edid->{serial_number};
if (!exists $found{$serial}) {
$found{$serial} = 1;
eval "use MIME::Base64;";
$base64 = encode_base64($raw_edid) if !$@;
if ($common->can_run("uuencode")) {
chomp($uuencode = `echo $raw_edid|uuencode -`);
if (!$base64) {
chomp($base64 = `echo $raw_edid|uuencode -m -`);
}
}
$common->addMonitor ({
BASE64 => $base64,
CAPTION => $caption,
DESCRIPTION => $description,
MANUFACTURER => $manufacturer,
SERIAL => $serial,
UUENCODE => $uuencode,
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Generic/Users.pm 0000664 0000000 0000000 00000000665 13327377321 0024631 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Generic::Users;
sub check {
# Useless check for a posix system i guess
my @who = `who 2>/dev/null`;
return 1 if @who;
return;
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my %user;
# Logged on users
for (`who`){
my $user = $1 if /^(\S+)./;
$common->addUser ({ LOGIN => $user });
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX.pm 0000664 0000000 0000000 00000001177 13327377321 0022737 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX;
use strict;
use vars qw($runAfter);
$runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"];
sub check { $^O =~ /hpux/ }
sub run {
my $params = shift;
my $common = $params->{common};
my $OSName;
my $OSVersion;
my $OSComment;
#my $uname_path = &_get_path('uname');
# Operating systeminformations
chomp($OSName = `uname -s`);
chomp($OSVersion = `uname -r`);
chomp($OSComment = `uname -l`);
$common->setHardware({
OSNAME => $OSName,
OSCOMMENTS => $OSComment,
OSVERSION => $OSVersion,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/ 0000775 0000000 0000000 00000000000 13327377321 0022373 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/Bios.pm 0000664 0000000 0000000 00000002403 13327377321 0023624 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX::Bios;
use strict;
###
# Version 1.1
# Correction of Bug n 522774
#
# thanks to Marty Riedling for this correction
#
###
sub check { $^O =~ /hpux/ }
sub run {
my $params = shift;
my $common = $params->{common};
my $BiosVersion;
my $BiosDate;
my $SystemModel;
my $SystemSerial;
$SystemModel=`model`;
if ($common->can_run ("machinfo")) {
foreach (`machinfo`) {
if (/Firmware\s+revision\s?[:=]\s+(\S+)/) {
$BiosVersion=$1;
}
if (/achine\s+serial\s+number\s?[:=]\s+(\S+)/) {
$SystemSerial=$1;
}
}
} else {
for (`echo 'sc product cpu;il' | /usr/sbin/cstm | grep "PDC Firmware"`) {
if (/Revision:\s+(\S+)/){
$BiosVersion="PDC $1";
}
}
for (`echo 'sc product system;il' | /usr/sbin/cstm | grep "System Serial Number"`) {
if (/:\s+(\w+)/) {
$SystemSerial=$1;
}
}
}
$common->setBios ({
BVERSION => $BiosVersion,
BDATE => $BiosDate,
BMANUFACTURER => "HP",
SMANUFACTURER => "HP",
SMODEL => $SystemModel,
SSN => $SystemSerial,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/CPU.pm 0000664 0000000 0000000 00000006031 13327377321 0023360 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX::CPU;
###
# Version 1.1
# Correction of Bug n 522774
#
# thanks to Marty Riedling for this correction
#
###
use strict;
use LWP::UserAgent;
sub check { $^O =~ /hpux/ }
sub run {
my $params = shift;
my $common = $params->{common};
my $processort;
my $processorn;
my $processors="";
my $DeviceType;
my $cpuInfo;
my $serie;
# Using old system HpUX without machinfo
# the Hpux with machinfo will be done after
my %cpuInfos = (
"D200"=>"7100LC 75",
"D210"=>"7100LC 100",
"D220"=>"7300LC 132",
"D230"=>"7300LC 160",
"D250"=>"7200 100",
"D260"=>"7200 120",
"D270"=>"8000 160",
"D280"=>"8000 180",
"D310"=>"7100LC 100",
"D320"=>"7300LC 132",
"D330"=>"7300LC 160",
"D350"=>"7200 100",
"D360"=>"7200 120",
"D370"=>"8000 160",
"D380"=>"8000 180",
"D390"=>"8200 240",
"K360"=>"8000 180",
"K370"=>"8200 200",
"K380"=>"8200 240",
"K400"=>"7200 100",
"K410"=>"7200 120",
"K420"=>"7200 120",
"K460"=>"8000 180",
"K570"=>"8200 200",
"K580"=>"8200 240",
"L1000-36"=>"8500 360",
"L1500-7x"=>"8700 750",
"L3000-7x"=>"8700 750",
"N4000-44"=>"8500 440",
"ia64 hp server rx1620"=>"itanium 1600");
if ( $common->can_run ("machinfo") ) {
foreach ( `machinfo`) {
if ( /Number of CPUs\s+=\s+(\d+)/ ) {
$processorn=$1;
}
if ( /Clock speed\s+=\s+(\d+)\s+MHz/ ) {
$processors=$1;
}
# Added for HPUX 11.31
if ( /Intel\(R\) Itanium 2 9[01]00 series processor \((\d+\.\d+)/ ) {
$processors=$1*1000;
}
if ( /(\d+)\s+logical processors/ ) {
$processorn=$1;
}
# end HPUX 11.31
}
} else {
chomp($DeviceType =`model |cut -f 3- -d/`);
my $cpuInfo = $cpuInfos{"$DeviceType"};
if ( "$cpuInfo" =~ /^(\S+)\s(\S+)/ ) {
$processort=$1;
$processors=$2;
} else {
for ( `echo 'sc product cpu;il' | /usr/sbin/cstm | grep "CPU Module"` ) {
if ( /(\S+)\s+CPU\s+Module/ ) {
$processort=$1;
}
};
for ( `echo 'itick_per_usec/D' | adb -k /stand/vmunix /dev/kmem` ) {
if ( /tick_per_usec:\s+(\d+)/ ) {
$processors=$1;
}
}
};
# NBR CPU
chomp($processorn=`ioscan -Fk -C processor | wc -l`);
#print "HP $processort A $processorn A $processors ";
}
chomp($serie = `uname -m`);
if ( $serie =~ /ia64/) {
$processort="Itanium"
}
if ( $serie =~ /9000/) {
$processort="PA$processort";
}
$common->setHardware({
PROCESSORT => $processort,
PROCESSORN => $processorn,
PROCESSORS => $processors,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/Controller.pm 0000664 0000000 0000000 00000001446 13327377321 0025061 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX::Controller;
use strict;
sub check { $^O =~ /hpux/ }
sub run {
my $params = shift;
my $common = $params->{common};
my $name;
my $interface;
my $info;
my $type;
my @typeScaned=('ext_bus','fc','psi');
my $scaned;
for (@typeScaned) {
$scaned=$_;
for ( `ioscan -kFC $scaned| cut -d ':' -f 9,11,17,18` ) {
if ( /(\S+):(\S+):(\S+):(.+)/ ) {
$name=$2;
$interface=$3;
$info=$4;
$type=$1;
$common->addController({
'NAME' => $name,
'MANUFACTURER' => "$interface $info",
'TYPE' => $type,
});
};
};
};
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/Domains.pm 0000664 0000000 0000000 00000001346 13327377321 0024327 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX::Domains;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run ("domainname")
}
sub run {
my $params = shift;
my $common = $params->{common};
my $domain;
chomp($domain = `domainname`);
if (!$domain) {
my %domain;
if (open RESOLV, "/etc/resolv.conf") {
while() {
$domain{$2} = 1 if (/^(domain|search)\s+(.+)/);
}
close RESOLV;
}
$domain = join "/", keys %domain;
}
# If no domain name, we send "WORKGROUP"
$domain = 'WORKGROUP' unless $domain;
$common->setHardware({
WORKGROUP => $domain
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/Drives.pm 0000664 0000000 0000000 00000002615 13327377321 0024171 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX::Drives;
sub check { $^O =~ /hpux/ }
sub run {
my $params = shift;
my $common = $params->{common};
my $type;
my $fs;
my $lv;
my $total;
my $free;
for ( `fstyp -l | grep -v nfs` ) {
if ( /^\s*$/ ) { #Blank line
next;
}
$type=$_;
for ( `bdf -t $type `) {
if ( /Filesystem/ ) { ; } ;
if ( /^(\S+)\s(\d+)\s+(\d+)\s+(\d+)\s+(\d+%)\s+(\S+)/ ) {
$lv=$1;
$total=$2;
$free=$3;
$fs=$6;
$common->addDrives({
FREE => $free,
FILESYSTEM => $fs,
TOTAL => $total,
TYPE => $type,
VOLUMN => $lv,
});
};
if ( /^(\S+)\s/) {
$lv=$1;
};
if ( /(\d+)\s+(\d+)\s+(\d+)\s+(\d+%)\s+(\S+)/) {
$total=$1;
$free=$3;
$fs=$5;
# print "fs $fs lv $lv total $total free $free type $type\n";
$common->addDrives({
FREE => $free,
FILESYSTEM => $fs,
TOTAL => $total,
TYPE => $type,
VOLUMN => $lv,
});
};
};
};
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/IPv4.pm 0000664 0000000 0000000 00000000744 13327377321 0023520 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX::IPv4;
sub check {
`which ifconfig 2>&1`; ($? >> 8)?0:1
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my $ip;
my $hostname;
if ( `hostname` =~ /(\S+)/ ) {
$hostname=$1;
}
for ( `grep $hostname /etc/hosts ` ) {
if ( /(^\d+\.\d+\.\d+\.\d+)\s+/ ){
$ip=$1;
$common->setHardware({IPADDR => $ip});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/Mem.pm 0000664 0000000 0000000 00000001060 13327377321 0023444 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX::Mem;
use strict;
sub check { $^O =~ /hpux/ }
sub run {
my $params = shift;
my $common = $params->{common};
my $mem;
my $swap;
$mem = `grep Physical /var/adm/syslog/syslog.log|tr -s " "|cut -f 7 -d " "` ;
if ( $mem eq "" ) {
$mem = `grep Physical /var/adm/syslog/OLDsyslog.log|tr -s " "|cut -f 7 -d " "` ;
};
$mem = int ($mem/1024);
$swap = `swapinfo -mdfq`;
$common->setHardware({
MEMORY => $mem,
SWAP => $swap,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/Memory.pm 0000664 0000000 0000000 00000006352 13327377321 0024207 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX::Memory;
use strict;
sub check { $^O =~ /hpux/ }
sub run {
my $params = shift;
my $common = $params->{common};
my $capacity=0;
my $caption;
my $description;
my $numslot;
my $subnumslot;
my $serialnumber;
my $type;
my @list_mem=`echo 'sc product mem;il'| /usr/sbin/cstm`;
my $ok=0;
if ( `uname -m` =~ /ia64/ ) {
for ( `echo 'sc product IPF_MEMORY;il' | /usr/sbin/cstm` ) {
if ( /\w+IMM\s+Location/ ) {
;
} elsif ( /(\w+IMM)\s+(\w+)\s+(\S+)\s+(\w+IMM)\s+(\w+)\s+(\S+)/ ) {
$common->addMemories({
CAPACITY => $3,
CAPTION => $2 ,
NUMSLOTS => "1" ,
TYPE => $1,
});
$common->addMemories({
CAPACITY => $6,
CAPTION => $5 ,
NUMSLOTS => "1" ,
TYPE => $4,
});
}
}
} else {
for ( `echo 'sc product system;il' | /usr/sbin/cstm ` ) {
if ( /FRU\sSource\s+=\s+\S+\s+\(memory/ ) {
$ok=0;
#print "FRU Source memory\n";
}
if ( /Source\s+Detail\s+=\s4/ ) {
$ok=1;
#print "Source Detail IMM\n";
}
if ( /Extender\s+Location\s+=\s+(\S+)/ ) {
$subnumslot=$1;
#print "Extended sub $subnumslot\n";
};
if ( /DIMMS\s+Rank\s+=\s+(\S+)/ ) {
$numslot=sprintf("%02x",$1);
#print "Num slot $numslot\n";
}
if ( /FRU\s+Name\.*:\s+(\S+)/ ) {
if ( /(\S+)_(\S+)/ ) {
$type=$1;
$capacity=$2;
#print "Type $type capa $capacity\n";
} elsif ( /(\wIMM)(\S+)/ ) {
$ok=1;
$type=$1;
$numslot=$2;
#print "Type $type numslot $numslot\n";
}
}
if ( /Part\s+Number\.*:\s*(\S+)\s+/ ) {
$description=$1;
#print "ref $description\n";
};
if ( /Serial\s+Number\.*:\s*(\S+)\s+/ ) {
$serialnumber=$1;
if ( $ok eq 1 ) {
if ( $capacity eq 0 ){
foreach ( @list_mem ){
if ( /\s+$numslot\s+(\d+)/ ){
$capacity=$1;
#print "Capacity $capacity\n";
}
}
}
$common->addMemories({
CAPACITY => $capacity,
CAPTION => "Ext $subnumslot Slot $numslot" ,
DESCRIPTION => "Part Number $description",
NUMSLOTS => "1" ,
SERIALNUMBER => $serialnumber,
TYPE => $type,
});
$ok=0;
$capacity=0;
};
#print "Serial $serialnumber\n\n";
};
};
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/Networks.pm 0000664 0000000 0000000 00000005106 13327377321 0024547 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX::Networks;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_load("Net::IP qw(:PROC)");
}
sub run {
my $params = shift;
my $common = $params->{common};
my $name;
my $lanid;
my $ipmask;
my $ipgateway;
my $status;
my $macaddr;
my $speed;
my $type;
my $ipsubnet;
my $description;
my $ipaddress;
my $binip;
my $binmask;
my $binsubnet;
for ( `lanscan -iap`) {
# Reinit variable
$name="";
$lanid="";
$ipmask="";
$ipgateway="";
$status="";
$macaddr="";
$speed="";
$type="";
$ipsubnet="";
$description="";
$ipaddress="";
if ( /^(\S+)\s(\S+)\s(\S+)\s+(\S+)/) {
$name=$2;
$macaddr=$1;
$lanid=$4;
#print "name $name macaddr $macaddr lanid $lanid\n";
for ( `lanadmin -g $lanid` ) {
if (/Type.+=\s(.+)/) { $type = $1; };
if (/Description\s+=\s(.+)/) { $description = $1; };
if (/Speed.+=\s(\d+)/) {
$speed = $1;
unless ( $speed <= 1000000 ) { # in old version speed was given in Mbps
# we want speed in Mbps
$speed = $1/1000000;
}
};
if (/Operation Status.+=\s(.+)/) { $status = $1; };
}; # for lanadmin
#print "name $name macaddr $macaddr lanid $lanid speed $speed status $status \n";
for ( `ifconfig $name 2> /dev/null` ) {
if ( /inet\s(\S+)\snetmask\s(\S+)\s/ ) {
$ipaddress=$1;
$ipmask=$2;
if ($ipmask =~ /(..)(..)(..)(..)/) {
$ipmask=sprintf ("%i.%i.%i.%i",hex($1),hex($2),hex($3),hex($4));
}
};
}; # For ifconfig
$binip = ip_iptobin ($ipaddress ,4);
$binmask = ip_iptobin ($ipmask ,4);
$binsubnet = $binip & $binmask;
$ipsubnet = ip_bintoip($binsubnet,4);
$common->addNetworks({
DESCRIPTION => $description,
IPADDRESS => $ipaddress,
IPGATEWAY => $ipgateway,
IPMASK => $ipmask,
IPSUBNET => $ipsubnet,
MACADDR => $macaddr,
STATUS => $status,
SPEED => $speed,
TYPE => $type,
});
}; # If
}; # For lanscan
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/README 0000664 0000000 0000000 00000003067 13327377321 0023261 0 ustar 00root root 0000000 0000000 #####################################################
# 17/12/2009
# Auteur: dwizz.donowin@yahoo.fr
#
# This code is open source and may be copied and modified as long as the source
# code is always made freely available.
# Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
#
################################################################################
Version Francaise
-----------------
(for english version see below)
Ces fichiers sont generes pour etre utilisis avec
l'agent Unix OCS-NG 1.02
Installation:
Installer le client OCS-NG 1.02 avec ces prerequis
extraire les fichiers dans le repertoire
Ocsinventory/Agent/Backend/OS
Ils seront automatiquement pris en compte par le client OCS
Je n'ai pu tester ces fichiers que sur N4000 actuellement en version HP-UX 11.0
J'ai commence sur un rp3440 mais je n'ai pas encore toutes les informations
car le format des certaines donnees change.
N'hesitez pas a m'aider a le faire evoluer.
English version
---------------
This files are producted for using with
the OCS-NG 1.02 Unix Agent
Install:
Install the OCS-NG 1.02 Agent with the prerequesit
Extract the files in the
Ocsinventory/Agent/Backend/OS
It will be used automatically
I have test the script on only n4000 system for th moment on HP-Ux 11.0
I try it on rp3440 but some informations are not in the same format
If you wish to help me, you are welwome.
the files are
HPUX.pm
HPUX sub directory
Bios.pm
CPU.pm
Controller.pm
Domains.pm
Drives.pm
IPv4.pm
Mem.pm
Memory.pm
Networks.pm
Slots.pm
Software.pm
Storages.pm
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/Slots.pm 0000664 0000000 0000000 00000001525 13327377321 0024040 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX::Slots;
use strict;
sub check { $^O =~ /hpux/ }
sub run {
my $params = shift;
my $common = $params->{common};
my $name;
my $interface;
my $info;
my $type;
my @typeScaned=('ioa','ba');
my $scaned;
for (@typeScaned ) {
$scaned=$_;
for ( `ioscan -kFC $scaned| cut -d ':' -f 9,11,17,18` ) {
if ( /(\S+):(\S+):(\S+):(.+)/ ) {
$name=$2;
$interface=$3;
$info=$4;
$type=$1;
$common->addSlots({
DESCRIPTION => "$name",
DESIGNATION => "$interface $info",
NAME => "$type",
STATUS => "OK",
});
};
};
};
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/Software.pm 0000664 0000000 0000000 00000001436 13327377321 0024527 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX::Software;
sub check {
my $params = shift;
# Do not run an package inventory if there is the --nosoftware parameter
return if ($params->{params}->{nosoftware});
$^O =~ /hpux/
}
sub run {
my $params = shift;
my $common = $params->{common};
my @softList;
my $software;
@softList = `swlist | grep -v '^ PH' | grep -v '^#' |tr -s "\t" " "|tr -s " "` ;
foreach $software (@softList) {
chomp( $software );
if ( $software =~ /^ (\S+)\s(\S+)\s(.+)/ ) {
$common->addSoftwares({
'NAME' => $1 ,
'VERSION' => $2 ,
'COMMENTS' => $3 ,
'PUBLISHER' => "HP" ,
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/HPUX/Storages.pm 0000664 0000000 0000000 00000005451 13327377321 0024525 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::HPUX::Storages;
sub check { $^O =~ /hpux/ }
sub run {
my $params = shift;
my $common = $params->{common};
my @all_type = ("tape","disk") ;
my $type;
my $description;
my $path;
my $vendor;
my $ref;
my $size;
my $devdsk;
my $devrdsk;
my $revlvl;
my $alternate;
for ( @all_type ) {
$type = "$_";
for ( `ioscan -kFnC $type | cut -d ':' -f 1,11,18` ) {
if ( /(\S+)\:(\S+)\:(\S+)\s+(\S+)/ ) {
$description = $1;
$path = $2;
$vendor = $3;
$ref = $4;
};
$alternate = 0 ;
if ( $type eq "disk" ) {
if ( /\s+(\/dev\/dsk\/\S+)\s+(\/dev\/rdsk\/\S+)/ ) {
#print "1 $1 2 $2 \n";
$devdsk=$1;
$devrdsk=$2;
# We look if we are on an alternate link
for ( `pvdisplay $devdsk 2> /dev/null` ) {
if ( /$devdsk\.+lternate/ ) {
$alternate=1;
};
};
# We are not on an alternate link
if ( $alternate eq 0 ) {
#$size = `diskinfo -b $devrdsk`;
for ( `diskinfo -v $devrdsk`) {
if ( /^\s+size:\s+(\S+)/ ) {
$size=$1;
$size = int ( $size/1024 ) if $size;
};
if ( /^\s+rev level:\s+(\S+)/ ) {
$revlvl=$1;
};
};
#print "vendor $vendor ref $ref type $type description $description path $path size $size\n";
$common->addStorages({
MANUFACTURER => $vendor,
MODEL => $ref,
NAME => $devdsk,
DESCRIPTION => $description,
TYPE => $type,
DISKSIZE => $size,
FIRMWARE => $revlvl,
});
};
};
} else {
# We look for tapes
if ( /^\s+(\/dev\/rmt\/\Sm)\s+/ ) {
$devdsk=$1;
$common->addStorages({
MANUFACTURER => $vendor,
MODEL => $ref,
NAME => $devdsk,
DESCRIPTION => $description,
TYPE => $type,
DISKSIZE => ''
});
};
};
};
};
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux.pm 0000664 0000000 0000000 00000001537 13327377321 0023252 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux;
use strict;
use vars qw($runAfter);
$runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"];
sub check { $^O =~ /^linux$/ }
sub run {
my $params = shift;
my $common = $params->{common};
chomp (my $osversion = `uname -r`);
my $lastloggeduser;
my $datelastlog;
my @query = $common->runcmd("last -R");
foreach ($query[0]) {
if ( s/^(\S+)\s+\S+\s+(\S+\s+\S+\s+\S+\s+\S+)\s+.*// ) {
$lastloggeduser = $1;
$datelastlog = $2;
}
}
# This will probably be overwritten by a Linux::Distro module.
$common->setHardware({
OSNAME => "Linux",
OSCOMMENTS => "Unknown Linux distribution",
OSVERSION => $osversion,
LASTLOGGEDUSER => $lastloggeduser,
DATELASTLOGGEDUSER => $datelastlog
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/ 0000775 0000000 0000000 00000000000 13327377321 0022706 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/ 0000775 0000000 0000000 00000000000 13327377321 0023746 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/ARM.pm 0000664 0000000 0000000 00000000256 13327377321 0024726 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::ARM;
use strict;
use Config;
sub check {
return 1 if $Config{'archname'} =~ /^arm/;
0;
};
sub run{}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/ARM/ 0000775 0000000 0000000 00000000000 13327377321 0024365 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/ARM/CPU.pm 0000664 0000000 0000000 00000001303 13327377321 0025347 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::ARM::CPU;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_read("/proc/cpuinfo")
}
sub run {
my $params = shift;
my $common = $params->{common};
my @cpu;
my $current;
open CPUINFO, ") {
print;
if (/^Processor\s+:\s*:/) {
if ($current) {
$common->addCPU($current);
}
$current = {
CPUARCH => 'ARM',
};
}
$current->{TYPE} = $1 if /Processor\s+:\s+(\S.*)/;
}
# The last one
$common->addCPU($current);
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/Alpha.pm 0000664 0000000 0000000 00000000262 13327377321 0025331 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::Alpha;
use strict;
use Config;
sub check {
return 1 if $Config{'archname'} =~ /^alpha/;
0;
};
sub run{}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/Alpha/ 0000775 0000000 0000000 00000000000 13327377321 0024773 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/Alpha/CPU.pm 0000664 0000000 0000000 00000001564 13327377321 0025766 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::Alpha::CPU;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_read("/proc/cpuinfo")
}
sub run {
my $params = shift;
my $common = $params->{common};
my @cpu;
my $current;
open CPUINFO, ") {
print;
if (/^cpu\s*:/) {
if ($current) {
$common->addCPU($current);
}
$current = {
CPUARCH => 'Alpha',
};
} else {
$current->{SERIAL} = $1 if /^cpu serial number\s+:\s+(\S.*)/;
$current->{SPEED} = $1 if /cycle frequency \[Hz\]\s+:\s+(\d+)000000/;
$current->{TYPE} = $1 if /platform string\s+:\s+(\S.*)/;
}
}
# The last one
$common->addCPU($current);
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/MIPS.pm 0000664 0000000 0000000 00000000260 13327377321 0025052 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::MIPS;
use strict;
use Config;
sub check {
return 1 if $Config{'archname'} =~ /^mips/;
0;
};
sub run{}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/MIPS/ 0000775 0000000 0000000 00000000000 13327377321 0024516 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/MIPS/CPU.pm 0000664 0000000 0000000 00000001307 13327377321 0025504 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::MIPS::CPU;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_read("/proc/cpuinfo")
}
sub run {
my $params = shift;
my $common = $params->{common};
my @cpu;
my $current;
open CPUINFO, ") {
print;
if (/^system type\s+:\s*:/) {
if ($current) {
$common->addCPU($current);
}
$current = {
CPUARCH => 'MIPS',
};
}
$current->{TYPE} = $1 if /cpu model\s+:\s+(\S.*)/;
}
# The last one
$common->addCPU($current);
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/PowerPC.pm 0000664 0000000 0000000 00000000274 13327377321 0025626 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::PowerPC;
use strict;
use Config;
sub check {
return 1 if $Config{'archname'} =~ /^(ppc|powerpc)/;
0;
};
sub run{}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/PowerPC/ 0000775 0000000 0000000 00000000000 13327377321 0025265 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/PowerPC/CPU.pm 0000664 0000000 0000000 00000002447 13327377321 0026261 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::PowerPC::CPU;
use strict;
#processor : 0
#cpu : POWER4+ (gq)
#clock : 1452.000000MHz
#revision : 2.1
#
#processor : 1
#cpu : POWER4+ (gq)
#clock : 1452.000000MHz
#revision : 2.1
#
#timebase : 181495202
#machine : CHRP IBM,7029-6C3
#
#
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_read ("/proc/cpuinfo")
}
sub run {
my $params = shift;
my $common = $params->{common};
my @cpus;
my $current;
my $isIBM;
open CPUINFO, ") {
$isIBM = 1 if /^machine\s*:.*IBM/;
$current->{TYPE} = $1 if /cpu\s+:\s+(\S.*)/;
$current->{SPEED} = $1 if /clock\s+:\s+(\S.*)/;
$current->{SPEED} =~ s/\.[0-9]+MHz//;
if (/^\s*$/) {
if ($current->{TYPE}) {
push @cpus, $current;
}
$current = {};
}
}
if (/^\s*$/) {
if ($current->{TYPE}) {
push @cpus, $current;
}
$current = {};
}
foreach my $cpu (@cpus) {
$cpu->{MANUFACTURER} = 'IBM' if $isIBM;
$cpu->{CPUARCH} = 'PowerPC';
$common->addCPU($cpu);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/PowerPC/Various.pm 0000664 0000000 0000000 00000003174 13327377321 0027260 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::PowerPC::Various;
use strict;
sub check { 1 };
sub run {
my $params = shift;
my $common = $params->{common};
############ Motherboard
my $SystemManufacturer;
my $SystemModel;
my $SystemSerial;
my $BiosManufacturer;
my $BiosVersion;
my $BiosDate;
if (open SERIAL,";
$SystemSerial =~ s/[^\,^\.^\w^\ ]//g; # I remove some unprintable char
close SERIAL;
}
if (open MODEL,";
$SystemModel =~ s/[^\,^\.^\w^\ ]//g;
close MODEL;
}
if (open COLOR,";
close COLOR;
my ($color) = unpack "h7" , $tmp;
$SystemModel = $SystemModel." color: $color" if $color;
}
if (open OPENBOOT,";
$BiosVersion =~ s/[^\,^\.^\w^\ ]//g;
close OPENBOOT;
}
if (open COPYRIGHT,";
close COPYRIGHT;
if ($tmp =~ /Apple/) {
# What about the Apple clone?
$BiosManufacturer = "Apple Computer, Inc.";
$SystemManufacturer = "Apple Computer, Inc."
}
}
$common->setBios ({
SMANUFACTURER => $SystemManufacturer,
SMODEL => $SystemModel,
SSN => $SystemSerial,
BMANUFACTURER => $BiosManufacturer,
BVERSION => $BiosVersion,
BDATE => $BiosDate,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/SPARC.pm 0000664 0000000 0000000 00000000262 13327377321 0025154 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::SPARC;
use strict;
use Config;
sub check {
return 1 if $Config{'archname'} =~ /^sparc/;
0;
};
sub run{}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/SPARC/ 0000775 0000000 0000000 00000000000 13327377321 0024616 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/SPARC/CPU.pm 0000664 0000000 0000000 00000001121 13327377321 0025576 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::SPARC::CPU;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_read ("/proc/cpuinfo")
}
sub run {
my $params = shift;
my $common = $params->{common};
my @cpu;
my $current = { CPUARCH => 'ARM' };
my $ncpus = 1;
open CPUINFO, ") {
$current->{TYPE} = $1 if /cpu\s+:\s+(\S.*)/;
$ncpus = $1 if /ncpus probed\s+:\s+(\d+)/
}
foreach (1..$ncpus) {
$common->addCPU($current);
}
}
1
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/i386.pm 0000664 0000000 0000000 00000000270 13327377321 0024774 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::i386;
use strict;
use Config;
sub check {
return 1 if $Config{'archname'} =~ /^(i\d86|x86_64)/;
0;
};
sub run{}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/i386/ 0000775 0000000 0000000 00000000000 13327377321 0024437 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/i386/CPU.pm 0000664 0000000 0000000 00000011572 13327377321 0025432 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::i386::CPU;
use strict;
use Config;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_read("/proc/cpuinfo")
}
sub run {
open(my $fh, '<:encoding(UTF-8)', "/proc/cpuinfo") or warn;
my @cpuinfo = <$fh>;
close($fh);
my $params = shift;
my $common = $params->{common};
my @dmidecode = `dmidecode -t processor`;
my $fake_physid = 1;
my $processors;
my $processor;
my $vendor_id;
my $modelName;
my $cacheSize;
my $mhz;
my $physical_id;
my $siblings;
my $core_id;
my $cpuCores;
my $arch;
my $addressWidth;
my $dataWidth;
my $voltage;
my $serial;
my $maxMhz;
my $socket;
my $sockettype;
my $status;
$processor = $vendor_id = $modelName = $cacheSize = $mhz = $physical_id = $siblings
= $core_id = $cpuCores = $arch = $dataWidth = $addressWidth = $voltage = $serial
= $maxMhz = $socket = $status = $sockettype = "";
# get data from /proc/cpuinfo
foreach my $line (@cpuinfo) {
chomp $line;
if ($line =~ /^\s*$/) { # empty line, dump what we know
$physical_id = $fake_physid if ( $physical_id eq "");
$processors->{$physical_id}->{MANUFACTURER} = $vendor_id;
$processors->{$physical_id}->{TYPE} = $modelName;
$processors->{$physical_id}->{CURRENT_SPEED} = $mhz;
$processors->{$physical_id}->{L2CACHESIZE} = $cacheSize;
$processors->{$physical_id}->{CORES} = $cpuCores ? $cpuCores : 1;
$processors->{$physical_id}->{LOGICAL_CPUS} = $siblings ? $siblings : $processors->{$physical_id}->{CORES};
$processors->{$physical_id}->{CPUARCH} = $arch;
$processors->{$physical_id}->{DATA_WIDTH} = $dataWidth;
$processors->{$physical_id}->{CURRENT_ADDRESS_WIDTH} = $addressWidth;
$processor = $vendor_id = $modelName = $cacheSize = $mhz
= $physical_id = $siblings = $core_id = $cpuCores = $arch
= $dataWidth = $addressWidth = $voltage = $sockettype = "";
}
$processor = $1 if($line =~ /processor\s*:\s*(\S.*)/i);
$vendor_id = $2 if($line =~ /^vendor_id\s*:\s*(Authentic|Genuine|)(.+)/i);
$vendor_id =~ s/(TMx86|TransmetaCPU)/Transmeta/;
$vendor_id =~ s/CyrixInstead/Cyrix/;
$vendor_id =~ s/CentaurHauls/VIA/;
$modelName = $1 if($line =~ /model\sname\s*:\s*(\S.*)/i);
if($line =~ /cpu\sMHz\s*:\s*(\S.*)/i) {
$mhz = $1;
$mhz = sprintf "%i", $mhz;
}
if($line =~ /cache\ssize\s*:\s*(\S.*)/i) {
$cacheSize = $1;
$cacheSize =~ s/\D+//;
}
$physical_id = $1 if($line =~ /physical\sid\s*:\s*(\S.*)/i);
$siblings = $1 if($line =~ /siblings\s*:\s*(\S.*)/i);
$core_id = $1 if($line =~ /core\sid\s*:\s*(\S.*)/i);
$cpuCores = $1 if($line =~ /cpu\scores\s*:\s*(\S.*)/i);
if($line =~ /address\ssizes\s*:\s*(\S.*)/i) {
$addressWidth = $1;
$addressWidth =~ /(\d+)\s+bits\s*physical,\s*(\d+)\s*bits\s*virtual/;
$addressWidth = $2 ? $2 : ( $1 ? $1 : '' );
}
if($line =~ /flags/) {
if($line =~ /lm/) {
$arch = "x86_64";
$dataWidth = 64;
}
else {
$arch = "x86";
$dataWidth = 32;
}
}
}
$socket = -1;
foreach my $line (@dmidecode) {
chomp $line;
$socket++ if($line =~ /^Handle/); # handle opens a new processor in dmidecode output
next if $socket < 0; # if in preface still
if($line =~ /^\s*$/ ) { # end of processor/socket found
if ( $status ne "Unpopulated") {
if ($socket >= 0) {
$processors->{$socket}->{VOLTAGE} = $voltage;
$processors->{$socket}->{SPEED} = $maxMhz;
$processors->{$socket}->{SERIALNUMBER} = $serial;
$processors->{$socket}->{SOCKET} = $sockettype;
} # dmidecode tells about more CPUs than /proc/cpuinfo
}
$voltage = $maxMhz = $status = $serial = $sockettype = "";
}
$voltage = $1 if ($line =~ /Voltage:\s*(\S.*)/i);
$maxMhz = $1 if($line =~ /Current\sSpeed:\s*(\d+)/i);
$status = $1 if($line =~ /Status:\s*(\S.*)/i);
$serial = $1 if($line =~ /serial\sNumber:\s*(\S.*)/i);
if($line =~ /Upgrade:\s*(\S.*)/i) {
$sockettype = $1 unless ( $1 =~ /Unknown|Other/i );
}
}
foreach (keys %{$processors} ) {
$common->addCPU($processors->{$_});
}
}
1
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/m68k.pm 0000664 0000000 0000000 00000000256 13327377321 0025074 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::m68k;
use strict;
use Config;
sub check {
return 1 if $Config{'archname'} =~ /^m68k/;
0;
};
sub run{}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/m68k/ 0000775 0000000 0000000 00000000000 13327377321 0024533 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/m68k/CPU.pm 0000664 0000000 0000000 00000001412 13327377321 0025516 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::m68k::CPU;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_read("/proc/cpuinfo")
}
sub run {
my $params = shift;
my $common = $params->{common};
my @cpu;
my $current;
open CPUINFO, ") {
print;
if (/^CPU\s+:\s*:/) {
if ($current) {
$common->addCPU($current);
}
$current = {
CPUARCH => 'm68k',
};
} else {
$current->{TYPE} = $1 if /CPU:\s+(\S.*)/;
$current->{SPEED} = $1 if /Clocking:\s+:\s+(\S.*)/;
}
}
# The last one
$common->addCPU($current);
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/s390x.pm 0000664 0000000 0000000 00000000261 13327377321 0025171 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::s390x;
use strict;
use Config;
sub check {
return 1 if $Config{'archname'} =~ /^s390/;
0;
};
sub run{}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/s390x/ 0000775 0000000 0000000 00000000000 13327377321 0024634 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/s390x/CPU.pm 0000664 0000000 0000000 00000001435 13327377321 0025624 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Archs::s390x::CPU;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_read("/proc/cpuinfo")
}
sub run {
my $params = shift;
my $common = $params->{common};
my $current;
my $cpucores;
open CPUINFO, ") {
print;
if (/^vendor\s*:/) {
if ($current) {
$common->addCPU($current);
}
} elsif (/^processor [0-9]:\s+(\S.*)/) {
$cpucores++;
}
$current->{MANUFACTURER} = $1 if /vendor_id\s*:\s+(\S.*)/;
$current->{SPEED} = $1 if /bogomips per cpu:\s+(\S.*)/;
}
$current->{CORES} = $cpucores;
$common->addCPU($current);
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/ 0000775 0000000 0000000 00000000000 13327377321 0024152 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/LSB.pm 0000664 0000000 0000000 00000001057 13327377321 0025133 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::LSB;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("lsb_release")
}
sub run {
my $params = shift;
my $common = $params->{common};
my $release;
chomp($release =`lsb_release -is`);
my $OSversion;
chomp($OSversion =`lsb_release -rs`);
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => $release,
OSVERSION => $OSversion,
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB.pm 0000664 0000000 0000000 00000000234 13327377321 0025602 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB;
$runMeIfTheseChecksFailed = ["Ocsinventory::Agent::Backend::OS::Linux::Distro::LSB"];
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/ 0000775 0000000 0000000 00000000000 13327377321 0025245 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/ArchLinux.pm 0000664 0000000 0000000 00000000765 13327377321 0027510 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::ArchLinux;
use strict;
sub check {-f "/etc/arch-release"}
#####
sub findRelease {
my $v;
open V, ");
close V;
return "ArchLinux $v";
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/CentOS.pm 0000664 0000000 0000000 00000001102 13327377321 0026730 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::CentOS;
use strict;
sub check {
-f "/etc/centos-release"
&&
!readlink ("/etc/centos-release")
&&
!-f "/etc/vmware-release"
}
####
sub findRelease {
my $v;
open V, ");
close V;
$v;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Debian.pm 0000664 0000000 0000000 00000001041 13327377321 0026761 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Debian;
use strict;
sub check {-f "/etc/debian_version" && !-f "/etc/ubuntu_version"}
#####
sub findRelease {
my $v;
open V, ");
close V;
return "Debian GNU/Linux $v";
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Fedora.pm 0000664 0000000 0000000 00000000752 13327377321 0027007 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Fedora;
use strict;
sub check {-f "/etc/fedora-release"}
#####
sub findRelease {
my $v;
open V, ");
close V;
$v;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Gentoo.pm 0000664 0000000 0000000 00000001000 13327377321 0027025 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Gentoo;
use strict;
sub check {-f "/etc/gentoo-release"}
#####
sub findRelease {
my $v;
open V, ");
close V;
return "Gentoo Linux $v";
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Knoppix.pm 0000664 0000000 0000000 00000001033 13327377321 0027230 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Knoppix;
use strict;
sub check {-f "/etc/knoppix_version"}
#####
sub findRelease {
my $v;
open V, ");
close V;
print $v."\n";
return "Knoppix GNU/Linux $v";
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Mandrake.pm 0000664 0000000 0000000 00000001013 13327377321 0027320 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Mandrake;
use strict;
sub check {-f "/etc/mandrake-release" && !-f "/etc/mandriva-release"}
#####
sub findRelease {
my $v;
open V, ");
close V;
$v;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Mandriva.pm 0000664 0000000 0000000 00000001043 13327377321 0027342 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Mandriva;
use strict;
sub check {-f "/etc/mandrake-release" && -f "/etc/mandriva-release"}
#####
sub findRelease {
my $v;
open V, ");
close V;
return $v if $v;
0;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Oracle.pm 0000664 0000000 0000000 00000000773 13327377321 0027017 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::oracle;
use strict;
sub check {-f "/etc/oracle-release"}
#####
sub findRelease {
my $v;
open V, ");
close V;
return $v if $v;
0;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Redhat.pm 0000664 0000000 0000000 00000001104 13327377321 0027006 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Redhat;
use strict;
sub check {
-f "/etc/redhat-release"
&&
!readlink ("/etc/redhat-release")
&&
!-f "/etc/vmware-release"
}
####
sub findRelease {
my $v;
open V, ");
close V;
$v;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Slackware.pm 0000664 0000000 0000000 00000001141 13327377321 0027514 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Slackware;
use strict;
sub check {-f "/etc/slackware-version"}
#####
sub findRelease {
my $v;
open V, ");
foreach (){
$v=$1 if (/Slackware ([\d.]+)/);
close V;
return $v;
}
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => "Slackware",
OSVERSION => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/SuSE.pm 0000664 0000000 0000000 00000001071 13327377321 0026421 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::SuSE;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_read ("/etc/SuSE-release")
}
#####
sub findRelease {
my $v;
open V, ");
close V;
$v;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Trustix.pm 0000664 0000000 0000000 00000000755 13327377321 0027274 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Trustix;
use strict;
sub check {-f "/etc/trustix-release"}
#####
sub findRelease {
my $v;
open V, ");
close V;
$v;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Ubuntu.pm 0000664 0000000 0000000 00000001144 13327377321 0027065 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Ubuntu;
use strict;
use vars qw($runAfter);
$runAfter = ["Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Debian"];
sub check {-f "/etc/ubuntu_version"}
#####
sub findRelease {
my $v;
open V, ");
close V;
return "Ubuntu $v";
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/VmWare.pm 0000664 0000000 0000000 00000000752 13327377321 0027010 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::VmWare;
use strict;
sub check { -f "/etc/vmware-release" }
####
sub findRelease {
my $v;
open V, ");
close V;
$v;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSComment;
chomp($OSComment =`uname -v`);
$common->setHardware({
OSNAME => findRelease(),
OSCOMMENTS => "$OSComment"
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Domains.pm 0000664 0000000 0000000 00000001777 13327377321 0024652 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Domains;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run ("hostname");
my @domain = `hostname -d`;
return 1 if @domain || $common->can_read ("/etc/resolv.conf");
0;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $domain;
my %domain;
my @dns_list;
my $dns;
chomp($domain = `hostname -d`);
open RESOLV, "/etc/resolv.conf" or warn;
while (){
if (/^nameserver\s+(\S+)/i) {
push(@dns_list,$1);
} elsif (!$domain) {
$domain{$2} = 1 if (/^(domain|search)\s+(.+)/);
}
}
close RESOLV;
if (!$domain) {
$domain = join "/", keys %domain;
}
$dns=join("/",@dns_list);
# If no domain name, we send "WORKGROUP"
$domain = 'WORKGROUP' unless $domain;
$common->setHardware({
WORKGROUP => $domain,
DNS => $dns
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Drives.pm 0000664 0000000 0000000 00000011637 13327377321 0024510 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Drives;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run ("df");
my $df = `df -TP`;
return 1 if $df =~ /\w+/;
0
}
sub run {
my $params = shift;
my $common = $params->{common};
my %months = (
Jan => 1,
Fev => 2,
Mar => 3,
Apr => 4,
May => 5,
Jun => 6,
Jul => 7,
Aug => 8,
Sep => 9,
Oct => 10,
Nov => 11,
Dec => 12,
);
my %listVolume = ();
# Get complementary information in hash tab
if ($common->can_run ("lshal")) {
my %temp;
my $in = 0;
my $value;
foreach my $line (`lshal`) {
chomp $line;
if ( $line =~ s{^udi = '/org/freedesktop/Hal/devices/volume.*}{}) {
$in = 1;
%temp = ();
} elsif ($in == 1 and $line =~ s{^\s+(\S+) = (.*) \s*\((int|string|bool|string list|uint64)\)}{} ) {
if ($3 ne 'int' and $3 ne 'uint64') {
chomp($value = $2);
if ($3 eq 'string') {
chop($value);
#$value =~ s/^'?(.*)'?$/$1/g;
$value=substr($value,1,length($value));
$value=substr($value,0,length($value)-1);
}
$temp{$1} = $value;
} else {
$temp{$1} = (split(/\W/,$2))[0];
}
} elsif ($in== 1 and $line eq '') {
$in = 0 ;
$listVolume{$temp{'block.device'}} = {%temp};
}
}
}
foreach(`df -TP`) { # TODO retrieve error
my $createdate;
my $free;
my $filesystem;
my $label;
my $total;
my $type;
my $volumn;
my $serial;
if (/^(\S+)\s+(\S+)\s+(\S+)\s+(?:\S+)\s+(\S+)\s+(?:\S+)\s+(\S+)\n/){
$free = sprintf("%i",($4/1024));
$filesystem = $2;
$total = sprintf("%i",($3/1024));
$type = $5;
$volumn = $1;
# no virtual FS
next if ($filesystem =~ /^(tmpfs|usbfs|proc|devpts|devshm|udev)$/);
next if ($type =~ /^(tmpfs)$/);
if ($filesystem =~ /^ext(2|3|4|4dev)/ && $common->can_run('dumpe2fs')) {
foreach (`dumpe2fs -h $volumn 2> /dev/null`) {
if (/Filesystem UUID:\s+(\S+)/) {
$serial = $1;
} elsif (/Filesystem created:\s+\w+ (\w+) (\d+) ([\d:]+) (\d{4})$/) {
$createdate = $4.'/'.$months{$1}.'/'.$2.' '.$3;
} elsif (/Filesystem volume name:\s*(\S.*)/) {
$label = $1 unless $1 eq '';
}
}
} elsif ($filesystem =~ /^xfs$/ && $common->can_run('xfs_db')) {
foreach (`xfs_db -r -c uuid $volumn`) {
$serial = $1 if /^UUID =\s+(\S+)/;
;
}
foreach (`xfs_db -r -c label $volumn`) {
$label = $1 if /^label =\s+"(\S+)"/;
}
} elsif ($filesystem =~ /^vfat$/ && $common->can_run('dosfslabel')) {
chomp ($label = `dosfslabel $volumn`);
}
$label =~ s/\s+$//;
$serial =~ s/\s+$//;
# Check information and improve it
if (keys %listVolume) {
if ( defined $listVolume{$volumn} ) {
if ($filesystem eq '') { $filesystem = $listVolume{$volumn}->{'volume.fstype'};}
if ($label eq '') { $label = $listVolume{$volumn}->{'volume.label'};}
if ($total eq '') { $total = int($listVolume{$volumn}->{'volume.size'}/(1024*1024) + 0.5);}
if ($type eq '') { $type = $listVolume{$volumn}->{'storage.model'};}
if ($serial eq '') { $serial = $listVolume{$volumn}->{'volume.uuid'};}
delete ($listVolume{$volumn});
}
}
$common->addDrive({
CREATEDATE => $createdate,
FREE => $free,
FILESYSTEM => $filesystem,
LABEL => $label,
TOTAL => $total,
TYPE => $type,
VOLUMN => $volumn,
SERIAL => $serial
});
}
}
if ($common->can_run ("lshal")) {
while (my ($k,$v) = each %listVolume ) {
$common->addDrive({
FILESYSTEM => $v->{'volume.fstype'},
LABEL => $v->{'volume.label'},
TOTAL => int ($v->{'volume.size'}/(1024*1024) + 0.5),
TYPE => $v->{'storage.model'},
VOLUMN => $k,
SERIAL => $v->{'volume.uuid'}
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Inputs.pm 0000664 0000000 0000000 00000002645 13327377321 0024535 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Inputs;
use strict;
use warnings;
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my $in;
my $vendor;
my $phys;
my $name;
my $type;
if (open INPUTS, ") {
if (/^I: Bus=.*Vendor=(.*) Prod/){
$in=1;
$vendor=$1;
} elsif ($_ =~ /^$/) {
$in=0;
if ($phys && $phys =~ "input"){
$common->addInput({
DESCRIPTION=>$name,
CAPTION=>$name,
TYPE=>$type
});
}
} elsif ($in) {
if (/^P: Phys=.*(button).*/i) {
$phys="nodev";
} elsif (/^P: Phys=.*(input).*/i) {
$phys="input";
}
if (/^N: Name=\"(.*)\"/i){
$name=$1;
}
if (/^H: Handlers=(\w+)/i) {
if ($1 =~ ".*kbd.*") {
$type="Keyboard";
} elsif ($1 =~ ".*mouse.*") {
$type="Pointing";
} else {
$type=$1;
}
}
}
}
close INPUTS;
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/LVM.pm 0000664 0000000 0000000 00000004262 13327377321 0023706 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::LVM;
use strict;
use vars qw($runAfter);
$runAfter = ["Ocsinventory::Agent::Backend::OS::Linux::Drives"];
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run ("pvs");
1
}
sub run {
my $params = shift;
my $common = $params->{common};
use constant MB => (1024*1024);
if ($common->can_run('pvs')) {
foreach (`pvs --noheading --nosuffix --units b -o +pv_uuid`) {
chomp;
$_ =~s/^\s+//;
my @vs_elem=split('\s+');
my $status='VG: '.$vs_elem[1].', Fmt: '.$vs_elem[2].', Attr: '.$vs_elem[3];
$common->addDrive({
FREE => $vs_elem[5]/MB,
FILESYSTEM => 'LVM PV',
TOTAL => $vs_elem[4]/MB,
TYPE => $vs_elem[0],
VOLUMN => $status,
SERIAL => $vs_elem[6]
});
}
}
if ($common->can_run('vgs')) {
foreach (`vgs --noheading --nosuffix --units b -o +vg_uuid,vg_extent_size`) {
chomp;
$_ =~s/^\s+//;
my @vs_elem=split('\s+');
my $status = 'PV/LV: '.$vs_elem[1].'/'.$vs_elem[2]
.', Attr: '.$vs_elem[4].', PE: '.($vs_elem[8]/MB).' MB';
$common->addDrive({
FREE => $vs_elem[6]/MB,
FILESYSTEM => 'LVM VG',
TOTAL => $vs_elem[5]/MB,
TYPE => $vs_elem[0],
VOLUMN => $status,
SERIAL => $vs_elem[7]
});
}
}
if ($common->can_run('lvs')) {
foreach (`lvs -a --noheading --nosuffix --units b -o lv_name,vg_name,lv_attr,lv_size,lv_uuid,seg_count`) {
chomp;
$_ =~s/^\s+//;
my @vs_elem=split('\s+');
my $status='Attr: '.$vs_elem[2].', Seg: '.$vs_elem[5];
$common->addDrive({
FREE => 0,
FILESYSTEM => 'LVM LV',
TOTAL => $vs_elem[3]/MB,
TYPE => $vs_elem[1].'/'.$vs_elem[0],
VOLUMN => $status,
SERIAL => $vs_elem[4]
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Mem.pm 0000664 0000000 0000000 00000001256 13327377321 0023766 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Mem;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_read ("/proc/meminfo")
}
sub run {
my $params = shift;
my $common = $params->{common};
my $unit = 1024;
my $PhysicalMemory;
my $SwapFileSize;
# Memory informations
open MEMINFO, "/proc/meminfo";
while(){
$PhysicalMemory=$1 if /^memtotal\s*:\s*(\S+)/i;
$SwapFileSize=$1 if /^swaptotal\s*:\s*(\S+)/i;
}
# TODO
$common->setHardware({
MEMORY => sprintf("%i",$PhysicalMemory/$unit),
SWAP => sprintf("%i", $SwapFileSize/$unit),
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Network/ 0000775 0000000 0000000 00000000000 13327377321 0024337 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Network/IP.pm 0000664 0000000 0000000 00000002054 13327377321 0025206 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Network::IP;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run ("ip") || $common->can_run("ifconfig");
1;
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my @ip;
if ($common->can_run("ip")){
foreach (`ip a`){
if (/inet (\S+)\/\d{1,2}/){
($1=~/127.+/)?next:push @ip,$1;
} elsif (/inet6 (\S+)\d{2}/){
($1=~/::1\/128/)?next:push @ip, $1;
}
}
} elsif ($common->can_run("ifconfig")){
foreach (`ifconfig`){
#if(/^\s*inet\s*(\S+)\s*netmask/){
if (/^\s*inet add?r\s*:\s*(\S+)/ || /^\s*inet\s+(\S+)/){
($1=~/127.+/)?next:push @ip, $1;
} elsif (/^\s*inet6\s+(\S+)/){
($1=~/::1/)?next:push @ip, $1;
}
}
}
my $ip=join "/", @ip;
if (defined $ip) {
$common->setHardware({IPADDR => $ip});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Network/Networks.pm 0000664 0000000 0000000 00000055130 13327377321 0026515 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Network::Networks;
use strict;
use warnings;
use Data::Dumper;
use File::stat;
use Time::Local;
sub check {
my $params = shift;
my $common = $params->{common};
if ($common->can_run("ip") && $common->can_load("Net::IP qw(:PROC)") || ($common->can_run("ifconfig") && $common->can_run("route")) && $common->can_load("Net::IP qw(:PROC)")){
return 1;
} else {
return 0;
}
}
sub getLeaseFile {
my $if = @_;
my @directories = qw(
/var/db
/var/lib/dhclient
/var/lib/dhcp3
/var/lib/dhcp
/var/lib/NetworkManager
);
my @patterns = ("*$if*.lease", "*.lease", "dhclient.leases.$if");
my @files;
foreach my $directory (@directories) {
next unless -d $directory;
foreach my $pattern (@patterns) {
push @files,
grep { -s $_ }
glob("$directory/$pattern");
}
}
return unless @files;
@files =
map {$_->[0]}
sort {$a->[1]->ctime()<=>$b->[1]->ctime()}
map {[$_,stat($_)]}
@files;
return $files[-1];
}
sub _ipdhcp {
my $if = shift;
my $path;
my $dhcp;
my $ipdhcp;
my $leasepath;
if( $leasepath = getLeaseFile($if) ) {
if (open DHCP, $leasepath) {
my $lease;
while(){
$lease = 1 if(/lease\s*{/i);
$lease = 0 if(/^\s*}\s*$/);
#Interface name
if ($lease) { #inside a lease section
if (/interface\s+"(.+?)"\s*/){
$dhcp = ($1 =~ /^$if$/);
}
#Server IP
if (/option\s+dhcp-server-identifier\s+(\d{1,3}(?:\.\d{1,3}){3})\s*;/ and $dhcp){
$ipdhcp = $1;
}
}
}
close DHCP or warn;
} else {
warn "Can't open $leasepath\n";
}
}
return $ipdhcp;
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my $description;
my $driver;
my $ipaddress;
my $ipgateway;
my $ipmask;
my $ipsubnet;
my $ipaddress6;
my $ipgateway6;
my $ipmask6;
my $ipsubnet6;
my $macaddr;
my $pcislot;
my $status;
my $type;
my $virtualdev;
my $settings;
my $speed;
my $current_speed;
my $duplex;
my $ssid;
my $bssid;
my $mode;
my $version;
my $bitrate;
my $mtu;
my @netsum;
my $basedev;
my $slave;
my %gateway;
if ($common->can_run("ip")){
my @netsum = `ip addr show`;
push @netsum, "\n";
chomp @netsum;
for (my $i=0;$i<=$#netsum;$i+=1) {
my $line=$netsum[$i];
if ($line =~ /^(\d+(?) {
$driver = $1 if /^DRIVER=(\S+)/;
$pcislot = $1 if /^PCI_SLOT_NAME=(\S+)/;
}
close UEVENT;
}
# Retrieve speed from /sys/class/net/$description/speed
$speed=getSpeed($description);
# Retrieve duplex from /sys/class/net/$description/duplex
$duplex=getDuplex($description);
# Retrieve mtu from /sys/class/net/$description/mtu
$mtu=getMTU($description);
# Retrieve status from /sys/class/net/$description/status
$status=getStatus($description);
if (-d "/sys/class/net/$description/wireless"){
my @wifistatus = `iwconfig $description 2>/dev/null`;
foreach my $line (@wifistatus){
$ssid = $1 if ($line =~ /ESSID:(\S+)/);
$version = $1 if ($line =~ /IEEE (\S+)/);
$mode = $1 if ($line =~ /Mode:(\S+)/);
$bssid = $1 if ($line =~ /Access Point: (\S+)/);
$bitrate = $1 if ($line =~ /Bit\sRate=\s*(\S+\sMb\/s)/i);
}
$type = "Wifi";
$status=1;
} elsif (-f "/sys/class/net/$description/mode") {
$type="infiniband";
}
if (defined ($ipgateway)) {
$common->setHardware({
DEFAULTGATEWAY => $ipgateway
});
} elsif (defined ($ipgateway6)){
$common->setHardware({
DEFAULTGATEWAY => $ipgateway6
});
}
# Virtual devices
# Reliable way to get the info
if (-d "/sys/devices/virtual/net/") {
$virtualdev = (-d "/sys/devices/virtual/net/$description")?"1":"0";
} elsif ($common->can_run("brctl")) {
# Let's guess
my %bridge;
foreach (`brctl show`) {
next if /^bridge name/;
$bridge{$1} = 1 if /^(\w+)\s/;
}
if ($pcislot) {
$virtualdev = "1";
} elsif ($bridge{$description}) {
$virtualdev = "0";
}
$type = "bridge";
}
# Check if this is dialup interface
if ($description =~ m/^ppp$/) {
$type="dialup";
$virtualdev=1;
}
# Check if this is an alias or tagged interface
if ($description =~ m/^([\w\d]+)[:.]\d+$/) {
$basedev=$1;
$type="alias";
$virtualdev=1;
}
# Check if this is a bonding slave
if (-d "/sys/class/net/$description/bonding"){
$slave=getslaves($description);
$type="aggregate";
$virtualdev=1;
}
# Check if this is a vlan
if (-f "/proc/net/vlan/$description"){
$type="vlan";
$virtualdev=1;
}
if ($description && $ipaddress) {
if ($type eq "Wifi") {
$common->addNetwork({
DESCRIPTION => $description,
DRIVER => $driver,
IPADDRESS => $ipaddress,
IPDHCP => _ipdhcp($description),
IPGATEWAY => $ipgateway,
IPMASK => $ipmask,
IPSUBNET => $ipsubnet,
MACADDR => $macaddr,
PCISLOT => $pcislot,
STATUS => $status?"Up":"Down",
TYPE => $type,
SPEED => $bitrate,
SSID => $ssid,
BSSID => $bssid,
IEEE => $version,
MODE => $mode,
});
} else {
$common->addNetwork({
BASE => $basedev?$basedev : undef,
DESCRIPTION => $description,
DRIVER => $driver,
IPADDRESS => $ipaddress,
IPDHCP => _ipdhcp($description),
IPGATEWAY => $ipgateway,
IPMASK => $ipmask,
IPSUBNET => $ipsubnet,
MACADDR => $macaddr,
PCISLOT => $pcislot,
STATUS => $status?"Up":"Down",
TYPE => $type,
VIRTUALDEV => $virtualdev,
DUPLEX => $duplex?"Full":"Half",
SPEED => $speed,
MTU => $mtu,
SLAVE => $slave?$slave : undef,
});
}
} elsif ($description && $ipaddress6) {
$common->addNetwork({
BASE => $basedev?$basedev : undef,
DESCRIPTION => $description,
DRIVER => $driver,
IPADDRESS => $ipaddress6,
IPDHCP => _ipdhcp($description),
IPGATEWAY => $ipgateway6,
IPMASK => $ipmask6,
IPSUBNET => $ipsubnet6,
MACADDR => $macaddr,
PCISLOT => $pcislot,
STATUS => $status?"Up":"Down",
TYPE => $type,
VIRTUALDEV => $virtualdev,
DUPLEX => $duplex?"Full":"Half",
SPEED => $speed,
MTU => $mtu,
SLAVE => $slave?$slave : undef,
});
} else {
$common->addNetwork({
DESCRIPTION => $description,
DRIVER => $driver,
MACADDR => $macaddr,
PCISLOT => $pcislot,
STATUS => $status?"Up":"Down",
TYPE => $type,
VIRTUALDEV => $virtualdev,
DUPLEX => $duplex?"Full":"Half",
SPEED => $speed,
MTU => $mtu,
});
}
$description = $driver = $ipaddress = $ipgateway = $ipmask = $ipsubnet = $ipaddress6 = $ipgateway6 = $ipmask6 = $ipsubnet6 = $macaddr = $pcislot = $status = $type = $virtualdev = $speed = $duplex = $mtu = undef;
}
$description = $1 if ($line =~ /^\d+:\s+([^:@]+)/); # Interface name
if ($description && $description eq "lo" ) { next; } # loopback interface is not inventoried
if ($line =~ /inet ((?:\d{1,3}+\.){3}\d{1,3})\/(\d+)/i){
$ipaddress=$1;
$ipmask=getIPNetmask($2);
$ipsubnet=getSubnetAddressIPv4($ipaddress,$ipmask);
$ipgateway=getIPRoute($ipaddress);
} elsif ($line =~ /\s+link\/(\S+)/){
$type=$1;
if ($type eq "ether"){
$type="ethernet";
}
$macaddr=getMAC($description);
} elsif ($line =~ /inet6 (\S+)\/(d{1,2})/i){
$ipaddress6=$1;
$ipmask6=getIPNetmaskV6($2);
$ipsubnet6=getSubnetAddressIPv6($ipaddress6,$ipmask6);
$ipgateway6=getIPRoute($ipaddress6);
}
}
} elsif ($common->can_run("ifconfig")){
foreach my $line (`ifconfig -a`) {
if ($line =~ /^$/ && $description && $macaddr) {
# end of interface section
# I write the entry
if (defined($ipgateway)){
$common->setHardware({
DEFAULTGATEWAY => $ipgateway
});
} elsif (defined($ipgateway6)) {
$common->setHardware({
DEFAULTGATEWAY => $ipgateway6
});
}
if (-d "/sys/class/net/$description/wireless"){
my @wifistatus = `iwconfig $description`;
foreach my $line (@wifistatus){
$ssid = $1 if ($line =~ /ESSID:(\S+)/);
$version = $1 if ($line =~ /IEEE (\S+)/);
$mode = $1 if ($line =~ /Mode:(\S+)/);
$bssid = $1 if ($line =~ /Access Point: (\S+)/);
$bitrate = $1 if ($line =~ /Bit\sRate=\s*(\S+\sMb\/s)/i);
}
$type = "Wifi";
} elsif (-f "/sys/class/net/$description/mode") {
$type="infiniband";
}
if (open UEVENT, ") {
$driver = $1 if /^DRIVER=(\S+)/;
$pcislot = $1 if /^PCI_SLOT_NAME=(\S+)/;
}
close UEVENT;
}
# Retrieve speed from /sys/class/net/$description/speed
$speed=getSpeed($description);
# Retrieve duplex from /sys/class/net/$description/duplex
$duplex=getDuplex($description);
# Virtual devices
# Reliable way to get the info
if (-d "/sys/devices/virtual/net/") {
$virtualdev = (-d "/sys/devices/virtual/net/$description")?"1":"0";
} elsif ($common->can_run("brctl")) {
# Let's guess
my %bridge;
foreach (`brctl show`) {
next if /^bridge name/;
$bridge{$1} = 1 if /^(\w+)\s/;
}
if ($pcislot) {
$virtualdev = "1";
} elsif ($bridge{$description}) {
$virtualdev = "0";
}
$type = "bridge";
}
# Check if this is dialup interface
if ($description =~ m/^ppp$/) {
$type="dialup";
$virtualdev=1;
}
# Check if this is an alias or tagged interface
if ($description =~ m/^([\w\d]+)[:.]\d+$/) {
$basedev=$1;
$type="alias";
$virtualdev=1;
}
# Check if this is a bonding slave
if (-d "/sys/class/net/$description/bonding"){
$slave=getslaves($description);
$type="aggregate";
$virtualdev=1;
}
# Check if this is a vlan
if (-f "/proc/net/vlan/$description"){
$type="vlan";
$virtualdev=1;
}
if ($description && $ipaddress) {
if ($type eq "Wifi") {
$common->addNetwork({
DESCRIPTION => $description,
DRIVER => $driver,
IPADDRESS => $ipaddress,
IPDHCP => _ipdhcp($description),
IPGATEWAY => $ipgateway,
IPMASK => $ipmask,
IPSUBNET => $ipsubnet,
MACADDR => $macaddr,
PCISLOT => $pcislot,
STATUS => $status?"Up":"Down",
TYPE => $type,
SPEED => $bitrate,
SSID => $ssid,
BSSID => $bssid,
IEEE => $version,
MODE => $mode,
});
} else {
$common->addNetwork({
BASE => $basedev?$basedev : undef,
DESCRIPTION => $description,
DRIVER => $driver,
IPADDRESS => $ipaddress,
IPDHCP => _ipdhcp($description),
IPGATEWAY => $ipgateway,
IPMASK => $ipmask,
IPSUBNET => $ipsubnet,
MACADDR => $macaddr,
PCISLOT => $pcislot,
STATUS => $status?"Up":"Down",
TYPE => $type,
VIRTUALDEV => $virtualdev,
DUPLEX => $duplex?"Full":"Half",
SPEED => $speed,
MTU => $mtu,
SLAVE => $slave?$slave : undef,
});
}
} elsif ($description && $ipaddress6) {
$common->addNetwork({
BASE => $basedev?$basedev : undef,
DESCRIPTION => $description,
DRIVER => $driver,
IPADDRESS => $ipaddress6,
IPDHCP => _ipdhcp($description),
IPGATEWAY => $ipgateway6,
IPMASK => $ipmask6,
IPSUBNET => $ipsubnet6,
MACADDR => $macaddr,
PCISLOT => $pcislot,
STATUS => $status?"Up":"Down",
TYPE => $type,
VIRTUALDEV => $virtualdev,
DUPLEX => $duplex?"Full":"Half",
SPEED => $speed,
MTU => $mtu,
SLAVE => $slave?$slave : undef,
});
}
}
if ($line =~ /^$/) { # End of section
$description = $driver = $ipaddress = $ipgateway = $ipmask = $ipsubnet = $macaddr = $pcislot = $status = $type = $virtualdev = $speed = $duplex = $mtu = undef;
} else { # In a section
if ($line =~ /^(\S+):/) {
$description = $1; # Interface name
if ($description && $description eq "lo" ) { next; } # loopback interface is not inventoried
}
if ($line =~ /inet add?r:(\S+)/i || $line =~ /^\s*inet\s+(\S+)/i || $line =~ /inet (\S+)\s+netmask/i){
$ipaddress=$1;
$ipmask=getIPNetmask($ipaddress);
$ipsubnet=getSubnetAddressIPv4($ipaddress,$ipmask);
$ipgateway=getRouteIfconfig($ipaddress);
} elsif ($line =~ /inet6 (\S+)\s+prefixlen\s+(\d{2})/i){
$ipaddress6=$1;
$ipmask6=getIPNetmaskV6($ipaddress6);
$ipsubnet6=getSubnetAddressIPv6($ipaddress6,$ipmask6);
$ipgateway6=getRouteIfconfig($ipaddress6);
}
$macaddr = $1 if ($line =~ /hwadd?r\s+(\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2})/i || $line =~ /ether\s+(\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2})/i);
$status = 1 if ($line =~ /^\s+UP\s/ || $line =~ /flags=.*[<,]UP[,>]/);
$type = $1 if ($line =~ /link encap:(\S+)/i);
$type = $2 if ($line =~ /^\s+(loop|ether).*\((\S+)\)/i);
if ($type eq "ether" || $type eq "Ethernet") {
$type="ethernet";
}
# Retrieve mtu from /sys/class/net/$description/mtu
$mtu=getMTU($description);
}
}
}
}
sub getslaves{
my ($name)=@_;
my @slaves= map{$_ =~/\/lowr_(\w+)$/} glob("/sys/class/net/$name/lower_*");
return join(",", @slaves);
}
sub getSpeed{
my ($prefix)=@_;
my $speed;
my $current_speed=0;
return undef unless $prefix;
if ( ! -z "/sys/class/net/$prefix/speed") {
open SPEED, "){
$current_speed=$_;
}
close SPEED;
chomp($current_speed);
if ($current_speed eq "65535" || $current_speed eq ""){
$current_speed = "Unknown";
}
if ($current_speed gt 100 ){
$speed = ($current_speed/1000)." Gbps";
} else {
$speed = $current_speed." Mbps";
}
}
return $speed;
}
sub getDuplex{
my ($prefix)=@_;
my $duplex;
return undef unless $prefix;
if (open DUPLEX, "){
$duplex=chomp($_);
}
close DUPLEX;
}
return $duplex;
}
sub getMTU {
my ($prefix)=@_;
my $mtu;
return undef unless $prefix;
if (open MTU, "){
chomp;
$mtu=$_;
}
close MTU;
}
return $mtu;
}
sub getStatus {
my ($prefix)=@_;
my $status;
return undef unless $prefix;
if (open STATUS, "){
chomp;
$status=$_;
}
close STATUS;
}
return $status;
}
sub getMAC {
my ($prefix)=@_;
my $mac;
return undef unless $prefix;
if (open MAC, "){
chomp;
$mac=$_;
}
close MAC;
}
return $mac;
}
sub getSubnetAddressIPv4 {
my ($address,$mask)=@_;
return undef unless $address && $mask;
my $binaddress=ip_iptobin($address, 4);
my $binmask=ip_iptobin($mask, 4);
my $binsubnet=$binaddress & $binmask;
return ip_bintoip($binsubnet, 4);
}
sub getIPNetmask {
my ($prefix) = @_;
return undef unless $prefix;
return ip_bintoip(ip_get_mask($prefix, 4), 4);
}
sub getSubnetAddressIPv6 {
my ($address,$mask)=@_;
return undef unless $address && $mask;
my $binaddress = ip_iptobin($address, 6);
my $binmask = ip_iptobin($mask, 6);
my $binsubnet = $binaddress & $binmask;
return ip_compress_address(ip_bintoip($binsubnet, 6),6);
}
sub getIPNetmaskV6 {
my ($prefix) = @_;
return undef unless $prefix;
return ip_compress_address(ip_bintoip(ip_get_mask($prefix, 6), 6),6);
}
sub getIPRoute {
my ($prefix) = @_;
my $route;
return undef unless $prefix;
if (ip_is_ipv4($prefix)) {
foreach my $line (`ip route`){
$route = $1 if $line =~ /^default via\s+(\S+)/;
}
} elsif (ip_is_ipv6($prefix)) {
foreach my $line (`ip -6 route`){
next if $line =~ /^Unreachable/;
$route = $1 if $line =~ /^(.*)\/.*/;
}
}
return $route;
}
sub getRouteIfconfig {
my ($prefix) = @_;
my $route;
return undef unless $prefix;
if (ip_is_ipv4($prefix)) {
foreach my $line (`route -n`){
next if $line =~ /^Default/;
$route = $1 if $line =~ /^0.0.0.0\s+(\S+)/;
}
} elsif (ip_is_ipv6($prefix)) {
foreach my $line (`route -6n`){
next if $line =~ /^2002/;
$route = $1 if $line =~ /^(.*)\/.*/;
}
}
return $route;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Sounds.pm 0000664 0000000 0000000 00000001010 13327377321 0024507 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Sounds;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("lspci")
}
sub run {
my $params = shift;
my $common = $params->{common};
foreach(`lspci`){
if (/audio/i && /^\S+\s([^:]+):\s*(.+?)(?:\(([^()]+)\))?$/i){
$common->addSound({
'DESCRIPTION' => $3,
'MANUFACTURER' => $2,
'NAME' => $1,
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Storages.pm 0000664 0000000 0000000 00000053243 13327377321 0025042 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Storages;
use strict;
use XML::Simple;
sub check {
my $params = shift;
my $common = $params->{common};
return unless ($common->can_run("lshw") || $common->can_run("lsscsi") || $common->can_run("lsblk") || $common->can_run("smartctl") || $common->can_run("multipath") || $common->can_run("udevinfo") || $common->can_run("udevadm") || $common->can_run("hdparm"));
}
######## TODO
# Do not remove, used by other modules
sub getFromUdev {
my @devs;
foreach (glob ("/dev/.udev/db/*")) {
my ($scsi_coid, $scsi_chid, $scsi_unid, $scsi_lun, $path, $device, $vendor, $model, $revision, $serial, $serial_short, $type, $bus, $capacity);
if (/^(\/dev\/.udev\/db\/.*)([sh]d[a-z]+)$/) {
$path = $1;
$device = $2;
open (PATH, $1 . $2);
while () {
if (/^S:.*-scsi-(\d+):(\d+):(\d+):(\d+)/) {
$scsi_coid = $1;
$scsi_chid = $2;
$scsi_unid = $3;
$scsi_lun = $4;
}
$vendor = $1 if /^E:ID_VENDOR=(.*)/;
$model = $1 if /^E:ID_MODEL=(.*)/;
$revision = $1 if /^E:ID_REVISION=(.*)/;
$serial = $1 if /^E:ID_SERIAL=(.*)/;
$serial_short = $1 if /^E:ID_SERIAL_SHORT=(.*)/;
$type = $1 if /^E:ID_TYPE=(.*)/;
$bus = $1 if /^E:ID_BUS=(.*)/;
}
$serial_short = $serial unless $serial_short =~ /\S/;
$capacity = getCapacity($device);
push (@devs, {NAME => $device, MANUFACTURER => $vendor, MODEL => $model, DESCRIPTION => $bus, TYPE => $type, DISKSIZE => $capacity, SERIALNUMBER => $serial_short, FIRMWARE => $revision, SCSI_COID => $scsi_coid, SCSI_CHID => $scsi_chid, SCSI_UNID => $scsi_unid, SCSI_LUN => $scsi_lun});
close (PATH);
}
}
return @devs;
}
sub getFromSysProc {
my($dev, $file) = @_;
my $value;
foreach ("/sys/block/$dev/device/$file", "/proc/ide/$dev/$file") {
next unless open PATH, $_;
chomp(my $value = );
$value =~ s/^(\w+)\W*/$1/;
return $value;
}
}
sub getCapacity {
my ($dev) = @_;
my $cap;
chomp ($cap = `fdisk -s /dev/$dev 2>/dev/null`); #requires permissions on /dev/$dev
$cap = int ($cap*1024) if $cap;
return $cap;
}
sub getDescription {
my ($name, $manufacturer, $description, $serialnumber) = @_;
# detected as USB by udev
# TODO maybe we should trust udev detection by default?
return "USB" if (defined ($description) && $description =~ /usb/i);
if ($name =~ /^s/) { # /dev/sd* are SCSI _OR_ SATA
if ($manufacturer =~ /ATA/ || $serialnumber =~ /ATA/ || $description =~ /ATA/i) {
return "SATA";
} else {
return "SCSI";
}
} else {
return "IDE";
}
}
sub getManufacturer {
my ($model) = @_;
#if($model =~ /(maxtor|western|sony|compaq|hewlett packard|ibm|seagate|toshiba|fujitsu|lg|samsung|nec|transcend)/i) {
# return ucfirst(lc($1));
if ($model =~ /^(IBM|LG|NEC$)/){
return $1;
} elsif ($model =~ /(maxtor|western|sony|compaq|hewlett packard|ibm|seagate|toshiba|fujitsu|lg|samsung|nec$|transcend)/i) {
$model = lc($1);
$model = s/\b(\w)/\u$1/g;
return $model;
} elsif ($model =~ /^HP/) {
return "Hewlett-Packard";
} elsif ($model =~ /^WD/) {
return "Western Digital";
} elsif ($model =~ /^ST/) {
return "Seagate";
} elsif ($model =~ /^(HD|IC|HU)/) {
return "Hitachi";
} elsif ($model =~ /^NECVMWar/) {
return "VMware";
} elsif ($model =~ /^VBOX/){
return "Virtual Box";
} else {
return $model;
}
}
sub getMultipathDisks {
my @mpList = `multipath -l`;
my @devs;
my $volume;
my $serial;
my $dm;
my $manufacturer;
my $model;
foreach my $line (@mpList) {
if ($line =~ /^([\w\d]+)\s\((.*)\)\s(dm-\d+)\s(\w+)\s+,([\w\d\s]+)$/i) {
$volume = $1;
$serial = $2;
$dm = $3;
$manufacturer = $4;
$model = $5;
}
if ($line =~ /size=(\d+)(\w+)\s/) {
my $size = $1;
my $unit = $2;
# conversion to mebibyte
my %conversion = (
"T" => 1000**4,
"G" => 1000**3,
"M" => 1000**2,
"K" => 1000,
);
if ($conversion{$unit}) {
$size = $size / $conversion{$unit} * 2**20;
} else {
$size = $size." ".$unit;
}
push (@devs, {NAME=>$dm, DESCRIPTION=>$volume, TYPE=>"Multipath volume", MODEL=>$model, SERIALNUMBER=>$serial, MANUFACTURER=>$manufacturer});
}
if ($line =~ /(sd[a-z]+)/i) {
push (@devs, {NAME=>$1, DESCRIPTION=>"Child of $dm", TYPE=>"Multipath child"});
}
}
return @devs;
}
# some hdparm release generated kernel error if they are
# run on CDROM device
# http://forums.ocsinventory-ng.org/viewtopic.php?pid=20810
sub correctHdparmAvailable {
my $hdparmVersion = `hdparm -V`;
if ($hdparmVersion =~ /^hdparm v(\d+)\.(\d+)(\.|$)/) {
return 1 if $1>9;
return 1 if $1==9 && $2>=15;
}
return;
}
# get available md softraid devices
sub getMdDevices {
return unless ( open(my $fh, '<:encoding(UTF-8)', '/proc/mdstat') );
my @lines = <$fh>;
close($fh);
my $devName;
my $raidLevel;
my @devs;
foreach (@lines) {
chomp($_);
if (/^(md\d*)\s*:\s*\w*\s*(raid\d)/) {
$devName = $1;
$raidLevel = $2;
push (@devs, {NAME => $devName, MODEL => $raidLevel});
}
}
return @devs;
}
# get available block devices from /dev
sub getFromDev {
my @devs;
my @disks;
my $dir = "/dev";
opendir (my $dh, $dir) or die $!;
@disks = grep{/^sd[a-z][a-z]?$|^vd[a-z][a-z]?$|^sr\d+$/} readdir($dh);
foreach (@disks) {
push (@devs, {NAME => $_});
}
return @devs;
}
# get data from lshw
sub getFromLshw {
my @devs;
my @inputlines = `lshw -class disk -xml -quiet`;
return unless $inputlines[0] =~ /xml/i;
my $foundcdroms = 0;
my $input;
foreach (@inputlines) {
if ( /\/g) { # adding "" root element because
$input =~ s/\?>/\?>\n/; # prior to version B.02.16, "lshw -class disk -xml" produces xml output
$input .= "\n
"; # without the "" root element, which does not parse correctly.
}
my $xml = new XML::Simple;
my $data = $xml->XMLin($input);
my $nodes = $data->{list}->{node};
foreach my $device (sort keys %$nodes) {
my $description = "";
my $size = 0;
my $sizeUnits = "";
my $name = "not set";
my $type = "";
my $vendor = "";
my $model = "";
my $serial = "";
my $revision = "";
if ($nodes->{$device}->{description}) {
$description = $nodes->{$device}->{description};
}
if ($nodes->{$device}->{size}) {
my %units = ('bytes', 1, 'kilobytes', 10**3, 'megabytes', 10**6, 'gigabytes', 10**9, 'terabytes', 10**12);
$sizeUnits = $nodes->{$device}->{size}->{units};
$size = $nodes->{$device}->{size}->{content};
$size = $size * $units{$sizeUnits};
$size = sprintf "%i", $size;
}
if ($nodes->{$device}->{logicalname}) {
$name = $nodes->{$device}->{logicalname};
if (ref($name) eq 'ARRAY') {
foreach (@{$name}) {
if (!readlink $_) {
$name = $_;
last;
}
}
}
$name =~ s/\/dev\///;
}
if ($nodes->{$device}->{type}) {
$type = $nodes->{$device}->{type};
}
if ($nodes->{$device}->{vendor}) {
$vendor = $nodes->{$device}->{vendor};
}
if ($nodes->{$device}->{model}) {
$model = $nodes->{$device}->{model};
}
if ($nodes->{$device}->{serial}) {
$serial = $nodes->{$device}->{serial};
}
push (@devs, {
NAME => $name,
MANUFACTURER => getManufacturer($vendor),
MODEL => $model,
DESCRIPTION => $description,
TYPE => $type,
DISKSIZE => $size,
SERIALNUMBER => $serial,
FIRMWARE => $revision
});
}
return @devs;
}
# get data from lsscsi
sub getFromLsscsi {
my @devs;
my ($id, $type, $vendor, $model, $rev, $device);
foreach my $line (`lsscsi`) {
($id, $type, $vendor, $model, $rev, $device) = unpack ('a13a8a9a17a6a15', $line);
$vendor =~ s/\s*$//;
$type =~ s/\s*$//;
$model =~ s/\s*$//;
my @columns = split /\s+/, $line;
my $deviceName = $columns[-1];
$deviceName =~ s/\/dev\///;
#debug print Dumper {NAME => $deviceName, MANUFACTURER => $vendor, TYPE => $type, MODEL => $model};
if ($type =~ /cd\/dvd|disk/) {
push (@devs, {NAME => $deviceName, MANUFACTURER => getManufacturer($vendor), TYPE => $type, MODEL => $model});
}
}
return @devs;
}
# get data from lsblk
sub getFromLsblk {
my @devs;
foreach my $line (`lsblk -ldbn`) {
my @columns = split /\s+/, $line;
my $deviceName = $columns[0];
my $size = $columns[3];
my $type = $columns[5];
$size = "" if ($type =~ /rom/);
push (@devs, {NAME => $deviceName, TYPE => $type, DISKSIZE => $size});
}
return @devs;
}
# get data from smartctl
sub getFromSmartctl {
my ($params, $devices) = @_;
my @devs;
foreach my $device (keys %$devices) {
my $vendor = "";
my $product = "";
my $revision = "";
my $size = "";
my $type = "";
my $serialnum = "";
my $description = "";
my $devName = $devices->{$device}->{NAME};
foreach my $line (`smartctl -i /dev/$devName`) {
chomp($line);
if ($line =~ m/Model Family:\s+(\S+.*)\s*$/i){
$vendor = $1;
} elsif ($line =~ m/Vendor:\s+(\S+.*)\s*$/i) {
$vendor = $1;
} elsif ($line =~ m/Device Model:\s+(\S+.*)\s*$/i){
$product = $1;
} elsif ($line =~ m/Product:\s+(\S+.*)\s*$/i) {
$product = $1;
} elsif ($line =~ m/Revision:\s+(\S+.*)\s*$/i) {
$revision = $1;
} elsif ($line =~ m/Firmware Version:\s+(\S+.*)\s*$/i) {
$revision = $1;
} elsif ($line =~ m/Serial Number:\s+(\S+.*)\s*$/i) {
$serialnum = $1;
} elsif ($line =~ m/User Capacity:\s+([\d\.,]+)\s+bytes/i) {
$size = $1;
$size =~ s/[\.,]//g;
} elsif ($line =~ m/Device type:\s+(\S+.*)\s*$/i) {
$type = $1;
} elsif ($line =~ m/Model Family\s+(\S.*)\s*/i) {
$description = $1;
}
}
push (@devs, {
NAME => $devName,
MANUFACTURER => getManufacturer($vendor),
MODEL => $product,
FIRMWARE => $revision,
TYPE => $type,
DISKSIZE => $size,
SERIALNUMBER => $serialnum,
DESCRIPTION => $description
});
}
return @devs;
}
# get data from UDEV
sub getFromuDev2 {
my $params = shift;
my $common = $params->{common};
my ($devices) = @_;
my @input;
my @devs;
foreach my $device (keys %$devices) {
my $type = "";
my $model = "";
my $vendor = "";
my $firmware = "";
my $serial = "";
my $serial_short = "";
my $serial_scsi = "";
my $serial_md = "";
my $devName = $devices->{$device}->{NAME};
if ($common->can_run("udevadm")) {
@input = `udevadm info -q all -n /dev/$devName`;
} else {
@input = `udevinfo -q all -n /dev/$devName`;
}
foreach my $line (@input) {
if ($line =~ m/ID_TYPE=(\S+.*)\s*$/){
$type = $1;
} elsif ($line =~ m/ID_MODEL=(\S+.*)\s*$/) {
$model = $1;
$model =~ s/_/ /g;
} elsif ($line =~ m/ID_VENDOR=(\S+.*)\s*$/) {
$vendor = $1;
} elsif ($line =~ m/ID_REVISION=(\S+.*)\s*$/) {
$firmware = $1;
} elsif ($line =~ m/ID_SERIAL_SHORT=(\S+.*)\s*$/) {
$serial_short = $1;
} elsif ($line =~ m/ID_SCSI_SERIAL=(\S+.*)\s*$/) {
$serial_scsi = $1;
} elsif ($line =~ m/ID_SERIAL=(\S+.*)\s*$/) {
$serial = $1;
}
if ($line =~ m/MD_LEVEL=(\S+.*)\s*$/) {
$model = $1;
} elsif ($line =~ m/MD_METADATA=(\d\.?\d?)/) {
$firmware = $1;
$firmware = "MD METADATA ".$firmware;
} elsif ($line =~ m/MD_UUID=(\S+.*)\s*$/) {
$serial_md = $1;
}
}
$serial = $serial_short unless $serial_short eq ""; # prefer serial_short over serial
$serial = $serial_scsi unless $serial_scsi eq "";
$serial = $serial_md unless $serial_md eq "";
if ($devName =~ /md\d+/) { # if device is a multiple disk softraid
$type = "MD";
$vendor = "Linux";
}
push (@devs, {
NAME => $devName,
TYPE => $type,
MODEL => $model,
MANUFACTURER => getManufacturer($vendor),
FIRMWARE => $firmware,
SERIALNUMBER => $serial
});
}
return @devs;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my $devices = {};
my ($serial,$cap,$unit,$model,$manufacturer,$type,$desc,$firmware,$name);
my @partitions;
# Get complementary information in hash tab
if ($common->can_run ("lshal")) {
my %temp;
my $in = 0;
my $value;
foreach my $line (`lshal`) {
chomp $line;
if ($line =~ s{^udi = '/org/freedesktop/Hal/devices/storage.*}{}) {
$in = 1;
%temp = ();
} elsif ($in == 1 and $line =~ s{^\s+(\S+) = (.*) \s*\((int|string|bool|string list|uint64)\)}{} ) {
my $key = $1;
my $value = $2;
$value =~ s/^'(.*)'\s*$/$1/; # Drop the quote
$value =~ s/\s+$//; # Drop the trailing white space
if ($key eq 'storage.serial') {
$temp{SERIALNUMBER} = $value;
} elsif ($key eq 'storage.firmware_version') {
$temp{FIRMWARE} = $value;
} elsif ($key eq 'block.device') {
$value =~ s/\/dev\/(\S+)/$1/;
$temp{NAME} = $value;
} elsif ($key eq 'info.vendor') {
$temp{MANUFACTURER} = getManufacturer($value);
} elsif ($key eq 'storage.model') {
$temp{MODEL} = $value;
} elsif ($key eq 'storage.drive_type') {
$temp{TYPE} = $value;
} elsif ($key eq 'storage.size') {
$temp{DISKSIZE} = int($value/(1024*1024) + 0.5);
}
} elsif ($in== 1 and $line eq '' and $temp{NAME}) {
$in = 0 ;
$devices->{$temp{NAME}} = {%temp};
}
}
}
foreach my $device (getMultipathDisks($params)) {
my $name = $device->{NAME};
foreach my $f ("NAME", "MANUFACTURER", "MODEL", "SERIALNUMBER", "DESCRIPTION", "TYPE") {
$devices->{$name}->{$f} = $device->{$f};
}
}
foreach my $device (getFromDev($params)) {
my $name = $device->{NAME};
foreach my $f ("NAME") {
if($devices->{$name}->{$f} eq "") {
#debug print "getFromDev $name $f device->{\$f} $device->{$f}\n";
$devices->{$name}->{$f} = $device->{$f};
}
}
}
foreach my $device (getMdDevices($params)) {
my $name = $device->{NAME};
foreach my $f ("NAME", "MODEL") {
if ($devices->{$name}->{$f} eq "") {
$devices->{$name}->{$f} = $device->{$f};
}
}
}
foreach my $device (getFromSmartctl($params,$devices)) {
my $name = $device->{NAME};
foreach my $f ("NAME", "MANUFACTURER", "TYPE", "MODEL", "DISKSIZE", "FIRMWARE", "SERIALNUMBER", "DESCRIPTION") {
if ($devices->{$name}->{$f} eq "") {
#debug print "getFromSmartctl $name $f device->{\$f} $device->{$f}\n";
$devices->{$name}->{$f} = $device->{$f};
}
}
}
foreach my $device (getFromuDev2($params,$devices)) {
my $name = $device->{NAME};
foreach my $f ("NAME", "MANUFACTURER", "TYPE", "MODEL", "FIRMWARE", "SERIALNUMBER") {
if ($devices->{$name}->{$f} eq "") {
#debug print "getFromuDev2 $name $f device->{\$f} $device->{$f}\n";
$devices->{$name}->{$f} = $device->{$f};
}
}
}
foreach my $device (getFromLshw($params)) {
my $name = $device->{NAME};
foreach my $f ("NAME", "MANUFACTURER", "MODEL", "DESCRIPTION", "TYPE", "DISKSIZE", "SERIALNUMBER", "FIRMWARE") {
if ($devices->{$name}->{$f} eq "") {
#debug print "getFromLshw $name $f device->{\$f} $device->{$f}\n";
$devices->{$name}->{$f} = $device->{$f};
}
}
}
foreach my $device (getFromLsblk($params)) {
my $name = $device->{NAME};
foreach my $f ("NAME", "DISKSIZE", "TYPE") {
if ($devices->{$name}->{$f} eq "") {
#debug print "getFromLsblk $name $f device->{\$f} $device->{$f}\n";
$devices->{$name}->{$f} = $device->{$f};
}
}
}
foreach my $device (getFromUdev($params)) {
my $name = $device->{NAME};
foreach my $f ("NAME", "MANUFACTURER", "MODEL", "DESCRIPTION", "TYPE", "DISKSIZE", "SERIALNUMBER", "FIRMWARE", "SCSI_COID", "SCSI_CHID", "SCSI_UNID", "SCSI_LUN") {
if ($devices->{$name}->{$f} eq "") {
#debug print "getFromuDev $name $f device->{\$f} $device->{$f}\n";
$devices->{$name}->{$f} = $device->{$f};
}
}
}
foreach my $device (getFromLsscsi($params)) {
my $name = $device->{NAME};
foreach my $f ("NAME", "MANUFACTURER", "TYPE", "MODEL") {
if ($devices->{$name}->{$f} eq "") {
#debug print "getFromLsscsi $name $f device->{\$f} $device->{$f}\n";
$devices->{$name}->{$f} = $device->{$f};
}
}
}
my $logical_drive = undef;
if ($common->can_run ('arcconf') ) {
my ($cur_cont,$info,$key,$dev,$controller);
$controller = Ocsinventory::Agent::Backend::OS::Linux::Storages::Adaptec::parse_config();
foreach $cur_cont (keys %{$controller}){ #travers Controller
$info = $controller->{$cur_cont};
foreach $key (keys %{$info}){ #travers Infos of Controller
if ($key=~m/logical drive/) {
$logical_drive= $info->{$key};
}
}
}
}
foreach my $device (sort (keys %$devices)) {
if ($devices->{$device}->{TYPE} =~ /(CD)|(CD\/DVD)|(DVD)|(BD)/i) {
$devices->{$device}->{DISKSIZE} = "0000";
} elsif ($devices->{$device}->{DISKSIZE}) {
$devices->{$device}->{DISKSIZE} = $devices->{$device}->{DISKSIZE} * 10**-6; # we need MB for the view
}
if (!$devices->{$device}->{DESCRIPTION}) {
$devices->{$device}->{DESCRIPTION} = getFromSysProc($device,"description");
}
if (!$devices->{$device}->{MANUFACTURER} or $devices->{$device}->{MANUFACTURER} eq 'ATA'or $devices->{$device}->{MANUFACTURER} eq '') {
$devices->{$device}->{MANUFACTURER} = getManufacturer($devices->{$device}->{MODEL});
}
if (!$devices->{$device}->{DISKSIZE} && $devices->{$device}->{TYPE} =~ /disk/) {
$devices->{$device}->{DISKSIZE} = getCapacity($devices->{$device}->{NAME})*10**-6;
}
#if ($devices->{$device}->{CAPACITY} =~ /^cdrom$/) {
# $devices->{$device}->{CAPACITY} = getCapacity($devices->{$device}->{NAME})*10**-6;
#}
if ($devices->{$device}->{MANUFACTURER}=~m/Adaptec/) {#check if found devices are Logical Devices
foreach my $devkey (keys %{$logical_drive}) {
if($devices->{$device}->{MODEL} =~m/$logical_drive->{$devkey}->{'Logical device name'}/) { #Correct infos
$devices->{$device}->{TYPE}="Logical Drive";
$devices->{$device}->{DISKSIZE} = $logical_drive->{$devkey}->{'Size'};
}
}
}
$common->addStorages($devices->{$device});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Storages/ 0000775 0000000 0000000 00000000000 13327377321 0024475 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Storages/3ware.pm 0000664 0000000 0000000 00000014405 13327377321 0026060 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Storages::3ware;
use Ocsinventory::Agent::Backend::OS::Linux::Storages;
# Tested on 2.6.* kernels
#
# Cards tested :
#
# 8006-2LP
# 9500S-4LP
# 9550SXU-4LP
# 9550SXU-8LP
# 9650SE-2LP
# 9650SE-4LPML
# 9650SE-8LPML
#
# AMCC/3ware CLI (version 2.00.0X.XXX)
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
my ($card, $res);
# Do we have tw_cli ?
if ($common->can_run("tw_cli")) {
foreach (`tw_cli info`) {
$card = $1 if /^(c\d+).*/;
if ($card) {
$res = `tw_cli info $card numdrives`;
$card = undef;
$res =~ s/^.*=\s(\d+)/$1/;
# Do we have drives on the card ?
($res == 0)?return 0:return 1;
}
}
}
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my ($tw_cli, $hd);
my ($card, $card_model, $unit, $unit_id, $port, $serialnumber, $serial, $model, $capacity, $firmware, $description, $media, $device, $manufacturer, $sn);
my @devices = Ocsinventory::Agent::Backend::OS::Linux::Storages::getFromUdev();
# First, getting the cards : c0, c1... etc.
foreach (`tw_cli info`) {
# Should output something like this :
#
# Ctl Model Ports Drives Units NotOpt RRate VRate BBU
# ------------------------------------------------------------------------
# c0 9650SE-2LP 2 2 1 0 1 1 -
if (/^(c\d)+\s+([\w|-]+)/) {
$card = $1;
$card_model = $2;
$logger->debug("Card : $card - Model : $card_model");
}
if ($card) {
# Second, getting the units : u0, u1... etc.
foreach (`tw_cli info $card`) {
# Example output :
#
# Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy
# ------------------------------------------------------------------------------
# u0 RAID-1 OK - - - 65.1826 ON OFF
#
# Port Status Unit Size Blocks Serial
# ---------------------------------------------------------------
# p0 OK u0 69.25 GB 145226112 WD-WMANS1648590
# p1 OK u0 69.25 GB 145226112 WD-WMANS1344790
if (/^(u)(\d+).*/) {
$unit = $1 . $2;
$unit_id = $2;
}
if ($unit) {
# Try do get unit's serial in order to compare it to what was found in udev db.
# Works only on newer cards.
# Allow us to associate a node to a drive : sda -> WD-WMANS1648590
$sn = `tw_cli info $card $unit serial 2> /dev/null`;
$sn =~ s/^.*serial number\s=\s(\w*)\s*/$1/;
# Third, getting the ports : p0, p1... etc.
foreach(`tw_cli info $card $unit`) {
$port = $1 if /^.*(p\d+).*/;
if ($port) {
# Finally, getting drives' values.
foreach (`tw_cli info $card $port model serial capacity firmware`) {
# Example output :
#
# /c0/p0 Model = WDC WD740ADFD-00NLR4
# /c0/p0 Serial = WD-WMANS1648590
# /c0/p0 Capacity = 69.25 GB (145226112 Blocks)
# /c0/p0 Firmware Version = 21.07QR4
$model = $1 if /^.*Model\s=\s(.*)/;
$serialnumber = $1 if /^.*Serial\s=\s(.*)/;
$capacity = 1024*$1 if /^.*Capacity\s=\s(\S+)\sGB.*/;
$firmware = $1 if /^.*Firmware Version\s=\s(.*)/;
}
foreach $hd (@devices) {
# How does this work with multiple older cards where serial for units is not implemented ?
# Need to be tested on a system with multiple 3ware cards.
if (($hd->{SERIALNUMBER} eq 'AMCC_' . $sn) or ($hd->{MODEL} eq 'Logical_Disk_' . $unit_id)) {
$device = $hd->{NAME};
}
}
# Getting description from card model, very basic and unreliable
# Assuming only IDE drives can be plugged in 5xxx/6xxx cards and
# SATA drives only to 7xxx/8xxx/9xxxx cards
$description = undef;
foreach ($card_model) {
$description = "IDE" if /^[5-6].*/;
$description = "SATA" if /^[7-9].*/;
}
$media = 'disk';
$manufacturer = Ocsinventory::Agent::Backend::OS::Linux::Storages::getManufacturer($model);
$port = undef;
$logger->debug("3ware: $device, $manufacturer, $model, $description, $media, $capacity, $serialnumber, $firmware");
$common->addStorages({
NAME => $device,
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => $description,
TYPE => $media,
DISKSIZE => $capacity,
SERIALNUMBER => $serialnumber,
FIRMWARE => $firmware,
});
}
$port = undef;
}
$unit = undef;
}
}
$card = undef;
$card_model = undef;
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Storages/Adaptec.pm 0000664 0000000 0000000 00000026110 13327377321 0026374 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Storages::Adaptec;
use Ocsinventory::Agent::Backend::OS::Linux::Storages;
#Function parse_config and parse_config_fh are taken from https://github.com/kumy/Parse-Arcconf
#
#LICENSE AND COPYRIGHT
#
#Copyright (C) 2012 Mathieu Alorent
#
#This program is free software; you can redistribute it and/or modify it
#under the terms of either: the GNU General Public License as published
#by the Free Software Foundation; or the Artistic License.
#
#See http://dev.perl.org/licenses/ for more information.
# Tested on 2.6.* kernels
#
# Cards tested :
#
# Adaptec AAC-RAID
use strict;
my @devices = Ocsinventory::Agent::Backend::OS::Linux::Storages::getFromUdev();
sub check {
my $params = shift;
my $common = $params->{common};
#Do we have arcconf
if ($common->can_run ('arcconf') ) {
my $conf = `arcconf GETCONFIG 1`;
if($conf =~ /Controllers found: (\d+)/) {
if($1>0) {
return 1;
}
}
}
#Do we have smartctl
if ($common->can_run ('smartctl') ) {
foreach my $hd (@devices) {
$hd->{MANUFACTURER} eq 'Adaptec'?return 1:1;
}
}
return 0;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my ($name,$vendor,$model,$serialnumber,$firmware, $size, $description, $media, $manufacturer);
my ($conf, $cur_cont,$info,$key, $dev, $devkey,$controller);
#get infos from arcconf if possible
if ($common->can_run ('arcconf') ) {
$conf = `arcconf GETCONFIG 1`;
if($conf =~ /Controllers found: (\d+)/) {
if($1>0) {
$controller = parse_config();
foreach $cur_cont (keys %{$controller}){ #travers Controller
$info = $controller->{$cur_cont};
foreach $key (keys %{$info}){ #travers Infos of Controller
#physical drives
if ($key=~m/physical drive/) {
$dev = $info->{$key};
foreach $devkey (keys %{$dev}) { #get infos
$vendor = $dev->{$devkey}->{'Vendor'};
$model = $dev->{$devkey}->{'Model'};
$serialnumber = $dev->{$devkey}->{'Serial number'};
$firmware = $dev->{$devkey}->{'Firmware'};
$size = $dev->{$devkey}->{'Size'};
$description = $dev->{$devkey}->{'Transfer Speed'};
$media = $dev->{$devkey}->{'Device is'};
unless ( $media=~m/an Enclosure services device/) { #Dont need services device just drives
if ( $media=~m/a Hard drive/ ){
$media = "HDD";
#try to determine if Drive is a Solid State Disk
if (exists $dev->{$devkey}->{'SSD'}) { #SSD Info is explicit in config
my $ssd = $dev->{$devkey}->{'SSD'};
if ($ssd=~m/Yes/) {
$media = "SSD";
}
} else { #No explicit info try to get it through model name
if($model =~m/SSD|Solid State|WDS/) {
$media = "SSD";
}
}
}
$manufacturer = Ocsinventory::Agent::Backend::OS::Linux::Storages::getManufacturer($vendor);
$logger->debug("Adaptec: $manufacturer $media $size, $manufacturer, $model, $description, $media, $size , $serialnumber, $firmware");
$common->addStorages({
NAME => "$manufacturer $media $size",
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => $description,
TYPE => $media,
DISKSIZE => $size,
SERIALNUMBER => $serialnumber,
FIRMWARE => $firmware,
});
}
}
}
}
}
}
}
}
elsif (-r '/proc/scsi/scsi') {
foreach my $hd (@devices) {
open (PATH, '/proc/scsi/scsi');
# Example output:
#
# Attached devices:
# Host: scsi0 Channel: 00 Id: 00 Lun: 00
# Vendor: Adaptec Model: raid10 Rev: V1.0
# Type: Direct-Access ANSI SCSI revision: 02
# Host: scsi0 Channel: 01 Id: 00 Lun: 00
# Vendor: HITACHI Model: HUS151436VL3800 Rev: S3C0
# Type: Direct-Access ANSI SCSI revision: 03
# Host: scsi0 Channel: 01 Id: 01 Lun: 00
# Vendor: HITACHI Model: HUS151436VL3800 Rev: S3C0
# Type: Direct-Access ANSI SCSI revision: 03
my ($host, $model, $firmware, $manufacturer, $size, $serialnumber);
my $count = -1;
while () {
($host, $count) = (1, $count+1) if /^Host:\sscsi$hd->{SCSI_COID}.*/;
if ($host) {
if ((/.*Model:\s(\S+).*Rev:\s(\S+).*/) and ($1 !~ 'raid.*')) {
$model = $1;
$firmware = $2;
$manufacturer = Ocsinventory::Agent::Backend::OS::Linux::Storages::getManufacturer($model);
foreach (`smartctl -i /dev/sg$count`) {
$serialnumber = $1 if /^Serial Number:\s+(\S*).*/;
}
$logger->debug("Adaptec: $hd->{NAME}, $manufacturer, $model, SATA, disk, $hd->{DISKSIZE}, $serialnumber, $firmware");
$host = undef;
$common->addStorages({
NAME => $hd->{NAME},
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => 'SATA',
TYPE => 'disk',
DISKSIZE => $size,
SERIALNUMBER => $serialnumber,
FIRMWARE => $firmware,
});
}
}
}
close (PATH);
}
}
}
sub parse_config
{
my $arcconf = "arcconf";
my $argument = "GETCONFIG 1";
my $command = sprintf("%s %s|", $arcconf, $argument);
my $fh;
if(open $fh, $command)
{
my $c = parse_config_fh($fh);
close $fh;
return $c;
}
return undef;
}
sub parse_config_fh
{
my $fh = $_[0];
my $controller = {};
my $total_controller = 0;
my $current_controller = 0;
my $current_logical_drive = undef;
my $current_physical_drive = undef;
my $ctrl = undef;
my $line = undef;
LEVEL1: while($line = <$fh>)
{
chomp $line;
next if($line =~ /^$/);
next if($line =~ /^-+$/);
if($line =~ /^Controllers found: (\d+)$/) {
$total_controller = $1;
}
if($line =~ /^Controller information/) {
$current_controller = $current_controller + 1;
$current_logical_drive = undef;
$current_physical_drive = undef;
$controller->{$current_controller} = {};
$ctrl = $controller->{$current_controller};
while($line = <$fh>) {
chomp $line;
if ($line =~ /^\s+(.*\w)\s+:\s+(.*)$/) {
$ctrl->{$1} = $2;
} elsif ($line =~ /^\s+-+$/) {
last;
}
}
LEVEL2: while($line = <$fh>) {
if ($line =~ /^\s+-+$/) {
$line = <$fh>;
chomp $line;
}
if($line =~ /^\s+(.*\w)\s*/) {
my $cat = $1;
$line = <$fh>;
LEVEL3: while($line = <$fh>) {
chomp $line;
if ($line =~ /^\s+(.*\w)\s+:\s+(.*)$/) {
$ctrl->{$cat}{$1} = $2;
} elsif ($line =~ /^\s+-+$/) {
last LEVEL3;
} elsif ($line =~ /^$/) {
last LEVEL2;
}
}
}
}
}
next if(!defined($current_controller));
if($line =~ /^Logical drive information/ or $line =~ /^Logical device information/) {
LEVEL4: while($line = <$fh>) {
chomp $line;
if ($line =~ /^\S+.*\w\s+(\d+)$/) {
$current_logical_drive = $1;
} elsif ($line =~ /^\s+(\S.*\S+)\s+:\s+(.*)$/) {
$ctrl->{'logical drive'}{$current_logical_drive}{$1} = $2;
} elsif ($line =~ /^\s+-+$/) {
my $cat = <$fh>;
$cat =~ s/^\s+(\S.*\S+)\s+/$1/;
chomp $cat;
LEVEL5: while($line = <$fh>) {
chomp $line;
if ($line =~ /^\s+(\S.*\S+)\s+:\s+(.*)$/) {
$ctrl->{'logical drive'}{$current_logical_drive}{$cat}{$1} = $2;
} elsif ($line =~ /^\S+.*\w\s+(\d+)$/) {
$current_logical_drive = $1;
last LEVEL5;
} elsif ($line =~ /^-+$/) {
last LEVEL4;
} elsif ($line =~ /^\s+-+$/) {
next;
}
}
}
}
}
if($line =~ /^Physical Device information/) {
LEVEL2: while($line = <$fh>) {
if ($line =~ /^\s+-+$/) {
$line = <$fh>;
chomp $line;
}
if ($line =~ /^\s+Device\s+#(\d+)$/) {
$current_physical_drive = $1;
} elsif ($line =~ /^\s+Device is (.*\w)/) {
$ctrl->{'physical drive'}{$current_physical_drive}{'Device is'} = $1;
} elsif ($line =~ /^\s+(.*\w)\s+:\s+(.*)$/) {
$ctrl->{'physical drive'}{$current_physical_drive}{$1} = $2;
} elsif ($line =~ /^\s+-+$/) {
last LEVEL3;
} elsif ($line =~ /^$/) {
last LEVEL2;
}
}
}
}
return $controller;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Storages/FusionIO.pm 0000664 0000000 0000000 00000003405 13327377321 0026530 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Storages::FusionIO;
use Ocsinventory::Agent::Backend::OS::Linux::Storages;
use strict;
sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
sub check {
my $params = shift;
my $common = $params->{common};
my $ret;
# Do we have fio-status?
if ($common->can_run("fio-status")) {
foreach (`fio-status 2> /dev/null`) {
if (/^fct(\d*).*/) {
$ret=1;
last;
}
}
}
return $ret;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my ($pd, $serialnumber, $model, $capacity, $firmware, $description, $media, $manufacturer);
foreach (`fio-status 2> /dev/null`) {
if (/^fct(\d*).*/) {
my $slot = $1;
my $cmd = "fio-status /dev/fct$slot --field";
$model = trim(`$cmd iom.board_name`);
$description = trim(`$cmd adapter.product_name`);
$media = trim('disk');
$capacity = trim(`$cmd iom.size_bytes`);
$serialnumber = 'OEM:'.trim(`$cmd adapter.oem_serial_number`).' FIO:'.trim(`$cmd adapter.fio_serial_number`).' IOM:'.trim(`$cmd iom.serial_number`);
$firmware = trim(`$cmd iom.fw_current_version`.' rev '.`$cmd iom.fw_current_revision`);
$logger->debug("Fusion-io: N/A, $manufacturer, $model, $description, $media, $capacity, $serialnumber, $firmware");
$common->addStorages({
NAME => $model,
MANUFACTURER => 'Fusion-io',
MODEL => $model,
DESCRIPTION => $description,
TYPE => $media,
DISKSIZE => $capacity,
SERIALNUMBER => $serialnumber,
FIRMWARE => $firmware
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Storages/HP.pm 0000664 0000000 0000000 00000010531 13327377321 0025342 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Storages::HP;
use Ocsinventory::Agent::Backend::OS::Linux::Storages;
# Tested on 2.6.* kernels
#
# Cards tested :
#
# Smart Array E200
#
# HP Array Configuration Utility CLI 7.85-18.0
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
my $ret;
# Do we have ssacli ?
if ($common->can_run("ssacli")) {
foreach (`ssacli ctrl all show 2> /dev/null`) {
if (/.*Slot\s(\d*).*/) {
$ret = 1;
last;
}
}
}
return $ret;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my ($pd, $serialnumber, $model, $capacity, $firmware, $description, $media, $manufacturer);
foreach (`ssacli ctrl all show 2> /dev/null`) {
# Example output :
#
# Smart Array E200 in Slot 2 (sn: PA6C90K9SUH1ZA)
if (/.*Slot\s(\d*).*/) {
my $slot = $1;
foreach (`ssacli ctrl slot=$slot pd all show 2> /dev/null`) {
# Example output :
# Smart Array E200 in Slot 2
#
# array A
#
# physicaldrive 2I:1:1 (port 2I:box 1:bay 1, SATA, 74.3 GB, OK)
# physicaldrive 2I:1:2 (port 2I:box 1:bay 2, SATA, 74.3 GB, OK)
if (/.*physicaldrive\s(\S*)/) {
my $pd = $1;
foreach (`ssacli ctrl slot=$slot pd $pd show 2> /dev/null`) {
# Example output :
#
# Smart Array E200 in Slot 2
#
# array A
#
# physicaldrive 1:1
# Port: 2I
# Box: 1
# Bay: 1
# Status: OK
# Drive Type: Data Drive
# Interface Type: SATA
# Size: 74.3 GB
# Firmware Revision: 21.07QR4
# Serial Number: WD-WMANS1732855
# Model: ATA WDC WD740ADFD-00
# SATA NCQ Capable: False
# PHY Count: 1
$model = $1 if /.*Model:\s(.*)/;
$description = $1 if /.*Interface Type:\s(.*)/;
$media = $1 if /.*Drive Type:\s(.*)/;
$capacity = $1 if /^\s*Size:\s(.*)/;
$serialnumber = $1 if /.*Serial Number:\s(.*)/;
$firmware = $1 if /.*Firmware Revision:\s(.*)/;
}
$serialnumber =~ s/^\s+//;
$model =~ s/^ATA\s+//; # ex: ATA WDC WD740ADFD-00
$model =~ s/\s+/ /;
$manufacturer = Ocsinventory::Agent::Backend::OS::Linux::Storages::getManufacturer($model);
if ($media eq 'Data Drive') {
$media = 'HDD';
if ($description =~m/SSD|Solid State/) {
$media = 'SSD';
} elsif ($model =~m/SSD|Solid State|WDS/) {
$media = 'SSD';
}
}
if ($capacity =~m/TB/) {
$capacity *= 1000000;
} elsif ($capacity =~m/GB/) {
$capacity *= 1000;
} else {
$capacity *= 1;
}
$logger->debug("HP: N/A, $manufacturer, $model, $description, $media, $capacity, $serialnumber, $firmware");
$common->addStorages({
NAME => $model,
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => $description,
TYPE => $media,
DISKSIZE => $capacity,
SERIALNUMBER => $serialnumber,
FIRMWARE => $firmware
});
}
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Storages/Lsilogic.pm 0000664 0000000 0000000 00000005135 13327377321 0026604 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Storages::Lsilogic;
use Ocsinventory::Agent::Backend::OS::Linux::Storages;
# Tested on 2.6.* kernels
#
# Cards tested :
#
# LSI Logic / Symbios Logic SAS1064E PCI-Express Fusion-MPT SAS
#
# mpt-status version : 1.2.0
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
my $device;
# Do we have smartctl ?
if ($common->can_run('smartctl')) {
foreach my $node (glob("/dev/sd?")) {
foreach (`smartctl -i $node`) {
$device = $1 if /.*Device:\s(\w*).*/;
}
}
($device eq 'LSILOGIC')?return 1:return 0;
}
return 0;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my $serialnumber;
my @devices = Ocsinventory::Agent::Backend::OS::Linux::Storages::getFromUdev();
foreach my $hd (@devices) {
foreach (`mpt-status -n -i $hd->{SCSI_UNID}`) {
# Example output :
#
# ioc:0 vol_id:0 type:IM raidlevel:RAID-1 num_disks:2 size(GB):148 state: OPTIMAL flags: ENABLED
# ioc:0 phys_id:1 scsi_id:2 vendor:ATA product_id:ST3160815AS revision:D size(GB):149 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
#ioc:0 phys_id:0 scsi_id:1 vendor:ATA product_id:ST3160815AS revision:D size(GB):149 state: ONLINE flags: NONE sync_state: 100 ASC/ASCQ:0xff/0xff SMART ASC/ASCQ:0xff/0xff
#scsi_id:1 100%
#scsi_id:0 100%
if (/.*phys_id:(\d+).*product_id:\s*(\S*)\s+revision:(\S+).*size\(GB\):(\d+).*/) {
$serialnumber = undef;
foreach (`smartctl -i /dev/sg$1`) {
$serialnumber = $1 if /^Serial Number:\s+(\S*)/;
}
my $model = $2;
my $size = 1024*$4; # GB => MB
my $firmware = $3;
my $manufacturer = Ocsinventory::Agent::Backend::OS::Linux::Storages::getManufacturer($model);
$logger->debug("Lsilogic: $hd->{NAME}, $manufacturer, $model, SATA, disk, $size, $serialnumber, $firmware");
$common->addStorages({
NAME => $hd->{NAME},
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => 'SATA',
TYPE => 'disk',
DISKSIZE => $size,
SERIALNUMBER => $serialnumber,
FIRMWARE => $firmware,
});
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Storages/Megacli.pm 0000664 0000000 0000000 00000005210 13327377321 0026372 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Storages::Megacli;
use Ocsinventory::Agent::Backend::OS::Linux::Storages;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
my $ret;
my $cont;
if ($common->can_run("megacli")) {
foreach (`megacli -adpCount 2>/dev/null`) {
if (/^Controller\sCount:\s(\d+)/) {
$cont=$1;
if (defined $cont && $cont == 1) {
$ret=1;
last;
}
}
}
}
return $ret;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my $adpc;
my $model;
my $description;
my $capacity;
my $firmware;
my $serial;
my $manufacturer;
my $index;
my @partitions;
my @sl;
# Retrieve the partition
open PARTINFO, '){
if (/^\s*(\d*)\s*(\d*)\s*(\d*)\s*([sh]d[a-z]+)$/i){
push(@partitions,$4);
}
}
# How adapters are present?
foreach (`megacli -adpCount 2> /dev/null`){
$adpc=$1 if (/^Controller Count:\s(\d+)./i);
}
# How slot are used on the controller?
for (my $count=0;$count<$adpc;$count++){
foreach (`megacli -ShowSummary -a$count`){
# Slot number : Connector : 0: Slot 1
if (/Connector\s*:\s*\d+(?:): Slot (\d+)/){
push (@sl, $1);
}
}
# use smartctcl command to retrieve information
foreach my $dev (@partitions){
foreach my $slo (@sl){
# smartctl -i -d megaraid,0 /dev/sda
my $result=`smartctl -i -d megaraid,$slo /dev/$dev`;
$model=$1 if ($result =~ /Model Family:\s*(.*)/);
$description=$1 if ($result =~ /Device Model:\s*(.*)/);
$manufacturer = Ocsinventory::Agent::Backend::OS::Linux::Storages::getManufacturer($description);
$serial=$1 if ($result =~ /Serial Number:\s*(.*)/);
$firmware=$1 if ($result =~ /Firmware Version:\s*(.*)/);
$capacity=$1 if ($result =~ /User Capacity:\s*.*\[(.*)\]/);
$common->addStorages({
NAME => $description,
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => $description,
TYPE => "Disk",
DISKSIZE => $capacity,
SERIALNUMBER => $serial,
FIRMWARE => $firmware
});
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Storages/ServeRaid.pm 0000664 0000000 0000000 00000007314 13327377321 0026724 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Storages::ServeRaid;
use Ocsinventory::Agent::Backend::OS::Linux::Storages;
# Tested on 2.6.* kernels
#
# Cards tested :
#
# IBM ServeRAID-6M
# IBM ServeRAID-6i
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
my $ret = 0;
# Do we have ipssend installed ?
if ($common->can_run("ipssend")) {
foreach (`ipssend GETVERSION 2>/dev/null`) {
if (/.*ServeRAID Controller Number\s(\d*).*/) {
$ret = $1;
last;
}
}
}
return $ret;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my $slot;
$logger->debug("ServeRaid: ipssend GETVERSION");
foreach (`ipssend GETVERSION 2>/dev/null`) {
# Example Output :
# Found 1 IBM ServeRAID controller(s).
#----------------------------------------------------------------------
#ServeRAID Controller(s) Version Information
#----------------------------------------------------------------------
# Controlling BIOS version : 7.00.14
#
#ServeRAID Controller Number 1
# Controller type : ServeRAID-6M
# Controller slot information : 2
# Actual BIOS version : 7.00.14
# Firmware version : 7.00.14
# Device driver version : 7.10.18
$slot = $1 if /.*ServeRAID Controller Number\s(\d*).*/;
if (/.*Controller type.*:\s(.*)/) {
my $name = $1;
my ($serial, $capacity, $scsi, $channel, $state);
$logger->debug("ServeRaid: ipssend GETCONFIG $slot PD");
foreach (`ipssend GETCONFIG $slot PD 2>/dev/null`) {
# Example Output :
# Channel #1:
# Target on SCSI ID 0
# Device is a Hard disk
# SCSI IDg: 0
# PFA (Yes/No) : No
# Stateg : Online (ONL)
# Size (in MB)/(in sectors): 34715/71096368
# Device ID : IBM-ESXSCBR036C3DFQDB2Q6CDKM
# FRU part number : 32P0729
$channel = $1 if /.*Channel #(.*):/;
$scsi = $1 if /.*SCSI ID.*:\s(.*)/;
$state = $1 if /.*State.*\((.*)\)/;
$capacity = $1 if /.*Size.*:\s(\d*)\/(\d*)/;
$serial = $1 if /.*Device ID.*:\s(.*)/;
if (/.*FRU part number.*:\s(.*)/) {
my $model = $1;
my $manufacturer = Ocsinventory::Agent::Backend::OS::Linux::Storages::getManufacturer($serial);
## my $fullname = "$name $slot/$channel/$scsi $state";
$logger->debug("ServeRaid: found $model, $manufacturer, $model, SCSI, disk, $capacity, $serial, ");
$common->addStorages({
NAME => "$manufacturer $model",
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => "SCSI",
TYPE => "disk",
DISKSIZE => $capacity,
SERIALNUMBER => $serial,
FIRMWARE => ""
});
# don't undef $channel, appear only once for several drive.
$scsi = $state = $capacity = $serial = undef;
}
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Sys.pm 0000664 0000000 0000000 00000000525 13327377321 0024024 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Sys;
#$LunchAfter = "Ocsinventory::Agent::Backend::OS::Linux::VirtualFs::Sys";
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run ("mount");
foreach (`mount`) {
return 1 if (/type\ sysfs/);
}
0;
}
sub run {}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Linux/Uptime.pm 0000664 0000000 0000000 00000001504 13327377321 0024507 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Linux::Uptime;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_read("/proc/uptime")
}
sub run {
my $params = shift;
my $common = $params->{common};
# Uptime
open UPTIME, "/proc/uptime";
my $uptime = ;
$uptime =~ s/^(.+)\s+.+/$1/;
close UPTIME;
# Uptime conversion
my ($UYEAR, $UMONTH , $UDAY, $UHOUR, $UMIN, $USEC) = (gmtime ($uptime))[5,4,3,2,1,0];
# Write in ISO format
$uptime=sprintf "%02d-%02d-%02d %02d:%02d:%02d", ($UYEAR-70), $UMONTH, ($UDAY-1), $UHOUR, $UMIN, $USEC;
chomp(my $DeviceType =`uname -m`);
# TODO$h->{'CONTENT'}{'HARDWARE'}{'DESCRIPTION'} = [ "$DeviceType/$uptime" ];
$common->setHardware({ DESCRIPTION => "$DeviceType/$uptime" });
}
1
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS.pm 0000664 0000000 0000000 00000003276 13327377321 0023117 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS;
use strict;
require Exporter;
our @ISA = qw /Exporter/;
our @EXPORT = qw /get_sysprofile_devices_names/;
sub check {
my $r;
# we check far darwin because that's the _real_ underlying OS
$r = 1 if (uc($^O) =~ /^DARWIN$/);
return($r);
}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSName;
my $OSComment;
my $OSVersion;
my $uuid;
# if we can load the system profiler, gather the information from that
if ($common->can_load("Mac::SysProfile")){
my $profile = Mac::SysProfile->new();
my $data = $profile->gettype('SPSoftwareDataType');
return(undef) unless(ref($data) eq 'ARRAY');
my $h = $data->[0];
my $SystemVersion = $h->{'os_version'};
if ($SystemVersion =~ /^(.*?)\s+(\d+.*)/) {
$OSName=$1;
$OSVersion=$2;
} else {
# Default values
$OSName="Mac OS X";
$OSVersion="Unknown";
}
} else {
# we can't load the system profiler, use the basic BSD stype information
# Operating system informations
chomp($OSName=`uname -s`);
chomp($OSVersion=`uname -r`);
}
# add the uname -v as the comment, not really needed, but extra info never hurt
chomp($OSComment=`uname -v`);
# We get UUID
if ($common->can_run("ioreg")) {
my @ioreg = split ("=", `ioreg -rd1 -c IOPlatformExpertDevice | grep -E '(UUID)'`);
chomp($uuid = $ioreg[1]);
$uuid =~ s/\"|\s//g;
}
$common->setHardware({
OSNAME => $OSName,
OSCOMMENTS => $OSComment,
OSVERSION => $OSVersion,
UUID => $uuid,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/ 0000775 0000000 0000000 00000000000 13327377321 0022551 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Bios.pm 0000664 0000000 0000000 00000002172 13327377321 0024005 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Bios;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return $common->can_load("Mac::SysProfile")
}
sub run {
my $params = shift;
my $common = $params->{common};
# use Mac::SysProfile to get the respected datatype
my $profile = Mac::SysProfile->new();
my $data = $profile->gettype('SPHardwareDataType');
# unless we get a real hash value, return with nothing
return(undef) unless($data && ref($data) eq 'ARRAY');
my $h = $data->[0];
# set the bios informaiton from the apple system profiler
$common->setBios({
SMANUFACTURER => 'Apple Inc', # duh
SMODEL => $h->{'model_identifier'} || $h->{'machine_model'},
# SSN => $h->{'Serial Number'}
# New method to get the SSN, because of MacOS 10.5.7 update
# system_profiler gives 'Serial Number (system): XXXXX' where 10.5.6
# and lower give 'Serial Number: XXXXX'
SSN => $h->{'serial_number'},
BVERSION => $h->{'boot_rom_version'},
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/CPU.pm 0000664 0000000 0000000 00000003665 13327377321 0023550 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::CPU;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return(undef) unless -r '/usr/sbin/system_profiler';
return(undef) unless $common->can_load("Mac::SysProfile");
return 1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $processors;
my $arch;
my $datawidth;
$processors->{1}->{MANUFACTURER} = `sysctl -n machdep.cpu.vendor`;
$processors->{1}->{TYPE} = `sysctl -n machdep.cpu.brand_string`;
$processors->{1}->{SPEED} = `sysctl -n hw.cpufrequency` / 1000 / 1000;
$processors->{1}->{L2CACHESIZE} = `sysctl -n hw.l2cachesize` / 1024;
$processors->{1}->{CORES} = `sysctl -n machdep.cpu.core_count`;
$processors->{1}->{LOGICAL_CPUS} = `sysctl -n machdep.cpu.thread_count`;
# 32 or 64 bits arch?
my $sysctl_arch = `sysctl -n hw.cpu64bit_capable`;
if ($sysctl_arch == 1){
$arch = "x86_64";
$datawidth = 64;
} else {
$arch = "x86";
$datawidth = 32;
}
$processors->{1}->{CPUARCH} = $arch;
$processors->{1}->{DATA_WIDTH} = $datawidth;
# copy cpu infos to other packages
my $ncpu=`sysctl -n hw.packages`;
foreach my $cpu (2..$ncpu) {
$processors->{$cpu}->{MANUFACTURER} = $processors->{1}->{MANUFACTURER};
$processors->{$cpu}->{TYPE} = $processors->{1}->{TYPE};
$processors->{$cpu}->{SPEED} = $processors->{1}->{SPEED};
$processors->{$cpu}->{L2CACHESIZE} = $processors->{1}->{L2CACHESIZE};
$processors->{$cpu}->{CORES} = $processors->{1}->{CORES};
$processors->{$cpu}->{LOGICAL_CPUS} = $processors->{1}->{LOGICAL_CPUS};
$processors->{$cpu}->{CPUARCH} = $processors->{1}->{CPUARCH};
$processors->{$cpu}->{DATA_WIDTH} = $processors->{1}->{DATA_WIDTH};
}
# Add new cpu infos to inventory
foreach (keys %{$processors}){
$common->addCPU($processors->{$_});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Camera.pm 0000664 0000000 0000000 00000001104 13327377321 0024273 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Camera;
use strict;
sub check {
return(undef) unless -r '/usr/sbin/system_profiler'; # check perms
return 1;
}
sub run {
my $params = shift;
my $common = $params->{common};
# create profiler obj, bail if datatype fails
my $data = $common->get_sysprofile_devices_names('SPCameraDataType');
return(undef) unless(ref($data) eq 'ARRAY');
# add sound cards
foreach my $cam (@$data){
$common->addCamera({
'MODEL' => $cam,
'UUID' => $cam,
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Controllers.pm 0000664 0000000 0000000 00000004560 13327377321 0025422 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Controllers;
sub check {
my $params = shift;
my $common = $params->{common};
return(undef) unless -r '/usr/sbin/system_profiler'; # check perms
return (undef) unless $common->can_load("Mac::SysProfile");
return 1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my ($caption, $description, $name, $type);
my $datatypes = {
#usb => 'SPUSBDataType', TODO: fix problems with SPUSBDataType in Mac::Sysprofile
firewire => 'SPFireWireDataType',
thunderbolt => 'SPThunderboltDataType',
ethernet => 'SPEthernetDataType',
};
for my $datatype (keys %$datatypes) {
# create the profile object and return undef unless we get something back
my $pro = Mac::SysProfile->new();
my $data = $pro->gettype($datatypes->{$datatype});
return(undef) unless(ref($data) eq 'ARRAY');
foreach my $port (@$data) {
if ($datatype =~ /usb/) {
$name = $port->{'usb_bus_number'};
$type = 'USB Bus';
$description = $port->{'controller_location'} . ", PCI Device ID: " . $port->{'pci_device'};
} elsif ($datatype =~ /firewire/) {
$name = 'FireWire';
$type = 'FireWire Bus';
$description = 'Max Speed: ' . $port->{'max_device_speed'};
} elsif ($datatype =~ /thunderbolt/) {
$name = $port->{'device_name_key'};
next unless $name;
$type = 'Thunderbolt';
$description = 'UID: ' . $port->{'switch_uid_key'};
} elsif ($datatype =~ /ethernet/) {
$name = $port->{'_name'};
if ($name ne '') {
$name = $port->{'spethernet_device-id'} if ($name eq 'ethernet');
$type = 'Ethernet Controller';
$description = 'BSD: ' . $port->{'spethernet_BSD_Name'};
}
}
$common->addController({
CAPTION => $caption,
DESCRIPTION => $description,
NAME => $name,
TYPE => $type,
});
$caption = $description = $name = $type = undef;
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Domains.pm 0000664 0000000 0000000 00000001653 13327377321 0024506 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Domains;
use strict;
# straight up theft from the other modules...
sub check {
my $hostname;
chomp ($hostname = `hostname`);
my @domain = split (/\./, $hostname);
shift (@domain);
return 1 if @domain;
-f "/etc/resolv.conf"
}
sub run {
my $params = shift;
my $common = $params->{common};
my $domain;
my $hostname;
chomp ($hostname = `hostname`);
my @domain = split (/\./, $hostname);
shift (@domain);
$domain = join ('.',@domain);
if (!$domain) {
my %domain;
open RESOLV, "/etc/resolv.conf" or warn;
while(){
$domain{$2} = 1 if (/^(domain|search)\s+(.+)/);
}
close RESOLV;
$domain = join "/", keys %domain;
}
# If no domain name, we send "WORKGROUP"
$domain = 'WORKGROUP' unless $domain;
$common->setHardware({
WORKGROUP => $domain
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Drives.pm 0000664 0000000 0000000 00000002115 13327377321 0024342 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Drives;
use strict;
# yea BSD theft!!!!
# would have used Mac::SysProfile, but the xml isn't quite fully supported
# the drives come back in apple xml tree's, and the module can't handle it yet (soon as I find the time to fix the patch)
sub check {1}
sub run {
my $params = shift;
my $common = $params->{common};
my $free;
my $filesystem;
my $total;
my $type;
my $volumn;
for my $t ("apfs", "ffs","ufs", "hfs") {
# OpenBSD has no -m option so use -k to obtain results in kilobytes
for(`df -P -k -t $t`){ # darwin needs the -t to be last
if(/^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\n/){
$type = $1;
$filesystem = $t;
$total = sprintf("%i",$2/1024);
$free = sprintf("%i",$4/1024);
$volumn = $6;
$common->addDrive({
FREE => $free,
FILESYSTEM => $filesystem,
TOTAL => $total,
TYPE => $type,
VOLUMN => $volumn
})
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Hostname.pm 0000664 0000000 0000000 00000001103 13327377321 0024660 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Hostname;
sub check {
my $params = shift;
my $common = $params->{common};
return 1 if $common->can_load ("Mac::SysProfile");
0;
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my $hostname;
my $profile = Mac::SysProfile->new();
my $data = $profile->gettype('SPSoftwareDataType');
return undef unless(ref($data) eq 'ARRAY');
my $h = $data->[0];
$hostname = $h->{'local_host_name'};
$common->setHardware ({NAME => $hostname}) if $hostname;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/IPv4.pm 0000664 0000000 0000000 00000001120 13327377321 0023663 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::IPv4;
# straight up theft from the other modules
sub check {
my @ifconfig = `ifconfig -a 2>/dev/null`;
return 1 if @ifconfig;
return;
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my @ip;
# Looking for ip addresses with ifconfig, except loopback
# *BSD need -a option
foreach (`ifconfig -a`){
if(/^\s*inet\s+(\S+)/){
($1=~/127.+/)?next:push @ip, $1
};
}
my $ip=join "/", @ip;
$common->setHardware({IPADDR => $ip});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Mem.pm 0000664 0000000 0000000 00000004307 13327377321 0023631 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Mem;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return(undef) unless -r '/usr/sbin/system_profiler'; # check perms
return (undef) unless $common->can_load("Mac::SysProfile");
return 1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $PhysicalMemory;
# create the profile object and return undef unless we get something back
my $profile = Mac::SysProfile->new();
my $data = $profile->gettype('SPMemoryDataType');
return(undef) unless(ref($data) eq 'ARRAY');
# Workaround for MacOSX 10.5.7
#if ($h->{'Memory Slots'}) {
# $h = $h->{'Memory Slots'};
#}
foreach my $memory (@$data){
next unless $memory->{'_name'} =~ /^BANK|SODIMM|DIMM/;
# tare out the slot number
my $slot = $memory->{'_name'};
# memory in 10.5
if($slot =~ /^BANK (\d)\/DIMM\d/){
$slot = $1;
}
# 10.4
if($slot =~ /^SODIMM(\d)\/.*$/){
$slot = $1;
}
# 10.4 PPC
if($slot =~ /^DIMM(\d)\/.*$/){
$slot = $1;
}
# 10.7
if ($slot =~ /^DIMM (\d)/) {
$slot = $1;
}
my $size = $memory->{'dimm_size'};
my $desc = $memory->{'dimm_part_number'};
if ($desc !~ /empty/) {
# dimm_part_number is an hex string, convert it to ascii
$desc = pack "H*", $desc;
$desc =~ s/\s+$//;
}
# if system_profiler lables the size in gigs, we need to trim it down to megs so it's displayed properly
if($size =~ /GB$/){
$size =~ s/GB$//;
$size *= 1024;
}
$common->addMemory({
'CAPACITY' => $size,
'SPEED' => $memory->{'dimm_speed'},
'TYPE' => $memory->{'dimm_type'},
'SERIALNUMBER' => $memory->{'dimm_serial_number'},
'DESCRIPTION' => $desc,
'NUMSLOTS' => $slot,
'CAPTION' => 'Status: '.$memory->{'dimm_status'},
});
}
# Send total memory size to inventory object
my $sysctl_memsize=`sysctl -n hw.memsize`;
$common->setHardware({
MEMORY => $sysctl_memsize / 1024 / 1024,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Networks.pm 0000664 0000000 0000000 00000007650 13327377321 0024733 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Networks;
# I think I hijacked most of this from the BSD/Linux modules
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("ifconfig") && $common->can_load("Net::IP qw(:PROC)")
}
sub _ipdhcp {
my $if = shift;
my $path;
my $ipdhcp;
my $leasepath;
foreach ( # XXX BSD paths
"/var/db/dhclient.leases.%s",
"/var/db/dhclient.leases",
# Linux path for some kFreeBSD based GNU system
"/var/lib/dhcp3/dhclient.%s.leases",
"/var/lib/dhcp3/dhclient.%s.leases",
"/var/lib/dhcp/dhclient.leases") {
$leasepath = sprintf($_,$if);
last if (-e $leasepath);
}
return undef unless -e $leasepath;
if (open DHCP, $leasepath) {
my $lease;
my $dhcp;
my $expire;
# find the last lease for the interface with its expire date
while(){
$lease = 1 if(/lease\s*{/i);
$lease = 0 if(/^\s*}\s*$/);
if ($lease) { #inside a lease section
if(/interface\s+"(.+?)"\s*/){
$dhcp = ($1 =~ /^$if$/);
}
#Server IP
if(/option\s+dhcp-server-identifier\s+(\d{1,3}(?:\.\d{1,3}){3})\s*;/
and $dhcp){
$ipdhcp = $1;
}
if (/^\s*expire\s*\d\s*(\d*)\/(\d*)\/(\d*)\s*(\d*):(\d*):(\d*)/
and $dhcp) {
$expire=sprintf "%04d%02d%02d%02d%02d%02d",$1,$2,$3,$4,$5,$6;
}
}
}
close DHCP or warn;
chomp (my $currenttime = `date +"%Y%m%d%H%M%S"`);
undef $ipdhcp unless $currenttime <= $expire;
} else {
warn "Can't open $leasepath\n";
}
return $ipdhcp;
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my $description;
my $ipaddress;
my $ipgateway;
my $ipmask;
my $ipsubnet;
my $macaddr;
my $status;
my $type;
# Looking for the gateway
# 'route show' doesn't work on FreeBSD so we use netstat
# XXX IPV4 only
for(`netstat -nr -f inet`){
$ipgateway=$1 if /^default\s+(\S+)/i;
}
my @ifconfig = `ifconfig -a`; # -a option required on *BSD
# first make the list available interfaces
# too bad there's no -l option on OpenBSD
my @list;
foreach (@ifconfig){
# skip loopback, pseudo-devices and point-to-point interfaces
#next if /^(lo|fwe|vmnet|sit|pflog|pfsync|enc|strip|plip|sl|ppp)\d+/;
next unless(/^en([0-9])/); # darwin has a lot of interfaces, for this purpose we only want to deal with eth0 and eth1
if (/^(\S+):/) { push @list , $1; } # new interface name
}
# for each interface get it's parameters
foreach $description (@list) {
$ipaddress = $ipmask = $macaddr = $status = $type = undef;
# search interface infos
@ifconfig = `ifconfig $description`;
foreach (@ifconfig){
$ipaddress = $1 if /inet (\S+)/i;
$ipmask = $1 if /netmask\s+(\S+)/i;
$macaddr = $2 if /(address:|ether|lladdr)\s+(\S+)/i;
$status = 1 if /status:\s+active/i;
$type = $1 if /media:\s+(\S+)/i;
}
my $binip = &ip_iptobin ($ipaddress ,4);
# In BSD, netmask is given in hex form
my $binmask = sprintf("%b", oct($ipmask));
my $binsubnet = $binip & $binmask;
$ipsubnet = ip_bintoip($binsubnet,4);
my $mask = ip_bintoip($binmask,4);
$common->addNetwork({
DESCRIPTION => $description,
IPADDRESS => ($status?$ipaddress:undef),
IPDHCP => _ipdhcp($description),
IPGATEWAY => ($status?$ipgateway:undef),
IPMASK => ($status?$mask:undef),
IPSUBNET => ($status?$ipsubnet:undef),
MACADDR => $macaddr,
STATUS => ($status?"Up":"Down"),
TYPE => ($status?$type:undef)
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Packages.pm 0000664 0000000 0000000 00000002257 13327377321 0024633 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Packages;
use strict;
use warnings;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_load("Mac::SysProfile");
# Do not run an package inventory if there is the --nosoftware parameter
return if ($params->{config}->{nosoftware});
1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $profile = Mac::SysProfile->new();
my $data = $profile->gettype('SPApplicationsDataType'); # might need to check version of darwin
return unless($data && ref($data) eq 'ARRAY');
# for each app, normalize the information, then add it to the inventory stack
foreach my $app (@$data){
#my $a = $apps->{$app};
my $kind = $app->{'runtime_environment'} ? $app->{'runtime_environment'} : 'UNKNOWN';
my $comments = '['.$kind.']';
$common->addSoftware({
'NAME' => $app->{'_name'},
'VERSION' => $app->{'version'} || 'unknown',
'COMMENTS' => $comments,
'PUBLISHER' => $app->{'info'} || 'unknown',
'INSTALLDATE' => $app->{'lastModified'},
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Printers.pm 0000664 0000000 0000000 00000001431 13327377321 0024714 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Printers;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return(undef) unless -r '/usr/sbin/system_profiler';
return(undef) unless $common->can_load("Mac::SysProfile");
return 1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $profile = Mac::SysProfile->new();
my $data = $profile->gettype('SPPrintersDataType');
return(undef) unless(ref($data) eq 'ARRAY');
foreach my $printer (@$data){
next if($printer->{'_name'} =~ /^The\sprinters\slist\sis\sempty\.(.*)$/);
$common->addPrinter({
NAME => $printer->{'_name'},
DRIVER => $printer->{'ppd'},
PORT => $printer->{'uri'},
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Slots.pm 0000664 0000000 0000000 00000002005 13327377321 0024210 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Slots;
sub check {
my $params = shift;
my $common = $params->{common};
return(undef) unless -r '/usr/sbin/system_profiler'; # check perms
return (undef) unless $common->can_load("Mac::SysProfile");
return 1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my ($name, $description, $status);
# create the profile object and return undef unless we get something back
my $pro = Mac::SysProfile->new();
my $data = $pro->gettype('SPPCIDataType');
return(undef) unless(ref($data) eq 'ARRAY');
foreach my $slot (@$data) {
$name = $slot->{'_name'};
$description = $slot->{'sppci_link-width'}." ".$slot->{'sppci_bus'}." ".$slot->{'sppci_slot_name'};
$common->addSlot({
NAME => $name,
DESCRIPTION => $description,
});
$name = $description = $status = undef;
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Sound.pm 0000664 0000000 0000000 00000001175 13327377321 0024203 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Sound;
use strict;
sub check {
return(undef) unless -r '/usr/sbin/system_profiler'; # check perms
return 1;
}
sub run {
my $params = shift;
my $common = $params->{common};
# create profiler obj, bail if datatype fails
my $data = $common->get_sysprofile_devices_names('SPAudioDataType');
return(undef) unless(ref($data) eq 'ARRAY');
# add sound cards
foreach my $sound (@$data){
$common->addSound({
'NAME' => $sound,
'MANUFACTURER' => $sound,
'DESCRIPTION' => $sound,
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Storages.pm 0000664 0000000 0000000 00000005562 13327377321 0024706 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Storages;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return $common->can_load('Mac::SysProfile');
}
sub getManufacturer {
my $model = shift;
if($model =~ /(maxtor|western|sony|compaq|hewlett packard|ibm|seagate|toshiba|fujitsu|lg|samsung|nec|transcend|matshita|pioneer|hitachi)/i) {
return ucfirst(lc($1));
}
elsif ($model =~ /^HP/) {
return "Hewlett Packard";
}
elsif ($model =~ /^WDC/) {
return "Western Digital";
}
elsif ($model =~ /^ST/) {
return "Seagate";
}
elsif ($model =~ /^HD/ or $model =~ /^IC/ or $model =~ /^HU/) {
return "Hitachi";
}
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my $devices = {};
my $profile = Mac::SysProfile->new();
# Get SATA Drives
my $sata = $profile->gettype('SPSerialATADataType');
if ( ref($sata) eq 'ARRAY') {
foreach my $storage ( @$sata ) {
next unless ( ref($storage) eq 'HASH' );
my $description;
if ( $storage->{'_name'} =~ /DVD/i || $storage->{'_name'} =~ /CD/i ) {
$description = 'CD-ROM Drive';
}
else {
$description = 'Disk drive';
}
my $size = $storage->{'size'};
if ($size =~ /GB/) {
$size =~ s/ GB//;
$size *= 1024;
}
if ($size =~ /TB/) {
$size =~ s/ TB//;
$size *= 1048576;
}
my $manufacturer = getManufacturer($storage->{'_name'});
my $model = $storage->{'device_model'};
$model =~ s/\s*$manufacturer\s*//i;
$devices->{$storage->{'_name'}} = {
NAME => $storage->{'name'},
SERIALNUMBER => $storage->{'device_serial'},
DISKSIZE => $size,
FIRMWARE => $storage->{'device_revision'},
MANUFACTURER => $manufacturer,
DESCRIPTION => $description,
MODEL => $model
};
}
}
# Get PATA Drives
my $pata = $profile->gettype('SPParallelATADataType');
if ( ref($sata) eq 'ARRAY') {
foreach my $storage ( @$pata ) {
next unless ( ref($storage) eq 'HASH' );
my $description;
if ( $storage->{'_name'} =~ /DVD/i || $storage->{'_name'} =~ /CD/i ) {
$description = 'CD-ROM Drive';
}
else {
$description = 'Disk drive';
}
my $manufacturer = getManufacturer($storage->{'_name'});
my $model = $storage->{'device_model'};
my $size;
$devices->{$storage->{'_name'}} = {
NAME => $storage->{'_name'},
SERIAL => $storage->{'device_serial'},
DISKSIZE => $size,
FIRMWARE => $storage->{'device_revision'},
MANUFACTURER => $manufacturer,
DESCRIPTION => $description,
MODEL => $model
};
}
}
foreach my $device ( keys %$devices ) {
$common->addStorages($devices->{$device});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/UUID.pm 0000664 0000000 0000000 00000001057 13327377321 0023660 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::UUID;
use strict;
use warnings;
sub check {
my $params = shift;
my $common = $params->{common};
return(undef) unless -r '/usr/sbin/system_profiler';
return 1;
}
sub run {
my $params = shift;
my $common = $params->{common};
my @sphardware=`system_profiler SPHardwareDataType`;
my $uuid;
foreach my $line (@sphardware){
chomp $line;
$uuid = $1 if ($line =~ /Hardware UUID:\s(.*)/i);
}
$common->setHardware({
UUID => $uuid,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Uptime.pm 0000664 0000000 0000000 00000001550 13327377321 0024353 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Uptime;
use strict;
sub check {
my $boottime = `sysctl -n kern.boottime 2>/dev/null`; # straight from the BSD module ;-)
return 1 if $boottime;
return;
}
sub run {
my $params = shift;
my $common = $params->{common};
# stolen code from bsd.
chomp (my $boottime = `sysctl -n kern.boottime`);
$boottime = $1 if $boottime =~ /sec\s*=\s*(\d+)/;
chomp (my $currenttime = `date +%s`);
my $uptime = $currenttime - $boottime;
# Uptime conversion
my ($UYEAR, $UMONTH , $UDAY, $UHOUR, $UMIN, $USEC) = (gmtime ($uptime))[5,4,3,2,1,0];
# Write in ISO format
$uptime=sprintf "%02d-%02d-%02d %02d:%02d:%02d", ($UYEAR-70), $UMONTH, ($UDAY-1), $UHOUR, $UMIN, $USEC;
chomp(my $DeviceType =`uname -m`);
$common->setHardware({ DESCRIPTION => "$DeviceType/$uptime" });
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/MacOS/Video.pm 0000664 0000000 0000000 00000005015 13327377321 0024156 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::MacOS::Video;
use strict;
use Parse::EDID qw(parse_edid);
sub check {
my $params = shift;
my $common = $params->{common};
# make sure the user has access, cause that's the command that's gonna be run
return(undef) unless -r '/usr/sbin/ioreg';
return(undef) unless -r '/usr/sbin/system_profiler';
return(undef) unless $common->can_load("Mac::SysProfile");
return 1;
}
sub run {
my $params = shift;
my $common = $params->{common};
# run the profiler to get our datatype
my $profile = Mac::SysProfile->new();
my $data = $profile->gettype('SPDisplaysDataType');
# unless we get a valid return, bail out
return(undef) unless(ref($data) eq 'ARRAY');
# we get video card because system_profiler XML output does not provide a human readable value
my $video_names = $common->get_sysprofile_devices_names('SPDisplaysDataType');
return(undef) unless(ref($video_names) eq 'ARRAY');
my $count = 0;
#Getting monitor serial number
#TODO: get serial for multiples monitors
my $ioreg_binary = `ioreg -lw0 | grep "EDID" | sed "/[^<]*{'monitor_name'};
my $ioreg_name = $ioreg->{'serial_number2'};
# add the video information
foreach my $video (@$data){
my $memory;
# macOS 10.13 doesn't have spdisplays_vram but has _spdisplays_vram
if (exists($video->{'spdisplays_vram'})) {
$memory = $video->{'spdisplays_vram'};
} elsif (exists($video->{'_spdisplays_vram'})) {
$memory = $video->{'_spdisplays_vram'};
}
$memory =~ s/ MB$//;
$common->addVideo({
'NAME' => $$video_names[$count],
'CHIPSET' => $video->{'sppci_model'},
'MEMORY' => $memory,
'RESOLUTION' => $video->{'spdisplays_ndrvs'}[0]->{'spdisplays_resolution'},
});
foreach my $display (@{$video->{'spdisplays_ndrvs'}}){
my $serial;
next unless(ref($display) eq 'HASH');
next if($display->{'_name'} eq 'spdisplays_display_connector');
$serial = $ioreg_serial if ($ioreg_name eq $display->{'_name'});
$common->addMonitor({
'CAPTION' => $display->{'_name'},
'SERIAL' => $serial,
})
}
$count++;
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris.pm 0000664 0000000 0000000 00000002164 13327377321 0023564 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris;
use strict;
use vars qw($runAfter);
$runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"];
sub check {$^O =~ /^solaris$/}
sub run {
my $params = shift;
my $common = $params->{common};
my $OSName;
my $OSComment;
my $OSVersion;
my $OSLevel;
my $HWDescription;
my ( $karch, $hostid, $proct, $platform);
#Operating system informations
chomp($OSName=`uname -s`);
chomp($OSLevel=`uname -r`);
chomp($OSComment=`uname -v`);
open(FH, "< /etc/release") and do {
chomp($OSVersion = readline (FH));
$OSVersion =~ s/^\s+//;
close FH;
};
chomp($OSVersion=`uname -v`) unless $OSVersion;
chomp($OSVersion);
$OSVersion=~s/^\s*//;
$OSVersion=~s/\s*$//;
# Hardware informations
chomp($karch=`arch -k`);
chomp($hostid=`hostid`);
chomp($proct=`uname -p`);
chomp($platform=`uname -i`);
$HWDescription = "$platform($karch)/$proct HostID=$hostid";
$common->setHardware({
OSNAME => "$OSName $OSLevel",
OSCOMMENTS => $OSComment,
OSVERSION => $OSVersion,
DESCRIPTION => $HWDescription
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/ 0000775 0000000 0000000 00000000000 13327377321 0023223 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/Bios.pm 0000664 0000000 0000000 00000014135 13327377321 0024461 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::Bios;
# SPARC
# $ showrev
#Hostname: 157501s021plc
#Hostid: 83249bbf
#Release: 5.10
#Kernel architecture: sun4u
#Application architecture: sparc
#Hardware provider: Sun_Microsystems
#Domain: be.cnamts.fr
#Kernel version: SunOS 5.10 Generic_118833-17
#
# $ prtconf -pv (-b would be great...but doesn't work before S10)
#System Configuration: Sun Microsystems sun4u
#Memory size: 16384 Megabytes
#System Peripherals (PROM Nodes):
#
#Node 0xf0819f00
# scsi-initiator-id: 00000007
# node#: 00000000
# #size-cells: 00000002
# stick-frequency: 00bebc20
# clock-frequency: 08f0d180
# idprom: 01840014.4f4162cb.45255cf4.4162cb16.55555555.55555555.55555555.55555555
# breakpoint-trap: 0000007f
# device_type: 'gptwo'
# banner-name: 'Sun Fire E6900'
# compatible: 'SUNW,Serengeti'
# newio-addr: 00000001
# name: 'SUNW,Sun-Fire'
# X64
# $ showrev
#Hostname: stlaurent
#Hostid: 403100b
#Release: 5.10
#Kernel architecture: i86pc
#Application architecture: i386
#Hardware provider:
#Domain:
#Kernel version: SunOS 5.10 Generic_127112-07
#
# $ smbios -t SMB_TYPE_SYSTEM
#ID SIZE TYPE
#1 76 SMB_TYPE_SYSTEM (system information)
#
# Manufacturer: Sun Microsystems, Inc.
# Product: Sun Fire V40z
# Version: 00
# Serial Number: R00T34E0009
#
# UUID: be1630df-d130-41a4-be32-fd28bb4bd1ac
# Wake-Up Event: 0x6 (power switch)
# SKU Number:
# Family:
use strict;
sub run {
my $params = shift;
my $common = $params->{common};
my $zone;
my( $SystemSerial , $SystemModel, $SystemManufacturer, $ChassisType, $MotherBoardSerial, $MotherBoardModel, $MotherBoardManufacturer, $BiosManufacturer, $BiosVersion, $BiosDate, $aarch);
if ( !$common->can_run("zonename") || `zonename` =~ /global/ ) {
# Ether pre Sol10 or in Sol10/Sol11 global zone
$zone = "global";
} else {
$zone = "";
}
if ($zone){
chomp($SystemModel = `uname -m`);
chomp($aarch = `uname -p`);
if( $aarch eq "i386" ){
#
# For a Intel/AMD arch, we're using smbios
#
foreach(`/usr/sbin/smbios -t SMB_TYPE_SYSTEM`) {
if(/^\s*Manufacturer:\s*(.+)$/){$SystemManufacturer = $1};
if(/^\s*Serial Number:\s*(.+)$/){$SystemSerial = $1;}
if(/^\s*Product:\s*(.+)$/){$SystemModel = $1;}
}
foreach(`/usr/sbin/smbios -t SMB_TYPE_BIOS`) {
if(/^\s*Vendor:\s*(.+)$/){$BiosManufacturer = $1};
if(/^\s*Version String:\s*(.+)$/){$BiosVersion = $1};
if(/^\s*Release Date:\s*(.+)$/){$BiosDate = $1};
}
foreach(`/usr/sbin/smbios -t SMB_TYPE_BASEBOARD`) {
if(/^\s*Product\s*(.+)$/){$MotherBoardModel = $1};
if(/^\s*Serial Number:\s*(.+)$/){$MotherBoardSerial = $1};
if(/^\s*Manufacturer:\s*(.+)$/){$MotherBoardManufacturer = $1};
}
foreach(`/usr/sbin/smbios -t SMB_TYPE_CHASSIS`) {
if(/^\s*Chassis Type:.*\((.+)\)$/) {$ChassisType = $1};
}
} elsif( $aarch eq "sparc" ) {
#
# For a Sparc arch, we're using prtconf
#
my $name;
my $OBPstring;
my $found=0;
if ( $common->can_run("virtinfo") && `virtinfo -t` =~ /.*LDoms guest.*/ ) {
foreach(`virtinfo -a`) {
if(/^Domain role:\s*(.+)$/) {$ChassisType = $1};
if(/^Chassis serial.:\s*(.+)$/) {$SystemSerial = $1};
}
}
foreach(`/usr/sbin/prtconf -pv`) {
# prtconf is an awful thing to parse
if(/^System Configuration:\s*(.+)\s+\S+$/) {$SystemManufacturer = $1; $BiosManufacturer = $1; }
if(/^\s*banner-name:\s*'(.+)'$/){$SystemModel = $1;}
unless ($name)
{ if(/^\s*name:\s*'(.+)'$/){$name = $1;} }
unless ($OBPstring) {
if(/^\s*version:\s*'(.+)'$/){
$OBPstring = $1;
# looks like : "OBP 4.33.6.f 2014/07/10 10:24"
# with further informations sometimes
if( $OBPstring =~ m@OBP\s+(\S+)\s+(\d+)/(\d+)/(\d+)@ ){
$BiosVersion = "OBP $1";
$BiosDate = "$2/$3/$4";
} else { $BiosVersion = $OBPstring }
}
}
}
$SystemModel .= " ($name)" if( $name );
if ( $common->can_run("ipmitool") ) {
foreach(`/usr/sbin/ipmitool fru print`) {
if (/^\s*Chassis Type\s+:\s+(.+)/) {
$ChassisType = $1;
$found = 1;
}
elsif ( $found && /^\s*Product Serial\s+:\s+(.+)/) {
$SystemSerial = $1;
last;
}
}
}
if ( !$SystemSerial ) {
# No serial found via ipmitool, so use sneep
if( -x "/opt/SUNWsneep/bin/sneep" ) {
chomp($SystemSerial = `/opt/SUNWsneep/bin/sneep`);
}else {
foreach(`/bin/find /opt -name sneep`) {
chomp($SystemSerial = `$1`) if /^(\S+)/;
}
if (!$SystemSerial){
$SystemSerial = "Please install package SUNWsneep";
}
}
}
}
}else{
foreach(`showrev`){
if(/^Hardware provider:\s+(\S+)/){$SystemManufacturer = $1};
}
$SystemModel = "Solaris Containers";
$SystemSerial = "Solaris Containers";
}
# Writing data
$common->setBios ({
BVERSION => $BiosVersion,
BDATE => $BiosDate,
BMANUFACTURER => $BiosManufacturer,
SMANUFACTURER => $SystemManufacturer,
SMODEL => $SystemModel,
SSN => $SystemSerial,
MMANUFACTURER => $MotherBoardManufacturer,
MSN => $MotherBoardSerial,
TYPE => $ChassisType,
MMODEL => $MotherBoardModel
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/CPU.pm 0000664 0000000 0000000 00000035161 13327377321 0024216 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::CPU;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
if (!$common->can_run ("memconf")) {
$logger->debug('memconf not found in $PATH');
return;
}
1;
}
sub run {
my $params = shift;
my $common = $params->{common};
#modif 20100329
my @cpu;
my $current;
my $cpu_core;
my $cpu_thread;
my $cpu_slot;
my $cpu_speed;
my $cpu_type;
my $model;
my $zone;
my $sun_class_cpu=0;
my $cpusocket=1;
my $cpu_arch;
my $cpu_manufacturer;
my $data_width;
my %coretable = ( 'dual', 2, 'quad', 4, 'six', 6, 'eight', 8, 'ten', 10, 'twelve', 12 );
my $aarch;
chomp($aarch = `uname -p`);
chomp($cpu_arch = `uname -m`);
chomp($data_width = `isainfo -b`);
if ( !$common->can_run("zonename") || `zonename` =~ /global/ ) {
# Either pre Sol10 or in Sol10/Sol11 global zone
$zone = "global";
} else {
# Sol10/Sol11 local zone
$zone = "";
}
if ($zone) {
if ( $aarch =~ /sparc/ && $common->can_run("virtinfo") && `virtinfo -t` =~ /.*LDoms guest.*/ ) {
$model = "Solaris Ldom";
} else {
chomp($model = `uname -i`);
}
} else {
$model = "Solaris Containers";
}
#print "CPU Model: $model\n";
# we map (hopfully) our server model to a known class
#
# #sun_class_cpu sample out from memconf
# 0 (default) generic detection with prsinfo
# 1 Sun Microsystems, Inc. Sun Fire 880 (4 X UltraSPARC-III 750MHz)
# 2 Sun Microsystems, Inc. Sun Fire V490 (2 X dual-thread UltraSPARC-IV 1350MHz)
# 3 Sun Microsystems, Inc. Sun-Fire-T200 (Sun Fire T2000) (8-core quad-thread UltraSPARC-T1 1000MHz)
# 4 Sun Microsystems, Inc. SPARC Enterprise T5220 (4-core 8-thread UltraSPARC-T2 1165MHz)
#
#if ($model eq "SUNW,Sun-Fire-280R") { $sun_class_cpu = 1; }
#if ($model eq "SUNW,Sun-Fire-480R") { $sun_class_cpu = 1; }
#if ($model eq "SUNW,Sun-Fire-V240") { $sun_class_cpu = 1; }
#if ($model eq "SUNW,Sun-Fire-V245") { $sun_class_cpu = 1; }
#if ($model eq "SUNW,Sun-Fire-V250") { $sun_class_cpu = 1; }
#if ($model eq "SUNW,Sun-Fire-V440") { $sun_class_cpu = 1; }
#if ($model eq "SUNW,Sun-Fire-V445") { $sun_class_cpu = 1; }
#if ($model eq "SUNW,Sun-Fire-880") { $sun_class_cpu = 1; }
#if ($model eq "SUNW,Sun-Fire-V490") { $sun_class_cpu = 2; }
#if ($model eq "SUNW,Netra-T12") { $sun_class_cpu = 2; }
#if ($model eq "SUNW,Sun-Fire-T200") { $sun_class_cpu = 3; }
#if ($model eq "SUNW,SPARC-Enterprise-T1000") { $sun_class_cpu = 4; }
#if ($model eq "SUNW,SPARC-Enterprise-T5220") { $sun_class_cpu = 4; }
#if ($model eq "SUNW,SPARC-Enterprise-T5240") { $sun_class_cpu = 4; }
#if ($model eq "SUNW,SPARC-Enterprise-T5120") { $sun_class_cpu = 4; }
#if ($model eq "SUNW,SPARC-Enterprise") { $sun_class_cpu = 4; }
if ($model =~ /SUNW,SPARC-Enterprise/) { $sun_class_cpu = 5; } # M5000
if ($model =~ /SUNW,SPARC-Enterprise-T\d/){ $sun_class_cpu = 4; } #T5220 - T5210
if ($model =~ /SUNW,Netra-T/){ $sun_class_cpu = 2; }
if ($model =~ /SUNW,Sun-Fire-\d/){ $sun_class_cpu = 1; }
if ($model =~ /SUNW,Sun-Fire-V/){ $sun_class_cpu = 2; }
if ($model =~ /SUNW,Sun-Fire-T\d/) { $sun_class_cpu = 3; }
if ($model =~ /Solaris Containers/){ $sun_class_cpu = 6; }
if ($model =~ /SUNW,SPARCstation/) { $sun_class_cpu = 7; }
if ($model =~ /SUNW,Sun-Blade-100/) { $sun_class_cpu = 7; }
if ($model =~ /SUNW,Sun-Blade-1500/) { $sun_class_cpu = 7; }
if ($model =~ /SUNW,Ultra/) { $sun_class_cpu = 7; }
if ($model =~ /FJSV,GPUZC-M/) { $sun_class_cpu = 8; }
# Recent and current hardware
if ($model =~ /SUNW,T5/) { $sun_class_cpu = 20; } # T5240, T5440
if ($model =~ /i86pc/) { $sun_class_cpu = 21; } # Solaris Intel
if ($model =~ /sun4v/) { $sun_class_cpu = 22; } # T3-x, T4-x, T5-x
if ($model =~ /Solaris Ldom/){ $sun_class_cpu = 23; }
if($sun_class_cpu == 0)
{
# if our maschine is not in one of the sun classes from upside, we use psrinfo
# a generic methode
foreach (`psrinfo -v`)
{
if (/^\s+The\s(\w+)\sprocessor\soperates\sat\s(\d+)\sMHz,/)
{
$cpu_type = $1;
$cpu_speed = $2;
$cpu_slot++;
}
}
}
if($sun_class_cpu == 1)
{
# Sun Microsystems, Inc. Sun Fire 880 (4 X UltraSPARC-III 750MHz)
foreach (`memconf 2>&1`)
{
if(/^Sun Microsystems, Inc. Sun Fire\s+\S+\s+\((\d+)\s+X\s+(\S+)\s+(\d+)/)
{
$cpu_manufacturer = "Sun Microsystems, Inc.";
$cpu_slot = $1;
$cpu_type = $2;
$cpu_speed = $3;
$cpu_core=$1;
$cpu_thread="0";
}
elsif (/^Sun Microsystems, Inc. Sun Fire\s+\S+\s+\((\S+)\s+(\d+)/)
{
$cpu_manufacturer = "Sun Microsystems, Inc.";
$cpu_slot="1";
$cpu_type=$1;
$cpu_speed=$2;
$cpu_core="1";
$cpu_thread="0";
}
}
}
if($sun_class_cpu == 2)
{
#Sun Microsystems, Inc. Sun Fire V490 (2 X dual-thread UltraSPARC-IV 1350MHz)
foreach (`memconf 2>&1`)
{
if(/^Sun Microsystems, Inc. Sun Fire\s+\S+\s+\((\d+)\s+X\s+(\S+)\s+(\S+)\s+(\d+)/)
{
$cpu_manufacturer = "Sun Microsystems, Inc.";
$cpu_slot = $1;
$cpu_type = $3 . " (" . $2 . ")";
$cpu_speed = $4;
$cpu_core=$1;
$cpu_thread=$2;
}
elsif (/^Sun Microsystems, Inc. Sun Fire\s+V\S+\s+\((\d+)\s+X\s+(\S+)\s+(\d+)(\S+)/)
{
$cpu_manufacturer = "Sun Microsystems, Inc.";
$cpu_slot = $1;
$cpu_type = $2 . " (" . $1 . ")";
$cpu_speed = $3;
$cpu_core=$1;
$cpu_thread=$2;
}
# Sun Microsystems, Inc. Sun Fire V240 (UltraSPARC-IIIi 1002MHz)
elsif (/^Sun Microsystems, Inc. Sun Fire\s+\S+\s+\((\S+)\s+(\d+)/)
{
$cpu_manufacturer = "Sun Microsystems, Inc.";
$cpu_slot="1";
$cpu_type=$1;
$cpu_speed=$2;
$cpu_core="1";
$cpu_thread="0";
}
}
}
if($sun_class_cpu == 3)
{
foreach (`memconf 2>&1`)
{
#Sun Microsystems, Inc. Sun-Fire-T200 (Sun Fire T2000) (8-core quad-thread UltraSPARC-T1 1000MHz)
#Sun Microsystems, Inc. Sun-Fire-T200 (Sun Fire T2000) (4-core quad-thread UltraSPARC-T1 1000MHz)
if(/^Sun Microsystems, Inc.\s+\S+\s+\(\S+\s+\S+\s+\S+\)\s+\((\d+).*\s+(\S+)-\S+\s+(\S+)\s+(\d+)/)
{
# T2000 has only one CPU
$cpu_manufacturer = "Sun Microsystems, Inc.";
$cpu_slot = 1;
$cpu_type = "$3 ($1-Core $2-Thread)";
$cpu_speed = $4;
$cpu_core=$1;
$cpu_thread = $coretable{lc($2)};
}
}
}
if($sun_class_cpu == 4)
{
foreach (`memconf 2>&1`)
{
#Sun Microsystems, Inc. SPARC Enterprise T5120 (8-core 8-thread UltraSPARC-T2 1165MHz)
#Sun Microsystems, Inc. SPARC Enterprise T5120 (4-core 8-thread UltraSPARC-T2 1165MHz)
#Oracle Corporation SPARC Enterprise T5220 (8-Core 8-Thread UltraSPARC-T2 1415MHz)
if(/^(.*)\s+SPARC.+\((\d+)*(\S+)\s+(\d+)*(\S+)\s+(\S+)\s+(\d+)MHz\)/)
{
$cpu_manufacturer = $1;
$cpu_slot = 1;
$cpu_type = "$6 ($2-Core $4-Thread)";
$cpu_speed = $7;
$cpu_core=$2;
$cpu_thread=$4;
}
}
}
if($sun_class_cpu == 5)
{
foreach (`memconf 2>&1`)
{
#Sun Microsystems, Inc. Sun SPARC Enterprise M5000 Server (6 X dual-core dual-thread SPARC64-VI 2150MHz)
#Sun Microsystems, Inc. SPARC Enterprise M8000 Server (2 X Quad-Core Dual-Thread SPARC64-VII 2520MHz)
#Fujitsu SPARC Enterprise M4000 Server (4 X dual-core dual-thread SPARC64-VI 2150MHz)
if(/^Sun Microsystems, Inc\..+\((\d+)\s+X\s+(\S+)-\S+\s+(\S+)-\S+\s+(\S+)\s+(\d+)/)
{
$cpu_manufacturer = "Sun Microsystems, Inc.";
$cpu_slot = $1;
$cpu_type = "$4 ($2-Core $3-Thread)";
$cpu_speed = $5;
$cpu_core = $coretable{lc($2)};
$cpu_thread = $coretable{lc($3)};
}
#Fujitsu SPARC Enterprise M4000 Server (4 X dual-core dual-thread SPARC64-VI 2150MHz)
if(/^Fujitsu SPARC Enterprise.*\((\d+)\s+X\s+(\S+)-\S+\s+(\S+)-\S+\s+(\S+)\s+(\d+)/)
{
$cpu_manufacturer = "Fujitsu";
$cpu_slot = $1;
$cpu_type = "$4 ($2-Core $3-Thread)";
$cpu_speed = $5;
$cpu_core = $coretable{lc($2)};
$cpu_thread = $coretable{lc($3)};
}
}
}
if($sun_class_cpu == 6)
{
$cpu_manufacturer = "Solaris Container";
foreach (`prctl -n zone.cpu-shares $$`)
{
$cpu_type = $1 if /^zone.(\S+)$/;
$cpu_type = $cpu_type." ".$1 if /^\s*privileged+\s*(\d+).*$/;
$cpu_slot = 1 if /^\s*privileged+\s*(\d+).*$/;
}
}
if($sun_class_cpu == 7) {
foreach(`memconf 2>&1`) {
#Sun Microsystems, Inc. Sun Blade 1500 (UltraSPARC-IIIi 1062MHz)
#Sun Microsystems, Inc. Sun Blade 100 (UltraSPARC-IIe 502MHz)
#Sun Microsystems, Inc. Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 333MHz)
#Sun Microsystems, Inc. Sun Ultra 1 SBus (UltraSPARC 143MHz)
#Sun Microsystems, Inc. SPARCstation 20 (1 X 390Z50) (SuperSPARC 50MHz)
#Sun Microsystems, Inc. SPARCstation 5 (TurboSPARC-II 170MHz)
if (/^Sun Microsystems, Inc\..+\((\S+)\s+(\d+)MHz\)/) {
$cpu_manufacturer = "Sun Microsystems, Inc.";
$cpu_slot = 1;
$cpu_type = $1;
$cpu_speed = $2;
$cpu_core = 1;
$cpu_thread = 0;
}
}
}
if ($sun_class_cpu == 8) {
foreach (`memconf 2>&1`){
#Fujitsu PRIMEPOWER450 4x SPARC64 V clone (4 X SPARC64-V 1978MHz)
#Fujitsu PRIMEPOWER250 2x SPARC64 V clone (2 X SPARC64-V 1649MHz)
if (/^FJSV,GPUZC-M.+\((\d+)\s+X\s+(\S+)\s+(\d+)MHz\)/) {
$cpu_manufacturer = "Fujitsu";
$cpu_slot = $1;
$cpu_type = $2;
$cpu_speed = $3;
$cpu_core = $1;
$cpu_thread = "0";
}
}
}
if ($sun_class_cpu == 20) {
foreach (`memconf 2>&1`) {
#Oracle Corporation T5240 (2 X 8-Core 8-Thread UltraSPARC-T2+ 1582MHz)
#Oracle Corporation T5440 (4 X 8-Core 8-Thread UltraSPARC-T2+ 1596MHz)
#Sun Microsystems, Inc. T5240 (2 X 8-Core 8-Thread UltraSPARC-T2+ 1582MHz)
if(/^(.*)\s+T\d+\s+\((\d+)\s+X\s+(\d+)-\S+\s+(\d)+-\S+\s+(\S+)\s+(\d+)MHz\)/) {
$cpu_manufacturer = $1;
$cpu_slot = $2;
$cpu_type = "$5 ($3-Core $4-Thread)";
$cpu_speed = $6;
$cpu_core = $3;
$cpu_thread = $4;
}
}
}
if ($sun_class_cpu == 21) {
foreach (`memconf 2>&1`) {
# Solaris on x86
#Oracle Corporation Sun Fire X4270 Server (2 X Quad-Core Hyper-Threaded Intel(R) Xeon(R) X5570 @ 2.93GHz)
#HP ProLiant DL380 G5 (2 X Quad-Core Intel(R) Xeon(R) E5430 @ 2.66GHz)
#HP ProLiant DL380 G7 (2 X Six-Core Hyper-Threaded Intel(R) Xeon(R) X5670 @ 2.93GHz)
#HP ProLiant DL580 G7 (4 X Ten-Core Hyper-Threaded Intel(R) Xeon(R) E7- 4860 @ 2.27GHz)
#HP ProLiant DL380p Gen8 (2 X Eight-Core Hyper-Threaded Intel(R) Xeon(R) E5-2660 0 @ 2.20GHz Proc 2)
#HP ProLiant DL380 Gen9 (2 X Twelve-Core Hyper-Threaded Intel(R) Xeon(R) E5-2680 v3 @ 2.50GHz Proc 2 2497MHz)
if(/^.*\((\d+) X (\S+)-Core Hyper-Threaded (\S+)(.*) @ (\S+)GHz.*\)/) {
# Hyper-Threaded CPU
$cpu_manufacturer = $3;
$cpu_slot = $1;
$cpu_type = $3 . $4;
$cpu_speed = $5 * 1000;
$cpu_core = $coretable{lc($2)};
$cpu_thread = "on";
}
elsif(/^.*\((\d+) X (\S+)-Core (\S+)(.*) @ (\S+)GHz.*\)/) {
# Non Hyper-Threaded CPU
$cpu_manufacturer = $3;
$cpu_slot = $1;
$cpu_type = $3 . $4;
$cpu_speed = $5 * 1000;
$cpu_core = $coretable{lc($2)};
$cpu_thread = "off";
}
elsif(/^.*\((\S+)-Core (\S+)(.*) @ (\S+)GHz.*\)/) {
# single core CPU
$cpu_manufacturer = $2;
$cpu_slot = 1;
$cpu_type = $2 . $3;
$cpu_speed = $4 * 1000;
$cpu_core = $coretable{lc($1)};
$cpu_thread = "off";
}
}
}
if ($sun_class_cpu == 22) {
foreach (`memconf 2>&1`) {
#Oracle Corporation SPARC T3-1 (16-Core 8-Thread SPARC-T3 1649MHz)
#Oracle Corporation SPARC T3-2 (2 X 16-Core 8-Thread SPARC-T3 1649MHz)
#Oracle Corporation SPARC T4-1 (8-Core 8-Thread SPARC-T4 2848MHz)
#Oracle Corporation SPARC T4-2 (2 X 8-Core 8-Thread SPARC-T4 2848MHz)
#Oracle Corporation SPARC T4-4 (4 X 8-Core 8-Thread SPARC-T4 2998MHz)
#Oracle Corporation SPARC T5-2 (16-Core 8-Thread SPARC-T5 3600MHz)
#Oracle Corporation SPARC T5-4 (4 X 16-Core 8-Thread SPARC-T5 3600MHz)
if(/^Oracle Corporation.+\((\d+)-Core (\d+)-Thread (\S+) (\d+)MHz\)/) {
# Single CPU string
$cpu_manufacturer = "Oracle Corporation";
$cpu_slot = 1;
$cpu_type = "$3 ($1-Core $2-Thread)";
$cpu_speed = $4;
$cpu_core = $1;
$cpu_thread = $2;
}
elsif(/^Oracle Corporation.+\((\d+) X (\d+)-Core (\d+)-Thread (\S+) (\d+)MHz\)/) {
# Multiple CPU string
$cpu_manufacturer = "Oracle Corporation";
$cpu_slot = $1;
$cpu_type = "$4 ($2-Core $3-Thread)";
$cpu_speed = $5;
$cpu_core = $2;
$cpu_thread = $3;
}
}
}
if($sun_class_cpu == 23)
{
# Solaris LDom support
$cpu_slot=1;
$cpu_core = 0;
$cpu_thread = 0;
$cpu_manufacturer = "Solaris LDom";
foreach (`psrinfo -pv`) {
if (/^The physical processor has.* (\d+) virtual processors.*/) {
$cpu_thread = $cpu_thread + $1;
}
elsif (/^\s+(\S+)\s+\(.*clock\s+(\d+)\sMHz\)/) {
$cpu_type = $1;
$cpu_speed = $2;
}
}
}
# for debug only
#print "cpu_slot: " . $cpu_slot . "\n";
#print "cpu_type: " . $cpu_type . "\n";
#print "cpu_speed: " . $cpu_speed . "\n";
#print "cpu_core: " . $cpu_core . "\n";
#print "cpu_thread: " . $cpu_thread . "\n";
# Finally, add the found CPUs
for $cpusocket ( 1 .. $cpu_slot ) {
$current->{MANUFACTURER} = $cpu_manufacturer if $cpu_manufacturer;
$current->{SPEED} = $cpu_speed if $cpu_speed;
$current->{CURRENT_SPEED} = $cpu_speed if $cpu_speed;
$current->{TYPE} = $cpu_type if $cpu_type;
$current->{CORES} = $cpu_core if $cpu_core;
$current->{CPUARCH} = $cpu_arch if $cpu_arch;
if ( $cpu_core == 0 ) {
$current->{LOGICAL_CPUS} = $cpu_thread if ( $cpu_thread );
} else {
$current->{LOGICAL_CPUS} = $cpu_core * $cpu_thread if ( $cpu_core && $cpu_thread );
}
$current->{DATA_WIDTH} = $data_width if $data_width;
$common->addCPU($current);
}
# insert to values we have found
# $common->setHardware({
# PROCESSORT => $cpu_type,
# PROCESSORN => $cpu_slot,
# PROCESSORS => $cpu_speed
# });
}
#run();
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/Controllers.pm 0000664 0000000 0000000 00000001530 13327377321 0026066 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::Controllers;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run ("cfgadm")
}
sub run {
my $params = shift;
my $common = $params->{common};
my $name;
my $type;
my $description;
foreach(`cfgadm -s cols=ap_id:type:info`){
$name = $type = $description = "";
next if (/^Ap_Id/);
if (/^(\S+)\s+/){
$name = $1;
}
if(/^\S+\s+(\S+)/){
$type = $1;
}
#No manufacturer, but informations about controller
if(/^\S+\s+\S+\s+(.*)/){
$description = $1;
}
$common->addController({
'NAME' => $name,
'TYPE' => $type,
'DESCRIPTION' => $description,
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/Domains.pm 0000664 0000000 0000000 00000001345 13327377321 0025156 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::Domains;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run ("domainname")
}
sub run {
my $params = shift;
my $common = $params->{common};
my $domain;
chomp($domain = `domainname`);
if (!$domain) {
my %domain;
if (open RESOLV, "/etc/resolv.conf") {
while() {
$domain{$2} = 1 if (/^(domain|search)\s+(.+)/);
}
close RESOLV;
}
$domain = join "/", keys %domain;
}
# If no domain name, we send "WORKGROUP"
$domain = 'WORKGROUP' unless $domain;
$common->setHardware({
WORKGROUP => $domain
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/Drives.pm 0000664 0000000 0000000 00000003702 13327377321 0025017 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::Drives;
#Filesystem kbytes used avail capacity Mounted on
#/dev/vx/dsk/bootdg/rootvol 16525754 5423501 10936996 34% /
#/devices 0 0 0 0% /devices
#ctfs 0 0 0 0% /system/contract
#proc 0 0 0 0% /proc
#mnttab 0 0 0 0% /etc/mnttab
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run ("df")
}
sub run {
my $params = shift;
my $common = $params->{common};
my $free;
my $filesystem;
my $total;
my $type;
my $volumn;
#Looking for mount points and disk space
for (`df -k`){
if (/^Filesystem\s*/){next};
# on Solaris 10 and up, /devices is an extra mount which we like to exclude
if (/^\/devices/){next};
# on Solaris 10 and up, /platform/.../libc_psr_hwcap1.so.1 is an extra mount which we like to exclude
if (/^\/platform/){next};
# exclude cdrom mount point
if (/^\/.*\/cdrom/){next};
if (/^swap.*/){next};
# exclude special entries such as ctfs, proc, mnttab, etc...
if (/^.*\s+0\s+0\s+0.*/){next};
# skip nfs (dirty hack)
if (/^\S+:\/.*/){next};
# everything else is a local filesystem
if (/^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\n/){
$filesystem = $6;
$total = sprintf("%i",($2/1024));
$free = sprintf("%i",($4/1024));
$volumn = $1;
chomp($type = `mount -v | grep " $filesystem "`);
$type =~ s/\S+\s+on\s+\S+\s+type\s+(\S+)\s+.*/$1/;
$common->addDrive({
FREE => $free,
FILESYSTEM => $filesystem,
TOTAL => $total,
TYPE => $type,
VOLUMN => $volumn
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/IPv4.pm 0000664 0000000 0000000 00000002201 13327377321 0024336 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::IPv4;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run ("ifconfig")
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my %ip;
my $ip;
my $hostn;
#Looking for ip addresses with ifconfig, except loopback
# Solaris need -a option
for (`ifconfig -a`){#ifconfig in the path
#Solarisligne inet
if (/^\s*inet\s+(\S+).*/){($1=~/127.+/)?next:($ip{$1}=1)};
}
# Ok. Now, we have the list of IP addresses configured
# We could have too many addresses to list them in HW
# (details will be sent in Networks instead)
#
# How could we choose ?
#
# Let's try to resolve the name of our server
#
chomp( $hostn = `uname -n` );
if ($hostn) {
my $aip;
foreach (`ping -s $hostn 10 1`) {
unless ( $ip ) {
if( /^.*\((\d+\.\d+\.\d+\.\d+)\):.*/ ) {
$aip = $1;
$ip = $aip if( exists($ip{$aip}) );
}
}
}
}
$common->setHardware({IPADDR => $ip});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/Mem.pm 0000664 0000000 0000000 00000001324 13327377321 0024277 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::Mem;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run ("swap") && $common->can_run ("prtconf")
}
sub run {
my $params = shift;
my $common = $params->{common};
#my $unit = 1024;
my $PhysicalMemory;
my $SwapFileSize;
# Memory informations
foreach(`prtconf`){
if(/^Memory\ssize:\s+(\S+)/){
#print "total memoire: $1";
$PhysicalMemory = $1};
}
#Swap Informations
foreach(`swap -l`){
if(/\s+(\S+)$/){$SwapFileSize = $1};
}
$common->setHardware({
MEMORY => $PhysicalMemory,
SWAP => $SwapFileSize
});
}
1
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/Memory.pm 0000664 0000000 0000000 00000054503 13327377321 0025040 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::Memory;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run ("memconf")
}
sub run {
my $model;
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my $capacity;
my $description;
my $numslots;
my $speed = undef;
my $type = undef;
my $banksize;
my $module_count=0;
my $empty_slots;
my $flag=0;
my $flag_mt=0;
my $caption;
my $sun_class=0;
my $OSLevel;
my $zone;
my $aarch;
# for debug only
my $j=0;
# first, we need determinate on which model of sun server we run,
# because prtdiags output (and with that memconfs output) is differend
# from server model to server model
# we try to classified our box in one of the known classes
chomp($OSLevel = `uname -r`);
chomp($aarch = `uname -p`);
if ( !$common->can_run("zonename") || `zonename` =~ /global/ ) {
# Either pre Sol10 or in Sol10/Sol11 global zone
$zone = "global";
}else{
# Sol10/Sol11 local zone
$zone = "";
}
#print "Nom :".$zone."*************************\n";
if ($zone)
{
if ( $aarch =~ /sparc/ && $common->can_run("virtinfo") && `virtinfo -t` =~ /.*LDoms guest.*/ ) {
$model = "Solaris Ldom";
}else{
chomp($model = `uname -i`);
}
}else{
$model="Solaris Containers";
}
#print "Memory Model: $model\n";
#$model=`uname -i`;
# debug print model
#print "Model: '$model'";
# cut the CR from string model
#$model = substr($model, 0, length($model)-1);
# we map (hopfully) our server model to a known class
#if ($model eq "SUNW,Sun-Fire-280R") { $sun_class = 1; }
#if ($model eq "SUNW,Sun-Fire-480R") { $sun_class = 1; }
#if ($model eq "SUNW,Sun-Fire-V490") { $sun_class = 1; }
#if ($model eq "SUNW,Sun-Fire-880") { $sun_class = 1; }
#if ($model eq "SUNW,Sun-Fire-V240") { $sun_class = 2; }
#if ($model eq "SUNW,Sun-Fire-V440") { $sun_class = 2; }
#if ($model eq "SUNW,Sun-Fire-V250") { $sun_class = 2; }
#if ($model eq "SUNW,Sun-Fire-T200") { $sun_class = 3; }
#if ($model eq "SUNW,Sun-Fire-T1000") { $sun_class = 3; }
#if ($model eq "SUNW,SPARC-Enterprise-T5220") { $sun_class = 4; }
#if ($model eq "SUNW,SPARC-Enterprise") { $sun_class = 5; } # for M5000 && M4000
if ($model =~ /SUNW,SPARC-Enterprise/) { $sun_class = 5; } # for M5000 && M4000
if ($model =~ /SUNW,SPARC-Enterprise-T\d/){ $sun_class = 4; }
if ($model =~ /SUNW,Netra-T/){ $sun_class = 2; }
if ($model =~ /SUNW,Sun-Fire-\d/){ $sun_class = 1; }
if ($model =~ /SUNW,Sun-Fire-V/){ $sun_class = 2; }
if ($model =~ /SUNW,Sun-Fire-V490/) { $sun_class = 1; }
if ($model =~ /SUNW,Sun-Fire-T\d/) { $sun_class = 3; }
if ($model =~ /SUNW,SPARCstation/) { $sun_class = 3; }
if ($model =~ /SUNW,Ultra-/) { $sun_class = 3; }
if ($model =~ /SUNW,Sun-Blade-100/) { $sun_class = 8; }
if ($model =~ /SUNW,Sun-Blade-1500/) { $sun_class = 8; }
if ($model =~ /SUNW,T\d/) { $sun_class = 3; }
if ($model =~ /Solaris Containers/){ $sun_class = 7; }
if ($model =~ /Solaris Ldom/) { $sun_class = 7; }
if ($model =~ /i86pc/) { $sun_class = 6; }
if ($model =~ /sun4v/) { $sun_class = 3; }
# debug print model
#print "Sunclass: $sun_class\n";
# now we can look at memory information, depending from our class
if($sun_class == 0)
{
$logger->debug("sorry, unknown model, could not detect memory configuration");
}
if($sun_class == 1)
{
foreach(`memconf 2>&1`)
{
# debug
#print "count: " .$j++ . " " . $flag_mt . " : " . "$_";
# if we find "empty groups:", we have reached the end and indicate that by setting flag = 0
if(/^empty \w+:\s(\S+)/)
{
$flag = 0;
if($1 eq "None"){$empty_slots = 0;}
}
# grep the type of memory modules from heading
if($flag_mt && /^\s*\S+\s+\S+\s+\S+\s+\S+\s+(\S+)/) {$flag_mt=0; $description = $1;}
# only grap for information if flag = 1
if ($flag && /^\s*(\S+)\s+(\S+)/) { $caption = "Board " . $1 . " MemCtl " . $2; }
if ($flag && /^\s*\S+\s+\S+\s+(\S+)/) { $numslots = $1; }
if ($flag && /^\s*\S+\s+\S+\s+\S+\s+(\d+)/) { $banksize = $1; }
if ($flag && /^\s*\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(\d+)/) { $capacity = $1; }
if ($flag)
{
for (my $i = 1; $i <= ($banksize / $capacity); $i++)
{
#print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$module_count++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
}
# this is the caption line
if(/^\s+Logical Logical Logical/) { $flag_mt = 1; }
# if we find "---", we set flag = 1, and in next line, we start to look for information
if(/^-+/){ $flag = 1; }
}
#print "# of RAM Modules: " . $module_count . "\n";
#print "# of empty slots: " . $empty_slots . "\n";
}
if($sun_class == 2)
{
foreach(`memconf 2>&1`)
{
# debug
#print "line: " .$j++ . " " . $flag_mt . "/" . $flag ." : " . "$_";
# if we find "empty sockets:", we have reached the end and indicate that by resetting flag = 0
# emtpy sockets is follow by a list of emtpy slots, where we extract the slot names
if(/^empty sockets:\s*(\S+)/)
{
$flag = 0;
# cut of first 15 char containing the string empty sockets:
substr ($_,0,15) = "";
$capacity = "empty";
$numslots = 0;
foreach $caption (split)
{
if ($caption eq "None")
{
$empty_slots = 0;
# no empty slots -> exit loop
last;
}
# debug
#print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$empty_slots++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
}
if(/.*Memory Module Groups.*/)
{
$flag = 0;
$flag_mt = 0;
}
# we only grap for information if flag = 1
if($flag && /^\s*\S+\s+\S+\s+(\S+)/){ $caption = $1; }
if($flag && /^\s*(\S+)/){ $numslots = $1; }
if($flag && /^\s*\S+\s+\S+\s+\S+\s+(\d+)/){ $capacity = $1; }
if($flag)
{
# debug
#print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$module_count++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => "DIMM",
CAPTION => "Ram slot ".$numslots,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
# this is the caption line
if(/^ID ControllerID/) { $flag_mt = 1; $description = $1;}
# if we find "---", we set flag = 1, and in next line, we start to look for information
if($flag_mt && /^-+/){ $flag = 1;}
}
# debug: show number of modules found and number of empty slots
}
if($sun_class == 3)
{
# socket MB/MEM3/CMP3/BR1/CH1/D2 has a Micron Technology 36HTF51272F80EE1D4 4GB FB-DIMM
foreach(`memconf 2>&1`)
{
# debug
if(/^empty sockets:\s*(\S+)/)
{
# cut of first 15 char containing the string empty sockets:
substr ($_,0,15) = "";
$description = "";
$type = "";
$capacity = "empty";
$numslots = 0;
foreach $caption (split)
{
if ($caption eq "None")
{
$empty_slots = 0;
# no empty slots -> exit loop
last;
}
# debug
#print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$empty_slots++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
}
# socket MB/MEM3/CMP3/BR1/CH1/D2 has a Micron Technology 36HTF51272F80EE1D4 4GB FB-DIMM
if(/^socket\s+(\S+) has a (.+) (\d+)GB (\S+)/)
{
$caption = $1;
$description = $2;
$type = $4;
$numslots = 0;
$capacity = $3 * 1024;
# debug
#print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$module_count++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
# socket P1C1/B31/C1/D0 (LUN 0 ID 124): Samsung 32768MB DDR4 SDRAM DIMM, M393A4K40BB1-CRC
if(/^socket\s+(\S+) \(LUN \d+ ID \d+\): (.+) (\d+)MB (\S+) (\S+) DIMM, (\S+)/)
{
$caption = $1;
$description = "$2 $6";
$type = "$4 $5";
$numslots = 0;
$capacity = $3;
$module_count++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
}
# debug: show number of modules found and number of empty slots
#print "# of RAM Modules: " . $module_count . "\n";
#print "# of empty slots: " . $empty_slots . "\n";
}
if($sun_class == 4)
{
foreach(`memconf 2>&1`)
{
# debug
#print "line: " .$j++ . " " . $flag_mt . "/" . $flag ." : " . "$_";
# if we find "empty sockets:", we have reached the end and indicate that by resetting flag = 0
# emtpy sockets is follow by a list of emtpy slots, where we extract the slot names
if(/^empty sockets:\s*(\S+)/)
{
$flag = 0;
# cut of first 15 char containing the string empty sockets:
substr ($_,0,15) = "";
$capacity = "empty";
$numslots = 0;
foreach $caption (split)
{
if ($caption eq "None")
{
$empty_slots = 0;
# no empty slots -> exit loop
last;
}
# debug
print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$empty_slots++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
}
# we only grap for information if flag = 1
# socket MB/CMP0/BR0/CH0/D0 has a Samsung 501-7953-01 Rev 05 2GB FB-DIMM
if(/^socket\s+(\S+) has a (.+)\s+(\S+)GB\s+(\S+)$/i)
{
$caption = $1;
$description = $2;
$type = $4;
$numslots = 0;
$capacity = $3 * 1024;
# debug
#print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$module_count++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
}
# debug: show number of modules found and number of empty slots
#print "# of RAM Modules: " . $module_count . "\n";
#print "# of empty slots: " . $empty_slots . "\n";
}
if ($sun_class == 5 )
{
foreach(`memconf 2>&1`)
{
# debug
#print "line: " .$j++ . " " . $flag_mt . "/" . $flag ." : " . "$_";
# if we find "empty sockets:", we have reached the end and indicate that by resetting flag = 0
# emtpy sockets is follow by a list of emtpy slots, where we extract the slot names
if(/^total memory.*(\S+)/) { $flag = 0;}
#print "flag : $flag\n";
if($flag_mt && /^\s+\S+\s+\S+\s+\S+\s+(\S+)/) {$flag_mt=0; $type = $1;}
#print "description : $description\n";
if ($flag && /^\s(\S+)\s+(\S+)/) { $numslots = "LSB " . $1 . " Group " . $2; }
if ($flag && /^\s(\S+)\s+(\S+)/) { $caption = "LSB " . $1 . " Group " . $2; }
if ($flag && /^\s+\S+\s+\S\s+\S+\s+\S+\s+(\d+)/) { $capacity = $1; }
if ($flag && /^\s+\S+\s+\S\s+(\d+)/) { $banksize = $1; }
#print "Num slot ". $numslots . " Bank Number: " . $numslots . " Bank size " . $banksize . " DIMM Capacity: " . $capacity . "MB\n";
if ($flag && $capacity > 1 )
{
for (my $i = 1; $i <= ($banksize / $capacity); $i++)
{
#print "caption ". $caption . " Bank Number: " . $numslots . " Bank size " . $banksize . " DIMM Capacity: " . $capacity . "MB\n";
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $module_count
})
}
$module_count++;
}
#Caption Line
if (/^Sun Microsystems/) { $flag_mt=1; $flag=1; }
}
}
if($sun_class == 6)
{
#CPU1_D2 BANK2: 4096MB DDR3 DIMM, Samsung M393B5170EH1-CH9 (SUN FIRE X4270)
#DIMM 1A: 4096MB Synchronous DDR2 FBDIMM (ProLiant DL380 G5)
#Board 1, DIMM 1A: 8192MB Synchronous DDR3 (ProLiant DL580 G7)
#PROC 1 DIMM 12: 16384MB Synchronous DDR3 DIMM, HP (ProLiant DL380p Gen8)
#PROC 1 DIMM 12: 32768MB Synchronous DIMM, HP 752372-081 (ProLiant DL380 Gen9)
#XMM1: 2048MB Synchronous DDR2 DIMM, Elpida EBE21UE8AEFA-8G-E (HP Desktop PC)
#DIMM_1: 1024MB Synchronous DDR2 DIMM, Kingston KCM633-ELC (Dell Desktop PC)
foreach(`memconf 2>&1`)
{
# debug
#print "line: " .$j++ . " " . $flag_mt . "/" . $flag ." : " . "$_";
if(/^empty memory sockets:\s*(\S+)/)
{
# cut of first 22 char containing the string empty sockets:
substr ($_,0,22) = "";
chomp();
$capacity = "0";
$numslots = 0;
foreach $caption (split(/, /,$_))
{
if ($caption eq "None")
{
$empty_slots = 0;
# no empty slots -> exit loop
last;
}
# debug
#print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$empty_slots++;
if ($caption =~ /.* (\d+)$/) { $numslots = $1; }
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => "empty",
CAPTION => $caption,
SPEED => 'n/a',
TYPE => 'n/a',
NUMSLOTS => $numslots
})
}
}
# These are the non-emtpy sockets in various formats
#DIMM 1A: 4096MB Synchronous DDR2 FBDIMM (ProLiant DL380 G5)
#Board 1, DIMM 1A: 8192MB Synchronous DDR3 (ProLiant DL580 G7)
#PROC 1 DIMM 12: 16384MB Synchronous DDR3 DIMM, HP (ProLiant DL380p Gen8)
if(/^(.*DIMM) (\S+):\s+(\d+)MB\s(\S+ DDR\d+)\s*(\w*)?(,?.*)/)
{
$caption = "$1 $2";
$description = "$4 $5$6";
$numslots = $2;
$capacity = $3;
$type = $5;
unless ($type) { $type = "DIMM" }; # Default if nothing else found
# debug
#print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$module_count++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
#CPU1_D2 BANK2: 4096MB DDR3 DIMM, Samsung M393B5170EH1-CH9 (SUN FIRE X4270)
if(/^(.*BANK)(\S+):\s+(\d+)MB\s(\S*DDR\d+)\s*(\w+)?(,?.*)/)
{
$caption = "$1 $2";
$description = "$4 $5$6";
$numslots = $2;
$capacity = $3;
$type = $5;
# debug
#print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$module_count++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
#PROC 1 DIMM 12: 32768MB Synchronous DIMM, HP 752372-081 (ProLiant DL380 Gen9)
if(/^(.*DIMM) (\S+):\s+(\d+)MB\s(\S+)\s+(DIMM\w*)(,?.*)/)
{
$caption = "$1 $2";
$description = "$4 $5$6";
$numslots = $2;
$capacity = $3;
$type = $5;
# debug
#print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$module_count++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
#XMM1: 2048MB Synchronous DDR2 DIMM, Elpida EBE21UE8AEFA-8G-E (HP Desktop PC)
#DIMM_1: 1024MB Synchronous DDR2 DIMM, Kingston KCM633-ELC (Dell Desktop PC)
if(/^(\S+):\s+(\d+)MB\s(.+)\s+(DIMM\w*)(,?.*)/)
{
$caption = "$1";
$description = "$3 $4$5";
$numslots = $1;
$capacity = $2;
$type = $4;
# debug
#print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$module_count++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
}
# debug: show number of modules found and number of empty slots
#print "# of RAM Modules: " . $module_count . "\n";
#print "# of empty slots: " . $empty_slots . "\n";
}
if ($sun_class == 7)
{
foreach (`prctl -n project.max-shm-memory $$ 2>&1`)
{
$description = $1 if /^project.(\S+)$/;
$capacity = $1 if /^\s*system+\s*(\d+).*$/;
if(($description && $capacity)){
$capacity = $capacity * 1024;
$numslots = 1 ;
$description = "Memory Allocated";
$caption = "Memory Share";
#print $description."_".$capacity."***\n";
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
}
}
if($sun_class == 8) {
# example output of a Sun Blade 100 Workstation
#Sun Microsystems, Inc. Sun Blade 100 (UltraSPARC-IIe 502MHz)
#Memory Segment Table:
#-----------------------------------------------------------------------
#Base Address Size Interleave Factor Contains
#-----------------------------------------------------------------------
#0x0 256MB 1 chassis/system-board/DIMM0
#empty sockets: DIMM1 DIMM2 DIMM3
#total memory = 256MB
#Sun Microsystems, Inc. Sun Blade 100 (UltraSPARC-IIe 502MHz)
#Memory Segment Table:
#-----------------------------------------------------------------------
#Base Address Size Interleave Factor Contains
#-----------------------------------------------------------------------
#0x0 256MB 1 Label DIMM0
#0x20000000 256MB 1 Label DIMM1
#empty sockets: DIMM2 DIMM3
#total memory = 512MB
foreach(`memconf 2>&1`) {
if (/^empty sockets:\s*(.+)/) {
foreach $caption (split(/ /, $1)) {
if ($caption eq "None") {
$empty_slots = 0;
last;
}
$empty_slots++;
# print "empty slot\n";
$common->addMemory({
CAPACITY => "empty",
DESCRIPTION => '',
CAPTION => $caption,
SPEED => '',
TYPE => '',
NUMSLOTS => $numslots
})
}
}
if (/^0x(\d+)\s+(\d+)(\S)B\s+(\S+)\s+(.+)/) {
$caption = "$5";
$description = "";
$numslots = 0;
$capacity = $2 if ( $3 eq "M" );
$capacity = $2 * 1024 if ( $3 eq "G" );
$type = "";
# debug
# print "Caption: " . $caption . " Description: " . $description . " Bank Number: " . $numslots . " DIMM Capacity: " . $capacity . "MB\n";
$module_count++;
$common->addMemory({
CAPACITY => $capacity,
DESCRIPTION => $description,
CAPTION => $caption,
SPEED => $speed,
TYPE => $type,
NUMSLOTS => $numslots
})
}
}
}
}
#run();
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/Networks.pm 0000664 0000000 0000000 00000011314 13327377321 0025375 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::Networks;
#ce5: flags=1000843 mtu 1500 index 3
# inet 55.37.101.171 netmask fffffc00 broadcast 55.37.103.255
# ether 0:3:ba:24:9b:bf
#aggr40001:2: flags=201000843 mtu 1500 index 3
# inet 55.37.101.172 netmask ffffff00 broadcast 223.0.146.255
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run("ifconfig") && $common->can_run("netstat") && $common->can_load ("Net::IP qw(:PROC)")
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my $description;
my $ipaddress;
my $ipgateway;
my $ipmask;
my $ipsubnet;
my $macaddr;
my $status;
my $type;
my $zone;
my @zoneadmcmd;
my @zacsplitted;
# get the first field of the first line of "zoneadm list -p"
@zoneadmcmd = `zoneadm list -p`;
@zacsplitted = split(/:/, $zoneadmcmd[0]);
$zone = $zacsplitted[0];
foreach (`netstat -rn`){
$ipgateway=$1 if /^default\s+(\S+)/i;
}
#print "Nom :".$zone."*************************\n";
### STEP 1: get aliases and zones' interfaces
foreach (`ifconfig -a`){
# resets if new interface
$ipaddress = $description = $macaddr = $status = $type = undef if /^(\S+):/;
# interface name and other data
$description = $1.":".$2 if /^(\S+):(\S+):/;
$ipaddress = $1 if /inet\s+(\S+)/i;
$ipmask = $1 if /\S*netmask\s+(\S+)/i;
if (/ether\s+(\S+)/i) {
# See
# https://sourceforge.net/tracker/?func=detail&atid=487492&aid=1819948&group_id=58373
$macaddr = sprintf "%02x:%02x:%02x:%02x:%02x:%02x" ,
map hex, split /\:/, $1;
}
$status = 1 if /addNetwork({
DESCRIPTION => $description,
IPADDRESS => $ipaddress,
IPGATEWAY => $ipgateway,
IPMASK => $ipmask,
IPSUBNET => $ipsubnet,
MACADDR => $macaddr,
STATUS => $status?"Up":"Down",
TYPE => $type,
});
}
}
### STEP 2: get physical interfaces when not a zone
if (!$zone){
foreach (`ifconfig -a`){
# resets if new interface
$ipaddress = $description = $macaddr = $status = $type = undef if /^(\S+):/;
# interface name and other data
$description = $1 if /^(\S+): /;
$ipaddress = $1 if /inet\s+(\S+)/i;
$ipmask = $1 if /\S*netmask\s+(\S+)/i;
if (/ether\s+(\S+)/i) {
# See
# https://sourceforge.net/tracker/?func=detail&atid=487492&aid=1819948&group_id=58373
$macaddr = sprintf "%02x:%02x:%02x:%02x:%02x:%02x" ,
map hex, split /\:/, $1;
}
$status = 1 if /addNetwork({
DESCRIPTION => $description,
IPADDRESS => $ipaddress,
IPGATEWAY => $ipgateway,
IPMASK => $ipmask,
IPSUBNET => $ipsubnet,
MACADDR => $macaddr,
STATUS => $status?"Up":"Down",
TYPE => $type,
});
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/Packages.pm 0000664 0000000 0000000 00000005120 13327377321 0025275 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::Packages;
use strict;
use warnings;
sub check {
my $params = shift;
my $common = $params->{common};
# Do not run an package inventory if there is the --nosoftware parameter
return if ($params->{config}->{nosoftware});
$common->can_run("pkginfo") || $common->can_run("pkg");
}
sub run {
my $params = shift;
my $common = $params->{common};
my $chaine ;
my @tab;
my $name;
my $version;
my $comments;
my $publisher;
if ( `uname -r` =~ /5.11/ ) {
# Solaris 11
foreach (`pkg info`) {
if (/^\s*$/) {
$common->addSoftware({
'NAME' => $name,
'VERSION' => $version,
'COMMENTS' => $comments,
'PUBLISHER' => $publisher,
});
$name = '';
$version = '';
$comments = '';
$publisher = '';
} elsif (/Name:\s+(.+)/) {
$name = $1;
} elsif (/Version:\s+(.+)/) {
$version = $1;
} elsif (/Publisher:\s+(.+)/) {
$publisher = $1;
} elsif (/Summary:\s+(.+)/) {
$comments = $1;
}
}
} else {
# Solaris 10 and lower
foreach (`pkginfo -l`) {
if (/^\s*$/) {
$common->addSoftware({
'NAME' => $name,
'VERSION' => $version,
'COMMENTS' => $comments,
'PUBLISHER' => $publisher,
});
$name = '';
$version = '';
$comments = '';
$publisher = '';
} elsif (/PKGINST:\s+(.+)/) {
$name = $1;
} elsif (/VERSION:\s+(.+)/) {
$version = $1;
} elsif (/VENDOR:\s+(.+)/) {
$publisher = $1;
} elsif (/DESC:\s+(.+)/) {
$comments = $1;
}
}
my $testrep;
$testrep=0;
#opendir(DIR,'/var/sis/') || exit ;
opendir(DIR,'/var/sis/') || ($testrep=1) ;
if ($testrep==0) {
foreach (`ls /var/sis/*.SIS`) {
$chaine= `cat $_` ;
@tab = split(/;/, $chaine);
if (/^\/var\/sis\/(\S+).SIS/){
$common->addSoftware({
'VERSION' => $tab[2],
'NAME' => $tab[0]." ($1)",
'PUBLISHER' => $tab[1],
'COMMENTS' => $1,
});
}
}
}
closedir(DIR);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/Ports.pm 0000664 0000000 0000000 00000002632 13327377321 0024673 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::Ports;
use strict;
sub run {
my $params = shift;
my $common = $params->{common};
my $zone;
my $SystemModel;
my $aarch;
my $flag;
my $caption;
my $description;
my $name;
my $type;
if ( !$common->can_run("zonename") || `zonename` =~ /global/ ) {
# Ether pre Sol10 or in Sol10/Sol11 global zone
$zone = "global";
} else {
$zone = "";
}
if ($zone) {
chomp($SystemModel = `uname -m`);
chomp($aarch = `uname -p`);
if( $aarch eq "i386" ){
#
# For a Intel/AMD arch, we're using smbios
#
foreach(`/usr/sbin/smbios -t SMB_TYPE_PORT`) {
if(/\s+Internal Reference Designator:\s*(.+)/i ) {
$flag = 1;
$name = $1;
}
elsif ($flag && /^$/) { # end of section
$flag = 0;
$common->addPorts({
CAPTION => $caption,
DESCRIPTION => $description,
NAME => $name,
TYPE => $type,
});
$caption = $description = $name = $type = undef;
}
elsif ($flag) {
$caption = $1 if /\s+External Connector Type:.*\((.+)\)/i;
$description = $1 if /\s+External Reference Designator:\s*(.+)/i;
$type = $1 if /\s+Port Type:.*\((.+)\)/i;
}
}
}
elsif( $aarch eq "sparc" ) {
#
# For a Sparc arch, we're done
#
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/Slots.pm 0000664 0000000 0000000 00000031702 13327377321 0024670 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::Slots;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run ("prtdiag")
}
sub run {
my $params = shift;
my $common = $params->{common};
my $description;
my $designation;
my $name;
my $status;
my @pci;
my $flag;
my $flag_pci;
my $model;
my $sun_class;
chomp($model = `uname -i`);
# debug print model
#print "Model: '$model'";
$sun_class = 0;
# we map (hopfully) our server model to a known class
if ($model =~ /SUNW,SPARC-Enterprise/) { $sun_class = 1; } # M9000
if ($model =~ /SUNW,SPARC-Enterprise-T\d/) { $sun_class = 22; } # T5220
if ($model =~ /SUNW,Sun-Fire-\d/) { $sun_class = 3; } # 280R, 480R
if ($model =~ /SUNW,Sun-Fire-V\d/) { $sun_class = 3; } # V490
if ($model =~ /SUNW,Sun-Fire-T\d/) { $sun_class = 4; } # T2000
if ($model =~ /SUNW,Sun-Blade-1500/) { $sun_class = 8; } # Blade 1500 workstation
if ($model =~ /i86pc/) { $sun_class = 21; } # x86 hardware
if ($model =~ /SUNW,T5/) { $sun_class = 22; } # T5240, T5440
if ($model =~ /sun4v/) { $sun_class = 22; } # T3-x, T4-x, T5-x
#Debug
#print "sun_class : $sun_class\n";
if ( $sun_class == 0 ) {
# Default class, probably doesn't work
foreach (`prtdiag `) {
last if(/^\=+/ && $flag_pci);
next if(/^\s+/ && $flag_pci);
if($flag && $flag_pci && /^(\S+)\s+/) {
$name = $1;
}
if($flag && $flag_pci && /(\S+)\s*$/) {
$designation = $1;
}
if($flag && $flag_pci && /^\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)/) {
$description = $1;
}
if($flag && $flag_pci && /^\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)/) {
$status = $1;
}
if($flag && $flag_pci) {
$common->addSlot({
DESCRIPTION => $description,
DESIGNATION => $designation,
NAME => $name,
STATUS => $status,
});
}
if(/^=+\s+IO Cards/){$flag_pci = 1;}
if($flag_pci && /^-+/){$flag = 1;}
}
}
if ( $sun_class == 1 ) {
# M9000
#========================= IO Devices =========================
#
# IO Lane/Frq
#LSB Type LPID RvID,DvID,VnID BDF State Act, Max Name Model
#--- ----- ---- ------------------ --------- ----- ----------- ------------------------------ --------------------
# Logical Path
# ------------
#00 PCIx 0 8, 125, 1033 2, 0, 0 okay 133, 133 pci-pciexclass,060400 N/A
# /pci@0,600000/pci@0
#
foreach (`prtdiag -v`) {
last if(/^\=+/ && $flag_pci && $flag);
if ($flag && $flag_pci && /^(\d+)\s+(\S+)\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)\s+\S+\s+\S+\s+((\S+)-\S+)\s+(\S+).*/ ) {
$designation = "LSB " . $1;
$status = $3;
$name = $4;
$description = "[$2] $5";
$description .= " ($6)" unless ($6=~/N\/A/);
$common->addSlot({
DESCRIPTION => $description,
DESIGNATION => $designation,
NAME => $name,
STATUS => $status,
});
}
if(/^=+\S+\s+IO Devices/){$flag_pci = 1; }
if($flag_pci && /^-+/){$flag = 1;}
}
}
if ( $sun_class == 2 ) {
# to be checked
foreach (`prtdiag `) {
if (/pci/) {
@pci = split(/ +/);
$name=$pci[4]." ".$pci[5];
$description=$pci[0]." (".$pci[1].")";
$designation=$pci[3];
$status="";
$common->addSlot({
DESCRIPTION => $description,
DESIGNATION => $designation,
NAME => $name,
STATUS => $status,
});
}
}
}
if ( $sun_class == 3 ) {
# SUNW,Sun-Fire-480R
# ========================= IO Cards =========================
#
# Bus Max
# IO Port Bus Freq Bus Dev,
# Type ID Side Slot MHz Freq Func State Name Model
# ---- ---- ---- ---- ---- ---- ---- ----- -------------------------------- ----------------------
# PCI 8 B 3 33 33 3,0 ok SUNW,qlc-pci1077,2312.1077.101.2+
# PCI 8 B 3 33 33 3,1 ok SUNW,qlc-pci1077,2312.1077.101.2+
# PCI 8 B 5 33 33 5,0 ok pci-pci1011,25.4/pci108e,1000 PCI-BRIDGE
# PCI 8 B 5 33 33 0,0 ok pci108e,1000-pci108e,1000.1 device on pci-bridge
# PCI 8 B 5 33 33 0,1 ok SUNW,qfe-pci108e,1001 SUNW,pci-qfe/pci-bridg+
foreach (`prtdiag `) {
last if(/^\=+/ && $flag_pci && $flag); # End of IO Devices, next section starts here
if($flag && $flag_pci && /PCI/) {
@pci = split(/ +/);
$name=join(" ",@pci[9..$#pci]);
$description="[".$pci[0]."] ".$pci[8];
$designation=$pci[0]."/".$pci[1]."/".$pci[2]."/".$pci[3];
$status=$pci[7];
$common->addSlot({
DESCRIPTION => $description,
DESIGNATION => $designation,
NAME => $name,
STATUS => $status,
});
}
if(/^=+\S+\s+IO Cards/){
$flag_pci = 1; # Start of IO Devices section, still header to skip
}
if($flag_pci && /^-+/){
$flag = 1; # End of IO Devices header, real info starts here
}
}
}
if ( $sun_class == 21 ) {
# x86 hardware
$flag = 0;
foreach (`/usr/sbin/smbios -t SMB_TYPE_SLOT`) {
if ($flag && /^ID.*/) {
# write current slot
$common->addSlot({
DESCRIPTION => "$description ($status)",
DESIGNATION => $designation,
NAME => $name,
STATUS => $status,
});
$flag = 0;
}
elsif(/\s+Location Tag:\s+(.*)$/) {
$description = $1;
}
elsif(/\s+Slot ID:\s+(.*)$/) {
$designation= $1;
}
elsif(/\s+Type:\s+\S+\s+\((.*)\)$/) {
$name= $1;
}
elsif(/\s+Usage:\s+\S+\s+\((.*)\).*$/) {
$status = $1;
}
$flag = 1;
}
# Finally add the last card
$common->addSlot({
DESCRIPTION => "$description ($status)",
DESIGNATION => $designation,
NAME => $name,
STATUS => $status,
});
}
if ( $sun_class == 4 ) {
# SUNW,Sun-Fire-T200
#========================= IO Configuration =========================
#
# IO
#Location Type Slot Path Name Model
#----------- ----- ---- --------------------------------------------- ------------------------- ---------
#IOBD/PCIE0 PCIE 0 /pci@780/pci@0/pci@8/network@0 network-pciex8086,105e SUNW,pcie+
foreach(`prtdiag `) {
last if(/^\=+/ && $flag_pci && $flag); # End of IO Devices, next section starts here
if($flag && $flag_pci && /PCI/) {
@pci = split(/ +/);
$name=$pci[5];
$description="[".$pci[1]."] ".$pci[4];
$designation=$pci[0];
$status=" ";
if($flag && $flag_pci) {
$common->addSlot({
DESCRIPTION => $description,
DESIGNATION => $designation,
NAME => $name,
STATUS => $status,
});
}
}
if(/^=+\S+\s+IO Configuration/){
$flag_pci = 1; # Start of IO Devices section, still header to skip
}
if($flag_pci && /^-+/){
$flag = 1; # End of IO Devices header, real info starts here
}
}
}
if ( $sun_class == 8 ) {
# SUNW,Sun-Blade-1500
#================================= IO Devices =================================
#Bus Freq Slot + Name +
#Type MHz Status Path Model
#------ ---- ---------- ---------------------------- --------------------
#pci 33 MB isa/su (serial)
# okay /pci@1e,600000/isa@7/serial@0,3f8
foreach (`prtdiag `) {
last if(/^\=+/ && $flag_pci && $flag); # End of IO Devices, next section starts here
# pci 33 MB isa/su(serial) SUNW,xxx
if($flag && $flag_pci && /(\S+)\s+(\S+)\s+(\S+)\s+(\S+\s+\(\S+\))\s*(.*)/) {
$name = $5;
$designation = $3;
$description = "[$1] $4";
$status = " ";
$common->addSlot({
DESCRIPTION => $description,
DESIGNATION => $designation,
NAME => $name,
STATUS => $status,
});
}
if(/^=+\S+\s+IO Devices/){
$flag_pci = 1; # Start of IO Devices section, still header to skip
}
if($flag_pci && /^-+/){
$flag = 1; # End of IO Devices header, real info starts here
}
}
}
if ( $sun_class == 22 ) {
# SUNW,T5440
#======================================== IO Devices =======================================
#Slot + Bus Name + Model Max Speed Cur Speed
#Status Type Path /Width /Width
#-------------------------------------------------------------------------------------------
#MB/HBA PCIE scsi-pciex1000,58 LSI,1068E -- --
# /pci@400/pci@0/pci@1/scsi@0
# SPARC T3-1
#================================= IO Devices =================================
#Slot + Bus Name + Model Speed
#Status Type Path
#------------------------------------------------------------------------------
#/SYS/MB/SASHBA0 PCIE scsi-pciex1000,72 LSI,2008 --
# /pci@400/pci@1/pci@0/pci@4/scsi@0
#/SYS/MB/RISER2/PCIE2PCIE network-pciex108e,abcd SUNW,pcie-qgc --
# /pci@400/pci@1/pci@0/pci@6/network@0
# SPARC T4-4
#======================================== IO Devices =======================================
#Slot + Bus Name + Model Max Speed Cur Speed
#Status Type Path /Width /Width
#-------------------------------------------------------------------------------------------
#/SYS/MB/REM0/SASHBA0 PCIE LSI,sas-pciex1000,72 LSI,2008 -- --
# /pci@400/pci@1/pci@0/pci@0/LSI,sas@0
#/SYS/RIO/NET0 PCIE network-pciex8086,10c9 -- --
# /pci@400/pci@1/pci@0/pci@2/network@0
#/SYS/RIO/NET1 PCIE network-pciex8086,10c9 -- --
# /pci@400/pci@1/pci@0/pci@2/network@0,1
#/SYS/PCI-EM2 PCIE SUNW,qlc-pciex1077,2532 QEM3572 -- --
# /pci@400/pci@1/pci@0/pci@4/pci@0/pci@2/SUNW,qlc@0
# SPARC T5-4
#======================================== IO Devices =======================================
#Slot + Bus Name + Model Max Speed Cur Speed
#Status Type Path /Width /Width
#-------------------------------------------------------------------------------------------
#/SYS/MB/USB_CTLR PCIE usb-pciexclass,0c0330 -- --
# /pci@300/pci@1/pci@0/pci@4/pci@0/pci@6/usb@0
#/SYS/RIO/XGBE0 PCIE network-pciex8086,1528 -- --
# /pci@300/pci@1/pci@0/pci@4/pci@0/pci@8/network@0
#/SYS/MB/SASHBA0 PCIE scsi-pciex1000,87 LSI,2308_2 -- --
# /pci@300/pci@1/pci@0/pci@4/pci@0/pci@c/scsi@0
foreach (`prtdiag `) {
last if(/^\=+/ && $flag_pci && $flag); # End of IO Devices, next section starts here
# Lazy match for $name due to differences in prtdiag output:
# * the "Model" column does not always have a value
# * 5-column output on Sol10, 6-column output on Sol11
if($flag && $flag_pci && /(\S+)\s+(\S+)\s+((\S+)-\S+)\s+(\S+)\s+.*/) {
$designation = $1;
$status = " ";
$name = $3;
$description = "[$2] $4";
$description .= " ($5)" unless ($5=~/.*GT\/?x\d+|--/);
$common->addSlot({
DESCRIPTION => $description,
DESIGNATION => $designation,
NAME => $name,
STATUS => $status,
});
}
if(/^=+\S+\s+IO Devices/){
$flag_pci = 1; # Start of IO Devices section, still header to skip
}
if($flag_pci && /^-+/){
$flag = 1; # End of IO Devices header, real info starts here
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/Storages.pm 0000664 0000000 0000000 00000005701 13327377321 0025353 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::Storages;
use strict;
#use warning;
#sd0 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
#Vendor: HITACHI Product: DK32EJ72NSUN72G Revision: PQ08 Serial No: 43W14Z080040A34E
#Size: 73.40GB <73400057856 bytes>
#Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
#Illegal Request: 0 Predictive Failure Analysis: 0
# With -En :
#c8t60060E80141A420000011A420000300Bd0 Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
#Vendor: HITACHI Product: OPEN-V -SUN Revision: 5009 Serial No:
#Size: 64.42GB <64424509440 bytes>
#Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
#Illegal Request: 1 Predictive Failure Analysis: 0
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run ("iostat")
}
sub run {
my $params = shift;
my $common = $params->{common};
my $manufacturer;
my $model;
my $description;
my $capacity;
my $name;
my $rev;
my $sn;
my $type;
my $flag_first_line;
my $rdisk_path;
foreach(`iostat -En`){
#print;
if ($flag_first_line){
## To be removed when FIRMWARE will be supported
if ($rev) {
$description .= ' ' if $description;
$description .= "FW:$rev";
}
$rdisk_path=`ls -l /dev/rdsk/${name}s2`;
if ( $rdisk_path =~ /.*->.*scsi_vhci.*/ ) {
$type="MPxIO";
} elsif( $rdisk_path =~ /.*->.*fp@.*/ ) {
$type="FC";
} elsif( $rdisk_path =~ /.*->.*scsi@.*/ ) {
$type="SCSI";
} elsif( $rdisk_path =~ /.*->.*virtual-devices.*/ ) {
$type="Virtual";
}
$common->addStorages({
NAME => $name,
MANUFACTURER => $manufacturer,
MODEL => $model,
DESCRIPTION => $description,
TYPE => $type,
FIRMWARE => $rev,
SERIALNUMBER => $sn,
DISKSIZE => $capacity
});
$manufacturer='';
$model='';
$description='';
$name='';
$rev='';
$sn='';
$type='';
}
$flag_first_line = 0;
if (/^(\S+)\s+Soft/){
$name = $1;
}
if (/^.*Product:\s*(\S+)/){
$model = $1;
}
if (/^.*<(\S+)\s*bytes/){
$capacity = $1;
$capacity = $capacity/(1024*1024);
#print $capacity."\n";
}
if (/^.*Serial No:\s*(\S+)/){
$sn = $1;
## To be removed when SERIALNUMBER will be supported
$description = "S/N:$sn";
##
}
if (/^.*Revision:\s*(\S+)/){
$rev = $1;
}
if (/^Vendor:\s*(\S+)/){
$manufacturer = $1;
$flag_first_line = 1;
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/OS/Solaris/Users.pm 0000664 0000000 0000000 00000000731 13327377321 0024663 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::OS::Solaris::Users;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run ("who")
}
# Initialise the distro entry
sub run {
my $params = shift;
my $common = $params->{common};
my %user;
# Logged on users
for (`who`){
$user{$1} = 1 if /^(\S+)./;
}
my $UsersLoggedIn = join "/", keys %user;
$common->setHardware ({ USERID => $UsersLoggedIn });
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/ 0000775 0000000 0000000 00000000000 13327377321 0024312 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/Docker.pm 0000664 0000000 0000000 00000002516 13327377321 0026063 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::Docker;
use strict;
sub check {
return(undef) unless -r '/usr/bin/docker';
return 1;
}
my @image;
sub run {
my $params = shift;
my $common = $params->{common};
foreach my $cont (`docker ps 2>/dev/null`) {
next if ($cont =~ /^CONTAINER ID/);
my $container_id=$1 if ($cont =~ /^(\w+)/i);
push @image, $container_id;
}
foreach my $c (@image) {
my $tab=`docker inspect $c`;
my $memory=$1 if ($tab =~ /\s+"Memory":\s(\d+),/);
my $name=$1 if ($tab =~ /\s+"Hostname":\s"(\w+)",/);
my $status=$1 if ($tab =~ /\s+"Status":\s"(\w+)",/);
my $vcpu=$1 if ($tab =~ /\s+"CpuShares":\s(\d+),/);
my $vmid=$1 if ($tab =~ /\s+"Id":\s"(\w+)",/);
my $ipaddr=$1 if ($tab =~ /\s+"IPAddress":\s"(.*)"/);
my $macaddr=$1 if ($tab =~ /\s+"MacAddress":\s"(.*)"/);
my $gateway=$1 if ($tab =~ /\s+"Gateway":\s"(.*)"/);
$common->addVirtualMachine({
CPUSHARES => $vcpu,
GATEWAY => $gateway,
IPADDR => $ipaddr,
MACADDR => $macaddr,
MEMORY => $memory,
NAME => $name,
STATUS => $status,
SUBSYSTEM => "Docker Container",
VMID => $vmid,
VTYPE => "Docker",
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/Jails.pm 0000664 0000000 0000000 00000002737 13327377321 0025723 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::Jails;
use strict;
sub check {
return(undef) unless -r '/usr/sbin/jls';
return 1;
}
my @jail;
sub run {
my $params = shift;
my $common = $params->{common};
foreach my $line (`jls -h 2>/dev/null | sed -e "1d"`) {
push @jail, $line;
}
foreach my $j (@jail) {
my @jparam=split('\s',$j);
my $vmid=$jparam[6];
my $name=$jparam[7];
my $subsystem=$jparam[9];
my $status="running";
my @ip;
my $ipv4=$jparam[39];
if ($ipv4 ne '-') {
my @ipv4=split(",",$ipv4);
foreach my $i (@ipv4) {
push @ip, $i;
}
}
my $ipv6=$jparam[41];
if ($ipv6 ne '-') {
my @ipv6=split(",",$ipv6);
foreach my $i (@ipv6) {
push @ip, $i;
}
}
my $ip=join "/", @ip;
if (defined $ip) {
$common->addVirtualMachine({
IPADDR => $ip,
NAME => $name,
STATUS => $status,
SUBSYSTEM => "FreeBSD $subsystem",
VMID => $vmid,
VTYPE => "Jail",
});
} else {
$common->addVirtualMachine({
NAME => $name,
STATUS => $status,
SUBSYSTEM => "FreeBSD $subsystem",
VMID => $vmid,
VTYPE => "Jail",
});
}
}
}
1; UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/Libvirt.pm 0000664 0000000 0000000 00000002555 13327377321 0026272 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::Libvirt;
use strict;
use XML::Simple;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run('virsh')
}
sub run {
my $params = shift;
my $common = $params->{common};
foreach (`virsh list --all`) {
if (/^\s*(\d+|\s+\-)\s+(\S+)\s+(\S.+)/){
my $memory;
my $vcpu;
my $name = $2;
my $status = $3;
$status =~ s/^shut off/off/;
my $xml = `virsh dumpxml $name`;
my $data = XMLin($xml);
my $vcpu = $data->{vcpu};
my $uuid = $data->{uuid};
my $vmtype = $data->{type};
if ($data->{currentMemory}->{unit}) {
$memory = $1 if $data->{currentMemory}->{content} =~ /(\d+)\d{3}$/;
$vcpu = $data->{vcpu}->{content};
} else {
$memory = $1 if $data->{currentMemory} =~ /(\d+)\d{3}$/;
$vcpu = $data->{vcpu};
}
my $machine = {
MEMORY => $memory,
NAME => $name,
UUID => $uuid,
STATUS => $status,
SUBSYSTEM => "Libvirt",
VMTYPE => $vmtype,
VCPU => $vcpu,
};
$common->addVirtualMachine($machine);
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/Lxc.pm 0000664 0000000 0000000 00000004700 13327377321 0025377 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::Lxc;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run('lxc-ls') && $common->can_run('lxc-info')
}
my $memory;
my $status;
my $name;
my $vmtype;
my $vmid;
my $vcpu=0;
my $lstatus="";
my $cpu;
my @lxc_vm;
sub run {
my $params = shift;
my $common = $params->{common};
# Retrieve name and state of the vm
foreach (`lxc-ls -1`) {
my $vm = $1 if (/^(\S+)$/);
#push (@lxc_vm, $vm);
foreach (`lxc-info -n $vm`){
$name = $1 if (/^Name:\s*(\S+)$/);
$vmid = $1 if (/^PID:\s*(\S+)$/);
$lstatus = $1 if (/^State:\s*(\S+)$/);
if ($lstatus eq "RUNNING") {
$status = "Running";
$memory = $1 if (`lxc-cgroup -n $name memory.limit_in_bytes` =~ /(\S+)/);
if (`lxc-cgroup -n $name cpuset.cpus` =~ /(\S+)/) {
$cpu = $1;
if ($cpu =~ /^(\d+)-(\d+)/){
my @tmp = ($1..$2);
$vcpu += $#tmp + 1;
} else {
$vcpu += 1;
}
}
} elsif ($lstatus eq "FROZEN") {
$status = "Paused";
} elsif ($lstatus eq "STOPPED") {
$status = "Off";
open LXC, ") {
next if (/^#.*/);
if (/^lxc.cgroup.memory.limit_in_bytes\s+=\s*(\S+)\s*$/){
$memory = $1;
}
if (/^lxc.cgroup.cpuset.cpus\s+=\s*(\S+)\s*$/){
foreach $cpu (split(/,/,$1)){
$cpu = $1;
if ($cpu =~ /(\d+)-(\d+)/){
my @tmp = ($1..$2);
$vcpu += $#tmp + 1;
} else {
$vcpu += 1;
}
}
}
}
}
}
my $machine = {
MEMORY => $memory,
NAME => $name,
STATUS => $status,
SUBSYSTEM => "LXC Container",
VCPU => $vcpu,
VMID => $vmid,
VMTYPE => "LXC",
};
$common->addVirtualMachine($machine);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/Parallels.pm 0000664 0000000 0000000 00000015127 13327377321 0026575 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::Parallels;
use strict;
use warnings;
use XML::Simple;
sub check {
my $params = shift;
my $common = $params->{common};
return $common->can_run('prlctl')
}
sub run {
my $params = shift;
my $common = $params->{common};
my $config = $params->{config};
my %status_list = (
'running' => 'running',
'blocked' => 'blocked',
'paused' => 'paused',
'suspended' => 'suspended',
'crashed' => 'crashed',
'dying' => 'dying',
);
my $xmlfile = undef;
if (defined($config->{server}) && $config->{server}) {
my $dir = $config->{server};
$dir =~ s/\//_/g;
$config->{vardir} = $config->{basevardir}."/".$dir;
} elsif (defined($config->{local}) && $config->{local}) {
$config->{vardir} = $config->{basevardir}."/__LOCAL__";
}
if (-d $config->{vardir}) {
$xmlfile = $config->{vardir}."/uuid.xml";
}
my ($uuid,$mem,$status,$name,$subsys)=undef;
my $cpus = 1;
my @users = ();
# We don't want to scan user directories unless --scan-homedirs is used
return unless $config->{scanhomedirs};
foreach my $lsuser ( glob("/Users/*") ) {
$lsuser =~ s/.*\///; # Just keep the login
next if $lsuser =~ /Shared/i;
next if $lsuser =~ /^\./i; # Ignore hidden directory
next if $lsuser =~ /\ /; # Ignore directory with space in the name
next if $lsuser =~ /'/; # Ignore directory with space in the name
push(@users,$lsuser);
}
foreach my $user (@users) {
my @command = `su $user -c "prlctl list -a"`;
shift (@command);
foreach my $line ( @command ) {
chomp $line;
my @params = split(/ /, $line);
$uuid = $params[0];
$status = $params[1];
# Avoid security risk. Should never appends
next if $uuid =~ /(;\||&)/;
foreach my $infos ( `sudo -u $user prlctl list -i $uuid`) {
if ($infos =~ m/^\s\smemory\s(.*)Mb/) {
$mem = $1;
}
elsif ($infos =~ m/^\s\scpu\s([0-9]{1,2})/) {
$cpus= $1;
}
elsif ($infos =~ m/^Name:\s(.*)/) {
$name = $1;
}
elsif ($infos =~ m/^OS:\s(.*)/) {
$subsys = $1;
}
}
$uuid =~ s/{// if ($uuid =~ m/{/);
$uuid =~ s/}// if ($uuid =~ m/}/);
my ($hwUUID,$currentUUID)=undef;
# if vm is running, fetch the real uuid
if ($status eq 'running') {
my $command = "sudo -u $user prlctl exec $uuid /usr/sbin/ioreg -rd1 -c IOPlatformExpertDevice";
open(IOREG, "$command |") or die "Failed to run '$command': $!\n";
while() {
if (/^[\s|]*"(\w+)"\s*=\s*(.*)$/) {
next unless $1 eq "IOPlatformUUID";
$currentUUID = $2;
$currentUUID =~ s/\"//g;
}
}
}
if (! -e $xmlfile) {
my $uuid_xml = {
'PARALLELS' => {
'VIRTUALMACHINES' => {
'NAME' => [$name],
'PARALLELSUUID' => [$uuid], # Damned random uuid value
'GUESTUUID' => [$currentUUID], # The true and great uuid value
},
},
};
my $xs = XML::Simple->new(
ForceArray => 1,
KeepRoot => 1,
XMLDecl => '');
my $xml = $xs->XMLout($uuid_xml);
open (MYFILE, "> $xmlfile");
print MYFILE "$xml"; # write xml output to the newly created file
close (MYFILE);
$hwUUID = $currentUUID; # fetch guest uuid value, even if it's empty (vm not currently running)
} else {
my $parallels = XML::Simple->new(
ForceArray => 1,
KeepRoot => 1,
XMLDecl => '',
);
my $vm = $parallels->XMLin($xmlfile);
my $numberOfVMs = 0;
my $boolean = 0;
while (defined $vm->{PARALLELS}[0]{VIRTUALMACHINES}[$numberOfVMs]) {
$numberOfVMs+=1;
}
for (my $counter=0; $counter<$numberOfVMs; $counter++) {
if ( $vm->{PARALLELS}[0]{VIRTUALMACHINES}[$counter]{NAME}[0] eq $name ) {
# if the vm with this name exists in the file, set its GUESTUUID value, if the currentUUID isn't empty
if ( defined ($currentUUID)) {
$vm->{PARALLELS}[0]{VIRTUALMACHINES}[$counter]{GUESTUUID}[0] = $currentUUID;
}
$vm->{PARALLELS}[0]{VIRTUALMACHINES}[$counter]{PARALLELSUUID}[0] = $uuid; # if vm re-registered, parallels uuid changes
$boolean = 1;
if ( defined ($vm->{PARALLELS}[0]{VIRTUALMACHINES}[$counter]{GUESTUUID}[0])) {
$hwUUID = $vm->{PARALLELS}[0]{VIRTUALMACHINES}[$counter]{GUESTUUID}[0];
}
}
}
unless ($boolean) {
# if vm doesn't exist, push it to the file
push @{$vm->{PARALLELS}[0]{VIRTUALMACHINES}},
{
NAME => [$name],
PARALLELSUUID => [$uuid],
GUESTUUID => [$currentUUID],
};
}
open (MYFILE, "> $xmlfile");
print MYFILE $parallels->XMLout($vm);
close (MYFILE);
}
$common->addVirtualMachine ({
NAME => $name,
VCPU => $cpus,
MEMORY => $mem,
STATUS => $status,
SUBSYSTEM => $subsys,
VMTYPE => "Parallels",
UUID => $hwUUID,
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/Qemu.pm 0000664 0000000 0000000 00000003612 13327377321 0025561 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::Qemu;
# With Qemu 0.10.X, some option will be added to get more and easly information (UUID, memory, ...)
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return ($common->can_run('qemu') || $common->can_run('kvm') || $common->can_run('qemu-kvm'))
}
sub run {
my $params = shift;
my $common = $params->{common};
foreach ( `ps -ef` ) {
if (m/^\S+\s+(\d+).*((qemu|kvm|(qemu-kvm)).*\-([fh]d[a-d]|drive|cdrom).*)$/) {
# match only if an qemu instance
my $name = "N/A";
my $mem = 0;
my $uuid;
my $vmtype = $3;
my $vcpu = 1;
my $pid = $1;
if (open F, "/proc/$pid/cmdline") {
my @a=split "\000-", ;
close F;
foreach my $option ( @a ) {
if ($option =~ m/^name\000(\S+)/) {
$name = $1;
} elsif ($option =~ m/^m\000(\S+)/) {
$mem = $1;
} elsif ($option =~ m/^uuid\000(\S+)/) {
$uuid = $1;
} elsif ($option =~ m/.*uuid=(\S+)/) {
$uuid = $1;
} elsif ($option =~ m/^smp\000(\d+)/) {
$vcpu = $1;
}
}
}
if ($mem == 0 ) {
# Default value
$mem = 128;
}
$common->addVirtualMachine ({
NAME => $name,
UUID => $uuid,
VCPU => $vcpu,
MEMORY => $mem,
STATUS => "running",
SUBSYSTEM => $vmtype,
VMTYPE => $vmtype,
});
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/SolarisLdoms.pm 0000664 0000000 0000000 00000002620 13327377321 0027263 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::SolarisLdoms;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run('ldm');
}
sub run {
my @ldoms;
my $ldom;
my @ldomdetails;
my $ldomdetail;
my $ldomname;
my $ldomstatus;
my $ldommem;
my $ldomncpu;
my $ldomuuid;
my $ldomsoftstate;
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
@ldoms = `/usr/sbin/ldm list-domain -p`;
foreach $ldom (@ldoms) {
if($ldom =~ /^DOMAIN\|name=(\S+)\|state=(\S+)\|flags=\S+\|cons=\S+\|ncpu=(\d+)\|mem=(\d+)\|.*/) {
$ldomname=$1;
$ldomstatus=$2;
$ldomncpu=$3;
$ldommem=$4/1024/1024;
$ldomsoftstate="";
@ldomdetails = `/usr/sbin/ldm list-domain -o domain -p $ldomname`;
foreach $ldomdetail (@ldomdetails) {
if($ldomdetail =~ /^DOMAIN\|.*\|softstate=(.*)$/) {
$ldomsoftstate=$1;
} elsif($ldomdetail =~ /^UUID\|uuid=(.*)$/) {
$ldomuuid=$1;
}
}
my $machine = {
MEMORY => $ldommem,
NAME => $ldomname,
UUID => $ldomuuid,
STATUS => $ldomstatus,
SUBSYSTEM => $ldomsoftstate,
VMTYPE => "Solaris Ldom",
VCPU => $ldomncpu,
};
$common->addVirtualMachine($machine);
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/SolarisZones.pm 0000664 0000000 0000000 00000004474 13327377321 0027314 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::SolarisZones;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return unless $common->can_run('zoneadm');
return unless $common->can_run('zonecfg');
return unless check_solaris_valid_release();
}
sub check_solaris_valid_release{
#check if Solaris 10 release is higher than 08/07
#no problem if Solaris 11
my $OSlevel;
my @rlines;
my $release_file;
my $release;
my $year;
my $month;
$OSlevel=`uname -r`;
if ( $OSlevel =~ /5.10/ ) {
$release_file = "/etc/release";
if (!open(SOLVERSION, $release_file)) {
return;
}
@rlines = ;
@rlines = grep(/Solaris/,@rlines);
$release = @rlines[0];
$release =~ m/(\d)\/(\d+)/;
$month = $1;
$year = $2;
$month =~ s/^0*//g;
$year =~ s/^0*//g;
if ($year <= 7 and $month < 8 ){
return 0;
}
}
1
}
sub run {
my @zones;
my @lines;
my $zone;
my $zoneid;
my $zonename;
my $zonestatus;
my $zonefile;
my $pathroot;
my $uuid;
my $zonetype;
my $memory;
my $memcap;
my $vcpu;
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
@zones = `/usr/sbin/zoneadm list -p`;
@zones = grep (!/global/,@zones);
foreach $zone (@zones) {
($zoneid,$zonename,$zonestatus,$pathroot,$uuid,$zonetype)=split(/:/,$zone);
$memory="";
foreach (`/usr/sbin/zonecfg -z $zonename info capped-memory`) {
if (/\s+physical:\s+(\S+)(\S)/) {
# recalculate to GB
$memory = $1 if ( $2 eq "G" ) ;
$memory = $1 / 1024 if ( $2 eq "M" ) ;
}
}
$vcpu="";
foreach (`/usr/sbin/zonecfg -z $zonename info dedicated-cpu`) {
if (/\s+ncpus:\s+\S*(\d+)/) {
$vcpu = $1;
}
}
my $machine = {
MEMORY => $memory,
NAME => $zonename,
UUID => $uuid,
STATUS => $zonestatus,
SUBSYSTEM => $zonetype,
VMTYPE => "Solaris Zones",
VMID => $zoneid,
VCPU => $vcpu,
};
$common->addVirtualMachine($machine);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/VirtualBox.pm 0000664 0000000 0000000 00000015522 13327377321 0026754 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::VirtualBox;
# This module detects only all VMs create by the user who launch this module (root VMs).
use strict;
use XML::Simple;
use File::Glob ':glob';
sub check {
my $params = shift;
my $common = $params->{common};
return $common->can_run('VirtualBox') and $common->can_run('VBoxManage')
}
sub run {
my $params = shift;
my $common = $params->{common};
my $scanhomedirs = $params->{accountinfo}{config}{scanhomedirs};
my $cmd_list_vms = "VBoxManage -nologo list vms";
my ( $version ) = ( `VBoxManage --version` =~ m/^(\d\.\d).*$/ ) ;
if ( $version > 2.1 ) { # detect VirtualBox version 2.2 or higher
$cmd_list_vms = "VBoxManage -nologo list --long vms";
}
my $in = 0;
my $uuid;
my $mem;
my $status;
my $name;
foreach my $line (`$cmd_list_vms`){ # read only the information on the first paragraph of each vm
chomp ($line);
if ($in == 0 and $line =~ m/^Name:\s+(.*)$/) { # begin
$name = $1;
$in = 1;
} elsif ($in == 1 ) {
if ($line =~ m/^UUID:\s+(.*)/) {
$uuid = $1;
} elsif ($line =~ m/^Memory size:\s+(.*)/ ) {
$mem = $1;
} elsif ($line =~ m/^State:\s+(.*)\(.*/) {
$status = ( $1 =~ m/off/ ? "off" : $1 );
} elsif ($line =~ m/^\s*$/) { # finish
$in = 0 ;
next if $uuid =~ /^N\\A$/ ; #If no UUID found, it is not a virtualmachine
$common->addVirtualMachine ({
NAME => $name,
VCPU => 1,
UUID => $uuid,
MEMORY => $mem,
STATUS => $status,
SUBSYSTEM => "Oracle xVM VirtualBox",
VMTYPE => "VirtualBox",
});
$name = $status = $mem = $uuid = 'N\A'; # useless but need it for security (new version, ...)
}
}
}
if ($in == 1) { # Anormal situation ! save the current vm information ...
$common->addVirtualMachine ({
NAME => $name,
VCPU => 1,
UUID => $uuid,
MEMORY => $mem,
STATUS => $status,
SUBSYSTEM => "Oracle xVM VirtualBox",
VMTYPE => "VirtualBox",
});
}
# try to found another VMs, not exectute by root
my @vmRunnings = ();
my $index = 0 ;
foreach my $line ( `ps -ef` ) {
chomp($line);
if ( $line !~ m/^root/) {
if ($line =~ m/^.*VirtualBox (.*)$/) {
my @process = split (/\s*\-\-/, $1); #separate options
$name = $uuid = "N/A";
foreach my $option ( @process ) {
#print $option."\n";
if ($option =~ m/^comment (.*)/) {
$name = $1;
} elsif ($option =~ m/^startvm (\S+)/) {
$uuid = $1;
}
}
if ($scanhomedirs == 1 ) { # If I will scan Home directories,
$vmRunnings [$index] = $uuid; # save the no-root running machine
$index += 1;
} else {
$common->addVirtualMachine ({ # add in inventory
NAME => $name,
VCPU => 1,
UUID => $uuid,
STATUS => "running",
SUBSYSTEM => "Oracle xVM VirtualBox",
VMTYPE => "VirtualBox",
});
}
}
}
}
# If home directories scan is authorized
if ($scanhomedirs == 1 ) {
# Read every Machines Xml File of every user
foreach my $xmlMachine (bsd_glob("/home/*/.VirtualBox/Machines/*/*.xml")) {
chomp($xmlMachine);
# Open config file ...
my $configFile = new XML::Simple;
my $data = $configFile->XMLin($xmlMachine);
# ... and read it
if ($data->{Machine}->{uuid}) {
my $uuid = $data->{Machine}->{uuid};
$uuid =~ s/^{?(.{36})}?$/$1/;
my $status = "off";
foreach my $vmRun (@vmRunnings) {
if ($uuid eq $vmRun) {
$status = "running";
}
}
$common->addVirtualMachine ({
NAME => $data->{Machine}->{name},
VCPU => $data->{Machine}->{Hardware}->{CPU}->{count},
UUID => $uuid,
MEMORY => $data->{Machine}->{Hardware}->{Memory}->{RAMSize},
STATUS => $status,
SUBSYSTEM => "Oracle xVM VirtualBox",
VMTYPE => "VirtualBox",
});
}
}
foreach my $xmlVirtualBox (bsd_glob("/home/*/.VirtualBox/VirtualBox.xml")) {
chomp($xmlVirtualBox);
# Open config file ...
my $configFile = new XML::Simple;
my $data = $configFile->XMLin($xmlVirtualBox);
# ... and read it
my $defaultMachineFolder = $data->{Global}->{SystemProperties}->{defaultMachineFolder};
if ( $defaultMachineFolder != 0 and $defaultMachineFolder != "Machines" and $defaultMachineFolder =~ /^\/home\/S+\/.VirtualBox\/Machines$/ ) {
foreach my $xmlMachine (bsd_glob($defaultMachineFolder."/*/*.xml")) {
my $configFile = new XML::Simple;
my $data = $configFile->XMLin($xmlVirtualBox);
if ( $data->{Machine} != 0 and $data->{Machine}->{uuid} != 0 ) {
my $uuid = $data->{Machine}->{uuid};
$uuid =~ s/^{?(.{36})}?$/$1/;
my $status = "off";
foreach my $vmRun (@vmRunnings) {
if ($uuid eq $vmRun) {
$status = "running";
}
}
$common->addVirtualMachine ({
NAME => $data->{Machine}->{name},
VCPU => $data->{Machine}->{Hardware}->{CPU}->{count},
UUID => $uuid,
MEMORY => $data->{Machine}->{Hardware}->{Memory}->{RAMSize},
STATUS => $status,
SUBSYSTEM => "Oracle xVM VirtualBox",
VMTYPE => "VirtualBox",
});
}
}
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/VmWareDesktop.pm 0000664 0000000 0000000 00000002614 13327377321 0027406 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::VmWareDesktop;
#
# initial version: Walid Nouh
#
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return $common->can_run('/Library/Application\ Support/VMware\ Fusion/vmrun')
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my $uuid;
my $mem;
my $status;
my $name;
my $i = 0;
my $commande = "/Library/Application\\ Support/VMware\\ Fusion\/vmrun list";
foreach my $vmxpath ( `$commande` ) {
next unless $i++ > 0; # Ignore the first line
if (!open TMP, "<$vmxpath") {
$logger->debug("Can't open $vmxpath\n");
next;
}
my @vminfos = ;
close TMP;
foreach my $line (@vminfos) {
if ($line =~ m/^displayName =\s\"+(.*)\"/) {
$name = $1;
} elsif ($line =~ m/^memsize =\s\"+(.*)\"/) {
$mem = $1;
} elsif ($line =~ m/^uuid.bios =\s\"+(.*)\"/) {
$uuid = $1;
}
}
$common->addVirtualMachine ({
NAME => $name,
VCPU => 1,
UUID => $uuid,
MEMORY => $mem,
STATUS => "running",
SUBSYSTEM => "VmWare Fusion",
VMTYPE => "VmWare",
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/VmWareESX.pm 0000664 0000000 0000000 00000002576 13327377321 0026443 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::VmWareESX;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run('vmware-cmd')
}
sub run {
my $params = shift;
my $common = $params->{common};
foreach my $vmx (`vmware-cmd -l`) {
chomp $vmx;
next unless -f $vmx;
my %machineInfo;
open VMX, "<$vmx" or warn;
foreach () {
if (/^(\S+)\s*=\s*(\S+.*)/) {
my $key = $1;
my $value = $2;
$value =~ s/(^"|"$)//g;
$machineInfo{$key} = $value;
}
}
close VMX;
my $status = 'unknow';
if ( `vmware-cmd "$vmx" getstate` =~ /=\ (\w+)/ ) {
# off
$status = $1;
}
my $memory = $machineInfo{'memsize'};
my $name = $machineInfo{'displayName'};
my $uuid = $machineInfo{'uuid.bios'};
# correct uuid format
$uuid =~ s/\s+//g;# delete space
$uuid =~ s!^(........)(....)(....)-(....)(.+)$!\1-\2-\3-\4-\5!; # add dashs
my $machine = {
MEMORY => $memory,
NAME => $name,
UUID => $uuid,
STATUS => $status,
SUBSYSTEM => "VmWareESX",
VMTYPE => "VmWare",
};
$common->addVirtualMachine($machine);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/VmWareWorkstation.pm 0000664 0000000 0000000 00000003075 13327377321 0030323 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::VmWareWorkstation;
#
# initial version: Walid Nouh
#
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
return $common->can_run('/bin/vmrun')
}
sub run {
my $params = shift;
my $common = $params->{common};
my $logger = $params->{logger};
my $cpu;
my $cores;
my $uuid;
my $mem;
my $status;
my $name;
my $i = 0;
my $commande = "/bin/vmrun list";
foreach my $vmxpath ( `$commande` ) {
next unless $i++ > 0; # Ignore the first line
if (!open TMP, "<$vmxpath") {
$logger->debug("Can't open $vmxpath\n");
next;
}
my @vminfos = ;
close TMP;
foreach my $line (@vminfos) {
if ($line =~ m/^displayName =\s\"+(.*)\"/) {
$name = $1;
} elsif ($line =~ m/^numvcpus =\s\"+(.*)\"/){
$cpu = $1;
} elsif ($line =~ m/^cpuid.coresPerSocket =\s\"+(.*)\" /){
$cores = $1;
} elsif ($line =~ m/^memsize =\s\"+(.*)\"/) {
$mem = $1;
} elsif ($line =~ m/^uuid.bios =\s\"+(.*)\"/) {
$uuid = $1;
}
}
$common->addVirtualMachine ({
NAME => $name,
VCPU => $cpu,
CORES => $cores,
UUID => $uuid,
MEMORY => $mem,
STATUS => "running",
SUBSYSTEM => "VmWare Workstation",
VMTYPE => "VmWare",
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/Vmsystem.pm 0000664 0000000 0000000 00000015077 13327377321 0026511 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::Vmsystem;
# Initial Ocsinventory::Agent::Backend::Virtualization::Vmsystem version: Nicolas EISEN
#
# Code include from imvirt - I'm virtualized?
# http://micky.ibh.net/~liske/imvirt.html
#
# Authors:
# Thomas Liske
#
# Copyright Holder:
# 2008 (C) IBH IT-Service GmbH [http://www.ibh.de/]
#
# License:
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
##
#
# Outputs:
# Xen
# VirtualBox
# Virtual Machine
# VMware
# QEMU
# SolarisZone
#
# If no virtualization has been detected:
# Physical
#
##
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
if ( $common->can_run("zoneadm")){ # Is a solaris zone system capable ?
return 1;
}
if ( $common->can_run ("dmidecode") ) {
# 2.6 and under haven't -t parameter
my $dmidecode_ver = `dmidecode -V 2>/dev/null`;
my @SplitVersion = split(/\./, $dmidecode_ver);
if (@SplitVersion[0] > 2) {
return 1;
} elsif (@SplitVersion[0] == 2 && @SplitVersion[1] >= 7) {
return 1;
}
}
return 0;
}
sub run {
my $params = shift;
my $common = $params->{common};
my $dmidecode = '/usr/sbin/dmidecode';
my $cmd = '$dmidecode -t system';
my $dmesg = '/bin/dmesg | head -n 750';
my $status = "Physical";
my $found = 0;
# Solaris zones
my @solaris_zones;
@solaris_zones = `/usr/sbin/zoneadm list`;
@solaris_zones = grep (!/global/,@solaris_zones);
if(@solaris_zones){
$status = "SolarisZone";
$found = 1;
}
if ( -d '/proc/xen' || check_file_content('/sys/devices/system/clocksource/clocksource0/available_clocksource','xen')) {
$found = 1 ;
if (check_file_content('/proc/xen/capabilities', 'control_d')) {
# dom0 host
} else {
# domU PV host
$status = "Xen";
# those information can't be extracted from dmidecode
$common->setBios ({
SMANUFACTURER => 'Xen',
SMODEL => 'PVM domU'
});
}
}
# dmidecode needs root to work :(
if ($found == 0 and -r '/dev/mem' && -x $dmidecode) {
my $sysprod = `$dmidecode -s system-product-name`;
if ($sysprod =~ /^VMware/) {
$status = "VMware";
$found = 1;
} elsif ($sysprod =~ /^Virtual Machine/) {
$status = "Virtual Machine";
$found = 1;
} elsif ($sysprod =~ /^Microsoft Corporation/) {
$status = "Hyper-V";
$found=1;
} else {
my $biosvend = `$dmidecode -s bios-vendor`;
if ($biosvend =~ /^QEMU/) {
$status = "QEMU";
$found = 1;
} elsif ($biosvend =~ /^Xen/) { # virtualized Xen
$status = "Xen";
$found = 1;
}
}
}
# Parse loaded modules
my %modmap = (
'^vmxnet\s' => 'VMware',
'^xen_\w+front\s' => 'Xen',
);
if ($found == 0 and open(HMODS, '/proc/modules')) {
while() {
foreach my $str (keys %modmap) {
if (/$str/) {
$status = "$modmap{$str}";
$found = 1;
last;
}
}
}
close(HMODS);
}
# Let's parse some logs & /proc files for well known strings
my %msgmap = (
'VMware vmxnet virtual NIC driver' => 'VMware',
'Vendor: VMware\s+Model: Virtual disk' => 'VMware',
'Vendor: VMware,\s+Model: VMware Virtual ' => 'VMware',
': VMware Virtual IDE CDROM Drive' => 'VMware',
' QEMUAPIC ' => 'QEMU',
'QEMU Virtual CPU' => 'QEMU',
': QEMU HARDDISK,' => 'QEMU',
': QEMU CD-ROM,' => 'QEMU',
': Virtual HD,' => 'Virtual Machine',
': Virtual CD,' => 'Virtual Machine',
' VBOXBIOS ' => 'VirtualBox',
': VBOX HARDDISK,' => 'VirtualBox',
': VBOX CD-ROM,' => 'VirtualBox',
'Hypervisor signature: xen' => 'Xen',
'Xen virtual console successfully installed' => 'Xen',
'Xen reported:' => 'Xen',
'Xen: \d+ - \d+' => 'Xen',
'xen-vbd: registered block device' => 'Xen',
'ACPI: RSDP \(v\d+\s+Xen ' => 'Xen',
'ACPI: XSDT \(v\d+\s+Xen ' => 'Xen',
'ACPI: FADT \(v\d+\s+Xen ' => 'Xen',
'ACPI: MADT \(v\d+\s+Xen ' => 'Xen',
'ACPI: HPET \(v\d+\s+Xen ' => 'Xen',
'ACPI: SSDT \(v\d+\s+Xen ' => 'Xen',
'ACPI: DSDT \(v\d+\s+Xen ' => 'Xen',
);
if ($found == 0 and open(HDMSG, '/var/log/dmesg')) {
while() {
foreach my $str (keys %msgmap) {
if (/$str/) {
$status = "$msgmap{$str}";
$found = 1;
last;
}
}
}
close(HDMSG);
}
# Read kernel ringbuffer directly
if ($found == 0 and open(HDMSG, '$dmesg |')) {
while() {
foreach my $str (keys %msgmap) {
if (/$str/) {
$status = "$msgmap{$str}";
$found = 1;
last;
}
}
}
close(HDMSG);
}
if ($found == 0 and open(HSCSI, '/proc/scsi/scsi')) {
while() {
foreach my $str (keys %msgmap) {
if (/$str/) {
$status = "$msgmap{$str}";
$found = 1;
last;
}
}
}
close(HSCSI);
}
$common->setHardware ({
VMSYSTEM => $status,
});
}
sub check_file_content {
my ($file, $pattern) = @_;
return 0 unless -r $file;
my $found = 0;
open (my $fh, '<', $file) or die "Can't open file $file: $!";
while (my $line = <$fh>) {
if ($line =~ /$pattern/) {
$found = 1;
last;
}
}
close ($fh);
return $found;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/Xen.pm 0000664 0000000 0000000 00000000227 13327377321 0025403 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::Xen;
$runMeIfTheseChecksFailed = ["Ocsinventory::Agent::Backend::Virtualization::Libvirt"];
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/Xen/ 0000775 0000000 0000000 00000000000 13327377321 0025044 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/Xen/XL.pm 0000664 0000000 0000000 00000004233 13327377321 0025727 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::Xen::XL;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
my $can_run = $common->can_run('xl');
if ($can_run) {
system('xl list');
my $exit_val = $? >> 8;
return $exit_val eq 0;
}
return $can_run;
}
sub run {
my $params = shift;
my $common = $params->{common};
# output: xm list
#
# Name ID Mem(MiB) VCPUs State Time(s)
# Domain-0 0 98 1 r----- 5068.6
# Fedora3 164 128 1 r----- 7.6
# Fedora4 165 128 1 ------ 0.6
# Mandrake2006 166 128 1 -b---- 3.6
# Mandrake10.2 167 128 1 ------ 2.5
# Suse9.2 168 100 1 ------ 1.8
# xl status
my %status_list = (
'r' => 'running',
'b' => 'blocked',
'p' => 'paused',
's' => 'shutdown',
'c' => 'crashed',
'd' => 'dying',
);
my $vmtype = 'xen';
my $subsystem = 'xl';
my @xl_list = `xl list`;
# remove first line
shift @xl_list;
foreach my $vm (@xl_list) {
chomp $vm;
my ($name, $vmid, $memory, $vcpu, $status, $time) = split(' ',$vm);
$status =~ s/-//g;
$status = ( $status ? $status_list{$status} : 'off');
my @vm_info = `xl list -l $name`;
my $uuid;
foreach my $value (@vm_info) {
chomp $value;
if ($value =~ /uuid/) {
$value =~ s/"//g;
$value =~ s/,//g;
$value =~ s/\s+.*uuid:\s+(.*)/\1/;
$uuid = $value;
last;
}
}
my $machine = {
MEMORY => $memory,
NAME => $name,
UUID => $uuid,
STATUS => $status,
SUBSYSTEM => $subsystem,
VMTYPE => $vmtype,
VCPU => $vcpu,
VMID => $vmid,
};
$common->addVirtualMachine($machine);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/Xen/XM.pm 0000664 0000000 0000000 00000004166 13327377321 0025735 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::Xen::XM;
use strict;
sub check {
my $params = shift;
my $common = $params->{common};
my $can_run = $common->can_run('xm');
if ($can_run) {
system('xm list');
my $exit_val = $? >> 8;
return $exit_val eq 0;
}
return $can_run;
}
sub run {
my $params = shift;
my $common = $params->{common};
# output: xm list
#
# Name ID Mem(MiB) VCPUs State Time(s)
# Domain-0 0 98 1 r----- 5068.6
# Fedora3 164 128 1 r----- 7.6
# Fedora4 165 128 1 ------ 0.6
# Mandrake2006 166 128 1 -b---- 3.6
# Mandrake10.2 167 128 1 ------ 2.5
# Suse9.2 168 100 1 ------ 1.8
# xm status
my %status_list = (
'r' => 'running',
'b' => 'blocked',
'p' => 'paused',
's' => 'shutdown',
'c' => 'crashed',
'd' => 'dying',
);
my $vmtype = 'xen';
my $subsystem = 'xm';
my @xm_list = `xm list`;
# remove first line
shift @xm_list;
foreach my $vm (@xm_list) {
chomp $vm;
my ($name, $vmid, $memory, $vcpu, $status, $time) = split(' ',$vm);
$status =~ s/-//g;
$status = ( $status ? $status_list{$status} : 'off');
my @vm_info = `xm list -l $name`;
my $uuid;
foreach my $value (@vm_info) {
chomp $value;
if ($value =~ /uuid/) {
$value =~ s/\(|\)//g;
$value =~ s/\s+.*uuid\s+(.*)/\1/;
$uuid = $value;
last;
}
}
my $machine = {
MEMORY => $memory,
NAME => $name,
UUID => $uuid,
STATUS => $status,
SUBSYSTEM => $subsystem,
VMTYPE => $vmtype,
VCPU => $vcpu,
VMID => $vmid,
};
$common->addVirtualMachine($machine);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Backend/Virtualization/XenCitrixServer.pm 0000664 0000000 0000000 00000002667 13327377321 0027767 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Backend::Virtualization::XenCitrixServer;
use strict;
use warnings;
sub check {
my $params = shift;
my $common = $params->{common};
$common->can_run('xe')
}
sub run {
my $params = shift;
my $common = $params->{common};
my $hostname = `hostname`;
my $residenton;
foreach (`xe host-list params=uuid hostname=$hostname`) {
$residenton = $1 if /:\s+(.+)/;
}
foreach (`xe vm-list params=uuid resident-on=$residenton`) {
if (/:\s+(.+)/) {
my $uuid = $1 if /:\s+(.+)/;
my $fname = `xe vm-list params=name-label uuid=$uuid`;
my $name = $1 if $fname =~ /:\s+(.+)/;
my $fstatus = `xe vm-list params=power-state uuid=$uuid`;
my $status = $1 if $fstatus =~ /:\s+(.+)/;
my $fvcpu = `xe vm-list params=VCPUs-max uuid=$uuid`;
my $vcpu = $1 if $fvcpu =~ /:\s+(.+)/;
my $fmemory = `xe vm-list params=memory-actual uuid=$uuid`;
my $tmemory = $1 if $fmemory =~ /:\s+(.+)/;
my $memory = $1 if $tmemory =~ /(\d+)\d{6}$/;
my $machine = {
MEMORY => $memory,
NAME => $name,
UUID => $uuid,
STATUS => $status,
SUBSYSTEM => "xe",
VMTYPE => "XEN",
VCPU => $vcpu,
};
$common->addVirtualMachine($machine);
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Common.pm 0000664 0000000 0000000 00000066566 13327377321 0021550 0 ustar 00root root 0000000 0000000 ###############################################################################
## OCSINVENTORY-NG
## Copyleft Guillaume PROTET 2010
## Web : http://www.ocsinventory-ng.org
##
## This code is open source and may be copied and modified as long as the source
## code is always made freely available.
## Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################
package Ocsinventory::Agent::Common;
use strict;
no strict 'refs';
use warnings;
=head1 NAME
Ocsinventory::Agent::Common - give common methods to other modules
=over
=item addController()
Add a controller in the inventory.
=item addUsb()
Add external usb devices in the inventory.
=item addInput()
Add internal inputs as keyboard, mouse in the inventory.
=item addModem()
Add a modem in the inventory.
=item addDrive()
Add a partition in the inventory.
=item addStorages()
Add a storage system (hard drive, USB key, SAN volume, etc) in the inventory.
=item addMemory()
Add a memory module in the inventory.
=item addPort()
Add a port module in the inventory.
=item addSlot()
Add a slot in the inventory.
=item addSoftware()
Register a software in the inventory.
=item addMonitor()
Add a monitor (screen) in the inventory.
=item addVideo()
Add a video card in the inventory.
=item addSound()
Add a sound card in the inventory.
=item addNetwork()
Register a network in the inventory.
=item addRepo()
Register a repository in the inventory.
=item setHardware()
Save global information regarding the machine.
The use of setHardware() to update USERID and PROCESSOR* information is
deprecated, please, use addUser() and addCPU() instead.
=item setBios()
Set BIOS information.
=item addCPU()
Add a CPU in the inventory.
=item addUser()
Add an user in the list of logged user.
=item addPrinter()
Add a printer in the inventory.
=item addVirtualMachine()
Add a Virtual Machine in the inventory.
=item addProcess()
Record a running process in the inventory.
=item addCamera()
Add a camera device in the inventory. Only avalaible for MacOSX
=item addIpDiscoverEntry()
IpDiscover is used to identify network interface on the local network. This
is done on the ARP level.
This function adds a network interface in the inventory.
=item setAccessLog()
What is that for? :)
=item flushXMLTags()
Clear the content of $common->{xmltags} (to use after adding it in XML)
=item addBatteries()
Add a memory module in the inventory.
=back
=cut
##################################################################################
# Ocsinventory::Agent::Common is use to give common methods to other modules #
##################################################################################
sub new {
my (undef, $params) = @_;
my $self = {};
$self->{logger} = $params->{logger};
$self->{config} = $params->{config};
$self->{xmltags} = {};
bless $self;
}
sub addController {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION DRIVER NAME MANUFACTURER PCIID PCISLOT TYPE/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{CONTROLLERS}},$content;
}
sub addUsb {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION INTERFACE MANUFACTURER SERIAL TYPE/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{USBDEVICES}},$content;
}
sub addInput {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION INTERFACE MANUFACTURER SERIAL TYPE/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{INPUTS}},$content;
}
sub addModem {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION NAME/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{MODEMS}}, $content;
}
# For compatibility
sub addModems {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addModems to addModem()");
$self->addModem(@_);
}
sub addDrive {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/CREATEDATE FREE FILESYSTEM LABEL SERIAL TOTAL TYPE VOLUMN/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{DRIVES}}, $content;
}
# For compatibility
sub addDrives {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addDrives to addDrive()");
$self->addDrive(@_);
}
sub addStorages {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION DISKSIZE FIRMWARE MANUFACTURER MODEL NAME SERIALNUMBER SCSI_CHID SCSI_COID SCSI_LUN SCSI_UNID TYPE/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{STORAGES}}, $content;
}
# For compatibility
sub addStorage {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addStorages to addStorage()");
$self->addStorage(@_);
}
sub addMemory {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/CAPACITY CAPTION DESCRIPTION ERRORCORRECTIONTYPE MANUFACTURER NUMSLOTS SERIALNUMBER SPEED TYPE/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{MEMORIES}}, $content;
}
# For compatibility
sub addMemories {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addMemories to addMemory()");
$self->addMemory(@_);
}
sub addPorts{
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/CAPTION DESCRIPTION NAME TYPE/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{PORTS}}, $content;
}
# For compatibility
sub addPort {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addPorts to addPort()");
$self->addPort(@_);
}
sub addSlot {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION DESIGNATION NAME STATUS/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{SLOTS}}, $content;
}
# For compatibility
sub addSlots {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addSlots to addSlot()");
$self->addSlot(@_);
}
sub addSoftware {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/COMMENTS FILESIZE FOLDER FROM INSTALLDATE NAME PUBLISHER VERSION/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{SOFTWARES}}, $content;
}
# For compatibility
sub addSoftwares {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addSoftwares to addSoftware()");
$self->addSoftware(@_);
}
sub addMonitor {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/BASE64 CAPTION DESCRIPTION MANUFACTURER SERIAL UUENCODE/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{MONITORS}}, $content;
}
# For compatibility
sub addMonitors {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addMonitors to addMonitor()");
$self->addMonitor(@_);
}
sub addVideo {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/CHIPSET DRVVERSION MEMORY NAME PCISLOT PCIID RESOLUTION SPEED UUID VBIOS/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{VIDEOS}}, $content;
}
# For compatibility
sub addVideos {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addVideos to addVideo()");
$self->addVideo(@_);
}
sub addSound {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION MANUFACTURER NAME/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{SOUNDS}}, $content;
}
# For compatibility
sub addSounds {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addSounds to addSound()");
$self->addSound(@_);
}
sub addNetwork {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/BASE BSSID DESCRIPTION DRIVER DUPLEX IPADDRESS IPDHCP IPGATEWAY IPMASK IPSUBNET MACADDR MODE MTU PCISLOT SLAVE SPEED SSID STATUS TYPE VERSION VIRTUALDEV /) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{NETWORKS}}, $content;
}
# For compatibility
sub addNetworks {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addNetworks to addNetwork()");
$self->addNetwork(@_);
}
sub addRepo {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/BASEURL ENABLED FINGERPRINTS FILENAME MIRROR NAME PACKAGES PRIORITY REVISION SIGNATURE SIZE TAG UPDATED/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{REPOSITORY}}, $content;
}
# For compatibility
sub addRepos {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addRepos to addRepo()");
$self->addRepo(@_);
}
sub setHardware {
my ($self, $args, $nonDeprecated) = @_;
my $xmltags = $self->{xmltags};
my $logger = $self->{logger};
foreach my $key (qw/USERID OSVERSION PROCESSORN OSCOMMENTS CHECKSUM
PROCESSORT NAME PROCESSORS SWAP ETIME TYPE OSNAME IPADDR WORKGROUP
DESCRIPTION MEMORY UUID DNS LASTLOGGEDUSER
DATELASTLOGGEDUSER DEFAULTGATEWAY VMSYSTEM/) {
if (exists $args->{$key}) {
if ($key eq 'PROCESSORS' && !$nonDeprecated) {
$logger->debug("PROCESSORN, PROCESSORS and PROCESSORT shouldn't be set directly anymore. Please use addCPU() method instead.");
}
if ($key eq 'USERID' && !$nonDeprecated) {
$logger->debug("USERID shouldn't be set directly anymore. Please use addUser() method instead.");
}
$xmltags->{'HARDWARE'}{$key}[0] = $args->{$key};
}
}
}
sub setBios {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
foreach my $key (qw/SMODEL SMANUFACTURER SSN BDATE BVERSION BMANUFACTURER MMANUFACTURER MSN MMODEL ASSETTAG TYPE/) {
if (exists $args->{$key}) {
$xmltags->{'BIOS'}{$key}[0] = $args->{$key};
}
}
}
sub addCPU {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/CORES CPUARCH CPUSTATUS CURRENT_SPEED DATA_WIDTH HPT L2CACHESIZE MANUFACTURER NBSOCKET SERIALNUMBER SOCKET SPEED TYPE VOLTAGE LOGICAL_CPUS/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{CPUS}}, $content;
# For the compatibility with HARDWARE/PROCESSOR*
my $processorn = int @{$xmltags->{CPUS}};
my $processors = $xmltags->{CPUS}[0]{SPEED}[0];
my $processort = $xmltags->{CPUS}[0]{TYPE}[0];
$self->setHardware ({
PROCESSORN => $processorn,
PROCESSORS => $processors,
PROCESSORT => $processort,
}, 1);
}
sub addUser {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $login = $args->{LOGIN};
return unless $login;
# Is the login, already in the XML ?
foreach my $user (@{$xmltags->{USERS}}) {
return if $user->{LOGIN}[0] eq $login;
}
push @{$xmltags->{USERS}},
{
LOGIN => [$login]
};
my $userString = $xmltags->{HARDWARE}->{USERID}[0] || "";
$userString .= '/' if $userString;
$userString .= $login;
$self->setHardware ({
USERID => $userString,
}, 1);
}
sub addPrinter {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION DRIVER NAME PORT/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{PRINTERS}}, $content;
}
# For compatibility
sub addPrinters {
my $self = shift;
my $logger = $self->{logger};
$logger->debug("please rename addPrinters to addPrinter()");
$self->addPrinter(@_);
}
sub addBatteries {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/CHEMISTRY DESIGNCAPACITY DESIGNVOLTAGE LOCATION MANUFACTURER MANUFACTUREDATE MAXERROR NAME OEMSPECIFIC SBDSVERSION SERIALNUMBER /) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{BATTERIES}}, $content;
}
sub addVirtualMachine {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/CORES IPADDR MEMORY NAME UUID STATUS SUBSYSTEM VMTYPE VCPU VMID/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{VIRTUALMACHINES}}, $content;
}
sub addProcess {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/COMMANDLINE CPUUSAGE PROCESSMEMORY PROCESSID STARTED TTY USERNAME VIRTUALMEMORY/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{RUNNING_PROCESSES}}, $content;
}
sub addCamera {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/MODEL UUID/){
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key} if $args->{$key};
}
}
push @{$xmltags->{RUNNING_PROCESSES}}, $content;
}
sub addIpDiscoverEntry {
my ($self, $args) = @_;
my $xmltags = $self->{xmltags};
my $ipaddress = $args->{IPADDRESS};
my $macaddr = $args->{MACADDR};
my $name = $args->{NAME};
if (!$xmltags->{IPDISCOVER}{H}) {
$xmltags->{IPDISCOVER}{H} = [];
}
push @{$xmltags->{IPDISCOVER}{H}}, {
# If I or M is undef, the server will ignore the host
I => [$ipaddress?$ipaddress:""],
M => [$macaddr?$macaddr:""],
N => [$name?$name:"-"], # '-' is the default value returned by ipdiscover
};
}
sub setAccessLog {
my ($self, $args) = @_;
foreach my $key (qw/USERID LOGDATE/) {
if (exists $args->{$key}) {
$self->{xmlroot}{'CONTENT'}{'ACCESSLOG'}{$key}[0] = $args->{$key};
}
}
}
sub flushXMLTags {
my $self= shift;
$self->{xmltags} = {};
}
### SNMP specifics subroutines ####
sub getSnmpTable {
my ($self,$snmp_table,$baseoid,$snmp_infos) = @_;
# $snmp_infos is a hash passed for the SNMP information we want to get
# It has to be created like this :
# my $hash = {
# INFORMATION => OID,
#};
my $results={}; #The final hash which will contain one key per SNMP reference
for my $oid ( keys %$snmp_table ) {
if ( $oid =~ /$baseoid\.\d+\.\d+\.(\S+)/ ) {
my $reference=$1; #Getting the last digits of the OID separated by a dot
# Getting information if one the values from $snmp_infos hash is found for the current OID
for my $value (keys %$snmp_infos) {
if ($oid =~ /$snmp_infos->{$value}\.$reference/) {
$results->{$reference}->{$value}= $snmp_table->{$oid}
}
}
}
}
return $results;
}
sub setSnmpCommons {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
foreach my $key (qw/IPADDR MACADDR SNMPDEVICEID NAME DESCRIPTION CONTACT LOCATION UPTIME DOMAIN TYPE / ) {
if (exists $args->{$key}) {
$xmltags->{COMMON}[0]{$key}[0] = $args->{$key};
}
}
}
sub setSnmpPrinter {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
foreach my $key (qw/NAME SERIALNUMBER COUNTER STATUS ERRORSTATE/ ) {
if (exists $args->{$key}) {
$xmltags->{PRINTERS}[0]{$key}[0] = $args->{$key};
}
}
}
sub setSnmpSwitchInfos {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
foreach my $key (qw/TYPE/) {
if (exists $args->{$key}) {
$xmltags->{SWITCHINFOS}[0]{$key}[0] = $args->{$key};
}
}
}
sub setSnmpFirewalls {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
foreach my $key (qw/SERIALNUMBER SYSTEM/) {
if (exists $args->{$key}) {
$xmltags->{FIREWALLS}[0]{$key}[0] = $args->{$key};
}
}
}
sub setSnmpLoadBalancer {
my ($self,$args) = @_;
my $xmltags=$self->{xmltags};
foreach my $key (qw/SERIALNUMBER SYSTEM MANUFACTURER TYPE/ ) {
if (exists $args->{$key}) {
$xmltags->{LOADBALANCERS}[0]{$key}[0] = $args->{$key};
}
}
}
sub setSnmpBlade {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
foreach my $key (qw/SERIALNUMBER SYSTEM/) {
if (exists $args->{$key}) {
$xmltags->{BLADES}[0]{$key}[0] = $args->{$key};
}
}
}
sub setSnmpComputer {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
foreach my $key (qw/SYSTEM/) {
if (exists $args->{$key}) {
$xmltags->{COMPUTERS}[0]{$key}[0] = $args->{$key};
}
}
}
sub addSnmpPrinterCartridge {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION TYPE LEVEL MAXCAPACITY COLOR/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key};
}
}
push @{$xmltags->{CARTRIDGES}},$content;
}
sub addSnmpPrinterTray {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/NAME DESCRIPTION LEVEL MAXCAPACITY/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key};
}
}
push @{$xmltags->{TRAYS}},$content;
}
sub addSnmpNetwork {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION MACADDR DEVICEMACADDR SLOT STATUS SPEED TYPE DEVICEADDRESS DEVICENAME DEVICEPORT DEVICETYPE TYPEMIB IPADDR IPMASK IPGATEWAY IPSUBNET IPDHCP DRIVER VIRTUALDEV/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key};
}
}
push @{$xmltags->{NETWORKS}},$content;
}
sub addSnmpCard {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION REFERENCE FIRMWARE SOFTWARE REVISION SERIALNUMBER MANUFACTURER TYPE/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key};
}
}
push @{$xmltags->{CARDS}},$content;
}
sub addSnmpFan {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION REFERENCE REVISION SERIALNUMBER MANUFACTURER TYPE/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key};
}
}
push @{$xmltags->{FANS}},$content;
}
sub addSnmpPowerSupply {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/MANUFACTURER REFERENCE TYPE SERIALNUMBER DESCRIPTION REVISION/ ) {
if (exists $args->{$key}) {
$content->{$key}[0]=$args->{$key};
}
}
push @{$xmltags->{POWERSUPPLIES}},$content;
}
sub addSnmpSwitch {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/MANUFACTURER REFERENCE TYPE SOFTVERSION FIRMVERSION SERIALNUMBER REVISION DESCRIPTION/) {
if (exists $args->{$key}) {
$content->{$key}[0]=$args->{$key};
}
}
push @{$xmltags->{SWITCHS}},$content;
}
sub addSnmpLocalPrinter {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/NAME/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key};
}
}
push @{$xmltags->{LOCALPRINTERS}},$content;
}
sub addSnmpInput {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/DESCRIPTION TYPE/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key};
}
}
push @{$xmltags->{INPUTS}},$content;
}
sub addSnmpCPU {
my ($self,$args) = @_;
my $xmltags = $self->{xmltags};
my $content = {};
foreach my $key (qw/MANUFACTURER TYPE SPEED/) {
if (exists $args->{$key}) {
$content->{$key}[0] = $args->{$key};
}
}
push @{$xmltags->{CPUS}},$content;
}
#Subroutine to add 0 in 'Sun like' MAC address if needed
sub padSnmpMacAddress {
my ($self,$mac) = @_;
my @splitedAddr = split(':', $mac);
for (@splitedAddr) {
unless ($_ =~ /\w{2}/) {
$_ = sprintf("%02s", $_);
}
}
$mac=join (':', @splitedAddr);
return $mac;
}
sub cleanXml {
my ($self,$content) = @_;
my $logger = $self->{logger};
my $clean_content;
# To avoid strange breakage I remove the unprintable characters in the XML
foreach (split "\n", $content) {
if (! m/\A(
[\x09\x0A\x0D\x20-\x7E] # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
)*\z/x) {
s/[[:cntrl:]]//g;
$self->{logger}->debug("non utf-8 '".$_."'");
}
# Is that a good idea. Intent to drop some nasty char
# s/[A-z0-9_\-<>\/:\.,#\ \?="'\(\)]//g;
$clean_content .= $_."\n";
}
return $clean_content;
}
#Subroutine to read XML structure (returned by XML::Simple::XMLin) and encode content in utf8.
sub readXml {
my ($self, $xml, $forcearray) = @_;
my $logger = $self->{logger};
my $content = XML::Simple::XMLin($xml, ForceArray => [@{$forcearray}]);
foreach my $key (keys %$content) {
if (grep(/^$key$/, @{$forcearray})) { #Forced array in XML parsing
$self->parseXmlArray($content->{$key},$forcearray);
} else { #Not a forced array in XML parsing
if (ref ($content->{$key}) =~ /^HASH$/ && !keys %{$content->{$key}}) { # If empty hash from XMLin()
$content->{$key} = '';
} else { utf8::encode($content->{$key}) };
}
}
return $content;
}
#Subroutine to parse array in XML structure (returned by XML::Simple::XMLin) and encode it in utf8
sub parseXmlArray {
my ($self,$array,$forcearray) = @_;
foreach my $hash (@{$array}) {
foreach my $key (keys %$hash) {
if ( grep (/^$key$/,@$forcearray)) { #Forced array in XML parsing
$self->parseXmlArray($hash->{$key},$forcearray);
} else { #Not a forced array in XML parsing
if (ref ($hash->{$key}) =~ /^HASH$/ && !keys %{$hash->{$key}}) { # If empty hash from XMLin()
$hash->{$key} = '';
} else { utf8::encode($hash->{$key}) };
}
}
}
}
#Subroutine to convert versions to numbers (with icutting or right padding if needed)
# We create it because Perl 5.8 does not include version comparison modules or functions
sub convertVersion {
my ($self,$version,$length) = @_;
$version =~ s/\.//g; #We convert to number
my $ver_length = length ($version);
if ($ver_length > $length) { # We cut the number
$version = substr $version, 0, $length;
} elsif ($ver_length < $length) { #We add 0 to the right
$version = substr($version . (0 x $length), 0, $length);
}
return $version;
}
#We create this subroutine because MacOSX system_profiler XML output does not give all
##the neeeded data (for videos and sounds for example)
sub get_sysprofile_devices_names {
my ($self,$type) = @_;
return(undef) unless -r '/usr/sbin/system_profiler';
my $output=`system_profiler $type`;
my $name;
my $names=[];
# Code inspired from Mac::Sysprofile 0.03 from Daniel Muey
for(split /\n/, $output) {
next if m/^\s*$/ || m/^\w/;
if(m/^\s{4}\w/) {
$name = $_;
$name =~ s/^\s+//;
$name =~ s/:.*$//;
push(@$names,$name);
}
}
return $names;
}
### Generic shared subroutines #####
sub can_run {
my $self = shift;
my $binary = shift;
my $logger = $self->{logger};
my $calling_namespace = caller(0);
chomp(my $binpath=`which $binary 2>/dev/null`);
return unless -x $binpath;
$self->{logger}->debug(" - $binary found");
1;
}
sub can_load {
my $self = shift;
my $module = shift;
my $logger = $self->{logger};
my $calling_namespace = caller(0);
eval "package $calling_namespace; use $module;";
return if $@;
$self->{logger}->debug(" - $module loaded");
1;
}
sub can_read {
my $self = shift;
my $file = shift;
my $logger = $self->{logger};
return unless -r $file;
$self->{logger}->debug(" - $file can be read");
1;
}
sub runcmd {
my $self = shift;
my $cmd = shift;
my $logger = $self->{logger};
return unless $cmd;
# $self->{logger}->debug(" - run $cmd");
return `$cmd`;
}
#### Old subroutines from the former Common.pm used by Download.pm #######
sub get_path{
my $self = shift;
my $binary = shift;
my $path;
my @bin_directories = qw { /usr/local/sbin/ /sbin/ /usr/sbin/ /bin/ /usr/bin/ /usr/local/bin/ /etc/ocsinventory-client/};
print "\n=> retrieving $binary...\n" if $::debug;
for (@bin_directories){
$path = $_.$binary,last if -x $_.$binary;
}
# For debbuging purposes
if ($path){
print "=> $binary is at $path\n\n" if $::debug;
} else {
print "$binary not found (Maybe it is not installed ?) - Some functionnalities may lack !!\n\n";
}
return $path;
}
sub already_in_array {
my $self = shift;
my $lookfor = shift;
my @array = @_;
foreach (@array){
if ($lookfor eq $_){
return 1 ;
}
}
return 0;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Config.pm 0000664 0000000 0000000 00000017051 13327377321 0021506 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Config;
use strict;
use Getopt::Long;
our $VERSION = '2.4.2';
my $basedir = '';
my $default = {
'daemon' => 0,
'debug' => 0,
'devlib' => 0,
'force' => 0,
'help' => 0,
'info' => 1,
'lazy' => 0,
'local' => '',
# 'logger' => 'Syslog,File,Stderr',
'logger' => 'Stderr',
'logfacility' => 'LOG_USER',
'logfile' => '',
'password' => '',
'proxy' => '',
'realm' => '',
'remotedir' => '/ocsinventory', # deprecated, give a complete URL to
# --server instead
'server' => 'http://ocsinventory-ng/ocsinventory',
'stdout' => 0,
'tag' => '',
'user' => '',
'version' => 0,
'wait' => '',
# 'xml' => 0,
'nosoftware'=> 0,
'delaytime' => '3600', # max delay time (seconds)
'backendCollectTimeout' => '600', # timeOut of process : see Backend.pm
'scanhomedirs' => 0,
'ssl' => 1,
'ca' => '',
# Other values that can't be changed with the
# CLI parameters
'VERSION' => $VERSION,
'deviceid' => '',
'basevardir'=> $basedir.'/var/lib/ocsinventory-agent',
'logdir' => $basedir.'/var/log/ocsinventory-agent',
# 'pidfile' => $basedir.'/var/run/ocsinventory-agent.pid',
};
sub new {
my (undef, $params) = @_;
my $self = {};
bless $self;
$self->{file} = $params->{file};
$self->{config} = $default;
$self->loadFromCfgFile();
return $self;
}
sub loadFromCfgFile {
my $self = shift;
my $config;
$self->{config}{etcdir} = [];
push (@{$self->{config}{etcdir}}, '/etc/ocsinventory');
push (@{$self->{config}{etcdir}}, '/usr/local/etc/ocsinventory');
push (@{$self->{config}{etcdir}}, '/etc/ocsinventory-agent');
push (@{$self->{config}{etcdir}}, $ENV{HOME}.'/.ocsinventory'); # Should I?
my $file;
if (!$file || !-f $file) {
foreach (@{$self->{config}{etcdir}}) {
$file = $_.'/ocsinventory-agent.cfg';
last if -f $file;
}
return $config unless -f $file;
}
$self->{configfile} = $file;
if (!open (CONFIG, "<".$file)) {
print(STDERR "Config: Failed to open $file\n");
return $config;
}
foreach () {
s/^#.+//;
if (/(\w+)\s*=\s*(.+)/) {
my $key = $1;
my $val = $2;
# Remove the quotes
$val =~ s/\s+$//;
$val =~ s/^'(.*)'$/$1/;
$val =~ s/^"(.*)"$/$1/;
$self->{config}{$key} = $val;
}
}
close CONFIG;
}
sub loadUserParams {
my $self = shift;
my %options = (
"backend-collect-timeout=s" => \$self->{config}{backendCollectTimeout},
"basevardir=s" => \$self->{config}{basevardir},
"d|daemon" => \$self->{config}{daemon},
"debug" => \$self->{config}{debug},
"devlib" => \$self->{config}{devlib},
"f|force" => \$self->{config}{force},
"h|help" => \$self->{config}{help},
"i|info" => \$self->{config}{info},
"lazy" => \$self->{config}{lazy},
"l|local=s" => \$self->{config}{local},
"logfile=s" => \$self->{config}{logfile},
"nosoftware" => \$self->{config}{nosoftware},
"p|password=s" => \$self->{config}{password},
"P|proxy=s" => \$self->{config}{proxy},
"r|realm=s" => \$self->{config}{realm},
"R|remotedir=s" => \$self->{config}{remotedir},
"s|server=s" => \$self->{config}{server},
"stdout" => \$self->{config}{stdout},
"t|tag=s" => \$self->{config}{tag},
"u|user=s" => \$self->{config}{user},
"version" => \$self->{config}{version},
"w|wait=s" => \$self->{config}{wait},
# "x|xml" => \$self->{config}{xml},
"delaytime" => \$self->{config}{delaytime},
"scan-homedirs" => \$self->{config}{scanhomedirs},
"nolocal" => \$self->{config}{nolocal},
"ssl=s" => \$self->{config}{ssl},
"ca=s" => \$self->{config}{ca},
);
$self->help() if (!GetOptions(%options) || $self->{config}{help});
$self->version() if $self->{config}{version};
}
sub help {
my ($self, $error) = @_;
if ($error) {
chomp $error;
print "ERROR: $error\n\n";
}
if ($self->{configfile}) {
print STDERR "Setting initialised with values retrieved from ".
"the config found at ".$self->{configfile}."\n";
}
print STDERR "\n";
print STDERR "Usage:\n";
print STDERR "\t--backend-collect-timeout set a max delay time of one action (search package id, ...) is set (".$self->{config}{backendCollectTimeout}.")\n";
print STDERR "\t--basevardir=/path indicate the directory where should the agent store its files (".$self->{config}{basevardir}.")\n";
print STDERR "\t-d --daemon detach the agent in background (".$self->{config}{daemon}.")\n";
print STDERR "\t --debug debug mode (".$self->{config}{debug}.")\n";
print STDERR "\t --devlib search for Backend mod in ./lib only (".$self->{config}{devlib}.")\n";
print STDERR "\t-f --force always send data to server (Don't ask before) (".$self->{config}{force}.")\n";
print STDERR "\t-i --info verbose mode (".$self->{config}{info}.")\n";
print STDERR "\t--lazy do not contact the server more than one time during the PROLOG_FREQ (".$self->{config}{lazy}.")\n";
print STDERR "\t-l --local=DIR do not contact server but write inventory in DIR directory in XML (".$self->{config}{local}.")\n";
print STDERR "\t --logfile=FILE log message in FILE (".$self->{config}{logfile}.")\n";
print STDERR "\t-p --password=PWD password for server auth\n";
print STDERR "\t-P --proxy=PROXY proxy address. e.g: http://user:pass\@proxy:port (".$self->{config}{proxy}.")\n";
print STDERR "\t-r --realm=REALM realm for server auth. e.g: 'Restricted Area' (".$self->{config}{realm}.")\n";
print STDERR "\t-s --server=uri server uri (".$self->{config}{server}.")\n";
print STDERR "\t --stdout do not write or post the inventory but print it on STDOUT\n";
print STDERR "\t-t --tag=TAG use TAG as tag (".$self->{config}{tag}."). Will be ignored by server if a value already exists.\n";
print STDERR "\t-u --user=USER user for server auth (".$self->{config}{user}.")\n";
print STDERR "\t --version print the version\n";
print STDERR "\t-w --wait=seconds wait a random period before contacting server like --daemon does (".$self->{config}{wait}.")\n";
# print STDERR "\t-x --xml write output in a xml file ($self->{config}{xml})\n";
print STDERR "\t--nosoftware do not return installed software list (".$self->{config}{nosoftware}.")\n";
print STDERR "\t--delaytime set a max delay time (in second) if no PROLOG_FREQ is set (".$self->{config}{delaytime}.")\n";
print STDERR "\t--scan-homedirs permit to scan home user directories (".$self->{config}{scanhomedirs}.")\n" ;
print STDERR "\t--ssl=0|1 disable or enable SSL communications check\n" ;
print STDERR "\t--ca=FILE path to CA certificate chain file in PEM format\n" ;
print STDERR "\n";
print STDERR "Manpage:\n";
print STDERR "\tSee man ocsinventory-agent\n";
print STDERR "\n";
print STDERR "Ocsinventory-Agent is released under GNU GPL 2 license\n";
exit 1;
}
sub version {
print "Ocsinventory unified agent for UNIX, Linux and MacOSX (".$VERSION.")\n";
exit 0;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Hooks.pm 0000664 0000000 0000000 00000006025 13327377321 0021363 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Hooks;
# This package give possibility to use hooks in unified unix agent.
use strict;
use warnings;
#use FindBin qw($Bin);
sub new {
my (undef, $context) = @_;
my $self = {};
$self->{accountinfo} = $context->{accountinfo};
$self->{accountconfig} = $context->{accountconfig};
my $logger = $self->{logger}=$context->{logger};
$self->{config} = $context->{config};
$self->{dontuse} = 1;
my $modulefile;
foreach (@{$self->{config}->{etcdir}}) {
$modulefile = $_.'/modules.conf';
if (-f $modulefile) {
if (do $modulefile) {
$logger->debug("Turns hooks on for $modulefile");
$self->{dontuse} = 0;
last;
} else {
$logger->debug("Failed to load `$modulefile': $?");
}
}
}
if ($self->{dontuse}) {
$logger->debug("No modules will be used.");
} else {
my $ocsAgentServerUri;
# to avoid a warning if $self->{config}->{server} is not defined
if ($self->{config}->{server}) {
$ocsAgentServerUri = "http://".$self->{config}->{server}.$self->{config}->{remotedir};
}
if ($self->{config}->{debug}) {
$::debug = 2;
}
}
# Create objects for modules
foreach my $package (searchModules(\%Ocsinventory::Agent::Modules::)){
my $module = new $package($context);
my $name = $module->{structure}->{name};
# Store the reference in a key to access modules easily
$self->{modules}->{$name}=$module;
}
bless $self;
}
# This function recursively searches for modules in a given namespace
# Param: a hash reference to the namespace
# Returns: an array with modules fully qualified names
sub searchModules {
my $symbols_href = shift;
my @modules_list = ();
my %symbols_h = %{$symbols_href};
my @symbols_a = sort(keys(%symbols_h));
foreach(@symbols_a){
if ($_ eq 'new'){
# Found a "new" method -> this is a usable module
my $module_fqn = $symbols_h{$_};
# Keep the module fqn, without '*' at start
$module_fqn =~ s/\*?(.+)::new$/$1/;
push(@modules_list, $module_fqn);
} elsif (substr($_, -2) eq '::') {
# If we meet a package, continue walking
push(@modules_list, searchModules($symbols_h{$_}));
}
}
return @modules_list;
}
sub run {
my ($self, $args, $moduleparam) = @_;
return if $self->{dontuse};
my $name = $args->{name}; #type of hook asked
my $logger = $self->{logger};
$logger->debug("Calling handlers : `$name'");
# Launching hook for modules if not 'undef' and if modules are not disabled by start_handler
for (keys %{$self->{modules}}) {
my $module = $self->{modules}->{$_};
unless ($module->{disabled}) {
my $hook = $module->{structure}->{$name};
if ($hook) {
$module->$hook($moduleparam);
}
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/ 0000775 0000000 0000000 00000000000 13327377321 0021347 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Apache/ 0000775 0000000 0000000 00000000000 13327377321 0022530 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Apache/Vhosts/ 0000775 0000000 0000000 00000000000 13327377321 0024016 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Apache/Vhosts/Common.pm 0000664 0000000 0000000 00000024610 13327377321 0025607 0 ustar 00root root 0000000 0000000 ###############################################################################
# Apache::Vhosts::Common - Common stuff for apache vhosts inventory
#
# Author: Linkbynet
###############################################################################
package Ocsinventory::Agent::Modules::Apache::Vhosts::Common;
=head1 NAME
Apache::Vhosts::Common - Lib for common operations in vhosts inventory
=head1 DESCRIPTION
This package is meant to contain common functions used by OCS modules for
Apache virtualhosts.
For example, we could have two OCS modules:
=over
=item ApacheVhostsPackaged
which would deal with packaged apache setups
=item ApacheVhostsCompiled
which would deal with compiled apache versions
=back
At different times, these modules still would need to do the same things, such
as parsing apache configuration files, reading and extracting information from
a vhost dump, reading a x509 certificate with openssl, ...
To avoid code duplication, the specific modules can call the functions
contained in this common package.
=head2 Exports
The module exports the following functions:
=over
=item C
=item C
=back
=cut
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(&readVhostsDump &readVhostConfFile);
use strict;
use warnings;
#### BEGIN: Define regexes
# Useful lines in vhosts dump (NameVirtualHosts and IP vhosts only)
my $dumpline_name_re = qr/^port ([0-9]+) namevhost (\S+) \((\S+):([0-9]+)\)/;
my $dumpline_ip_re = qr/^([0-9.]+):([0-9]+)\s+(\S+) \((\S+):([0-9]+)\)/;
# "subject=" line of openssl x509 command output (used to extract CN)
my $subject_cn_re = qr/^subject=.*\/CN=([^\s\/]+).*$/;
# Simplistic email address pattern
my $damn_simple_email_re = qr/.+\@.+\..+/;
#### END: Define regexes
=head2 readVhostsDump()
Return an array of hashes with the virtualhosts found thanks to Apache's vhosts
dump (C command).
=head3 Return type
The function returns a reference to an array of hashes.
=head3 Process
The function's workflow is as follows:
=over
=item 1
Open C command output, with the current configuration file
=item 2
Read dump line by line to match IP-based or name-based virtualhost information
(both types of lines should be recognized):
port 80 namevhost mynamevhost.fr (/etc/httpd/.../10-mynamevhost.conf:50)
10.0.0.1:80 myvhost myipvhost.fr (/etc/httpd/.../20-myipvhost.conf:1)
=item 3
Create a hash with the virtualhost's data
We put the following attributes in it:
(string) computedname, (int) port, (string) srvname,
(string) vhostfile, (string) vhostline, (string) docroot, (bool) ssl
At this stage we do not know docroot or ssl, so they are "/nonexistent" and
false (0), respectively.
=item 4
Push the vhost hash to the array.
=back
=head3 Return example
[
{
'computedname' => "[httpd] myvhost.fr:80",
'port' => 80,
'srvname' => 'myvhost.fr',
'vhostfile' => '/etc/httpd/conf.d/10-myvhost.conf',
'vhostline' => 1,
'docroot' => '/nonexistent',
'ssl' => 0
},
{
'computedname' => "[httpd] myvhost.fr:443",
'port' => 443,
'srvname' => 'myvhost.fr',
'vhostfile' => '/etc/httpd/conf.d/10-myvhost.conf',
'vhostline' => 20,
'docroot' => '/nonexistent',
'ssl' => 0
}
]
=head3 Calling
my $vhosts = readVhostsDump($httpd_bin, $httpd_conf_file, $logger);
=over
=item Parameter: $httpd_bin (string)
Path to the httpd binary to execute (for example: C).
Specific options (such as C<-D> parameters) may be added to the string.
=item Parameter: $httpd_conf_file (string)
Path to the main httpd configuration file (for example:
C).
=item Parameter: $logger (reference to OCS logger instance)
To make use of OCS logging capabilities within the function.
=back
=cut
sub readVhostsDump {
my ($httpd_bin, $httpd_conf_file, $logger) = @_;
my @vhosts = ();
# 2>&1 because some very old Apache versions write the vhosts dump
# on stderr!
open(my $DUMPFILE, "$httpd_bin -S -f $httpd_conf_file 2>&1 |")
or die("Cannot open \$(httpd -S -f $httpd_conf_file) $!");
while (<$DUMPFILE>) {
chomp;
s/^\s+//; # lstrip
my ($ip, $port, $srvname, $vhostfile, $vhostline);
if ($_ =~ $dumpline_name_re) {
($port, $srvname, $vhostfile, $vhostline) = ($1, $2, $3, $4);
} elsif ($_ =~ $dumpline_ip_re) {
($ip, $port, $srvname, $vhostfile, $vhostline) = ($1, $2, $3, $4, $5);
}
if (defined($port)) { # sufficient test to know if line was found
my %vhost = (
'computedname' => "$srvname:$port",
'port' => int($port),
'srvname' => $srvname,
'vhostfile' => $vhostfile,
'vhostline' => int($vhostline),
'docroot' => '/nonexistent',
'ssl' => 0
);
push(@vhosts, \%vhost);
}
}
close($DUMPFILE);
return \@vhosts;
}
=head2 readVhostConfFile()
Enhance a virtualhost's information with elements found when parsing the
vhost's configuration file.
=head3 Return type
The function returns nothing.
It only operates on the (referenced) vhost hash it got in parameter.
=head3 Process
The function must read the apache configuration file in which the vhost gets
defined ( block).
The path to the particular configuration file and the line number of the vhost
declaration are known in the C and C attributes, thanks
to the vhost dump.
The function's process, for the given vhost, is as follows:
=over
=item 1
Open the configuration file at C
=item 2
Read line by line, waiting to be at correct line number (C) to
start searching for information.
=item 3
Search for the following information in the and enhance the
given vhost hash with:
=over
=item *
docroot (string)
the value of the C directive
=item *
ssl (bool)
we turn it to true if we find a C directive
=item *
sslcertpath (string)
value of the C directive, if such a directive is present
=back
=item 4
File reading stops when we find the C<< >> closing block
(in case multiple vhosts are declared in the same configuration file).
=back
=head3 Calling
foreach my $vhost (@$vhosts) # Generally
{
readVhostConfFile($vhost, $httpd_basedir);
}
=over
=item Parameter: $vhost (reference to hash)
The virtualhost hash to enhance.
=item Parameter: $httpd_basedir (string)
The path to base directory of httpd, in case we encounter a relative path
in C and need to complete it.
B: the given path is expected to end with a slash '/', for example:
"/etc/httpd/"
=back
=cut
sub readVhostConfFile {
my ($vhost, $relpath_prefix) = @_;
my $nr = 0;
open(my $VHOST_FILE, '<', $vhost->{'vhostfile'})
or die ("Cannot open $vhost->{'vhostfile'}");
while (my $vline = <$VHOST_FILE>) {
# Waiting the correct line to start reading
next if ++$nr < $vhost->{'vhostline'};
$vline =~ s/^\s+//; # lstrip
# Get various vhost properties
# -- DocumentRoot
if ($vline =~ m/^DocumentRoot ["']?([^\s'"]+)["']?/i) {
$vhost->{'docroot'} = $1;
}
# -- SSLEngine (bool)
elsif ($vline =~ m/^SSLEngine on/i) {
$vhost->{'ssl'} = 1;
}
# -- SSLCertificateFile path
elsif ($vline =~ m/^SSLCertificateFile ["']?([^\s'"]+)["']?/i) {
$vhost->{'sslcertpath'} = $1;
readVhostSSLCert($vhost, $relpath_prefix);
}
# Stop reading on block closing tag
last if $vline =~ m@^@i;
}
close($VHOST_FILE);
}
###############################################################################
# readVhostSSLCert() - read a vhost's SSL certificate to get its details
#
# Invoking:
# readVhostSSLCert($vhost, $relpath_prefix)
#
# Params:
# - $vhost - a reference to the vhost hash
# - $relpath_prefix - the prefix to use in case the SSLCertificateFile path
# is a relative one, in order to make it an absolute path
#
# Returns:
# nothing.
#
# We read the certificate with an "openssl x509" command.
# We try to retrieve the following fields:
#
# - "subject" (specifically to get the CN)
# - "notBefore" and "notAfter" dates
# - "email" (we catch the first email returned)
#
# The certificate details found here are gently stuffed in
# $vhost->{'sslcertdetails'}, as follows:
#
# {
# # (in a vhost here)
# # [...]
# 'srvname' => 'myvhost.fr',
# 'ssl' => 1,
# 'sslcertpath' => 'conf/ssl/myvhost.fr.crt',
# 'sslcertdetails' => {
# 'cn' => 'myvhost.fr',
# 'startdate' => '31/12/2012',
# 'enddate' => '31/12/2042',
# 'email' => 'certadmin-email@example.com'
# }
# }
sub readVhostSSLCert {
my ($vhost, $relpath_prefix) = @_;
$vhost->{'sslcertdetails'} = ();
my $sslcertpath = $vhost->{'sslcertpath'};
my $absolute = (substr($sslcertpath, 0, 1) eq '/');
if (!$absolute) {
$sslcertpath = "${relpath_prefix}${sslcertpath}";
}
open(my $OPENSSL_CMD, "openssl x509 -in \"$sslcertpath\" -noout -subject -dates -email |");
while (my $oline = <$OPENSSL_CMD>) {
if ($oline =~ $subject_cn_re) {
$vhost->{'sslcertdetails'}->{'cn'} = $1;
} elsif ($oline =~ m/^notBefore=(.+)$/) {
$vhost->{'sslcertdetails'}->{'startdate'} = formatDate($1);
} elsif ($oline =~ m/^notAfter=(.+)$/) {
$vhost->{'sslcertdetails'}->{'enddate'} = formatDate($1);
} elsif ($oline =~ $damn_simple_email_re) {
chomp $oline;
$vhost->{'sslcertdetails'}->{'email'} = $oline;
# stop processing from the first email address
# (it should be the last line of the command output)
last;
}
}
close($OPENSSL_CMD);
}
###############################################################################
# formatDate() - reformat date, with help of system command date(1)
#
# Invoking:
# formatDate($date)
#
# Params:
# - $date - the date string to reformat, in a format parsable by date(1)
#
# Returns:
# the ISO 8601 (%Y-%m-%d) formatted date (string)
#
sub formatDate {
my ($date) = @_;
my $formattedDate = `date --date="$date" --iso-8601`;
chomp $formattedDate;
return $formattedDate;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Apache/VhostsEL.pm 0000664 0000000 0000000 00000012574 13327377321 0024606 0 ustar 00root root 0000000 0000000 ################################################################################
## Author: Linkbynet
##
## This code is open source and may be copied and modified as long as the source
## code is always made freely available.
## Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
##
## #############################################################################
##
## This module retrieves information about Apache virtualhosts.
##
## It handles setups where Apache was installed by package (Enterprise Linux
## distributionsi family: RHEL, CentOS, Fedora) with configuration in standard
## dir /etc/httpd.
##
## Information gets written to tags at XPaths:
##
## /REQUEST/CONTENT/APACHE_VHOST
## /REQUEST/CONTENT/APACHE_VHOST_CERTIFICATE
##
## Example:
##
##
##
## /var/www/example.com
## example.com:443
## example.com
## 443
##
##
##
## example.com
## 30/06/2023
## 01/07/2013
## example.com:443
## certmaster@example.com
##
##
##
################################################################################
package Ocsinventory::Agent::Modules::Apache::VhostsEL;
use strict;
use warnings;
use Ocsinventory::Agent::Modules::Apache::Vhosts::Common;
sub new {
my $name = "apachevhosts_el"; # Set the name of your module here
my (undef,$context) = @_;
my $self = {};
# Create a special logger for the module
$self->{logger} = new Ocsinventory::Logger ({
config => $context->{config}
});
$self->{logger}->{header} = "[$name]";
$self->{context} = $context;
$self->{structure} = {
name => $name,
start_handler => $name."_start_handler", # or undef if don't use this hook
prolog_writer => undef, # or undef if don't use this hook
prolog_reader => undef, # or undef if don't use this hook
inventory_handler => $name."_inventory_handler", # or undef if don't use this hook
end_handler => undef # or undef if don't use this hook
};
# Path to httpd bin
$self->{modinfos}->{httpd_bin} = '/usr/sbin/httpd';
# Path to httpd dir in /etc
# (basis for relative paths or SSLCertificateFile, for example)
$self->{modinfos}->{httpd_basedir} = '/etc/httpd/';
# Path to httpd conf dir
$self->{modinfos}->{httpd_confdir} = '/etc/httpd/conf';
# Path to httpd main conf file
$self->{modinfos}->{httpd_conf_file} = '/etc/httpd/conf/httpd.conf';
bless $self;
}
######### Hook methods ############
sub apachevhosts_el_start_handler { # Use this hook to test prerequisites needed by module and disble it if needed
my $self = shift;
my $logger = $self->{logger};
my $prerequisites = 1;
# TESTS:
#
# 1 - Apache HTTPD server is installed the packet way (conf dir present)
# 2 - We can execute the httpd binary
# 3 - We can read the main conf file (httpd.conf or equivalent)
if (! -d $self->{modinfos}->{httpd_confdir}) {
# No apache found on this server (or not in the expected place)
$logger->debug("- no $self->{modinfos}->{httpd_confdir} directory found");
$prerequisites = 0;
} elsif (! -x $self->{modinfos}->{httpd_bin}) {
$logger->debug("- no executable $self->{modinfos}->{httpd_bin} found");
$prerequisites = 0;
} elsif (! -f $self->{modinfos}->{httpd_conf_file}) {
$logger->debug("- did not find $self->{modinfos}->{httpd_conf_file} file");
$prerequisites = 0;
}
if ($prerequisites == 0) {
$self->{disabled} = 1; # Use this to disable the module
$logger->debug("Humm my prerequisites are not OK...disabling module :( :( ");
}
}
sub apachevhosts_el_inventory_handler { # Use this hook to add or modify entries in the inventory XML
my $self = shift;
my $logger = $self->{logger};
my $common = $self->{context}->{common};
$logger->debug(__PACKAGE__);
# Reading httpd -S output
my $vhosts = readVhostsDump($self->{modinfos}->{httpd_bin}, $self->{modinfos}->{httpd_conf_file}, $logger);
# Enhancing information by parsing each vhost's configuration
foreach my $vhost (@$vhosts) {
readVhostConfFile($vhost, $self->{modinfos}->{httpd_basedir});
}
# Write OCS XML
foreach my $vhost (@$vhosts) {
push @{$common->{'xmltags'}->{'APACHE_VHOST'}}, {
"NAME" => [$vhost->{'computedname'}],
"URL" => [$vhost->{'srvname'}],
"DIRECTORY" => [$vhost->{'docroot'}],
"PORT_NUMBER" => [$vhost->{'port'}]
};
if ($vhost->{'ssl'}) {
push @{$common->{'xmltags'}->{'APACHE_VHOST_CERTIFICATE'}}, {
"SITE" => [$vhost->{'computedname'}],
"DOMAINNAME" => [$vhost->{'sslcertdetails'}->{'cn'}],
"REGISTRATIONDATE" => [$vhost->{'sslcertdetails'}->{'startdate'}],
"EXPIRATIONDATE" => [$vhost->{'sslcertdetails'}->{'enddate'}],
"EMAIL" => [$vhost->{'sslcertdetails'}->{'email'}]
};
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Databases/ 0000775 0000000 0000000 00000000000 13327377321 0023236 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Databases/Oracle.pm 0000664 0000000 0000000 00000006571 13327377321 0025012 0 ustar 00root root 0000000 0000000 ################################################################################
## Author: Linkbynet
##
## This code is open source and may be copied and modified as long as the source
## code is always made freely available.
## Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
##
## #############################################################################
##
## This module finds and retrieves information about Oracle instances.
##
## First elements are taken from the /etc/oratab file. For each instance listed
## in it, we get the precise version number (with tnsping utility) and bundle
## name by reading the file below:
##
## $ORACLE_HOME/inventory/Components21/oracle.server/*/context.xml
##
## Information gets written to tags at XPaths:
##
## /REQUEST/CONTENT/ORACLE_INSTANCE
##
## Example:
##
##
##
## 0
## Standard
## EXDB01
## 11.2.0.4.0
##
##
##
################################################################################
package Ocsinventory::Agent::Modules::Databases::Oracle;
use strict;
use warnings;
use Ocsinventory::Agent::Modules::Databases::Oracle::Instances;
sub new {
my $name = "oracleinstances"; # Set the name of your module here
my (undef,$context) = @_;
my $self = {};
# Create a special logger for the module
$self->{logger} = new Ocsinventory::Logger ({
config => $context->{config}
});
$self->{logger}->{header} = "[$name]";
$self->{context} = $context;
$self->{structure} = {
name => $name,
start_handler => $name."_start_handler", # or undef if don't use this hook
prolog_writer => undef, # or undef if don't use this hook
prolog_reader => undef, # or undef if don't use this hook
inventory_handler => $name."_inventory_handler", # or undef if don't use this hook
end_handler => undef # or undef if don't use this hook
};
bless $self;
}
######### Hook methods ############
sub oracleinstances_start_handler { # Use this hook to test prerequisites needed by module and disble it if needed
my $self = shift;
my $logger = $self->{logger};
my $prerequisites = 1;
if (!(-f '/etc/oratab' && -r '/etc/oratab')) {
$logger->debug("- no readable /etc/oratab file");
$prerequisites = 0;
}
if ($prerequisites == 0) {
$self->{disabled} = 1; # Use this to disable the module
$logger->debug("Humm my prerequisites are not OK...disabling module :( :( ");
}
}
sub oracleinstances_inventory_handler { # Use this hook to add or modify entries in the inventory XML
my $self = shift;
my $logger = $self->{logger};
my $common = $self->{context}->{common};
$logger->debug(__PACKAGE__);
my $database = getInstances();
# Write to OCS XML
foreach my $instance (keys(%$database)) {
push @{$common->{xmltags}->{ORACLE_INSTANCE}}, {
'NAME' => [$instance],
'AUTOSTART' => [$database->{$instance}->{'AUTOSTART'}],
'VERSION' => [$database->{$instance}->{'VERSION'}],
'BUNDLE' => [$database->{$instance}->{'BUNDLE'}]
};
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Databases/Oracle/ 0000775 0000000 0000000 00000000000 13327377321 0024443 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Databases/Oracle/Instances.pm 0000664 0000000 0000000 00000013534 13327377321 0026736 0 ustar 00root root 0000000 0000000 ################################################################################
# Oracle::Instances - Common stuff to get Oracle instances and versions
#
# Author: Linkbynet
################################################################################
package Ocsinventory::Agent::Modules::Databases::Oracle::Instances;
=head1 NAME
Oracle::Instances - Lib for Oracle instances and versions retrieval
=head1 DESCRIPTION
This module provides a function to retrieve information about Oracle instances
on the current server.
To do so, the function reads the /etc/oratab file to find instances and then:
=over
=item 1
Checks the existence of the ORACLE_HOME directory.
=item 2
Add (ORACLE_SID, ORACLE_HOME, AUTOSTART) to the databases hash.
=item 3
Go and find server version and bundle for each ORACLE_HOME.
This information is found by executing the C command and by reading
the following XML file:
$ORACLE_HOME/inventory/Components21/oracle.server/*/context.xml
The following bundles are known: SE1 (Standard Edition One), SE (Standard
Edition), EE (Enterprise Edition), XE (Express Edition).
=item 4
Returns the database hash as follows:
{
'SID' => {
'BUNDLE' => 'Standard',
'AUTOSTART' => 0,
'ORA_HOME' => '/home/oracle/oracle/product/11.2.0',
'VERSION' => '11.2.0.4.0'
}
};
=back
Optionally, you can call C to return only the hash of versions
and bundles, instead of the complete instances hash:
{
'/home/oracle/oracle/product/11.2.0' => {
'BUNDLE' => 'Standard',
'VERSION' => '11.2.0.4.0'
}
};
In that case, you just have to pass parameter 1 (integer one) when calling the
function.
=head2 Exports
The module exports the C function.
=cut
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(&getInstances);
use strict;
use warnings;
######### BEGIN: Constants ############
# Known Oracle editions. The two-letter codes are the ones which can be
# encountered in the context.xml file.
my %bundles = (
'SE1' => 'Standard One',
'SE' => 'Standard',
'EE' => 'Enterprise',
'XE' => 'Express'
);
######### END: Constants ############
=head2 getInstances()
=head3 Synopsis
getInstances($version_only)
where $versions_only is a integer (tested as a bool)
my $database = getInstances()
my $versions = getInstances(1)
=head3 Return values
The function returns a hash reference containing the instances or versions.
=cut
sub getInstances {
my $versions_only = shift;
my %database;
my %versions;
# First, read the /etc/oratab to find out Oracle instances
# Here we already get the SID, path and autostart
open(my $ORATAB, '<', '/etc/oratab') or die("Cannot open /etc/oratab $!");
while (my $oratab_line = <$ORATAB>) {
chomp $oratab_line;
next if $oratab_line =~ /^(#|$)/; # skip comments and empty lines
my ($ora_sid, $ora_home, $dbstart_yn) = split(/:/, $oratab_line);
# Keep existing instances only
if (-d $ora_home) {
$database{$ora_sid} = {
'ORA_HOME' => $ora_home,
'AUTOSTART' => $dbstart_yn eq 'Y' ? 1 : 0
};
}
}
close($ORATAB);
# Retrieve version and bundle information in %versions
# and put information in global %database hash too
foreach my $ora_sid (keys(%database)) {
my $ora_home = $database{$ora_sid}{'ORA_HOME'};
unless (exists($versions{$ora_home})) {
$versions{$ora_home} = _getVersionAndBundle($ora_home);
}
my $version_bundle = $versions{$ora_home};
$database{$ora_sid}{'VERSION'} = $version_bundle->{'VERSION'};
$database{$ora_sid}{'BUNDLE'} = $version_bundle->{'BUNDLE'};
}
# Return complete database hash or only version and bundle, according to
# $versions_only argument
if ($versions_only) {
return \%versions;
} else {
return \%database;
}
}
# _getVersionAndBundle($ora_home)
#
# Simple method building a hash with two keys 'VERSION' and 'BUNDLE' and their
# values.
#
# Return: a hash reference
sub _getVersionAndBundle {
my $ora_home = shift;
my %version_bundle = (
'VERSION' => _getVersion($ora_home),
'BUNDLE' => _getBundle($ora_home)
);
return \%version_bundle;
}
# _getVersion($ora_home)
#
# Find Oracle server version installed in ORACLE_HOME.
#
# We are using the tnsping command for that.
# Return: the version string (for example "11.2.0.4.0" or "N/A" by default)
sub _getVersion {
my $ora_home = shift;
my $version = 'N/A';
my $tnsping = "$ora_home/bin/tnsping";
if (-x $tnsping) {
open(my $TNSPING_OUT, "$tnsping localhost |")
or die("Cannot exec tnsping $!");
while (my $tp_line = <$TNSPING_OUT>) {
if ($tp_line =~ m/^TNS Ping Utility for Linux: Version ([0-9.]+)/) {
$version = $1;
}
}
close($TNSPING_OUT);
}
return $version;
}
# _getBundle($ora_home)
#
# Find bundle version, reading a context.xml file down below ORACLE_HOME.
#
# Return: the full name of the install type (e.g. Standard or Enterprise) or,
# by default, "N/A"
sub _getBundle {
my $ora_home = shift;
my $bundle = 'N/A';
my $xml_re = qr/^\s*) {
if ($xml_line =~ $xml_re) {
$xml_line =~ $type_re;
my $abbr = $1;
$bundle = $bundles{$abbr} if exists($bundles{$abbr});
last;
}
}
close($CONTEXT_XML);
}
return $bundle;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Download.pm 0000664 0000000 0000000 00000075633 13327377321 0023472 0 ustar 00root root 0000000 0000000 ###############################################################################
## OCSINVENTORY-NG
## Copyleft Pascal DANEK 2005
## Web : http://ocsinventory.sourceforge.net
##
## This code is open source and may be copied and modified as long as the source
## code is always made freely available.
## Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################
# Function by hook:
# -download_prolog_reader, download_message, download
# -download_inventory_handler
# -download_end_handler, begin, done, clean, finish, period, download, execute,
# check_signature and build_package
package Ocsinventory::Agent::Modules::Download;
use strict;
use Fcntl qw/:flock/;
use XML::Simple;
use LWP::UserAgent;
use Compress::Zlib;
use Digest::MD5;
use File::Path;
use Socket;
# Can be missing. By default, we use MD5
# You have to install it if you want to use SHA1 digest
eval{ require Digest::SHA1 };
#Global vars
my $ua;
my $download_config;
my @prior_pkgs;
sub new {
my $name="download"; #Set the name of your module here
my (undef,$context) = @_;
my $self = {};
# Create a special logger for the module
$self->{logger} = new Ocsinventory::Logger ({
config => $context->{config},
});
# We use the common object for the module
$self->{common} = $context->{common};
$self->{context} = $context;
$self->{logger}->{header}="[$name]";
$self->{structure} = {
name => $name,
start_handler => $name."_start_handler",
prolog_writer => undef,
prolog_reader => $name."_prolog_reader",
inventory_handler => $name."_inventory_handler",
end_handler => $name."_end_handler"
};
$self->{settings} = {
https_port => '443',
# Time to wait between scheduler periods, scheduling cycles and fragments downloads
frag_latency_default => 10,
period_latency_default => 0,
cycle_latency_default => 10,
max_error_count => 30,
# Number of loops for one period
period_lenght_default => 10,
};
$self->{messages} = {
# Errors
code_success => 'SUCCESS',
success_already_setup => 'SUCCESS_ALREADY_SETUP',
err_bad_id => 'ERR_BAD_ID',
err_download_info => 'ERR_DOWNLOAD_INFO',
err_bad_digest => 'ERR_BAD_DIGEST',
err_download_pack => 'ERR_DOWNLOAD_PACK',
err_build => 'ERR_BUILD',
err_execute => 'ERR_EXECUTE',
err_clean => 'ERR_CLEAN',
err_timeout => 'ERR_TIMEOUT',
};
# Special hash for packages
$self->{packages}= {};
bless $self;
}
sub download_start_handler {
my $self = shift;
my $logger = $self->{logger};
my $common = $self->{context}->{common};
my $config = $self->{context}->{config};
$logger->debug("Calling download_start_handler");
# Disabling module if local mode
if ($config->{stdout} || $config->{local}) {
$self->{disabled} = 1;
$logger->info("Agent is running in local mode...disabling module");
}
# If we cannot load prerequisite, we disable the module
if ($common->can_load('LWP')) {
my $lwp_version = $LWP::VERSION;
$lwp_version=$self->{common}->convertVersion($lwp_version,3);
if ($lwp_version > 583) { #Newer LWP version
unless ($common->can_load('LWP::Protocol::https')) {
$self->{disabled} = 1;
$logger->error("LWP::Protocol::https perl module is missing !!");
$logger->error("Humm my prerequisites are not OK...disabling module :( :(");
}
} else {
unless ($common->can_load('Crypt::SSLeay')) {
$self->{disabled} = 1;
$logger->error("Crypt::SSLeay perl module is missing !!");
$logger->error("Humm my prerequisites are not OK...disabling module :( :(");
}
}
} else {
$self->{disabled} = 1;
$logger->error("LWP perl module is missing !!");
$logger->error("Humm my prerequisites are not OK...disabling module :( :(");
}
}
sub download_prolog_reader{ #Read prolog response
my ($self,$prolog) = @_;
my $context = $self->{context};
my $logger = $self->{logger};
my $config = $self->{context}->{config};
my $network = $self->{context}->{network};
my $common = $self->{common};
my $settings = $self->{settings};
my $messages = $self->{messages};
my $packages = $self->{packages};
$logger->debug("Calling download_prolog_reader");
$logger->debug($prolog);
$prolog = XML::Simple::XMLin( $prolog, ForceArray => ['OPTION', 'PARAM']);
my $option;
# Create working directory
my $opt_dir = $context->{installpath}.'/download';
mkdir($opt_dir) unless -d $opt_dir;
# We create a file to tell to download process that we are running
open SUSPEND, ">$opt_dir/suspend";
close(SUSPEND);
# Create history file if needed
unless(-e "$opt_dir/history"){
open HISTORY, ">$opt_dir/history" or die("Cannot create history file: $!");
close(HISTORY);
}
# Create lock file if needed
unless(-e "$opt_dir/lock"){
open LOCK, ">$opt_dir/lock" or die("Cannot create lock file: $!");
close(LOCK);
}
# Retrieve our options
for $option (@{$prolog->{OPTION}}){
if ($option->{NAME} =~/download/i){
for (@{ $option->{PARAM} } ) {
# Type of param
if ($_->{'TYPE'} eq 'CONF'){
# Writing configuration
open CONFIG, ">$opt_dir/config" or die("Cannot open/create config file ($opt_dir/config)");
if (flock(CONFIG, LOCK_EX)){
$logger->debug("Writing config file.");
print CONFIG XMLout($_, RootName => 'CONF');
close(CONFIG);
$download_config = $_;
} else {
$logger->error("Cannot lock config file !!");
close(CONFIG);
return 0;
}
# Apply config
# ON ?
if ($_->{'ON'} == '0'){
$logger->info("Download is off.");
open LOCK, "$opt_dir/lock" or die("Cannot open lock file: $!");
if (flock(LOCK, LOCK_EX|LOCK_NB)){
close(LOCK);
unlink("$opt_dir/suspend");
return 0;
} else {
$logger->debug("Try to kill current download process...");
my $pid = ;
close(LOCK);
$logger->debug("Sending USR1 to $pid...");
if (kill("USR1", $pid)){
$logger->debug("Success.");
} else {
$logger->debug("Failed.");
}
return 0;
}
}
# Maybe a new package to download
} elsif ($_->{'TYPE'} eq 'PACK'){
$packages->{$_->{'ID'}} = {
'PACK_LOC' => $_->{'PACK_LOC'},
'INFO_LOC' => $_->{'INFO_LOC'},
#'ID' => $_->{'ID'},
'CERT_PATH' => $_->{'CERT_PATH'},
'CERT_FILE' => $_->{'CERT_FILE'},
'FORCE' => $_->{'FORCE'}
};
}
}
}
}
# We are now in download child
# Connect to server
if ($context->{network}) {
$ua = $context->{network}->{ua};
} else {
$logger->info("Cannot find network settings to make this module works properly...disabling module");
$self->{disabled} = 1;
}
# Check history file
unless(open HISTORY, "$opt_dir/history") {
flock(HISTORY, LOCK_EX);
unlink("$opt_dir/suspend");
$logger->error("Cannot read history file: $!");
return 1;
}
chomp(my @done = );
close(HISTORY);
# Package is maybe already handled
for (keys %$packages){
my $dir = $opt_dir."/".$_;
my $fileid = $_;
my $infofile = 'info';
my $location = $packages->{$_}->{'INFO_LOC'};
unless ($packages->{$_}->{'FORCE'} == 1) {
if($common->already_in_array($fileid, @done)){
$logger->info("Will not download $fileid. (already in history file)");
&download_message($fileid, $messages->{success_already_setup},$logger,$context);
next;
}
}
# Looking for packages status
unless(-d $dir){
$logger->debug("Making working directory for $fileid.");
mkdir($dir) or die("Cannot create $fileid directory: $!");
open FH, ">$dir/since" or die("Cannot create $fileid since file: $!");;
print FH time();
close(FH);
}
# Retrieve and writing info file if needed
unless(-f "$dir/$infofile"){
# Special value INSTALL_PATH
$packages->{$_}->{CERT_PATH} =~ s/INSTALL_PATH/$context->{installpath}/;
$packages->{$_}->{CERT_FILE} =~ s/INSTALL_PATH/$context->{installpath}/;
# Getting info file
if ($network->getFile("https","$location/$fileid","info","$dir/info")){
download_message($fileid, $self->{messages}->{err_download_info},$logger,$context);
$logger->error("Error download info file !!! Wrong URL or SSL certificate ?");
next;
}
}
}
unless(unlink("$opt_dir/suspend")){
$logger->error("Cannot delete suspend file: $!");
return 1;
}
return 0;
}
sub ssl_verify_callback {
my ($ok, $x509_store_ctx) = @_;
return $ok;
}
sub download_inventory_handler{ # Adding the ocs package ids to softwares
my ($self,$inventory) = @_;
my $context = $self->{context};
my $logger = $self->{logger};
$logger->debug("Calling download_inventory_handler");
my @history;
# Read download history file
if ( open PACKAGES, "$context->{installpath}/download/history" ){
flock(PACKAGES, LOCK_SH);
while(){
chomp( $_ );
push @history, { ID => $_ };
}
}
close(PACKAGES);
# Add it to inventory (will be handled by Download.pm server module
push @{ $inventory->{xmlroot}->{'CONTENT'}->{'DOWNLOAD'}->{'HISTORY'} },{
'PACKAGE'=> \@history
};
}
sub download_end_handler{ # Get global structure
my $self = shift;
my $context = $self->{context};
my $logger = $self->{logger};
my $common = $self->{common};
my $settings = $self->{settings};
my $messages = $self->{messages};
my $packages = $self->{packages};
$logger->debug("Calling download_end_handler");
my $dir = $context->{installpath}."/download";
my $pidfile = $dir."/lock";
return 0 unless -d $dir;
# We have jobs, we do it alone
my $fork = fork();
if ($fork>0){
return 0;
} elsif ($fork<0){
return 1;
} else {
$SIG{'USR1'} = sub {
print "Exiting on signal...\n";
&finish($logger, $context);
};
# Go into working directory
chdir($dir) or die("Cannot chdir to working directory...Abort\n");
}
# Maybe an other process is running
exit(0) if begin($pidfile,$logger);
# Retrieve the packages to download
opendir DIR, $dir or die("Cannot read working directory: $!");
my $end;
while(1){
# If agent is running, we wait
if (-e "suspend") {
$logger->debug('Found a suspend file... Will wait 10 seconds before retry');
sleep(10);
next;
}
$end = 1;
#TODO Uncomment this line #undef $packages;
# Reading configuration
open FH, "$dir/config" or die("Cannot read config file: $!");
if (flock(FH, LOCK_SH)){
$download_config = XMLin("$dir/config");
close(FH);
# If Frag latency is null, download is off
if ($download_config->{'ON'} eq '0'){
$logger->info("Option turned off. Exiting.");
finish($logger, $context);
}
} else {
$logger->error("Cannot read config file :-( . Exiting.");
close(FH);
finish($logger, $context);
}
# Retrieving packages to download and their priority
while (my $entry = readdir(DIR)){
next if $entry !~ /^\d+$/;
next unless(-d $entry);
# Clean package if info file does not still exist
unless(-e "$entry/info"){
$logger->debug("No info file found for $entry!!");
clean( $entry, $logger, $context, $messages, $packages );
next;
}
my $info = XML::Simple::XMLin( "$entry/info" ) or next;
# Check that fileid == directory name
if ($info->{'ID'} ne $entry){
$logger->debug("ID in info file does not correspond!!");
clean( $entry, $logger, $context, $messages, $packages );
download_message($entry, $messages->{err_bad_id},$logger,$context);
next;
}
# Manage package timeout
# Clean package if since timestamp is not present
unless(-e "$entry/since"){
$logger->debug("No since file found!!");
clean($entry, $logger, $context,$messages,$packages );
next;
} else {
my $time = time();
if (open SINCE, "$entry/since"){
my $since = ;
if ($since=~/\d+/){
if ((($time-$since)/86400) > $download_config->{TIMEOUT}){
$logger->error("Timeout Reached for $entry.");
clean($entry, $logger, $context,$messages,$packages );
&download_message($entry, $messages->{err_timeout},$logger,$context);
close(SINCE);
next;
} else {
$logger->debug("Checking timeout for $entry... OK");
}
} else {
$logger->error("Since data for $entry is incorrect.");
clean($entry, $logger, $context, $messages, $packages );
&download_message($entry, $messages->{err_timeout},$logger,$context);
close(SINCE);
next;
}
close(SINCE);
} else {
$logger->error("Cannot find since data for $entry.");
clean($entry, $logger, $context, $messages, $packages );
&download_message($entry, $messages->{err_timeout},$logger,$context);
next;
}
}
# Building task file if needed
unless( -f "$entry/task" and -f "$entry/task_done" ){
open FH, ">$entry/task" or die("Cannot create task file for $entry: $!");
my $i;
my $frags = $info->{'FRAGS'};
# There are no frags if there is only a command
if ($frags){
for ($i=1;$i<=$frags;$i++){
print FH "$entry-$i\n";
}
};
close FH;
# To be sure that task file is fully created
open FLAG, ">$entry/task_done" or die ("Cannot create task flag file for $entry: $!");
close(FLAG);
}
# Store info XML descriptions in package attributes
for (keys %$info){
$packages->{$entry}->{$_} = $info->{$_}
}
$end = 0;
}
# Rewind directory
rewinddir(DIR);
# Call packages scheduler
if ($end){
last;
} else {
period($packages,$logger,$context,$self->{messages},$settings);
}
}
$logger->info("No more package to download.");
finish($logger, $context);
}
# Schedule the packages
sub period{
my ($packages,$logger,$context,$messages,$settings) = @_ ;
my $period_lenght_default = $settings->{period_lenght_default} ;
my $frag_latency_default= $settings->{frag_latency_default} ;
my $cycle_latency_default= $settings->{cycle_latency_default} ;
my $period_latency_default= $settings->{period_latency_default} ;
my $i;
#Serching packages with the priority 0
for (keys %$packages) {
if ($packages->{$_}->{'PRI'} eq "0") {
push (@prior_pkgs,$_);
}
}
$logger->debug("New period. Nb of cycles: ".
(defined($download_config->{'PERIOD_LENGTH'})?$download_config->{'PERIOD_LENGTH'}:$period_lenght_default));
for ($i=1;$i<=( defined($download_config->{'PERIOD_LENGTH'})?$download_config->{'PERIOD_LENGTH'}:$period_lenght_default);$i++){
# Highest priority
if (@prior_pkgs){
$logger->debug("Managing ".scalar(@prior_pkgs)." package(s) with absolute priority.");
for (@prior_pkgs){
# If done file found, clean package
if (-e "$_/done"){
$logger->debug("done file found!!");
done($_,$logger,$context,$messages,$settings,$packages);
next;
}
download($_,$logger,$context,$messages,$settings,$packages);
$logger->debug("Now pausing for a fragment latency => ".(
defined($download_config->{'FRAG_LATENCY'})?$download_config->{'FRAG_LATENCY'}:$frag_latency_default)
." seconds");
sleep( defined($download_config->{'FRAG_LATENCY'})?$download_config->{'FRAG_LATENCY'}:$frag_latency_default );
}
next;
}
# Normal priority
for (keys %$packages){
# If done file found, clean package
if(-e "$_/done"){
$logger->debug("done file found!!");
done($_,$logger,$context,$messages,$settings,$packages);
next;
}
next if $i % $packages->{$_}->{'PRI'} != 0;
download($_,$logger,$context,$messages,$settings,$packages);
$logger->debug("Now pausing for a fragment latency => ".
(defined( $download_config->{'FRAG_LATENCY'} )?$download_config->{'FRAG_LATENCY'}:$frag_latency_default)
." seconds");
sleep(defined($download_config->{'FRAG_LATENCY'})?$download_config->{'FRAG_LATENCY'}:$frag_latency_default);
}
$logger->debug("Now pausing for a cycle latency => ".(
defined($download_config->{'CYCLE_LATENCY'})?$download_config->{'CYCLE_LATENCY'}:$cycle_latency_default)
." seconds");
sleep(defined($download_config->{'CYCLE_LATENCY'})?$download_config->{'CYCLE_LATENCY'}:$cycle_latency_default);
}
sleep($download_config->{'PERIOD_LATENCY'}?$download_config->{'PERIOD_LATENCY'}:$period_latency_default);
}
# Download a fragment of the specified package
sub download {
my ($id,$logger,$context,$messages,$settings,$packages) = @_;
my $error;
my $proto = $packages->{$id}->{'PROTO'};
my $location = $packages->{$id}->{'PACK_LOC'};
my $network = $context->{network};
# If we find a temp file, we know that the update of the task file has failed for any reason. So we retrieve it from this file
if (-e "$id/task.temp") {
unlink("$id/task.temp");
rename("$id/task.temp","$id/task") or return 1;
}
# Retrieve fragments already downloaded
unless(open TASK, "$id/task"){
$logger->error("Cannot open $id/task.");
return 1;
}
my @task = ;
# Done
if (!@task){
$logger->debug("Download of $id... Finished.");
close(TASK);
execute($id,$logger,$context,$messages,$settings,$packages);
return 0;
}
my $fragment = shift(@task);
$logger->debug("Downloading $fragment...");
# Using proxy if possible
my $res = $network->getFile(lc($proto),"$location/$id",$fragment,"$id/$fragment");
# Checking if connected
unless($res) {
#Success
$error = 0;
# Updating task file
rename(">$id/task", ">$id/task.temp");
open TASK, ">$id/task" or return 1;
print TASK @task;
close(TASK);
unlink(">$id/task.temp");
} else {
$error++;
if ($error > $settings->{max_error_count}){
$logger->error("Error : Max errors count reached");
finish($logger,$context);
}
return 1;
}
return 0;
}
# Assemble and handle downloaded package
sub execute{
my ($id,$logger,$context,$messages,$settings,$packages) = @_;
my $common = $context->{common};
my $tmp = $id."/tmp";
my $exit_code;
$logger->debug("Execute orders for package $id.");
if (build_package($id,$logger,$context,$messages,$packages)){
clean($id,$logger, $context,$messages,$packages);
return 1;
} else {
# First, we get in temp directory
unless( chdir($tmp) ){
$logger->error("Cannot chdir to working directory: $!");
download_message($id, $messages->{err_execute}, $logger,$context);
clean($id,$logger, $context,$messages,$packages);
return 1;
}
# Executing preorders (notify user, auto launch, etc....
# $id->{NOTIFY_USER}
# $id->{NOTIFY_TEXT}
# $id->{NOTIFY_COUNTDOWN}
# $id->{NOTIFY_CAN_ABORT}
# TODO: notification to send through DBUS to the user
eval{
# Execute instructions
if ($packages->{$id}->{'ACT'} eq 'LAUNCH'){
my $exe_line = $packages->{$id}->{'NAME'};
$packages->{$id}->{'NAME'} =~ s/^([^ -]+).*/$1/;
# Exec specified file (LAUNCH => NAME)
if (-e $packages->{$id}->{'NAME'}){
$logger->debug("Launching $packages->{$id}->{'NAME'}...");
chmod(0755, $packages->{$id}->{'NAME'}) or die("Cannot chmod: $!");
$exit_code = system( "./".$exe_line ) >> 8;
} else {
die();
}
} elsif ($packages->{$id}->{'ACT'} eq 'EXECUTE'){
# Exec specified command EXECUTE => COMMAND
$logger->debug("Execute $packages->{$id}->{'COMMAND'}...");
system( $packages->{$id}->{'COMMAND'} ) and die();
} elsif ($packages->{$id}->{'ACT'} eq 'STORE'){
# Store files in specified path STORE => PATH
$packages->{$id}->{'PATH'} =~ s/INSTALL_PATH/$context->{installpath}/;
# Build it if needed
my @dir = split('/', $packages->{$id}->{'PATH'});
my $dir;
for (@dir){
$dir .= "$_/";
unless(-e $dir){
mkdir($dir);
$logger->debug("Create $dir...");
}
}
$logger->debug("Storing package to $packages->{$id}->{'PATH'}...");
# Stefano Brandimarte => Stevenson!
system($common->get_path('cp')." -pr * ".$packages->{$id}->{'PATH'}) and die();
}
};
if ($@){
# Notify success to ocs server
download_message($id, $messages->{err_execute},$logger,$context);
chdir("../..") or die("Cannot go back to download directory: $!");
clean($id,$logger,$context,$messages,$packages);
return 1;
} else {
chdir("../..") or die("Cannot go back to download directory: $!");
done($id,$logger,$context,$messages,$settings,$packages,(defined($exit_code)?$exit_code:'_NONE_'));
return 0;
}
}
}
# Check package integrity
sub build_package{
my ($id,$logger,$context,$messages,$packages) = @_;
my $common = $context->{common};
my $count = $packages->{$id}->{'FRAGS'};
my $i;
my $tmp = "./$id/tmp";
unless(-d $tmp){
mkdir("$tmp");
}
# No job if no files
return 0 unless $count;
# Assemble package
$logger->info("Building package for $id.");
for ($i=1;$i<=$count;$i++){
if (-f "./$id/$id-$i"){
# We make a tmp working directory
if ($i==1){
open PACKAGE, ">$tmp/build.tar.gz" or return 1;
}
# We write each fragment in the final package
open FRAGMENT, "./$id/$id-$i" or return 1;
my $row;
while ($row = ){
print PACKAGE $row;
}
close(FRAGMENT);
} else {
return 1;
}
}
close(PACKAGE);
#
if (check_signature($packages->{$id}->{'DIGEST'}, "$tmp/build.tar.gz", $packages->{$id}->{'DIGEST_ALGO'}, $packages->{$id}->{'DIGEST_ENCODE'},$logger)){
download_message($id, $messages->{err_bad_digest},$logger,$context);
return 1;
}
if ( system( $common->get_path("tar")." -xvzf $tmp/build.tar.gz -C $tmp") ){
$logger->error("Cannot extract $id with tar, trying with unzip.");
if ( system( $common->get_path("unzip")." $tmp/build.tar.gz -d $tmp") ){
$logger->error("Cannot extract $id with unzip.");
download_message($id,$messages->{err_build},$logger,$context);
return 1;
}
}
$logger->debug("Building of $id... Success.");
unlink("$tmp/build.tar.gz") or die ("Cannot remove build file: $!\n");
return 0;
}
sub check_signature{
my ($checksum, $file, $digest, $encode,$logger) = @_;
$logger->info("Checking signature for $file.");
my $base64;
# Open file
unless(open FILE, $file){
$logger->error("cannot open $file: $!");
return 1;
}
binmode(FILE);
# Retrieving encoding form
if ($encode =~ /base64/i){
$base64 = 1;
$logger->debug('Digest format: Base 64');
} elsif ($encode =~ /hexa/i){
$logger->debug('Digest format: Hexadecimal');
} else {
$logger->debug('Digest format: Not supported');
return 1;
}
eval{
# Check it
if ($digest eq 'MD5'){
$logger->debug('Digest algo: MD5');
if ($base64){
die unless Digest::MD5->new->addfile(*FILE)->b64digest eq $checksum;
} else {
die unless Digest::MD5->new->addfile(*FILE)->hexdigest eq $checksum;
}
} elsif ($digest eq 'SHA1'){
$logger->debug('Digest algo: SHA1');
if ($base64){
die unless Digest::SHA1->new->addfile(*FILE)->b64digest eq $checksum;
} else {
die unless Digest::SHA1->new->addfile(*FILE)->hexdigest eq $checksum;
}
} else {
$logger->debug('Digest algo unknown: '.$digest);
die;
}
};
if ($@){
$logger->debug("Digest checking error !!");
close(FILE);
return 1;
} else {
close(FILE);
$logger->debug("Digest OK...");
return 0;
}
}
# Launch a download error to ocs server
sub download_message{
my ($id, $code,$logger,$context) = @_;
$logger->debug("Sending message for $id, code=$code.");
my $xml = {
'DEVICEID' => $context->{deviceid},
'QUERY' => 'DOWNLOAD',
'ID' => $id,
'ERR' => $code
};
# Generate xml
$xml = XMLout($xml, RootName => 'REQUEST');
# Compress data
$xml = Compress::Zlib::compress( $xml );
my $URI = $context->{servername};
# Send request
my $request = HTTP::Request->new(POST => $URI);
$request->header('Pragma' => 'no-cache', 'Content-type', 'application/x-compress');
$request->content($xml);
my $res = $ua->request($request);
# Checking result
if ($res->is_success) {
return 0;
}else{
return 1;
}
}
# At the beginning of end handler
sub begin{
my ($pidfile,$logger) = @_;
open LOCK_R, "$pidfile" or die("Cannot open pid file: $!");
if (flock(LOCK_R,LOCK_EX|LOCK_NB)){
open LOCK_W, ">$pidfile" or die("Cannot open pid file: $!");
select(LOCK_W) and $|=1;
select(STDOUT) and $|=1;
print LOCK_W $$;
$logger->info("Beginning work. I am $$.");
return 0;
} else {
close(LOCK_R);
$logger->error("$pidfile locked. Cannot begin work... :-(");
return 1;
}
}
sub done{
my ($id,$logger,$context,$messages,$settings,$packages,$suffix) = @_;
my $common = $context->{common};
my $frag_latency_default = $settings->{frag_latency_default};
$logger->debug("Package $id... Done. Sending message...");
# Trace installed package
open DONE, ">$id/done";
close(DONE);
# Read history file
open HISTORY,"$context->{installpath}/download/history" or warn("Cannot open history file: $!");
chomp(my @historyIds = );
close(HISTORY);
# Put it in history file
open HISTORY,">>$context->{installpath}/download/history" or warn("Cannot open history file: $!");
flock(HISTORY, LOCK_EX);
if ( $common->already_in_array($id, @historyIds) ){
$logger->debug("Warning: ID $id has been found in the history file (package was already deployed)");
} else {
$logger->debug("Writing $id reference in history file");
print HISTORY $id,"\n";
}
close(HISTORY);
# Notify success to ocs server
my $code;
if ($suffix ne '_NONE_'){
$code = $messages->{code_success}."_$suffix";
} else {
$code = $messages->{code_success};
}
unless(download_message($id, $code,$logger,$context)){
clean($id,$logger,$context,$messages,$packages);
} else {
sleep( defined($download_config->{'FRAG_LATENCY'})?$download_config->{'FRAG_LATENCY'}:$frag_latency_default );
}
return 0;
}
sub clean{
my ($id,$logger,$context,$messages,$packages) = @_;
$logger->info("Cleaning $id package.");
delete $packages->{$id};
#If the package is priority 0
if ((my $index) = grep { $prior_pkgs[$_] eq $id } 0..$#prior_pkgs){
delete $prior_pkgs[$index];
}
unless(File::Path::rmtree($id, 0)){
$logger->error("Cannot clean $id!! Abort...");
download_message($id, $messages->{err_clean},$logger,$context);
die();
}
return 0;
}
# At the end
sub finish{
my ($logger,$context) = @_;
open LOCK, '>'.$context->{installpath}.'/download/lock';
$logger->debug("End of work...\n");
exit(0);
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Example.pm 0000664 0000000 0000000 00000005260 13327377321 0023303 0 ustar 00root root 0000000 0000000 ###############################################################################
## OCSINVENTORY-NG
## Copyleft Guillaume PROTET 2010
## Web : http://www.ocsinventory-ng.org
##
## This code is open source and may be copied and modified as long as the source
## code is always made freely available.
## Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################
package Ocsinventory::Agent::Modules::Example;
sub new {
my $name="example"; #Set the name of your module here
my (undef,$context) = @_;
my $self = {};
#Create a special logger for the module
$self->{logger} = new Ocsinventory::Logger ({
config => $context->{config}
});
$self->{logger}->{header}="[$name]";
$self->{context}=$context;
$self->{structure}= {
name => $name,
start_handler => $name."_start_handler", #or undef if don't use this hook
prolog_writer => $name."_prolog_writer", #or undef if don't use this hook
prolog_reader => $name."_prolog_reader", #or undef if don't use this hook
inventory_handler => $name."_inventory_handler", #or undef if don't use this hook
end_handler => $name."_end_handler" #or undef if don't use this hook
};
bless $self;
}
######### Hook methods ############
sub example_start_handler { #Use this hook to test prerequisites needed by module and disble it if needed
my $self = shift;
my $logger = $self->{logger};
$logger->debug("Yeah you are in example_start_handler :)");
my $prerequisites = 1 ;
if ( $prerequisites == 0 ) {
$self->{disabled} = 1; #Use this to disable the module
$logger->debug("Humm my prerequisites are not OK...disabling module :( :( ");
}
}
sub example_prolog_writer { #Use this hook to add information the prolog XML
my $self = shift;
my $logger = $self->{logger};
$logger->debug("Yeah you are in example_prolog_writer :)");
}
sub example_prolog_reader { #Use this hook to read the answer from OCS server
my $self = shift;
my $logger = $self->{logger};
$logger->debug("Yeah you are in example_prolog_reader :)");
}
sub example_inventory_handler { #Use this hook to add or modify entries in the inventory XML
my $self = shift;
my $logger = $self->{logger};
$logger->debug("Yeah you are in example_inventory_handler :)");
}
sub example_end_handler { #Use this hook to add treatments before the end of agent launch
my $self = shift;
my $logger = $self->{logger};
$logger->debug("Yeah you are in example_end_handler :)");
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp.pm 0000664 0000000 0000000 00000100435 13327377321 0022625 0 ustar 00root root 0000000 0000000 ###############################################################################
## OCSINVENTORY-NG
## Copyleft Guillaume PROTET 2010
## Web : http://www.ocsinventory-ng.org
##
## This code is open source and may be copied and modified as long as the source
## code is always made freely available.
## Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################
package Ocsinventory::Agent::Modules::Snmp;
use strict;
no strict 'refs';
use warnings;
use XML::Simple;
use Digest::MD5;
# New lib for scanning
sub new {
my $name="snmp"; #Set the name of your module here
my (undef,$context) = @_;
my $self = {};
#Create a special logger for the module
$self->{logger} = new Ocsinventory::Logger ({
config => $context->{config}
});
$self->{logger}->{header}="[$name]";
$self->{common} = $context->{common};
$self->{context}=$context;
$self->{structure}= {
name => $name,
start_handler => $name."_start_handler",
prolog_writer => undef,
prolog_reader => $name."_prolog_reader",
inventory_handler => undef,
end_handler => $name."_end_handler",
};
$self->{number_scan}=0;
$self->{snmp_oid_run}=$name."_oid_run";
$self->{snmp_oid_xml}=$name."_oid_xml";
$self->{func_oid}={};
$self->{snmp_dir}=[];
$self->{snmp_vardir} = ["$self->{context}->{installpath}/snmp/mibs/local/","$self->{context}->{installpath}/snmp/mibs/remote/"];
my $spec_dir_snmp="Ocsinventory/Agent/Modules/Snmp/";
$self->{spec_dir_snmp}=$spec_dir_snmp;
$self->{spec_module_snmp}="Ocsinventory::Agent::Modules::Snmp::";
# We are going to search where is the directory Ocsinventory/Modules/snmp
foreach my $dir ( @INC ) {
my $res_dir=$dir."/".$spec_dir_snmp;
if ( -d $res_dir ) {
push(@{$self->{snmp_dir}},$res_dir);
}
}
# We create a xml for the snmp inventory that we will be sent to server
$self->{inventory}={};
bless $self;
}
sub snmp_start_handler {
my $self = shift;
my $logger = $self->{logger};
my $common = $self->{context}->{common};
my $config = $self->{context}->{config};
$logger->debug("Calling snmp_start_handler");
# Disabling module if local mode
if ($config->{stdout} || $config->{local}) {
$self->{disabled} = 1;
$logger->info("Agent is running in local mode...disabling module");
}
# If we cannot load prerequisite, we disable the module
unless ($common->can_load('Net::SNMP')) {
$self->{disabled} = 1;
$logger->error("Net::SNMP perl module is missing !!");
$logger->error("Humm my prerequisites are not OK...disabling module :( :(");
}
}
sub snmp_prolog_reader {
my ($self, $prolog) = @_;
my $logger = $self->{logger};
my $network = $self->{context}->{network};
my $snmp_vardir = $self->{snmp_vardir};
my $option;
$logger->debug("Calling snmp_prolog_reader");
$prolog = XML::Simple::XMLin( $prolog, ForceArray => ['OPTION', 'PARAM']);
for $option (@{$prolog->{OPTION}}){
if ( $option->{NAME} =~/snmp/i){
$self->{doscans} = 1 ;
for ( @{ $option->{PARAM} } ) {
if ($_->{'TYPE'} eq 'DEVICE'){
# Adding the IP in the devices array
push @{$self->{netdevices}},{
IPADDR => $_->{IPADDR},
MACADDR => $_->{MACADDR},
};
}
if ($_->{'TYPE'} eq 'COMMUNITY'){
# Adding the community in the communities array
push @{$self->{communities}},{
VERSION=>$_->{VERSION},
NAME=>$_->{NAME},
USERNAME=>$_->{USERNAME},
AUTHPROTO=>$_->{AUTHPROTO},
AUTHPASSWD=>$_->{AUTHPASSWD},
PRIVPROTO=>$_->{PRIVPROTO},
PRIVPASSWD=>$_->{PRIVPASSWD}
};
}
if ($_->{'TYPE'} eq 'NETWORK'){
push @{$self->{nets_to_scan}},$_->{SUBNET};
}
# Creating the directory for xml if they don't yet exist
mkdir($self->{context}->{installpath}."/snmp") unless -d $self->{context}->{installpath}."/snmp";
mkdir($self->{context}->{installpath}."/snmp/mibs") unless -d $self->{context}->{installpath}."/snmp/mibs";
foreach my $dir ( @{$snmp_vardir}) {
mkdir($dir) unless -d $dir;
}
}
}
}
}
sub snmp_end_handler {
my $self = shift;
my $logger = $self->{logger};
my $common = $self->{context}->{common};
my $network = $self->{context}->{network};
$logger->debug("Calling snmp_end_handler");
# If no order form server
return unless $self->{doscans};
# Flushing xmltags if it has not been done
$common->flushXMLTags();
# We get the config
my $config = $self->{context}->{config};
my $communities=$self->{communities};
if ( ! defined ($communities ) ) {
$logger->debug("We have no Community from server, we use default public community");
$communities=[{VERSION=>"2c",NAME=>"public"}];
}
my ($name,$comm,$error,$system_oid);
# sysName.0
my $snmp_sysname="1.3.6.1.2.1.1.5.0";
# sysDescr.0
my $snmp_sysdescr="1.3.6.1.2.1.1.1.0";
# sysLocation.0
my $snmp_syslocation="1.3.6.1.2.1.1.6.0";
# sysUpTime.0
my $snmp_sysuptime="1.3.6.1.2.1.1.3.0";
# sysObjectId.0
my $snmp_sysobjectid="1.3.6.1.2.1.1.2.0";
# syscontact.0
my $snmp_syscontact="1.3.6.1.2.1.1.4.0";
# ifPhysAddress.1
my $snmp_macaddr="1.3.6.1.2.1.2.2.1.6.";
my $snmp_ifdescr="1.3.6.1.2.1.2.2.1.2.";
my $snmp_iftype="1.3.6.1.2.1.2.2.1.3";
# Initalising the XML properties
my $snmp_inventory = $self->{inventory};
$snmp_inventory->{xmlroot}->{QUERY} = ['SNMP'];
$snmp_inventory->{xmlroot}->{DEVICEID} = [$self->{context}->{config}->{deviceid}];
# Scanning network
$logger->debug("Snmp: Scanning network");
my $nets_to_scan=$self->{nets_to_scan};
foreach my $net_to_scan ( @$nets_to_scan ){
$self->snmp_ip_scan($net_to_scan);
}
$logger->debug("Snmp: Ending Scanning network");
# Begin scanning ip tables
my $ip=$self->{netdevices};
foreach my $device ( @$ip ) {
my $session=undef;
my $full_oid=undef;
my $devicedata = $common->{xmltags}; #To fill the xml informations for this device
$logger->debug("Scanning $device->{IPADDR} device");
# Search for the good snmp community in the table community
LIST_SNMP: foreach $comm ( @$communities ) {
# Test if we use SNMP v3
if ( $comm->{VERSION} eq "3" ) {
($session, $error) = Net::SNMP->session(
-retries => 2 ,
-timeout => 3,
-version => 'snmpv'.$comm->{VERSION},
-hostname => $device->{IPADDR},
-translate => [-nosuchinstance => 0, -nosuchobject => 0],
-username => $comm->{USERNAME},
-authpassword => $comm->{AUTHPASSWD},
-authprotocol => $comm->{AUTHPROTO},
-privpassword => $comm->{PRIVPASSWD},
-privprotocol => $comm->{PRIVPROTO},
);
# For a use in constructor module (Cisco)
$self->{username}=$comm->{USERNAME};
$self->{authpassword}=$comm->{AUTHPASSWD};
$self->{authprotocol}=$comm->{AUTHPROTO};
$self->{privpassword}=$comm->{PRIVPASSWD};
$self->{privprotocol}= $comm->{PRIVPROTO};
} else {
# We have an older version v2c ou v1
($session, $error) = Net::SNMP->session(
-retries => 1 ,
-timeout => 3,
-version => 'snmpv'.$comm->{VERSION},
-hostname => $device->{IPADDR},
-community => $comm->{NAME},
-translate => [-nosuchinstance => 0, -nosuchobject => 0],
);
};
unless (defined($session)) {
$logger->error("Snmp ERROR: $error");
} else {
$self->{snmp_session}=$session;
# For a use in constructor module (Cisco)
$self->{snmp_community}=$comm->{NAME};
$self->{snmp_version}=$comm->{VERSION};
$full_oid=$session->get_request( -varbindlist => [$snmp_sysobjectid] );
last LIST_SNMP if ( defined $full_oid);
$session->close;
$self->{snmp_session}=undef;
}
}
if ( defined $full_oid ) {
$full_oid=$full_oid->{$snmp_sysobjectid};
$session->max_msg_size(8192);
# We have found the good Community, we can scan this equipment
my ($constr_oid,$device_name,$description,$location,$contact,$uptime,$domain,$macaddr);
# We indicate that we scan a new equipment
$self->{number_scan}++;
my $result;
$result=$session->get_request( -varbindlist => [$snmp_sysname]);
if ( defined ( $result->{$snmp_sysname} ) && length($result->{$snmp_sysname}) > 0 ) {
$device_name=$result->{$snmp_sysname};
} else {
$device_name="Not Defined";
}
$result=$session->get_request(-varbindlist => [$snmp_sysobjectid]);
$full_oid=$result->{$snmp_sysobjectid};
$result=$session->get_request(-varbindlist => [$snmp_sysdescr]);
$description=$result->{$snmp_sysdescr};
$result=$session->get_request(-varbindlist => [$snmp_syslocation]);
$location=$result->{$snmp_syslocation};
$result=$session->get_request(-varbindlist => [$snmp_sysuptime]);
$uptime=$result->{$snmp_sysuptime};
$result=$session->get_request(-varbindlist => [$snmp_syscontact]);
$contact=$result->{$snmp_syscontact};
####################
# finding MACADDRESS for checksum
####################
my $index=$snmp_iftype;
$result=$session->get_next_request(-varbindlist => [$index]);
$macaddr=undef;
my $ref_iftype=3;
# We scan the kinod of connexion, if it is a ethernet, we can use this mac address
# If we have a ref_iftype > 3 then we have no eth (type 6)
while ( ! defined($macaddr) && defined( $result) && $ref_iftype == 3 ) {
foreach $index ( keys %{$result} ) {
if ( $index =~ /1\.3\.6\.1\.2\.1\.2\.2\.1\.(\S+)\.(\S+)/ ) {
$ref_iftype=$1;
my $ref_mac=$2;
if ( $result->{$index} == 6 ) {
my $res_mac=$session->get_request(-varbindlist => [$snmp_macaddr.$ref_mac]);
if ( defined ($res_mac ) && defined ($res_mac->{$snmp_macaddr.$ref_mac}) && $res_mac->{$snmp_macaddr.$ref_mac} ne '' ) {
$macaddr=" ".$res_mac->{$snmp_macaddr.$ref_mac};
} else {
$result=$session->get_next_request(-varbindlist => [$index]);
}
} else {
$result=$session->get_next_request(-varbindlist => [$index]);
}
} else {
$result=undef;
}
}
}
if ( defined($macaddr) && $macaddr =~ /^ 0x(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})$/ ) {
$macaddr="$1:$2:$3:$4:$5:$6";
} elsif ( ! defined($macaddr) || $macaddr eq "endOfMibView" ) {
if (defined ( $device->{MACADDR} ) ) {
$macaddr = $device->{MACADDR};
} else {
$macaddr=$device_name;
# $macaddr=$device->{IPADDR}."_".$device_name;
}
}
if ( defined ($macaddr) ) {
if ( $full_oid =~ /1\.3\.6\.1\.4\.1\.(\d+)/ ) {
$system_oid=$1;
}
# Create SnmpDeviceID
my $md5 = Digest::MD5->new;
$md5->add($macaddr, $system_oid);
my $snmpdeviceid = $md5->hexdigest;
# Adding standard informations
$common->setSnmpCommons({
IPADDR => $device->{IPADDR},
MACADDR => $macaddr,
SNMPDEVICEID => $snmpdeviceid,
NAME => $device_name,
DESCRIPTION => $description,
CONTACT => $contact,
LOCATION => $location,
UPTIME => $uptime,
WORKGROUP => $domain,
});
# We run the special treatments for the OID vendor
if ( $self->{snmp_oid_run}($self,$system_oid) == 1 ) {
# We have no vendor oid for this equipment (run or xml)
# we use default.pm
$self->{snmp_oid_run}($self,"Default");
}
# Add all the informations in the xml for this device
push @{$snmp_inventory->{xmlroot}->{CONTENT}->{DEVICE}},$devicedata;
}
} else {
$logger->debug("Failure in scanning Device $device->{IPADDR}: no snmp communication");
}
# We have finished with this equipment
if (defined $session) {
$session->close;
}
$self->{snmp_session}=undef;
# We clear the xml data for this device
$common->flushXMLTags();
}
$logger->info("No more SNMP device to scan");
# Formatting the XML and sendig it to the server
my $content = XMLout( $snmp_inventory->{xmlroot}, RootName => 'REQUEST' , XMLDecl => '', SuppressEmpty => undef );
#Cleaning XML to delete unprintable characters
my $clean_content = $common->cleanXml($content);
$network->sendXML({message => $clean_content});
$logger->debug("End snmp_end_handler :)");
}
#########################################################
# #
# function for scanning range of ip and determining if #
# there is an equipment for snmp scan #
# Parameters: #
# (self) #
# net_to_scan indicate the subnet to scan #
# #
#########################################################
sub snmp_ip_scan {
my ($self,$net_to_scan) = @_;
my $logger=$self->{logger};
my $common=$self->{common};
if ($common->can_load('Net::Netmask') ) {
my $block=Net::Netmask->new($net_to_scan);
my $size=$block->size()-2;
my $index=1;
if ( $common->can_run('nmap') && $common->can_load('Nmap::Parser') ) {
$logger->debug("Scannig $net_to_scan with nmap");
my $nmaparser = Nmap::Parser->new;
$nmaparser->parsescan("nmap","-sP",$net_to_scan);
for my $host ($nmaparser->all_hosts("up")) {
my $res=$host->addr;
$logger->debug("Found $res");
push( @{$self->{netdevices}},{ IPADDR=>$res }) unless $self->search_netdevice($res);
}
} elsif ($common->can_load('Net::Ping')) {
$logger->debug("Scanning $net_to_scan with ping");
my $ping=Net::Ping->new("icmp",1);
while ($index <= $size) {
my $res=$block->nth($index);
if ($ping->ping($res)) {
$logger->debug("Found $res");
push( @{$self->{netdevices}},{ IPADDR=>$res }) unless $self->search_netdevice($res);
}
$index++;
}
$ping->close();
} else {
$logger->debug("No scan possible");
}
} else {
$logger->debug("Net::Netmask not present: no scan possible");
}
}
#########################################################
# #
# function for executing sub perl with the oid #
# Parameters: #
# (self) #
# system oid for execute the .pm associated #
# #
#########################################################
sub snmp_oid_run {
my ($self,$system_oid)=@_;
my $logger=$self->{logger};
my $session=$self->{snmp_session};
my $spec_module_snmp=$self->{spec_module_snmp};
my $return_pm=0;
unless ( defined ( $self->{func_oid}{$system_oid} )) {
my $spec_dir_snmp=$self->{spec_dir_snmp};
# We init the default value
$self->{func_oid}{$system_oid}={};
$self->{func_oid}{$system_oid}{active}=0;
$self->{func_oid}{$system_oid}{oid_value}="1.3.6.1.2.1.1.2.0";
$self->{func_oid}{$system_oid}{oid_name}="Undefined";
# Can we find it in the snmp directory
foreach my $dir ( @{$self->{snmp_dir}} ) {
if ( -r $dir.$system_oid.".pm" ) {
# We find the module
my $module_found=$spec_module_snmp.$system_oid;
eval "use $module_found";
if ($@) {
$logger->debug ("Failed to load $module_found: $@");
} else {
# We have execute it. We can get the function pointer on snmp_run
my $package=$module_found."::";
$self->{func_oid}{$system_oid}{snmp_run}=$package->{'snmp_run'};
if ( defined ( $package->{'snmp_info'} ) ) {
my $return_info=&{$package->{'snmp_info'}};
if ( defined $return_info->{oid_value} ) {
$self->{func_oid}{$system_oid}{oid_value}=$return_info->{oid_value};
}
if ( defined $return_info->{oid_name} ) {
$self->{func_oid}{$system_oid}{oid_name}=$return_info->{oid_name};
}
}
$self->{func_oid}{$system_oid}{active}=1;
$self->{func_oid}{$system_oid}{last_exec}=0;
}
}
}
}
if ( $self->{func_oid}{$system_oid}{active} == 1 && $self->{func_oid}{$system_oid}{last_exec} < $self->{number_scan} )
{ # we test that this function as never been executed for this equipment
# We test first that this OID exist for this equipment
my $oid_scan=$self->{func_oid}{$system_oid}{oid_value};
my $result=$session->get_request(-varbindlist => [ $oid_scan ] );
# We indicate that this equipment is the last scanned
$self->{func_oid}{$system_oid}{last_exec}=$self->{number_scan};
if (defined ($result) && length ($result->{$oid_scan}) != 0 ){
# This OID exist, we can execute it
$logger->debug("Launching $system_oid\n");
&{$self->{func_oid}{$system_oid}{snmp_run}}($session,$self);
} else {
$return_pm=1;
}
}
my $return_xml=snmp_oid_xml($self,$system_oid);
if ( $return_pm == 1 ) {
return(1);
}
return($return_xml);
}
#########################################################
# #
# function for executing sub xml with the oid #
# Parameters: #
# (self) #
# system oid for execute the .xml associated #
# #
# $xml_oid->{system_oid} Ref the oid in the xml #
# {active} 0 Ko 1 OK #
# {xml_data} info get in xml file #
# {last_exec} num for verify that #
# this equipment is already scaned with this xml or no #
#########################################################
sub snmp_oid_xml {
my ($self,$system_oid)=@_;
my $logger=$self->{logger};
my $spec_module_snmp=$self->{spec_module_snmp};
my $snmp_vardir = $self->{snmp_vardir};
if ( ! defined ( $self->{xml_oid}{$system_oid} )) {
# We init the default value
$self->{xml_oid}{$system_oid}={};
$self->{xml_oid}{$system_oid}{active}=0;
# Can we find it in the snmp directory
foreach my $dir ( @{$self->{snmp_vardir}} ) {
# Can we find it in the snmp var directory
if ( $self->{xml_oid}{$system_oid}{active} == 0 ) {
if ( -r $dir.$system_oid.".xml" ) {
# We find the xml
# my $module_found=$spec_module_snmp.$system_oid;
# eval "use $module_found";
if ( $self->{xml_oid}{$system_oid}{xml_data}=XML::Simple::XMLin($dir.$system_oid.".xml",ForceArray => 1 ) ) {
# We have load the xml
$logger->debug("Load module xml $system_oid");
$self->{xml_oid}{$system_oid}{active}=1;
$self->{xml_oid}{$system_oid}{last_exec}=0;
if ( defined( $self->{xml_oid}{$system_oid}{PARAMETERS}[0]{NAME}[0] ) ) {
$self->{xml_oid}{$system_oid}{oid_name}=$self->{xml_oid}{$system_oid}{PARAMETERS}[0]{NAME}[0];
}
} else {
$logger->debug ("Failed to load xml $system_oid: $@");
$self->{xml_oid}{$system_oid}{active} = 0;
}
}
}
}
}
# now we have an information for the xml associated with this oid
# It can be active or no
if ( $self->{xml_oid}{$system_oid}{active} == 1 && $self->{xml_oid}{$system_oid}{last_exec} < $self->{number_scan} ) {
$logger->debug ("Begin xml on $system_oid");
$self->{xml_oid}{$system_oid}{last_exec}=$self->{number_scan};
# We have done other scan so we can now execute own scan
# We have actually only v1, we can have after other parallel version
if ( xml_scan_v1($self,$system_oid,$self->{xml_oid}{$system_oid}{xml_data}) == 1 ) {
$self->{xml_oid}{$system_oid}{active}=0;
return 1;
}
return 0;
}
return 1;
}
#########################################################
# #
# function for executing xml scan v1 #
# Parameters: #
# (self) #
# system oid #
# xml in input #
# #
#########################################################
sub xml_scan_v1 {
my ($self,$system_oid,$xml)=@_;
my $xmltags=$self->{context}->{common}->{xmltags};
my $logger=$self->{logger};
return 1 if ( xml_parameters_v1($self,$system_oid,$xml) == 1 ) ;
if ( ! defined ($xmltags) ) {
$xmltags={};
}
$logger->debug("Begin scanning v1 on $system_oid");
my $filters=[];
if ( defined ($xml->{LOOPS}) ) {
return 1 if ( xml_loops_v1($self,$xml->{LOOPS},$xmltags,$filters) == 1 );
}
if ( defined ($xml->{DATA}) ) {
return 1 if ( xml_data_v1($self,$xml->{DATA}[0],$xmltags,$filters,0) == 1 );
}
return 0;
}
#########################################################
# #
# function for parameters of xml v1 #
# Parameters: #
# (self) #
# system oid #
# xml in input #
# #
#########################################################
sub xml_parameters_v1 {
my ($self,$system_oid,$xml)=@_;
my $logger=$self->{logger};
$logger->debug("Validating xml parameters");
return 1 if ( ! defined($xml->{PARAMETERS}) ) ;
return 0 if ( ! defined($xml->{PARAMETERS}[0]{EXECUTE}) ) ;
# We first look if there is other scan to do
$logger->debug("Begin looking other scan");
foreach my $type_exec ( "RUN","XML" ) {
if ( defined( $xml->{PARAMETERS}[0]{EXECUTE}[0]{$type_exec}) ) {
my $liste_exec=$xml->{PARAMETERS}[0]{EXECUTE}[0]{$type_exec};
my $lower_type_exec=lc($type_exec);
foreach my $exec_perl ( @{$liste_exec} ) {
my $a_exec="snmp_oid_".$lower_type_exec;
$self->{$a_exec}($self,$exec_perl);
}
}
}
return 0;
}
#########################################################
# #
# function for reading for a loops #
# Parameters: #
# (self) #
# xml_loops (contain VALUE/INDEX/FILTER #
# and a sub DATA #
# result_table: pointer on where we #
# put result information #
# #
# Return: 1 Pb #
# 0 OK #
#########################################################
sub xml_loops_v1 {
my ($self,$xml_loops,$result_table,$filters)=@_;
my $session=$self->{snmp_session};
my $logger=$self->{logger};
ALL_LOOPS: foreach my $uniq_loops ( @{$xml_loops} ) {
if ( ! defined ($uniq_loops->{VALUE}) || ! defined($uniq_loops->{INDEX})|| ! defined($uniq_loops->{NAME_INDEX}) ) {
$logger->debug("Error in xml File: VALUE, INDEX or NAME_INDEX not defined");
return 1 ;
}
# We now replace already existent filters
my $data_value=$uniq_loops->{VALUE}[0];
my $index_value=$uniq_loops->{INDEX}[0];
foreach my $filter ( @{$filters} ) {
$data_value=~s/$filter->{NAME}/$filter->{VALUE}/g;
$index_value=~s/$filter->{NAME}/$filter->{VALUE}/g;
}
my $index_equipement=$session->get_entries(-columns => [ $data_value ] );
# If we have no data for this index it s not a problem in the xml
next ALL_LOOPS if ( ! defined ( $index_equipement ) ) ;
# We first verify if there is a filter on this value
# in this case, we must filter the topic if this filter is not OK
my $nbr_data=0;
foreach my $uniq_index_equipement ( keys %{$index_equipement} ) {
if ( defined ($uniq_loops->{FILTER}) && ! $index_equipement->{$uniq_index_equipement} =~ /$uniq_loops->{FILTER}[0]/ ) {
delete $index_equipement->{$uniq_index_equipement};
# The Filter is OK, we can looks sub tables for this INDEX
} elsif ( $uniq_index_equipement =~ /$index_value/ ) {
# we use the index on the value for finding what are the INDEX values
push(@{$filters},{VALUE=>$1,NAME=>$uniq_loops->{NAME_INDEX}[0]});
return 1 if ( xml_data_v1($self,$uniq_loops->{DATA}[0],$result_table,$filters,$nbr_data++) == 1);
# After use this filter, we must take it out
# so it can be used for other loops
pop(@{$filters});
}
}
}
return 0;
}
#########################################################
# #
# function for reading for a table #
# Parameters: #
# (self) #
# xml_line (containt SET/VALUE/FILTER #
# or a sub DATA #
# value_IDX for subtitution in the information #
# result_table: pointer on the table where we #
# put result information #
# #
# Return: 1 Pb #
# 0 OK #
#########################################################
sub xml_data_v1 {
my ($self,$xml_table,$result_table,$filters,$pos_table)=@_;
my $logger=$self->{logger};
foreach my $table ( keys %{$xml_table} ) {
if ( $table eq "DATA" ) {
foreach my $subtable ( @{$xml_table->{DATA}} ) {
if ( !defined $result_table->{$subtable}[0] ) {
$result_table->{$subtable}[0]={};
}
return 1 if ( xml_data_v1($self,$xml_table->{$subtable},$filters,$result_table->[0]{$subtable}[0],0) == 1);
}
} elsif ( $table eq "LOOPS" ) {
return 1 if ( xml_loops_v1($self,$xml_table->{LOOPS},$xml_table,$filters) == 1 );
} else {
# we look for all lines in this table
foreach my $line ( keys %{$xml_table->{$table}[0]} ) {
if ( $line eq "LOOPS" ) {
if ( ! defined ($result_table->{$table}[$pos_table]) ) {
$result_table->{$table}[$pos_table]={};
}
return 1 if ( xml_loops_v1($self,$xml_table->{$table}[0]{LOOPS},$result_table->{$table}[$pos_table],$filters) == 1 );
} else {
my $result=xml_line_v1($self,$xml_table->{$table}[0]{$line}[0],$filters);
if ( defined ($result) ) {
$result_table->{$table}[$pos_table]{$line}[0]=$result;
}
}
}
}
}
return 0;
}
#########################################################
# #
# function for reading for a uniq line in a table #
# Parameters: #
# (self) #
# xml_line (containt SET/VALUE/FILTER #
# value_IDX for subtitution in the information #
# #
# Return: undef if no line correct #
# the string for this line in others cases #
#########################################################
sub xml_line_v1 {
my ($self,$xml_line,$filters)=@_;
my $session=$self->{snmp_session};
return undef if ( ! defined ($xml_line) ) ;
# We have a SET or a VALUE and an optional FILTER
if ( defined ( $xml_line->{SET} ) ) {
return($xml_line->{SET}[0]);
}
return undef if ( ! defined ( $xml_line->{VALUE} ) ) ;
my $data_value=$xml_line->{VALUE}[0];
# If we have a loop, we must substitute the VLAUE
foreach my $filter ( @{$filters} ) {
$data_value=~s/$filter->{NAME}/$filter->{VALUE}/g;
}
# We look for information in the equipment with the snmp interogation
my $info_equipment=$session->get_request(-varbindlist => [$data_value]);
# We verify that information has been returned for this value
return undef if ( ! defined ($info_equipment) ) ;
$info_equipment=$info_equipment->{$data_value};
# Verify that we have data
return undef if ( ! defined ($info_equipment) || $info_equipment eq "" );
# If there is a fliter, we verifiy that this line pass the filter
return undef if ( defined ($xml_line->{FILTER}) && ! ($info_equipment =~ /$xml_line->{FILTER}[0]/ )) ;
# Remplacement
return $info_equipment if ( ! defined ($xml_line->{REPLACE}) );
foreach my $replace ( @{$xml_line->{REPLACE}} ) {
return undef if ( ! defined( $replace->{STRING}) || ! defined ($replace->{BY}) );
$info_equipment=~s/$replace->{STRING}[0]/$replace->{BY}[0]/g;
}
return $info_equipment;
}
#########################################################
# #
# function to search an IP address in netdevices array #
# Parameters: #
# (self) #
# IP address to search #
# #
# Return: 1 if IP address was found #
# nothing in other case #
#########################################################
sub search_netdevice {
my ($self,$ip)= @_ ;
for (@{$self->{netdevices}}) {
if ($ip =~ /^$_->{IPADDR}$/) {
return 1;
}
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/ 0000775 0000000 0000000 00000000000 13327377321 0022264 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/11.pm 0000664 0000000 0000000 00000000711 13327377321 0023042 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID:11 SYSTEM:HP
###
package Ocsinventory::Agent::Modules::Snmp::11;
use strict;
no strict 'refs';
use warnings;
sub snmp_run {
my ($session,$snmp) = @_;
my $common = $snmp->{common};
my $logger=$snmp->{logger};
my $list_mib=["If_Mib","Host_Resources_Mib", "Printer_Mib","Entity_Mib"];
$logger->debug("Running HP (11) MIB module");
foreach my $mib ( @{$list_mib} ) {
$snmp->snmp_oid_run($mib);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/231.pm 0000664 0000000 0000000 00000000672 13327377321 0023134 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID:231 SYSTEM:Fujistu
###
package Ocsinventory::Agent::Modules::Snmp::231;
use strict;
no strict 'refs';
use warnings;
sub snmp_run {
my ($session,$snmp) = @_;
my $common = $snmp->{common};
my $logger=$snmp->{logger};
my $list_mib=["If_Mib","Host_Resources_Mib"];
$logger->debug("Running Fujitsu (231) MIB module");
foreach my $mib ( @{$list_mib} ) {
$snmp->snmp_oid_run($mib);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/2620.pm 0000664 0000000 0000000 00000000742 13327377321 0023216 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID:2620 SYSTEM:Checkpoint
###
package Ocsinventory::Agent::Modules::Snmp::2620;
use strict;
no strict 'refs';
use warnings;
sub snmp_info {
return ( { oid_value => "1.3.6.1.4.1.2620.1.1.1.0", oid_name => "Checkpoint Mib" } );
}
sub snmp_run() {
my ($session,$snmp) = @_;
my $common = $snmp->{common};
my $logger=$snmp->{logger};
$logger->debug("Running Chekpoint (2620) MIB module");
$common->setSnmpCommons( {TYPE => "Firewall"} );
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/311.pm 0000664 0000000 0000000 00000001342 13327377321 0023126 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID:311 SYSTEM:Microsoft
###
package Ocsinventory::Agent::Modules::Snmp::311;
use strict;
no strict 'refs';
use warnings;
sub snmp_info {
return ( { oid_value => "1.3.6.1.4.1.77.1.2.1.0" , oid_name => "Microsoft" } );
}
sub snmp_run {
my ($session , $snmp )= @_;
my $oid_run=$snmp->{snmp_oid_run};
my $common = $snmp->{common};
my $inventory = $snmp->{inventory};
my $logger=$snmp->{logger};
$common->setSnmpCommons( {TYPE => "Microsoft"} );
$common->setSnmpComputer({SYSTEM => 'Microsoft'});
my $list_mib=["If_Mib", "Host_Resources_Mib"];
$logger->debug("Running Microsoft (311) MIB module");
foreach my $mib ( @{$list_mib} ) {
$snmp->snmp_oid_run($mib);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/3224.pm 0000664 0000000 0000000 00000001120 13327377321 0023206 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID:3224 SYSTEM:Juniper
###
package Ocsinventory::Agent::Modules::Snmp::3224;
use strict;
no strict 'refs';
use warnings;
sub snmp_info {
return ( { oid_value => "1.3.6.1.4.1.3224.5.1.0", oid_name => "Juniper Mib" } );
}
sub snmp_run() {
my ($session,$snmp) = @_;
my $common = $snmp->{common};
my $logger=$snmp->{logger};
$logger->debug("Running Juniper (3224) MIB module");
$common->setSnmpCommons( {TYPE => "Firewall"} );
my $list_mib=["If_Mib"];
foreach my $mib ( @{$list_mib} ) {
$snmp->snmp_oid_run($mib);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/3375.pm 0000664 0000000 0000000 00000004415 13327377321 0023227 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID:3375 SYSTEM:F5
###
package Ocsinventory::Agent::Modules::Snmp::3375;
use strict;
no strict 'refs';
use warnings;
sub snmp_info {
return ( { oid_value => "1.3.6.1.4.1.3375.2.1.1.1.1.1.0", oid_name => "F5 Mib" } );
}
sub snmp_run() {
my ($session,$snmp) = @_;
my $common = $snmp->{common};
my $logger=$snmp->{logger};
$logger->debug("Running F5 (3375) MIB module");
$common->setSnmpCommons( {TYPE => "Load Balanceur"} );
my $list_mib=["If_Mib"];
foreach my $mib ( @{$list_mib} ) {
$snmp->snmp_oid_run($mib);
}
my $snmp_sysProductName="1.3.6.1.4.1.3375.2.1.4.1.0";
my $snmp_sysProductVersion="1.3.6.1.4.1.3375.2.1.4.2.0";
my $snmp_sysProductBuild="1.3.6.1.4.1.3375.2.1.4.3.0";
my $snmp_sysProductDate="1.3.6.1.4.1.3375.2.1.4.5.0";
my $snmp_sysGeneralHwNumber="1.3.6.1.4.1.3375.2.1.3.3.2.0";
my $snmp_sysGeneralChassisSerialNum="1.3.6.1.4.1.3375.2.1.3.3.3.0";
my $NAME=$session->get_request ( -varbindlist => [ $snmp_sysProductName ] );
if ( defined ( $NAME ) ) {
$NAME=$NAME->{$snmp_sysProductName};
}
my $VERSION=$session->get_request ( -varbindlist => [ $snmp_sysProductVersion] );
if ( defined ( $VERSION ) ) {
$VERSION=$VERSION->{$snmp_sysProductVersion};
}
my $COMMENT=$session->get_request ( -varbindlist => [ $snmp_sysProductBuild] );
if ( defined ( $COMMENT ) ) {
$COMMENT=$COMMENT->{$snmp_sysProductBuild};
}
my $DATE=$session->get_request ( -varbindlist => [ $snmp_sysProductDate ] );
if ( defined ( $DATE ) ) {
$DATE=$DATE->{$snmp_sysProductDate};
}
$common->addSoftware( { NAME => $NAME ,
VERSION => $VERSION ,
INSTALLDATE => $DATE ,
COMMENT => $COMMENT,
});
my $TYPE=$session->get_request ( -varbindlist => [ $snmp_sysGeneralHwNumber ] ) ;
if ( defined ( $TYPE ) ) {
$TYPE=$TYPE->{$snmp_sysGeneralHwNumber};
}
my $SERIALNUMBER=$session->get_request ( -varbindlist => [ $snmp_sysGeneralChassisSerialNum ] ) ;
if ( defined ( $SERIALNUMBER ) ) {
$SERIALNUMBER=$SERIALNUMBER->{$snmp_sysGeneralChassisSerialNum};
}
$common->setSnmpLoadBalancer({
SERIALNUMBER => $SERIALNUMBER ,
TYPE => $TYPE ,
MANUFACTURER => "F5" ,
});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/42.pm 0000664 0000000 0000000 00000000644 13327377321 0023053 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID:42 SYSTEM:Sun
###
package Ocsinventory::Agent::Modules::Snmp::42;
use strict;
no strict 'refs';
use warnings;
sub snmp_run() {
my ($session,$snmp) = @_;
my $common = $snmp->{common};
my $logger=$snmp->{logger};
$logger->debug("Running Sun (42) MIB module");
$common->setSnmpCommons( {TYPE => "Sun"} );
$common->setSnmpComputer({SYSTEM => 'Sun'});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/641.pm 0000664 0000000 0000000 00000000711 13327377321 0023133 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID:641 SYSTEM:Lexmark
###
package Ocsinventory::Agent::Modules::Snmp::641;
use strict;
no strict 'refs';
use warnings;
sub snmp_run {
my ($session,$snmp) = @_;
my $common = $snmp->{common};
my $logger=$snmp->{logger};
my $list_mib=["If_Mib","Host_Resources_Mib", "Printer_Mib"];
$logger->debug("Running Lexmark (641) MIB module");
foreach my $mib ( @{$list_mib} ) {
$snmp->snmp_oid_run($mib);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/7244.pm 0000664 0000000 0000000 00000000726 13327377321 0023227 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID:7244 SYSTEM:Fujitsu
###
package Ocsinventory::Agent::Modules::Snmp::7244;
use strict;
no strict 'refs';
use warnings;
sub snmp_info {
return ( { oid_value => "1.3.6.1.4.1.7244.1.1.1.1.1.0", oid_name => "Fujitsu" } );
}
sub snmp_run() {
my ($session,$snmp) = @_;
my $common = $snmp->{common};
my $logger=$snmp->{logger};
$logger->debug("Running Fujitsu (7244) MIB module");
$common->setSnmpCommons( {TYPE => "Blade"} );
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/789.pm 0000664 0000000 0000000 00000005620 13327377321 0023154 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID:789 SYSTEM:NetApp
###
package Ocsinventory::Agent::Modules::Snmp::789;
use strict;
no strict 'refs';
use warnings;
sub snmp_run() {
my ($session,$snmp) = @_;
my $common = $snmp->{common};
my $logger=$snmp->{logger};
$logger->debug("Running NetApp (789) MIB module");
$common->setSnmpCommons( {TYPE => "Storage"} );
my $list_mib=["If_Mib"];
foreach my $mib ( @{$list_mib} ) {
$snmp->snmp_oid_run($mib);
}
my $snmp_sysProductName="1.3.6.1.4.1.789.1.1.5.0";
my $snmp_sysProductVersion="1.3.6.1.4.1.789.1.1.2.0";
my $snmp_sysProductBuild="1.3.6.1.4.1.789.1.1.3.0";
my $snmp_volumetable="1.3.6.1.4.1.789.1.5.4.1.2";
my $snmp_storageSize="1.3.6.1.4.1.789.1.5.4.1.29.";
my $snmp_storageUsed="1.3.6.1.4.1.789.1.5.4.1.30.";
my $name=$session->get_request ( -varbindlist => [ $snmp_sysProductName ] );
if ( defined ( $name ) ) {
$name=$name->{$snmp_sysProductName};
}
my $version=$session->get_request ( -varbindlist => [ $snmp_sysProductVersion] );
if ( defined ( $version ) ) {
$version=$version->{$snmp_sysProductVersion};
}
my $comment=$session->get_request ( -varbindlist => [ $snmp_sysProductBuild] );
if ( defined ( $comment ) ) {
$comment=$comment->{$snmp_sysProductBuild};
}
$common->addSoftware( { NAME => $name ,
VERSION => $version ,
COMMENT => $comment,
});
my $result;
my $result_table;
my $ref;
# We look for volumes
$result_table=$session->get_entries(-columns => [ $snmp_volumetable ]);
foreach my $result ( keys %{$result_table} ) {
if ( $result =~ /1\.3\.6\.1\.4\.1\.789\.1\.5\.4\.1\.2\.(\S+)/ ) {
$ref=$1;
# Definition Var for disks
my $FREE="";
my $FILESYSTEM="";
my $TOTAL="";
$TOTAL=$session->get_request(-varbindlist => [ $snmp_storageSize.$ref ]);
if ( defined ( $TOTAL ) ) {
$TOTAL=$TOTAL->{$snmp_storageSize.$ref};
}
#print $TOTAL, " ";
$FREE=$session->get_request(-varbindlist => [ $snmp_storageUsed.$ref ]);
if ( defined ( $FREE ) ) {
$FREE=$TOTAL - $FREE->{$snmp_storageUsed.$ref};
}
#print $FREE, " ";
$FILESYSTEM=$session->get_request(-varbindlist => [ $snmp_volumetable."\.".$ref ]);
#print $snmp_volumetable."\.".$ref, " ";
if ( defined ( $FILESYSTEM) ) {
$FILESYSTEM=$FILESYSTEM->{$snmp_volumetable."\.".$ref};
}
#print $FILESYSTEM, "\n";
$common->addDrive( {
FILESYSTEM => $FILESYSTEM ,
FREE => $FREE,
TOTAL => $TOTAL,
}),
} # End index of the element
} # End foreach storages
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/8072.pm 0000664 0000000 0000000 00000003006 13327377321 0023221 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID:8072 SYSTEM:Linux
###
package Ocsinventory::Agent::Modules::Snmp::8072;
use strict;
no strict 'refs';
use warnings;
sub snmp_run() {
my ($session,$snmp) = @_;
my $common = $snmp->{common};
my $logger=$snmp->{logger};
my $snmp_nom="1.3.6.1.2.1.1.5.0";
my $list_mib=["If_Mib", "Host_Resources_Mib"];
$logger->debug("Running Linux (8072) MIB module");
$common->setSnmpCommons( {TYPE => "Linux"} );
$common->setSnmpComputer({SYSTEM => 'Linux'});
foreach my $mib ( @{$list_mib} ) {
$snmp->snmp_oid_run($mib);
}
my $snmp_oids="1.3.6.1.4.1.8072.1.2.1.1.4";
my $list_oid_done={8072 => 1};
my $result;
my $results_oids=$session->get_next_request(-varbindlist => [$snmp_oids]) ;
while ( defined ($results_oids ) ) {
foreach $result ( keys %{$results_oids} ) {
$snmp_oids=$result;
if ( defined ( $results_oids->{$result} ) ) {
if ( $results_oids->{$result} =~ /endOfMibView/ ) {
$snmp_oids=undef;
} elsif ( $result =~ /^1\.3\.6\.1\.4\.1\.8072\.1\.2\.1\.1\.4\S+\.1\.3\.6\.1\.4\.1\.(\d+)\./ ) {
my $find_oid=$1;
if ( ! defined $list_oid_done->{$find_oid} ) {
$list_oid_done->{$find_oid}=1;
$snmp->snmp_oid_run($find_oid);
}
}
}
}
$results_oids=$session->get_next_request(-varbindlist => [$snmp_oids]) ;
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/9.pm 0000664 0000000 0000000 00000031747 13327377321 0023006 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID: 9 SYSTEM: Cisco
###
# Version 1.1
###
package Ocsinventory::Agent::Modules::Snmp::9;
use strict;
use warnings;
use Data::Dumper;
sub snmp_run {
my ($session , $snmp )= @_;
my $logger=$snmp->{logger};
my $common=$snmp->{common};
my $list_mib=["Entity_Mib"];
$logger->debug("Running Cisco (9) MIB module");
foreach my $mib ( @{$list_mib} ) {
$snmp->snmp_oid_run($mib);
}
# OID
my $snmp_osversion="1.3.6.1.4.1.9.2.1.73.0";
my $snmp_dot1dBasePortIfIndex="1.3.6.1.2.1.17.1.4.1.2.";
my $snmp_ifdesc="1.3.6.1.2.1.2.2.1.2.";
my $snmp_iftype="1.3.6.1.2.1.2.2.1.3";
my $snmp_ifspeed="1.3.6.1.2.1.2.2.1.5.";
my $snmp_physAddr="1.3.6.1.2.1.2.2.1.6.";
my $snmp_ifadminstatus="1.3.6.1.2.1.2.2.1.7.";
# Specific Cisco
my $snmp_description="1.3.6.1.4.1.9.2.2.1.1.28.";
my $snmp_cisco_deviceAddress="1.3.6.1.4.1.9.9.23.1.2.1.1.4.";
my $snmp_cisco_deviceId="1.3.6.1.4.1.9.9.23.1.2.1.1.6.";
my $snmp_cisco_devicePort="1.3.6.1.4.1.9.9.23.1.2.1.1.7.";
my $snmp_cisco_devicePlatform="1.3.6.1.4.1.9.9.23.1.2.1.1.8.";
my $snmp_vtp_vlan_state="1.3.6.1.4.1.9.9.46.1.3.1.1.2";
my $snmp_dot1dTpFdbPort="1.3.6.1.2.1.17.4.3.1.2";
my $snmp_cisco_ImageTable="1.3.6.1.4.1.9.9.25.1.1.1.2.4";
my $snmp_cisco_ImageVersion="1.3.6.1.4.1.9.9.25.1.1.1.2.5";
my $snmp_cisco_cpmProcessName="1.3.6.1.4.1.9.9.109.1.2.1.1.2";
my $snmp_cisco_cpmProcessCPU="1.3.6.1.4.1.9.9.109.1.2.1.1.6.";
my $oid;
my $oid_complet;
my $osversion;
my $ref;
my $serial;
my $first_serial=undef;
my $software;
my $firmware;
my $location;
my $TotalEthernet=0;
my $result_snmp;
my $result_sub;
my $index_mac={};
my $ref_mac={};
my $DESCRIPTION=undef;
my $SPEED=undef;
my $MACADDR=undef;
my $DEVICEMACADDR=undef;
my $SLOT=undef;
my $STATUS=undef;
my $TYPE=undef;
my $DEVICENAME=undef;
my $DEVICEADDRESS=undef;
my $DEVICEPORT=undef;
my $DEVICETYPE=undef;
my $VLAN=undef;
my $CPU=undef;
$common->setSnmpCommons( {TYPE => "Network"} );
# Info interessante SNMPv2-SMI::enterprises.9.9.23.1.2.1.1.6.10140.1
# SNMPv2-SMI::enterprises.9.9.25.1.1.1.2.1
# version IOS
$result_snmp=$session->get_request(-varbindlist => [$snmp_osversion]);
if ( defined($result_snmp->{$snmp_osversion}) ) {
$osversion=$result_snmp->{$snmp_osversion};
}
# We are going to look for the vlan existing on this equipment
$result_snmp=$session->get_entries(-columns => [$snmp_vtp_vlan_state]);
foreach my $resultmac ( keys %{$result_snmp} ) {
if ( $resultmac =~ /1\.3\.6\.1\.4\.1\.9\.9\.46\.1\.3\.1\.1\.2\.1\.(\S+)/ ) {
my $ref_vlan=$1;
my $sub_session;
# Now we can scan this vlan for mac address
# We must first open a new session with the index associated with the vlan
if ( $session->version eq 3 ) {
$sub_session= Net::SNMP->session(
-retries => 1 ,
-timeout => 3,
-version => $session->version,
-hostname => $session->hostname,
-community => $snmp->{snmp_community}."@".$ref_vlan,
-translate => [-nosuchinstance => 0, -nosuchobject => 0],
-username => $snmp->{USER},
-authpassword => $snmp->{AUTHPASSWD},
-authprotocol => $snmp->{AUTHPROTO},
-privpassword => $snmp->{PRIVPASSWD},
-privprotocol => $snmp->{PRIVPROTO},
);
} else {
$sub_session= Net::SNMP->session(
-retries => 1 ,
-timeout => 3,
-version => $session->version,
-hostname => $session->hostname,
-community => $snmp->{snmp_community}."@".$ref_vlan,
-translate => [-nosuchinstance => 0, -nosuchobject => 0],
);
}
if ( defined ( $sub_session ) ) {
my $result_snmp_mac=$sub_session->get_entries(-columns => [$snmp_dot1dTpFdbPort ]);
if ( defined ($result_snmp_mac ) ) {
# We scan all lines
for my $ligne_snmp_mac ( keys %{$result_snmp_mac} ) {
# We first take in the OID the 6 last numbers indicate in decimal the mac address
if ( $ligne_snmp_mac =~ /17\.4\.3\.1\.2\.(\S+)\.(\S+)\.(\S+)\.(\S+)\.(\S+)\.(\S+)$/ ) {
my $distant_mac=sprintf("%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",$1,$2,$3,$4,$5,$6);
my $data_values={};
my $index_bridge=$result_snmp_mac->{$ligne_snmp_mac};
# We have no table for this reference
if ( ! defined ( $index_mac->{$index_bridge}) ) {
# init of the table
$index_mac->{$index_bridge}=[];
# we take the value gived by the OID
my $snmp_intero=$snmp_dot1dBasePortIfIndex.$index_bridge;
# We take the index reference for the ifdesc
# So when we scan this ifdesc, we can add the vlans and mac
my $ref_snmp_line=$sub_session->get_request(-varbindlist => [ $snmp_intero ]);
# We transmit the ointer value to the ref_mac so we can have a double access for the data
# If we have no information: the mac is not associated with a port
# It's the switch mac address
if ( defined ( $ref_snmp_line->{$snmp_intero}) ) {
$ref_mac->{$ref_snmp_line->{$snmp_intero}}=$index_mac->{$index_bridge};
}
}
$data_values->{MACADRESS}[0]=$distant_mac;
$data_values->{VLANID}[0]=$ref_vlan;
push(@{$index_mac->{$result_snmp_mac->{$ligne_snmp_mac}}},$data_values);
}
}
}
$sub_session->close;
}
}
}
# We look for interfaces
$result_snmp=$session->get_entries(-columns => [$snmp_iftype]);
foreach my $result ( keys %{$result_snmp} ) {
# We work on real interface and no vlan
if ( $result_snmp->{$result} == 6 ) {
if ( $result =~ /1\.3\.6\.1\.2\.1\.2\.2\.1\.3\.(\S+)/ ) {
$ref=$1;
$TYPE="ethernetCsmacd";
$SLOT=$session->get_request(-varbindlist => [$snmp_ifdesc.$ref]);
if ( defined( $SLOT->{$snmp_ifdesc.$ref} ) ) {
$SLOT=$SLOT->{$snmp_ifdesc.$ref};
}
$SPEED=$session->get_request(-varbindlist => [$snmp_ifspeed.$ref]);
if ( defined( $SPEED->{$snmp_ifspeed.$ref}) ) {
$SPEED=$SPEED->{$snmp_ifspeed.$ref};
if ( $SPEED / 1000000000000 >= 1 ) {
$SPEED=$SPEED / 1000000000000;
$SPEED=$SPEED." T";
} elsif ( $SPEED / 1000000000 >= 1 ) {
$SPEED=$SPEED / 1000000000;
$SPEED=$SPEED." G";
} elsif ( $SPEED / 1000000 >= 1 ) {
$SPEED=$SPEED / 1000000;
$SPEED=$SPEED." M";
}
}
$MACADDR=$session->get_request(-varbindlist => [$snmp_physAddr.$ref]);
if ( defined( $MACADDR->{$snmp_physAddr.$ref}) ) {
# For MACADDR, we need a translation beetween Hexa and string
$MACADDR=$MACADDR->{$snmp_physAddr.$ref};
if ( length ($MACADDR) == 14 ) {
$MACADDR=substr($MACADDR,2,2).":".
substr($MACADDR,4,2).":".
substr($MACADDR,6,2).":".
substr($MACADDR,8,2).":".
substr($MACADDR,10,2).":".
substr($MACADDR,12,2);
} else {
$MACADDR="";
}
}
if ( defined $ref_mac->{$ref} ) {
$VLAN=$ref_mac->{$ref};
}
$STATUS=$session->get_request(-varbindlist => [ $snmp_ifadminstatus.$ref ]);
if ( $STATUS->{$snmp_ifadminstatus.$ref} == 1 ) {
$STATUS="Up";
} else {
$STATUS="Down";
}
$DESCRIPTION=$session->get_request(-varbindlist => [ $snmp_description.$ref ]);
if ( defined( $DESCRIPTION ) ) {
$DESCRIPTION=$DESCRIPTION->{$snmp_description.$ref};
}
$DEVICEADDRESS=$session->get_entries( -columns => [ $snmp_cisco_deviceAddress.$ref ] );
if ( defined( $DEVICEADDRESS ) ) {
my $DEVICEADDRESS_uniq;
foreach my $key ( keys %{$DEVICEADDRESS} ) {
$DEVICEADDRESS_uniq=$DEVICEADDRESS->{$key} ;
if ( length ( $DEVICEADDRESS_uniq ) == 10 ) {
$DEVICEADDRESS_uniq=hex(substr($DEVICEADDRESS_uniq,2,2)).
".".hex(substr($DEVICEADDRESS_uniq,4,2)).
".".hex(substr($DEVICEADDRESS_uniq,6,2)).
".".hex(substr($DEVICEADDRESS_uniq,8,2));
} else {
$DEVICEADDRESS_uniq=undef;
}
}
$DEVICEADDRESS=$DEVICEADDRESS_uniq;
}
$DEVICENAME=$session->get_entries( -columns => [ $snmp_cisco_deviceId.$ref ] );
if ( defined( $DEVICENAME ) ) {
my $DEVICENAME_uniq;
my $DEVICETYPE_uniq;
my $DEVICEPORT_uniq;
foreach my $key ( keys %{$DEVICENAME} ) {
$DEVICENAME_uniq=$DEVICENAME->{$key};
}
$DEVICENAME=$DEVICENAME_uniq;
# If we have the device name, the cdp can be used for the other informations
$DEVICETYPE=$session->get_entries( -columns => [ $snmp_cisco_devicePlatform.$ref ] );
if ( defined( $DEVICETYPE ) ) {
foreach my $key ( keys %{$DEVICETYPE} ) {
$DEVICETYPE_uniq=$DEVICETYPE->{$key};
}
$DEVICETYPE=$DEVICETYPE_uniq;
}
$DEVICEPORT=$session->get_entries( -columns => [ $snmp_cisco_devicePort.$ref ] );
if ( defined( $DEVICEPORT ) ) {
foreach my $key ( keys %{$DEVICEPORT} ) {
$DEVICEPORT_uniq=$DEVICEPORT->{$key};
}
$DEVICEPORT=$DEVICEPORT_uniq;
}
}
}
$common->addSnmpNetwork( {
DESCRIPTION => $DESCRIPTION,
SPEED => $SPEED,
MACADDR => $MACADDR,
SLOT => $SLOT,
STATUS => $STATUS,
TYPE => $TYPE,
DEVICENAME => $DEVICENAME,
DEVICEADDRESS => $DEVICEADDRESS,
DEVICEPORT => $DEVICEPORT,
DEVICETYPE => $DEVICETYPE,
VLAN => $VLAN,
});
$DESCRIPTION=undef;
$MACADDR=undef;
$SLOT=undef;
$STATUS=undef;
$TYPE=undef;
$SPEED=undef;
$MACADDR=undef;
$DEVICEADDRESS=undef;
$DEVICENAME=undef;
$DEVICEPORT=undef;
$DEVICETYPE=undef;
$VLAN=undef;
}
}
# We have finished for interfaces
# We look for Softwares on the switch
# We look for feature
# All feature are separated by a pipe
$result_snmp=$session->get_request ( -varbindlist => [ $snmp_cisco_ImageTable ]) ;
if ( defined ( $result_snmp ) ) {
$result_snmp=$result_snmp->{$snmp_cisco_ImageTable};
my @tab_feature=split(/\$/,$result_snmp);
@tab_feature=split(/\|/,$tab_feature[1]);
foreach $result_sub ( @tab_feature ) {
$common->addSoftware( { NAME => $result_sub , COMMENTS => "Feature" } );
}
}
# We look for IOS version
$result_snmp=$session->get_request ( -varbindlist => [ $snmp_cisco_ImageVersion ]) ;
if ( defined ( $result_snmp ) ) {
$result_snmp=$result_snmp->{$snmp_cisco_ImageVersion};
my @tab_feature=split(/\$/,$result_snmp);
$common->addSoftware( { NAME => $tab_feature[1] , COMMENTS => "IOS" } );
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/Default.pm 0000664 0000000 0000000 00000000751 13327377321 0024211 0 ustar 00root root 0000000 0000000 ###
# SNMP: Default
###
package Ocsinventory::Agent::Modules::Snmp::Default;
use strict;
no strict 'refs';
use warnings;
sub snmp_run {
my ($session , $snmp )= @_;
my $oid_run=$snmp->{snmp_oid_run};
my $inventory = $snmp->{inventory};
my $logger=$snmp->{logger};
my $list_mib=["If_Mib", "Host_Resources_Mib","Printer_Mib"];
$logger->debug("Running Default MIB module \n");
foreach my $mib ( @{$list_mib} ) {
$snmp->snmp_oid_run($mib);
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/Entity_Mib.pm 0000664 0000000 0000000 00000011076 13327377321 0024672 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID: 47 SYSTEM: Entity_Mib
###
# Version 0.5
###
package Ocsinventory::Agent::Modules::Snmp::Entity_Mib;
use strict;
use warnings;
sub snmp_run {
my ($session , $snmp )= @_;
my $logger=$snmp->{logger};
my $common=$snmp->{common};
$logger->debug("Running Entity MIB module");
# OID
my $snmp_entPhysicalClass="1.3.6.1.2.1.47.1.1.1.1.5";
my $translation_entPhysicalClass={
#1 => "other",
#2 => "unknown",
3 => "chassis",
#4 => "backplane",
#5 => "container",
6 => "powerSupply",
7 => "fan",
#8 => "sensor",
9 => "module",
#10 => "port",
#11 => "stack",
#12 => "cpu",
};
my $result_snmp;
my $result;
my $nbr_switch=0;
# We are looking for physical elements
$result_snmp=$session->get_entries(-columns => [$snmp_entPhysicalClass]);
foreach my $result ( keys %{$result_snmp} ) {
if ( $result =~ /1\.3\.6\.1\.2\.1\.47\.1\.1\.1\.1\.5\.(\S+)/ ) {
my $ref=$1;
my $PhysicalClass=$result_snmp->{$snmp_entPhysicalClass.".".$ref};
my $info = {};
if ( $PhysicalClass =~ /^[3,6,7,9,11]$/ ) {
info_element($info,$session,$ref,$logger);
$info->{TYPE}=$translation_entPhysicalClass->{$PhysicalClass};
if ( $PhysicalClass == 3 ) {
# We have a switch
$nbr_switch++;
$common->addSnmpSwitch( $info );
# Infos for a switch: DESCRIPTION, REFERENCE, REVISION, FIRMWARE, SERIALNUMBER, MANUFACTURER, TYPE
} elsif ( $PhysicalClass == 6 ) {
# Infos for an alimentation DESCRIPTION, REFERENCE, REVISION, SERIALNUMBER, MANUFACTURER, TYPE
$common->addSnmpPowerSupply( $info );
} elsif ( $PhysicalClass == 7 ) {
# Infos for a Fan: DESCRIPTION, REFERENCE, REVISION, SERIALNUMBER, MANUFACTURER, TYPE
$common->addSnmpFan( $info );
} elsif ( $PhysicalClass == 9 && defined ($info->{SERIALNUMBER}) ) {
if ( ! ($info->{DESCRIPTION} =~ /[CF]PU/ )) {
# Infor for a card: DESCRIPTION, REFERENCE, REVISION, FIRMWARE, SOFTWARE, SERIALNUMBER, MANUFACTURER, TYPE
$common->addSnmpCard( $info );
}
}
}
}
}
# We have scaned all equipment, we know now if we have a switch or a stack of switch
if ( $nbr_switch == 1 ) {
$common->setSnmpSwitchInfos({TYPE=>"Switch"});
} elsif ( $nbr_switch > 1 ) {
$common->setSnmpSwitchInfos({TYPE=>"Switchs Stack"});
}
}
sub info_element(){
my ($info ,$session, $ref, $logger)=@_;
my $snmp_info="1.3.6.1.2.1.47.1.1.1.1.2.";
my $snmp_ref="1.3.6.1.2.1.47.1.1.1.1.7.";
my $snmp_hardware="1.3.6.1.2.1.47.1.1.1.1.8.";
my $snmp_firmware="1.3.6.1.2.1.47.1.1.1.1.9.";
my $snmp_software="1.3.6.1.2.1.47.1.1.1.1.10.";
my $snmp_serial="1.3.6.1.2.1.47.1.1.1.1.11.";
my $snmp_entPhysicalMfgName="1.3.6.1.2.1.47.1.1.1.1.12.";
my $snmp_entPhysicalModelName="1.3.6.1.2.1.47.1.1.1.1.13.";
my $result;
# We have a good element
$result=$session->get_request(-varbindlist => [$snmp_info.$ref]);
if ( defined( $result) ) {
$info->{DESCRIPTION} = $result->{$snmp_info.$ref};
}
$result=$session->get_request(-varbindlist => [$snmp_ref.$ref]);
if ( defined( $result ) ) {
$info->{REFERENCE} = $result->{$snmp_ref.$ref};
}
$result=$session->get_request(-varbindlist => [$snmp_hardware.$ref]);
if ( defined( $result ) ) {
$info->{REVISION} = $result->{$snmp_hardware.$ref};
}
$result=$session->get_request(-varbindlist => [$snmp_serial.$ref]);
if ( defined( $result ) ) {
$info->{SERIALNUMBER} = $result->{$snmp_serial.$ref};
}
$result=$session->get_request(-varbindlist => [$snmp_firmware.$ref]);
if ( defined( $result) ) {
$info->{FIRMWARE} = $result->{$snmp_firmware.$ref};
}
$result=$session->get_request(-varbindlist => [$snmp_software.$ref]);
if ( defined( $result ) ) {
$info->{SOFTWARE} = $result->{$snmp_software.$ref};
}
$result=$session->get_request(-varbindlist => [$snmp_entPhysicalMfgName.$ref]);
if ( defined( $result ) ) {
$info->{MANUFACTURER} = $result->{$snmp_entPhysicalMfgName.$ref};
}
$result=$session->get_request(-varbindlist => [$snmp_entPhysicalModelName.$ref]);
if ( defined( $result ) ) {
$info->{TYPE} = $result->{$snmp_entPhysicalModelName.$ref};
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/Host_Resources_Mib.pm 0000664 0000000 0000000 00000023267 13327377321 0026372 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Modules::Snmp::Host_Resources_Mib;
use strict;
use warnings;
sub snmp_info {
return ( { oid_value => "1.3.6.1.2.1.25.1.1.0", oid_name => "Host_Resources_Mib" } );
}
sub snmp_run {
my ($session , $snmp )= @_;
my $logger=$snmp->{logger};
my $common=$snmp->{common};
$logger->debug("Running Host Resources MIB module");
# OID
my $soft="1.3.6.1.2.1.25.6.3.1.";
my $memory="1.3.6.1.2.1.25.2.2.0";
my $snmp_storageType="1.3.6.1.2.1.25.2.3.1.2";
my $snmp_storageDescr="1.3.6.1.2.1.25.2.3.1.3.";
my $snmp_storageSize="1.3.6.1.2.1.25.2.3.1.5.";
my $snmp_storageUsed="1.3.6.1.2.1.25.2.3.1.6.";
my $snmp_storageAllocationUnits="1.3.6.1.2.1.25.2.3.1.4.";
my $snmp_hrDeviceType="1.3.6.1.2.1.25.3.2.1.2";
my $snmp_cpu="1.3.6.1.2.1.25.3.2.1.3.";
my $snmp_Printer="1.3.6.1.2.1.25.3.2.1.5.";
my $snmp_Video="1.3.6.1.2.1.25.3.2.1.10.";
my $snmp_Audio="1.3.6.1.2.1.25.3.2.1.11.";
my $snmp_Keyboard="1.3.6.1.2.1.25.3.2.1.13.";
my $snmp_Modem="1.3.6.1.2.1.25.3.2.1.14.";
my $snmp_ParallelPort="1.3.6.1.2.1.25.3.2.1.15.";
my $snmp_Pointing="1.3.6.1.2.1.25.3.2.1.16.";
my $snmp_SerialPort="1.3.6.1.2.1.25.3.2.1.17.";
my $DATE;
my $result;
my $result_table;
my $ref;
$result_table=$session->get_entries(-columns => [ $soft."2" ] );
foreach my $result ( keys %{$result_table} ) {
if ( $result =~ /1\.3\.6\.1\.2\.1\.25\.6\.3\.1\.2\.(\S+)/ ) {
$ref=$1;
$DATE=$session->get_request ( -varbindlist => [ $soft."5.".$ref ]);
if ( defined ( $DATE ) ) {
$DATE=$DATE->{$soft."5.".$ref};
if ( defined ($DATE ) ) {
if (length($DATE)>0) {
$DATE=sprintf("%d/%d/%d",hex(substr($DATE,2,4)),hex(substr($DATE,6,2)),hex(substr($DATE,8,2)));
}
}
}
$common->addSoftware( {
NAME=>$result_table->{ $result } ,
INSTALLDATE=>$DATE
} );
}
}
# Memory
$result=$session->get_request(-varbindlist => [ $memory ]);
if ( defined ($result) ) {
$common->addMemory( {CAPACITY => $result->{$memory} } );
}
# We look for disk
$result_table=$session->get_entries(-columns => [ $snmp_storageType ]);
foreach my $result ( keys %{$result_table} ) {
if ( $result =~ /1\.3\.6\.1\.2\.1\.25\.2\.3\.1\.2\.(\S+)/ ) {
$ref=$1;
# We look if the storage is a fixed disk
if ( $result_table->{$result} =~ /2\.1\.4$/ ) {
# Definition Var for disks
my $FREE="";
my $FILESYSTEM="";
my $LABEL="";
my $SERIAL="";
my $TOTAL="";
my $TYPE="HardDisk";
my $VOLUMN="";
my $AllocUnits=$session->get_request(-varbindlist => [ $snmp_storageAllocationUnits.$ref ]);
if ( defined ( $AllocUnits ) ) {
$AllocUnits=$AllocUnits->{$snmp_storageAllocationUnits.$ref};
# Allocation Units are in Bytes, but we want KB
if ( $AllocUnits ) {
$AllocUnits/=1024;
}
} else {
$AllocUnits=1;
}
$TOTAL=$session->get_request(-varbindlist => [ $snmp_storageSize.$ref ]);
if ( defined ( $TOTAL ) ) {
$TOTAL=$TOTAL->{$snmp_storageSize.$ref};
$TOTAL*=$AllocUnits;
} else {
$TOTAL=0;
}
$FREE=$session->get_request(-varbindlist => [ $snmp_storageUsed.$ref ]);
if ( defined ( $FREE ) ) {
$FREE=$TOTAL - $FREE->{$snmp_storageUsed.$ref}* $AllocUnits;
} else {
$FREE=0;
}
$FILESYSTEM=$session->get_request(-varbindlist => [ $snmp_storageDescr.$ref ]);
if ( defined ( $FILESYSTEM) ) {
$FILESYSTEM=$FILESYSTEM->{$snmp_storageDescr.$ref};
}
if ( $FILESYSTEM =~ /(\S+)\s+Label:(\S+)\s+Serial Number\s+(\S+)/ ) {
$VOLUMN=$1;
$LABEL=$2;
$SERIAL=$3;
$FILESYSTEM="";
} elsif ( $FILESYSTEM =~ /(\S+)\s+Label:\s+Serial Number\s+(\S+)/ ) {
$VOLUMN=$1;
$SERIAL=$2;
$FILESYSTEM="";
}
$common->addDrive( {
FILESYSTEM => $FILESYSTEM ,
VOLUMN => $VOLUMN,
TYPE => $TYPE,
LABEL => $LABEL,
SERIAL => $SERIAL,
FREE => $FREE,
TOTAL => $TOTAL,
}),
} # End looking for fixed disk
} # End index of the element
} # End foreach storages
$result_table=$session->get_entries(-columns => [ $snmp_hrDeviceType ]);
foreach my $result ( keys %{$result_table} ) {
if ( $result =~ /1\.3\.6\.1\.2\.1\.25\.3\.2\.1\.2\.(\S+)/ ) {
$ref=$1;
if ( $result_table->{$result} =~ /3\.1\.3$/ ) {
# We have a CPU
my $CPU=$session->get_request(-varbindlist => [ $snmp_cpu.$ref ] );
if ( defined ( $CPU ) ) {
$CPU=$CPU->{$snmp_cpu.$ref};
my $TYPE=$CPU;
my $MANUFACTURER="";
my $SPEED="";
if ( $CPU =~ /^Intel$/ ) {
# We have a windows system and for all processor
# it say Intel even if the proc is an AMD
$MANUFACTURER="x86 Manufacturer";
$TYPE="x86";
} elsif ( $CPU =~ /[Ii]nte/ ) {
$MANUFACTURER="Intel";
if ( $CPU =~ /\s+(\S+[GM][Hh][zZ])/ ) {
$SPEED=$1;
}
} elsif ( $CPU =~ /AMD/ ) {
$MANUFACTURER="AMD";
if ( $CPU =~ /\s+(\S+\+)/ ) {
$SPEED=$1;
}
}
$logger->debug("Speed $SPEED Manufacturer $MANUFACTURER Type $TYPE");
$common->addSnmpCPU( {
SPEED => $SPEED,
TYPE => $TYPE,
MANUFACTURER => $MANUFACTURER,
} );
}
}
} #end CPU
elsif ( $result_table->{$result} =~ /3\.1\.5$/ ) {
# We have a Printer
my $NAME=$session->get_request(-varbindlist => [ $snmp_Printer.$ref ] );
if ( defined ($NAME) ) {
$NAME=$NAME->{$snmp_Printer.$ref };
$common->addSnmpLocalPrinter( { NAME => $NAME } );
}
} # End Printer
elsif ( $result_table->{$result} =~ /3\.1\.13$/ ) {
# We have a Keyboard
my $DESCRIPTION=$session->get_request(-varbindlist => [ $snmp_Keyboard.$ref ] );
if ( defined ($DESCRIPTION) ) {
$DESCRIPTION=$DESCRIPTION->{$snmp_Keyboard.$ref };
$common->addSnmpInput( { DESCRIPTION => $DESCRIPTION , TYPE => "Keyboard" } );
}
} # End Keyboard
elsif ( $result_table->{$result} =~ /3\.1\.16$/ ) {
# We have a Pointing
my $DESCRIPTION=$session->get_request(-varbindlist => [ $snmp_Pointing.$ref ] );
if ( defined ($DESCRIPTION) ) {
$DESCRIPTION=$DESCRIPTION->{$snmp_Pointing.$ref };
$common->addSnmpInput( { DESCRIPTION => $DESCRIPTION , TYPE => "Mouse" } );
}
} # End Pointing
elsif ( $result_table->{$result} =~ /3\.1\.11$/ ) {
# We have a Audio
my $NAME=$session->get_request(-varbindlist => [ $snmp_Audio.$ref ] );
if ( defined ($NAME) ) {
$NAME=$NAME->{$snmp_Audio.$ref };
$common->addSound( { NAME => $NAME } );
}
} # End Audio
elsif ( $result_table->{$result} =~ /3\.1\.10$/ ) {
# We have a Video
my $NAME=$session->get_request(-varbindlist => [ $snmp_Video.$ref ] );
if ( defined ($NAME) ) {
$NAME=$NAME->{$snmp_Video.$ref };
$common->addVideo( { NAME => $NAME } );
}
} # End Video
elsif ( $result_table->{$result} =~ /3\.1\.14$/ ) {
# We have a Modem
my $NAME=$session->get_request(-varbindlist => [ $snmp_Modem.$ref ] );
if ( defined ($NAME) ) {
$NAME=$NAME->{$snmp_Modem.$ref };
$common->addModem( { NAME => $NAME } );
}
} # End Modem
elsif ( $result_table->{$result} =~ /3\.1\.15$/ ) {
# We have a ParallelPort
my $NAME=$session->get_request(-varbindlist => [ $snmp_ParallelPort.$ref ] );
if ( defined ($NAME) ) {
$NAME=$NAME->{$snmp_ParallelPort.$ref };
$common->addPorts( { NAME => $NAME , TYPE => "Parallel" } );
}
} # End ParallelPort
elsif ( $result_table->{$result} =~ /3\.1\.17$/ ) {
# We have a SerialPort
my $NAME=$session->get_request(-varbindlist => [ $snmp_SerialPort.$ref ] );
if ( defined ($NAME) ) {
$NAME=$NAME->{$snmp_SerialPort.$ref };
$common->addPorts( { NAME => $NAME , TYPE => "Serial" } );
}
} # End SerialPort
} # End scan of hrDeviceType
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/If_Mib.pm 0000664 0000000 0000000 00000016203 13327377321 0023751 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID: 2 SYSTEM: If_Mib
###
package Ocsinventory::Agent::Modules::Snmp::If_Mib;
use strict;
use warnings;
use Data::Dumper;
sub snmp_info {
return ( { oid_value => "1.3.6.1.2.1.2.1.0", oid_name => "If_Mib" } );
}
sub snmp_run {
my ($session , $snmp )= @_;
my $logger=$snmp->{logger};
my $common=$snmp->{common};
$logger->debug("Running If MIB module");
# OID a recuperer
my $snmp_ifdescr="1.3.6.1.2.1.2.2.1.2.";
my $snmp_iftype="1.3.6.1.2.1.2.2.1.3";
my $snmp_ifspeed="1.3.6.1.2.1.2.2.1.5.";
my $snmp_physAddr="1.3.6.1.2.1.2.2.1.6.";
my $snmp_ifadminstatus="1.3.6.1.2.1.2.2.1.7.";
my $snmp_ipAdEntIfIndex="1.3.6.1.2.1.4.20.1.2";
my $snmp_ipAdEntNetMask="1.3.6.1.2.1.4.20.1.3.";
my $snmp_ipRouteIfIndex="1.3.6.1.2.1.4.21.1.2.";
my $snmp_ipRouteNextHop="1.3.6.1.2.1.4.21.1.7.";
my $snmp_ipRouteType="1.3.6.1.2.1.4.21.1.8";
my $SPEED=undef;
my $MACADDR=undef;
my $SLOT=undef;
my $STATUS=undef;
my $TYPE=undef;
my $IPADDR=undef;
my $IPMASK=undef;
my $IPGATEWAY=undef;
my $IPSUBNET=undef;
my $ref;
my $result_snmp;
my $address_index=undef;
my $netmask_index=undef;
my $network_index=undef;
my $gateway_index=undef;
# the informations on ip address and gateway are not indexed on the
# interfaces so we must get it before and integrate the informations
# after for each interface
# We take all the snmp_ifadminstatus in a table if this information exist
$result_snmp=$session->get_entries(-columns => [$snmp_ipAdEntIfIndex]);
foreach my $result ( keys %{$result_snmp} ) {
if ( $result =~ /1\.3\.6\.1\.2\.1\.4\.20\.1\.2\.(\S+)/ ) {
my $address=$1;
$address_index->{$result_snmp->{$result}}=$address;
# We have the address so we can lokk for the netmask associated
my $netmask=$session->get_request(-varbindlist => [$snmp_ipAdEntNetMask.$address]);
if ( defined($netmask->{$snmp_ipAdEntNetMask.$address} ) ) {
$netmask_index->{$result_snmp->{$result}}=$netmask->{$snmp_ipAdEntNetMask.$address};
}
}
}
# now we can do the same thing for the gateway
# It is an other index and only indirect information (routing)
# are required actually
$result_snmp=$session->get_entries(-columns => [$snmp_ipRouteType]);
foreach my $result ( keys %{$result_snmp} ) {
if ( $result =~ /1\.3\.6\.1\.2\.1\.4\.21\.1\.8\.(\S+)/ ) {
if ( $result_snmp->{$result} == 4 ) {
my $net_address=$1;
# We get the index associating the interface with the gateway and subnet
my $ind=$session->get_request(-varbindlist => [$snmp_ipRouteIfIndex.$net_address] );
$ind=$ind->{$snmp_ipRouteIfIndex.$net_address};
# We ave already the network so we can add the information with the index
$network_index->{$ind}=$net_address;
# We get the gateway
my $gateway=$session->get_request(-varbindlist => [$snmp_ipRouteNextHop.$net_address] );
$gateway_index->{$ind}=$gateway->{$snmp_ipRouteNextHop.$net_address};
}
}
}
# We look for interfaces
$result_snmp=$session->get_entries(-columns => [$snmp_iftype]);
foreach my $result ( keys %{$result_snmp} ) {
# We work on real interface and no vlan
$TYPE=$result_snmp->{$result};
if ( $TYPE == 6 || $TYPE == 94) {
if ( $result =~ /1\.3\.6\.1\.2\.1\.2\.2\.1\.3\.(\S+)/ ) {
$ref=$1;
if ( $TYPE == 6 ) {
$TYPE="ethernetCsmacd";
} elsif ( $TYPE == 94 ) {
$TYPE="Adsl";
}
my $intero=$snmp_ifdescr.$ref;
#$SLOT=$session->get_request(-varbindlist => [$snmp_ifdescr.$ref]);
$SLOT=$session->get_request(-varbindlist => [$intero]);
$SLOT=" $SLOT->{$snmp_ifdescr.$ref}";
#print "Pour $intero Le slot $SLOT\n";
$SPEED=$session->get_request(-varbindlist => [$snmp_ifspeed.$ref]);
if ( defined( $SPEED->{$snmp_ifspeed.$ref}) ) {
$SPEED=$SPEED->{$snmp_ifspeed.$ref};
if ( $SPEED / 1000000000000 >= 1 ) {
$SPEED=$SPEED / 1000000000000;
$SPEED=$SPEED." T";
} elsif ( $SPEED / 1000000000 >= 1 ) {
$SPEED=$SPEED / 1000000000;
$SPEED=$SPEED." G";
} elsif ( $SPEED / 1000000 >= 1 ) {
$SPEED=$SPEED / 1000000;
$SPEED=$SPEED." M";
}
}
$MACADDR=$session->get_request(-varbindlist => [$snmp_physAddr.$ref]);
if ( defined( $MACADDR->{$snmp_physAddr.$ref}) ) {
# For MACADDR, we need a translation beetween Hexa and string
$MACADDR=" ".$MACADDR->{$snmp_physAddr.$ref};
if ( $MACADDR =~ /^ 0x(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})$/ ) {
$MACADDR="$1:$2:$3:$4:$5:$6";
}
$STATUS=$session->get_request(-varbindlist => [ $snmp_ifadminstatus.$ref ]);
if ( $STATUS->{$snmp_ifadminstatus.$ref} == 1 ) {
$STATUS="Up";
} else {
$STATUS="Down";
}
# If we have the address ip and netmask we can put it
if ( defined ( $address_index ) ) {
$IPADDR=$address_index->{$ref};
$IPMASK=$netmask_index->{$ref};
#if ( defined ($IPADDR ) ) {
# my $local_info=$session->hostname();
# print "$IPADDR et $local_info";
# if ( $IPADDR eq $session->hostname() ) {
# $common->setSnmpCommons({MACADDR => $MACADDR });
# }
#}
}
if ( defined ( $network_index ) ) {
$IPGATEWAY=$gateway_index->{$ref};
$IPSUBNET=$network_index->{$ref};
}
$common->addSnmpNetwork( {
TYPE => $TYPE,
SLOT => $SLOT,
SPEED => $SPEED,
MACADDR => $MACADDR,
STATUS => $STATUS,
IPADDR => $IPADDR,
IPMASK => $IPMASK,
IPGATEWAY => $IPGATEWAY,
IPSUBNET => $IPSUBNET,
});
$MACADDR=undef;
$SLOT=undef;
$STATUS=undef;
$SPEED=undef;
$IPADDR=undef;
$IPMASK=undef;
$IPGATEWAY=undef;
$IPSUBNET=undef;
}
}
}
} # End foreach result
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Modules/Snmp/Printer_Mib.pm 0000664 0000000 0000000 00000014120 13327377321 0025032 0 ustar 00root root 0000000 0000000 ###
# SNMP: OID: 43 SYSTEM: Printer_Mib
###
package Ocsinventory::Agent::Modules::Snmp::Printer_Mib;
use strict;
sub snmp_info {
#TODO: find a common OID from Printer_Mib (compatible with most printers) instead of using hrPrinterStatus from Host_Ressources_Mib
return ( { oid_value => "1.3.6.1.2.1.25.3.5.1.1.1", oid_name => "Printer_Mib" } );
}
sub snmp_run {
my ($session , $snmp )= @_;
my $logger=$snmp->{logger};
my $common=$snmp->{common};
my ($result,$name,$serialnumber,$lifecount,$countunit,$printerstatus,$errorstate);
$logger->debug("Running Printer MIB module");
$common->setSnmpCommons( {TYPE => "Printer"} );
# prtGeneralPrinterName
my $snmp_name="1.3.6.1.2.1.43.5.1.1.16.1";
# prtInputSerialNumber
my $snmp_serialnumber="1.3.6.1.2.1.43.5.1.1.17.1";
# prtMarkerLifeCount
my $snmp_lifecount="1.3.6.1.2.1.43.10.2.1.4.1.1";
# prtMarkerCounterUnit
my $snmp_countunit="1.3.6.1.2.1.43.10.2.1.3.1.1";
# prtInputTable
my $snmp_inputable="1.3.6.1.2.1.43.8.2";
# prtMarkerSuppliesTable
my $snmp_markersuppliestable="1.3.6.1.2.1.43.11.1";
# prtMarkerColorantValue
my $snmp_colorantvalue="1.3.6.1.2.1.43.12.1.1.4";
# hrPrinterStatus
my $snmp_printerstatus="1.3.6.1.2.1.25.3.5.1.1.1";
# PrinterDetectedErrorState
my $snmp_errorstate="1.3.6.1.2.1.25.3.5.1.2.1";
#Trays informations we want to get
my $trayinfos = {
name => "1.3.6.1.2.1.43.8.2.1.13", #prtInputName
description => "1.3.6.1.2.1.43.8.2.1.18", #prtInputDescription
level => "1.3.6.1.2.1.43.8.2.1.10", #prtInputLevel
maxcapacity => "1.3.6.1.2.1.43.8.2.1.9", #prtInputMaxCapacity
};
# Cartridges informations we want to get
my $cartridgeinfos = {
description => "1.3.6.1.2.1.43.11.1.1.6", #prtMarkerSuppliesDescription
type => "1.3.6.1.2.1.43.11.1.1.5", #prtMarkerSuppliesType
level => "1.3.6.1.2.1.43.11.1.1.9", #prtMarkerSuppliesSupplyLevel
maxcapacity => "1.3.6.1.2.1.43.11.1.1.8", #prtMarkerSuppliesMaxCapacity
};
# Translation for the prtMarkerCounterUnit integer
my $countunit_translation = {
3 => 'tenThousandthsOfInches',
4 => 'micrometers',
5 => 'characters',
6 => 'lines',
7 => 'impressions',
8 => 'sheets',
9 => 'dotRow',
11 => 'hours',
16 => 'feet',
17 => 'meters',
};
# Translation for the prtMarkerSuppliesType integer
my $suppliestype_translation = {
1 => 'other',
2 => 'unknown',
3 => 'toner',
4 => 'wasteToner',
5 => 'ink',
6 => 'inkCartridge',
7 => 'inkRibbon',
8 => 'wasteInk',
9 => 'opc',
10 => 'developer',
11 => 'fuserOil',
12 => 'solidWax',
13 => 'ribbonWax',
14 => 'wasteWax',
};
my $printerstatus_translation = {
1 => 'other',
2 => 'unknown',
3 => 'idle',
4 => 'printing',
5 => 'warmup',
};
my $errorstate_translation = {
'0x00' => 'lowPaper',
'0x01' => 'noPaper',
'0x02' => 'lowToner',
'0x03' => 'noToner',
'0x04' => 'doorOpen',
'0x05' => 'jammed',
'0x06' => 'offline',
'0x07' => 'serviceRequested',
'0x08' => 'inputTrayMissing',
'0x09' => 'outputTrayMissing',
'0x10' => 'markerSupplyMissing',
'0x11' => 'outputNearFull',
'0x12' => 'outputFull',
'0x13' => 'inputTrayEmpty',
'0x14' => 'overduePreventMaint',
};
#####
#Getting printer informations
$result=$session->get_request( -varbindlist => [$snmp_name]);
$name=$result->{$snmp_name};
$result=$session->get_request(-varbindlist => [$snmp_serialnumber]);
$serialnumber=$result->{$snmp_serialnumber};
$result=$session->get_request(-varbindlist => [$snmp_lifecount]);
$lifecount=$result->{$snmp_lifecount};
$result=$session->get_request(-varbindlist => [$snmp_countunit]);
$countunit=$countunit_translation->{ $result->{$snmp_countunit} };
$result=$session->get_request(-varbindlist => [$snmp_printerstatus]);
$printerstatus=$result->{$snmp_printerstatus};
$result=$session->get_request(-varbindlist => [$snmp_errorstate]);
$errorstate=$result->{$snmp_errorstate};
# Adding informations to XML
$common->setSnmpPrinter({
NAME => $name,
SERIALNUMBER => $serialnumber,
COUNTER => "$lifecount $countunit",
STATUS => $printerstatus_translation->{$printerstatus},
ERRORSTATE => $errorstate_translation->{$errorstate},
});
# Getting trays informations using the table
my $inputable=$session->get_table(-baseoid => $snmp_inputable) ;
my $trays = $common->getSnmpTable($inputable,$snmp_inputable,$trayinfos);
for my $tray ( keys %$trays ) {
#Adding informations about trays in XML
$common->addSnmpPrinterTray({
NAME => $trays->{$tray}->{name},
DESCRIPTION => $trays->{$tray}->{description},
LEVEL => $trays->{$tray}->{level},
MAXCAPACITY => $trays->{$tray}->{maxcapacity},
});
}
# Getting cartridges informations using the table
my $markersuppliestable=$session->get_table(-baseoid => $snmp_markersuppliestable) ;
my $cartridges = $common->getSnmpTable($markersuppliestable,$snmp_markersuppliestable,$cartridgeinfos);
for my $cartridge ( keys %$cartridges ) {
# Getting colorant value
$result = $session->get_request(-varbindlist => [$snmp_colorantvalue.$cartridge]);
my $colorantvalue = $result->{$snmp_colorantvalue.$cartridge};
# Adding informations about cartridges in XML
$common->addSnmpPrinterCartridge({
DESCRIPTION => $cartridges->{$cartridge}->{description},
TYPE => $suppliestype_translation->{ $cartridges->{$cartridge}->{type} },
LEVEL => $cartridges->{$cartridge}->{level},
MAXCAPACITY => $cartridges->{$cartridge}->{maxcapacity},
COLOR => $colorantvalue,
});
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/Network.pm 0000664 0000000 0000000 00000011333 13327377321 0021727 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::Network;
# TODO:
# - set the correct deviceID and olddeviceID
use strict;
use warnings;
use IO::Socket::SSL qw(SSL_VERIFY_NONE);
use LWP::UserAgent;
use Socket;
use Ocsinventory::Compress;
sub new {
my (undef, $params) = @_;
my $self = {};
$self->{accountconfig} = $params->{accountconfig};
$self->{accountinfo} = $params->{accountinfo};
$self->{common} = $params->{common};
my $logger = $self->{logger} = $params->{logger};
$self->{config} = $params->{config};
my $uaserver;
if ($self->{config}->{server} =~ /^http(|s):\/\//) {
$self->{URI} = $self->{config}->{server};
$uaserver = $self->{config}->{server};
$uaserver =~ s/^http(|s):\/\///;
$uaserver =~ s/\/.*//;
if ($uaserver !~ /:\d+$/) {
$uaserver .= ':443' if $self->{config}->{server} =~ /^https:/;
$uaserver .= ':80' if $self->{config}->{server} =~ /^http:/;
}
} else {
$self->{URI} = "http://".$self->{config}->{server}.$self->{config}->{remotedir};
$uaserver = $self->{config}->{server};
}
$self->{compress} = new Ocsinventory::Compress ({logger => $logger});
# Connect to server
$self->{ua} = LWP::UserAgent->new(keep_alive => 1);
if ($self->{config}->{proxy}) {
$self->{ua}->proxy(['http', 'https'], $self->{config}->{proxy});
} else {
$self->{ua}->env_proxy;
}
my $version = 'OCS-NG_unified_unix_agent_v';
$version .= exists ($self->{config}->{VERSION})?$self->{config}->{VERSION}:'';
$self->{ua}->agent($version);
$self->{config}->{user}.",".
$self->{config}->{password}."";
$self->{ua}->credentials(
$uaserver, # server:port, port is needed
$self->{config}->{realm},
$self->{config}->{user},
$self->{config}->{password}
);
#Setting SSL configuration depending on LWP version
$self->{ua}->_agent =~ /^libwww-perl\/(.*)$/;
my $lwp_version= $1;
$lwp_version=$self->{common}->convertVersion($lwp_version,3);
if ($lwp_version > 583) {
$self->{ua}->ssl_opts(
verify_hostname => $self->{config}->{ssl},
SSL_ca_file => $self->{config}->{ca}
);
if ($self->{config}->{ssl} == 0 ) {
$self->{ua}->ssl_opts(
SSL_verify_mode => SSL_VERIFY_NONE
);
}
} elsif ($self->{config}->{ssl} eq 1) {
# SSL verification is disabled by default in LWP prior to version 6
# we activate it using Crypt::SSLeay environment variables
$ENV{HTTPS_CA_FILE} = $self->{config}->{ca};
}
bless $self;
}
sub sendXML {
my ($self, $args) = @_;
my $logger = $self->{logger};
my $compress = $self->{compress};
my $message = $args->{message};
my $common = $self->{common};
my $req = HTTP::Request->new(POST => $self->{URI});
$req->header('Pragma' => 'no-cache', 'Content-type',
'application/x-compress');
$logger->debug ("sending XML");
$logger->debug ("sending: ".$message);
my $compressed = $compress->compress($message);
if (!$compressed) {
$logger->error ('failed to compress data');
return;
}
$req->content($compressed);
my $res = $self->{ua}->request($req);
# Checking if connected
if (!$res->is_success) {
$logger->error ('Cannot establish communication : '.$res->status_line);
return;
}
return $res ;
}
sub getXMLResp {
my ($self, $res, $msgtype) = @_;
my $logger = $self->{logger};
my $compress = $self->{compress};
# If no answer from OCS server
return unless $res;
# Reading the XML response from OCS server
my $content = $compress->uncompress($res->content);
if (!$content) {
$logger->error ("Deflating problem");
return;
}
my $tmp = "Ocsinventory::Agent::XML::Response::".$msgtype;
eval "require $tmp";
if ($@) {
$logger->error ("Can't load response module $tmp: $@");
}
$tmp->import();
my $response = $tmp->new ({
accountconfig => $self->{accountconfig},
accountinfo => $self->{accountinfo},
content => $content,
logger => $logger,
config => $self->{config},
common => $self->{common},
});
return $response;
}
sub getFile {
my ($self,$proto,$uri,$filetoget,$filepath) = @_;
my $logger= $self->{logger};
chomp($proto,$uri,$filetoget,$filepath);
my $url = "$proto://$uri/$filetoget";
my $response = $self->{ua}->mirror($url,$filepath);
if ($response->is_success){
$logger->debug("Success downloading $filetoget file...");
} else {
$logger->error("Failed downloading $filetoget: ".$response->status_line." !!!");
return 1;
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/XML/ 0000775 0000000 0000000 00000000000 13327377321 0020377 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/XML/Inventory.pm 0000664 0000000 0000000 00000020507 13327377321 0022736 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::XML::Inventory;
# TODO: resort the functions
use strict;
use warnings;
=head1 NAME
Ocsinventory::Agent::XML::Inventory - the XML abstraction layer
=head1 DESCRIPTION
OCS Inventory uses XML for the data transmission. The module is the
abstraction layer. It's mostly used in the backend module where it
called $inventory in general.
=cut
use XML::Simple;
use Digest::MD5 qw(md5_base64);
use Config;
use Ocsinventory::Agent::Backend;
=over 4
=item new()
The usual constructor.
=cut
sub new {
my (undef, $params) = @_;
my $self = {};
$self->{accountinfo} = $params->{context}->{accountinfo};
$self->{accountconfig} = $params->{context}->{accountconfig};
$self->{backend} = $params->{backend};
$self->{common} = $params->{context}->{common};
my $logger = $self->{logger} = $params->{context}->{logger};
$self->{config} = $params->{context}->{config};
if (!($self->{config}{deviceid})) {
$logger->fault ('deviceid unititalised!');
}
$self->{xmlroot}{QUERY} = ['INVENTORY'];
$self->{xmlroot}{DEVICEID} = [$self->{config}->{deviceid}];
#$self->{xmlroot}{CONTENT}{HARDWARE} = {
# TODO move that in a backend module
# ARCHNAME => [$Config{archname}]
#};
# Is the XML centent initialised?
$self->{isInitialised} = undef;
bless $self;
}
=item initialise()
Runs the backend modules to initialise the data.
=cut
sub initialise {
my ($self) = @_;
return if $self->{isInitialised};
$self->{backend}->feedInventory ({inventory => $self});
$self->{isInitialised} = 1;
}
=item getContent()
Return the inventory as a XML string.
=cut
sub getContent {
my ($self, $args) = @_;
my $logger = $self->{logger};
my $common = $self->{common};
if ($self->{isInitialised}) {
$self->processChecksum();
# checks for MAC, NAME and SSN presence
my $macaddr = $self->{xmlroot}->{CONTENT}->{NETWORKS}->[0]->{MACADDR}->[0];
my $ssn = $self->{xmlroot}->{CONTENT}->{BIOS}->{SSN}->[0];
my $name = $self->{xmlroot}->{CONTENT}->{HARDWARE}->{NAME}->[0];
my $missing;
$missing .= "MAC-address " unless $macaddr;
$missing .= "SSN " unless $ssn;
$missing .= "HOSTNAME " unless $name;
if ($missing) {
$logger->debug('Missing value(s): '.$missing.'. I will send this inventory to the server BUT important value(s) to identify the computer are missing');
}
$self->{accountinfo}->setAccountInfo($self);
my $content = XMLout( $self->{xmlroot}, RootName => 'REQUEST', XMLDecl => '', SuppressEmpty => undef );
# Cleaning XML to delete unprintable characters
my $clean_content=$common->cleanXml($content);
# Cleaning xmltags content after adding it o inventory
$common->flushXMLTags();
return $clean_content;
}
}
=item printXML()
Only for debugging purpose. Print the inventory on STDOUT.
=cut
sub printXML {
my ($self, $args) = @_;
if ($self->{isInitialised}) {
print $self->getContent();
}
}
=item writeXML()
Save the generated inventory as an XML file. The 'local' key of the config
is used to know where the file as to be saved.
=cut
sub writeXML {
my ($self, $args) = @_;
my $logger = $self->{logger};
if ($self->{config}{local} =~ /^$/) {
$logger->fault ('local path unititalised!');
}
if ($self->{isInitialised}) {
my $localfile = $self->{config}{local}."/".$self->{config}{deviceid}.'.ocs';
$localfile =~ s!(//){1,}!/!;
# Convert perl data structure into xml strings
if (open OUT, ">$localfile") {
print OUT $self->getContent();
close OUT or warn;
$logger->info("Inventory saved in $localfile");
} else {
warn "Can't open `$localfile': $!"
}
}
}
=item processChecksum()
Compute the field. This information is used by the server to
know which parts of the XML have changed since the last inventory.
The is done thank to the last_file file. It has MD5 prints of the previous
inventory.
=cut
sub processChecksum {
my $self = shift;
my $logger = $self->{logger};
my $common = $self->{common};
# To apply to $checksum with an OR
my %mask = (
'HARDWARE' => 1,
'BIOS' => 2,
'MEMORIES' => 4,
'SLOTS' => 8,
'REGISTRY' => 16,
'CONTROLLERS' => 32,
'MONITORS' => 64,
'PORTS' => 128,
'STORAGES' => 256,
'DRIVES' => 512,
'INPUT' => 1024,
'MODEMS' => 2048,
'NETWORKS' => 4096,
'PRINTERS' => 8192,
'SOUNDS' => 16384,
'VIDEOS' => 32768,
'SOFTWARES' => 65536,
'VIRTUALMACHINES' => 131072,
'CPUS' => 262144,
'BATTERIES' => 1048576,
);
if (!$self->{config}->{vardir}) {
$logger->fault ("vardir uninitialised!");
}
my $checksum = 0;
if (!$self->{config}{local} && $self->{config}->{last_statefile}) {
if (-f $self->{config}->{last_statefile}) {
# TODO: avoid a violant death in case of problem with XML
$self->{last_state_content} = XML::Simple::XMLin(
$self->{config}->{last_statefile},
SuppressEmpty => undef,
ForceArray => 1
);
} else {
$logger->debug ('last_state file: `'.
$self->{config}->{last_statefile}.
"' doesn't exist (yet).");
}
}
foreach my $section (keys %mask) {
# If the checksum has changed...
my $hash = md5_base64(XML::Simple::XMLout($self->{xmlroot}{'CONTENT'}{$section}));
if (!$self->{last_state_content}->{$section}[0] || $self->{last_state_content}->{$section}[0] ne $hash ) {
$logger->debug ("Section $section has changed since last inventory");
# We make OR on $checksum with the mask of the current section
$checksum |= $mask{$section};
# Finally I store the new value.
$self->{last_state_content}->{$section}[0] = $hash;
}
}
$common->setHardware({CHECKSUM => $checksum});
}
=item saveLastState()
At the end of the process IF the inventory was saved
correctly, the last_state is saved.
=cut
sub saveLastState {
my ($self, $args) = @_;
my $logger = $self->{logger};
if (!defined($self->{last_state_content})) {
$self->processChecksum();
}
if (!defined ($self->{config}->{last_statefile})) {
$logger->debug ("Can't save the last_state file. File path is not initialised.");
return;
}
if (open LAST_STATE, ">".$self->{config}->{last_statefile}) {
print LAST_STATE my $string = XML::Simple::XMLout( $self->{last_state_content}, RootName => 'LAST_STATE' );;
close LAST_STATE or warn;
} else {
$logger->debug ("Cannot save the checksum values in ".$self->{config}->{last_statefile}.":$!");
}
}
=item addSection()
A generic way to save a section in the inventory. Please avoid this
solution.
=cut
sub addSection {
my ($self, $args) = @_;
my $logger = $self->{logger};
my $multi = $args->{multi};
my $tagname = $args->{tagname};
for ( keys %{$self->{xmlroot}{CONTENT}} ){
if ( $tagname eq $_ ){
$logger->debug("Tag name `$tagname` already exists - Don't add it");
return 0;
}
}
if ($multi){
$self->{xmlroot}{CONTENT}{$tagname} = [];
} else {
$self->{xmlroot}{CONTENT}{$tagname} = {};
}
return 1;
}
=item feedSection()
Add information in inventory.
=back
=cut
# Q: is that really useful()? Can't we merge with addSection()?
sub feedSection{
my ($self, $args) = @_;
my $tagname = $args->{tagname};
my $values = $args->{data};
my $logger = $self->{logger};
my $found=0;
for ( keys %{$self->{xmlroot}{CONTENT}} ){
$found = 1 if $tagname eq $_;
}
if (!$found){
$logger->debug("Tag name `$tagname` doesn't exist - Cannot feed it");
return 0;
}
if ( $self->{xmlroot}{CONTENT}{$tagname} =~ /ARRAY/ ){
push @{$self->{xmlroot}{CONTENT}{$tagname}}, $args->{data};
} else {
$self->{xmlroot}{CONTENT}{$tagname} = $values;
}
return 1;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/XML/Prolog.pm 0000664 0000000 0000000 00000001422 13327377321 0022176 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::XML::Prolog;
use strict;
use warnings;
use XML::Simple;
use Digest::MD5 qw(md5_base64);
sub new {
my (undef, $params) = @_;
my $self = {};
$self->{config} = $params->{context}->{config};
$self->{logger} = $params->{context}->{logger};
die unless ($self->{config}->{deviceid}); #XXX
$self->{xmlroot}{QUERY} = ['PROLOG'];
$self->{xmlroot}{DEVICEID} = [$self->{config}->{deviceid}];
bless $self;
}
sub dump {
my $self = shift;
eval "use Data::Dumper;";
print Dumper($self->{xmlroot});
}
sub getContent {
my ($self, $args) = @_;
my $content=XMLout( $self->{xmlroot}, RootName => 'REQUEST', XMLDecl => '', SuppressEmpty => undef );
return $content;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/XML/Response.pm 0000664 0000000 0000000 00000002065 13327377321 0022536 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::XML::Response;
use strict;
use warnings;
use XML::Simple;
use Data::Dumper;
sub new {
my (undef, $params) = @_;
my $self = {};
$self->{accountconfig} = $params->{accountconfig};
$self->{accountinfo} = $params->{accountinfo};
$self->{content} = $params->{content};
$self->{config} = $params->{config};
$self->{common} = $params->{common};
my $logger = $self->{logger} = $params->{logger};
$self->{origmsg} = $params->{origmsg};
$logger->debug("=BEGIN=SERVER RET======");
$logger->debug(Dumper($self->{content}));
$logger->debug("=END=SERVER RET======");
$self->{parsedcontent} = undef;
bless $self;
}
sub getRawXML {
my $self = shift;
return $self->{content};
}
sub getParsedContent {
my ($self,$forcearray) = @_;
if (!$self->{parsedcontent}) {
$self->{parsedcontent} = $self->{common}->readXml($self->{content},$forcearray);
}
return $self->{parsedcontent};
}
sub origMsgType {
my ($self, $package) = @_;
return ref($package);
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/XML/Response/ 0000775 0000000 0000000 00000000000 13327377321 0022175 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/Agent/XML/Response/Inventory.pm 0000664 0000000 0000000 00000001072 13327377321 0024530 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::XML::Response::Inventory;
use strict;
use Ocsinventory::Agent::XML::Response;
our @ISA = ('Ocsinventory::Agent::XML::Response');
sub new {
my ($class, @params) = @_;
my $this = $class->SUPER::new(@params);
bless ($this, $class);
my $parsedContent = $this->getParsedContent(['ACCOUNTINFO']);
if ($parsedContent && exists ($parsedContent->{RESPONSE}) && $parsedContent->{RESPONSE} =~ /^ACCOUNT_UPDATE$/) {
$this->{accountinfo}->writeAccountInfoFile($parsedContent->{ACCOUNTINFO});
}
return $this;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/XML/Response/Prolog.pm 0000664 0000000 0000000 00000005276 13327377321 0024007 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::XML::Response::Prolog;
use strict;
use Ocsinventory::Agent::XML::Response;
our @ISA = ('Ocsinventory::Agent::XML::Response');
sub new {
my ($class, @params) = @_;
my $this = $class->SUPER::new(@params);
bless ($this, $class);
$this->updatePrologFreq();
$this->saveNextTime();
return $this;
}
sub isInventoryAsked {
my $self = shift;
my $parsedContent = $self->getParsedContent(['OPTION','PARAM']);
if ($parsedContent && exists ($parsedContent->{RESPONSE}) && $parsedContent->{RESPONSE} =~ /^SEND$/) {
return 1;
}
0
}
sub getOptionsInfoByName {
my ($self, $name) = @_;
my $parsedContent = $self->getParsedContent(['OPTION','PARAM']);
my $ret = [];
return unless ($parsedContent && $parsedContent->{OPTION});
foreach (@{$parsedContent->{OPTION}}) {
if ($_->{NAME} && $_->{NAME} =~ /^$name$/i) {
$ret = $_->{PARAM}
}
}
return $ret;
}
sub updatePrologFreq {
my $self = shift;
my $parsedContent = $self->getParsedContent(['OPTION','PARAM']);
my $logger = $self->{logger};
if ($parsedContent && exists ($parsedContent->{PROLOG_FREQ})) {
if( $parsedContent->{PROLOG_FREQ} ne $self->{accountconfig}->get("PROLOG_FREQ")){
$logger->info("PROLOG_FREQ has changed since last process(old=".$self->{accountconfig}->get("PROLOG_FREQ").",new=".$parsedContent->{PROLOG_FREQ}.")");
$self->{prologFreqChanged} = 1;
$self->{accountconfig}->set("PROLOG_FREQ", $parsedContent->{PROLOG_FREQ});
} else{
$logger->debug("PROLOG_FREQ has not changed since last process");
}
}
}
sub saveNextTime {
my ($self, $args) = @_;
my $logger = $self->{logger};
if (!$self->{config}->{next_timefile}) {
$logger->debug("no next_timefile to save!");
return;
}
my $parsedContent = $self->getParsedContent(['OPTION','PARAM']);
if (!open NEXT_TIME, ">".$self->{config}->{next_timefile}) {
$logger->error ("Cannot create the next_timefile `".$self->{config}->{next_timefile}."': $!");
return;
}
close NEXT_TIME or warn;
my $serverdelay = $self->{accountconfig}->get('PROLOG_FREQ');
my $time;
if( $self->{prologFreqChanged} ){
$logger->debug("Compute next_time file with random value");
$time = time + int rand(($serverdelay?$serverdelay*3600:$self->{config}->{delaytime}));
} else{
$time = time + ($serverdelay?$serverdelay*3600:$self->{config}->{delaytime});
}
utime $time,$time,$self->{config}->{next_timefile};
if ($self->{config}->{cron}) {
$logger->info ("Next inventory after ".localtime($time));
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Agent/XML/SimpleMessage.pm 0000664 0000000 0000000 00000001741 13327377321 0023476 0 ustar 00root root 0000000 0000000 package Ocsinventory::Agent::XML::SimpleMessage;
use strict;
use warnings;
use Data::Dumper; # XXX Debug
use XML::Simple;
use Digest::MD5 qw(md5_base64);
use Ocsinventory::Agent::XML::Prolog;
sub new {
my (undef, $params) = @_;
my $self = {};
$self->{config} = $params->{config};
$self->{accountinfo} = $params->{accountinfo};
die unless ($self->{config}->{deviceid}); #XXX
$self->{xmlroot}{QUERY} = ['PROLOG'];
$self->{xmlroot}{DEVICEID} = [$self->{config}->{deviceid}];
bless $self;
}
sub dump {
my $self = shift;
print Dumper($self->{xmlroot});
}
sub set {
my ($self, $args) = @_;
foreach (keys %$args) {
$self->{xmlroot}{$_} = [$args->{$_}];
}
}
sub getContent {
my ($self, $args) = @_;
$self->{accountinfo}->setAccountInfo($self);
my $content=XMLout( $self->{xmlroot}, RootName => 'REQUEST', XMLDecl => '', SuppressEmpty => undef );
return $content;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Compress.pm 0000664 0000000 0000000 00000005442 13327377321 0021037 0 ustar 00root root 0000000 0000000 package Ocsinventory::Compress;
use strict;
use File::Temp qw/ tempdir tempfile /;
sub new {
my (undef, $params) = @_;
my $self = {};
my $logger = $self->{logger} = $params->{logger};
eval{require Compress::Zlib;};
$self->{mode} = 'natif' unless $@;
chomp(my $gzippath=`which gzip 2>/dev/null`);
if ($self->{mode} eq 'natif') {
$logger->debug ('Compress::Zlib is available.');
} elsif (-x $gzippath) {
$logger->debug (
'Compress::Zlib is not available! The data will be compressed with
gzip instead but won\'t be accepted by server prior 1.02');
$self->{mode} = 'gzip';
$self->{tmpdir} = tempdir( CLEANUP => 1 );
mkdir $self->{tmpdir};
if ( ! -d $self->{tmpdir} ) {
$logger->fault("Failed to create the temp dir `$self->{tmpdir}'");
}
} else {
$self->{mode} = 'deflated';
$logger->debug ('I need the Compress::Zlib library or the gzip'.
' command to compress the data - The data will be sent uncompressed
but won\'t be accepted by server prior 1.02');
}
bless $self;
}
sub compress {
my ($self, $content) = @_;
my $logger = $self->{logger};
# native mode (zlib)
if ($self->{mode} eq 'natif') {
return Compress::Zlib::compress($content);
} elsif ($self->{mode} eq 'gzip'){
# gzip mode
my ($fh, $filename) = tempfile( DIR => $self->{tmpdir} );
print $fh $content;
close $fh;
system ("gzip --best $filename > /dev/null");
# print "filename ".$filename."\n";
my $ret;
open FILE, "<$filename.gz";
$ret .= $_ foreach ();
close FILE;
if ( ! unlink "$filename.gz" ) {
$logger->debug("Failed to remove `$filename.gz'");
}
return $ret;
} elsif($self->{mode} eq 'deflated'){
# No compression available
return $content;
}
}
sub uncompress {
my ($self,$data) = @_;
my $logger = $self->{logger};
# Native mode
if ($self->{mode} eq 'natif') {
return Compress::Zlib::uncompress($data);
} elsif($self->{mode} eq 'gzip'){
# Gzip mode
my ($fh, $filename) = tempfile( DIR => $self->{tmpdir}, SUFFIX => '.gz' );
print $fh $data;
close $fh;
system ("gzip -d $filename");
my ($uncompressed_filename) = $filename =~ /(.*)\.gz$/;
my $ret;
open FILE, "<$uncompressed_filename";
$ret .= $_ foreach ();
close FILE;
if ( ! unlink "$uncompressed_filename" ) {
$logger->debug("Failed to remove `$uncompressed_filename'");
}
return $ret;
} elsif($self->{mode} eq 'deflated'){
# No compression available
return $data;
}
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/Logger.pm 0000664 0000000 0000000 00000004436 13327377321 0020465 0 ustar 00root root 0000000 0000000 package Ocsinventory::Logger;
# TODO use Log::Log4perl instead.
use Carp;
sub new {
my (undef, $params) = @_;
my $self = {};
bless $self;
$self->{backend} = [];
$self->{config} = $params->{config};
$self->{debug} = $self->{config}->{debug}?1:0;
my @logger;
if (exists ($self->{config}->{logger})) {
@logger = split /,/, $self->{config}->{logger};
} else {
# if no 'logger' parameter exist I use Stderr as default backend
push @logger, 'Stderr';
}
my @loadedMbackends;
foreach (@logger) {
my $backend = "Ocsinventory::LoggerBackend::".$_;
eval ("require $backend"); # TODO deal with error
if ($@) {
print STDERR "Failed to load Logger backend: $backend ($@)\n";
next;
} else {
push @loadedMbackends, $_;
}
my $obj = new $backend ({
config => $self->{config},
});
push @{$self->{backend}}, $obj if $obj;
}
my $version = "Ocsinventory unified agent for UNIX, Linux and MacOSX ";
$version .= exists ($self->{config}->{VERSION})?$self->{config}->{VERSION}:'';
$self->debug($version."\n");
$self->debug("Log system initialised (@loadedMbackends)");
$self;
}
sub log {
my ($self, $args) = @_;
# levels: info, debug, warn, fault
my $level = $args->{level};
my $message = $args->{message};
my $header = $self->{header};
return if ($level =~ /^debug$/ && !($self->{debug}));
chomp($message);
#Add a header to message if needed
$message="$header $message" if $header;
$level = 'info' unless $level;
foreach (@{$self->{backend}}) {
$_->addMsg ({
level => $level,
message => $message
});
}
confess if $level =~ /^fault$/; # Die with a backtace
}
sub debug {
my ($self, $msg) = @_;
$self->log({ level => 'debug', message => $msg});
}
sub info {
my ($self, $msg) = @_;
$self->log({ level => 'info', message => $msg});
}
sub error {
my ($self, $msg) = @_;
$self->log({ level => 'error', message => $msg});
}
sub fault {
my ($self, $msg) = @_;
$self->log({ level => 'fault', message => $msg});
}
sub user {
my ($self, $msg) = @_;
$self->log({ level => 'user', message => $msg});
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/LoggerBackend/ 0000775 0000000 0000000 00000000000 13327377321 0021370 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/lib/Ocsinventory/LoggerBackend/File.pm 0000664 0000000 0000000 00000001122 13327377321 0022601 0 ustar 00root root 0000000 0000000 package Ocsinventory::LoggerBackend::File;
use strict;
sub new {
my (undef, $params) = @_;
my $self = {};
$self->{config} = $params->{config};
$self->{logfile} = $self->{config}->{logdir}."/".$self->{config}->{logfile};
bless $self;
}
sub addMsg {
my ($self, $args) = @_;
my $level = $args->{level};
my $message = $args->{message};
return if $message =~ /^$/;
open FILE, ">>".$self->{config}->{logfile} or warn "Can't open ".
"`".$self->{config}->{logfile}."'\n";
print FILE "[".localtime()."][$level] $message\n";
close FILE;
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/LoggerBackend/Stderr.pm 0000664 0000000 0000000 00000001121 13327377321 0023164 0 ustar 00root root 0000000 0000000 package Ocsinventory::LoggerBackend::Stderr;
sub new {
my (undef, $params) = @_;
my $self = {};
$self->{config} = $params->{config};
bless $self;
}
sub addMsg {
my ($self, $args) = @_;
my $level = $args->{level};
my $message = $args->{message};
return if $message =~ /^$/;
# if STDERR has been hijacked, I take its saved ref
my $stderr;
if (exists ($self->{config}->{savedstderr})) {
$stderr = $self->{config}->{savedstderr};
} else {
open ($stderr, ">&STDERR");
}
print $stderr "[$level] $message\n";
}
1;
UnixAgent-2.4.2/lib/Ocsinventory/LoggerBackend/Syslog.pm 0000664 0000000 0000000 00000001011 13327377321 0023177 0 ustar 00root root 0000000 0000000 package Ocsinventory::LoggerBackend::Syslog;
# Not tested yet!
use Sys::Syslog qw( :DEFAULT setlogsock);
sub new {
my (undef, $params) = @_;
my $self = {};
openlog("ocs-agent",'cons.pid', $params->{config}->{logfacility});
syslog('debug', 'syslog backend enabled');
bless $self;
}
sub addMsg {
my (undef, $args) = @_;
my $level = $args->{level};
my $message = $args->{message};
return if $message =~ /^$/;
syslog('info', $message);
}
sub destroy {
closelog();
}
1;
UnixAgent-2.4.2/memconf 0000775 0000000 0000000 00001405701 13327377321 0015013 0 ustar 00root root 0000000 0000000 #!/usr/bin/env perl
#
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# MODIFY THE LOCATION TO THE FULL PATH TO PERL ABOVE IF NECESSARY
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# @(#) memconf - Identify sizes of memory modules installed on a
# @(#) Solaris, Linux, FreeBSD or HP-UX workstation or server.
# @(#) Micron Technology, Inc. - Tom Schmidt 16-Nov-2017 V3.14
#
# Maintained by Tom Schmidt (tschmidt@micron.com)
#
# Check http://sourceforge.net/projects/memconf/ or my website at
# http://www.4schmidts.com/unix.html to get the latest version of memconf.
#
# If memconf does not recognize a system, then please run 'memconf -D' to
# have it automatically E-mail me the information I need to enhanced to
# recognize it. If the unrecognized system is a Sun clone, please also send
# any hardware documentation on the memory layout that you may have.
#
# Usage: memconf [ -v | -D | -h ] [explorer_dir]
# -v verbose mode
# -D E-mail results to memconf maintainer
# -h print help
# explorer_dir Sun/Oracle Explorer output directory
#
# memconf reports the size of each SIMM/DIMM memory module installed in a
# system. It also reports the system type and any empty memory sockets.
# In verbose mode, it also reports the following information if available:
# - banner name, model and CPU/system frequencies
# - address range and bank numbers for each module
#
# memconf is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# Original version based on SunManagers SUMMARY by Howard Modell
# (h.modell@ieee.org) on 29-Jan-1997.
#
# Tested to work on 32-bit and 64-bit kernels on:
# - Solaris 10 6/06 or later on x86 with /usr/platform/i86pc/sbin/prtdiag
# - Linux on SPARC with sparc-utils and /dev/openprom
# - Linux on x86 and x86_64 with kernel-utils or pmtools for dmidecode
# - FreeBSD on x86 and x86_64 with dmidecode
# - Most HP-UX systems with SysMgmtPlus (cprop) or Support Tools Manager (cstm)
# - Solaris (SunOS 4.X or 5.X) on the following SPARC systems
# - sun4c Sun SS1, SS2, IPC, IPX, ELC with Open Boot PROM V2.X
# - sun4m Sun 4/6x0, SS4, SS5, SS10, SS20, LX/ZX, Classic, Voyager, JavaEngine1
# - sun4d Sun SPARCserver-1000, 1000E, SPARCcenter-2000, 2000E
# - sun4u Sun Ultra 1, 2, 5, 10, 30, 60, 450
# - sun4u Sun Ultra 80, Ultra Enterprise 420R, and Netra t1400/1405.
# - sun4u Sun Ultra Enterprise 220R, 250, 450
# - sun4u Sun Ultra Enterprise 3000, 3500, 4000/5000, 4500/5500, 6000, 6500
# - sun4u1 Sun Ultra Enterprise 10000
# - sun4u Sun StorEdge N8400 and N8600 Filer
# - sun4u Sun SPARCengine Ultra AX, AXi, AXmp, AXmp+, AXe
# - sun4u Sun SPARCengine CP 1400, CP 1500, CP2140
# - sun4u Sun Netra t1 100/105, t1120/1125, ft1800, X1, T1 200, AX1105-500, 120
# - sun4u Sun Netra 20 (Netra T4)
# - sun4u Sun Netra ct800
# - sun4u Sun Blade 100, 150, 1000, 1500, 2000, 2500
# - sun4u Sun Fire 280R
# - sun4u Sun Fire 3800, 4800, 4810, 6800
# - sun4u Sun Fire V100, V120, V210, V240, V250, V440
# - sun4u Sun Netra 210, 240, 440
# - sun4u Sun Fire V125, V215, V245, V445
# - sun4u Sun Fire V480, V490, V880, V880z, V890
# - sun4u Sun Fire 12000, 15000, E20K, E25K
# - sun4u Sun Fire V1280, Netra 1280 (Netra T12)
# - sun4u Sun Fire E2900, E4900, E6900
# - sun4u Sun Fire B100s Blade Server
# - sun4u Sun Ultra 25 Workstation
# - sun4u Sun Ultra 45 Workstation
# - sun4u Sun/Fujitsu Siemens SPARC Enterprise M3000, M4000, M5000, M8000,
# and M9000 Server
# - sun4v Sun Fire T2000, T1000, Netra T2000
# - sun4v Sun Blade T6300, T6320, T6340
# - sun4v Sun SPARC Enterprise T2000, T1000 Server
# - sun4v Sun SPARC Enterprise T5120, T5140, T5220, T5240 Server, Netra T5220
# - sun4v Sun SPARC Enterprise T5440 Server, Netra T5440
# - sun4v Oracle SPARC T3-1, T3-1B, T3-2, T4-1, T4-2, T4-4, T5-2, T5-4, T7-4
# - sun4v Oracle SPARC S7-2, S7-2L
# - sun4v Fujitsu SPARC M10-1, M10-4
# - sun4m Tatung COMPstation 5, 10, 20AL, 20S and 20SL clones
# - sun4m transtec SPARCstation 20I clone
# - sun4m Rave Axil-255 SPARCstation 5 clone
# - sun4m Rave Axil-245, 311 and 320 clones (no verbose output)
# - sun4u AXUS Ultra 250
# - sun4u Tatung COMPstation U2, U60 and U80D clones
# - Force Computers SPARC clones (no verbose output)
# - Tadpole SPARCbook 3 and RDI PowerLite-170 (no verbose output)
# - Tadpole VoyagerIIi
# - Tadpole (Cycle) 3200 CycleQUAD Ultra 2 upgrade motherboard
# - Tadpole (Cycle) UP-520-IIi SPARCstation 5/20 upgrade motherboard
# - Tadpole SPARCle
# - Auspex 7000/650 (no verbose output)
# - Fujitsu S-4/10H, S-4/20L and S-4/20H clones (no verbose output)
# - Fujitsu GP7000, GP7000F
# - Fujitsu Siemens PrimePower 200, 400, 600, 800, 1000, 2000
# - Fujitsu Siemens PrimePower 250, 450, 650, 850
# - Fujitsu Siemens PrimePower 900, 1500, 2500, HPC2500
# - Twinhead TWINstation 5G, 20G
# - Detects VSIMMs for SX graphics on SS10SX/SS20 (1st VSIMM only)
# - Detects Prestoserve NVSIMMs on SS10/SS20/SS1000/SC2000
#
# Untested systems that should work:
# - sun4c Sun SS1+ with Open Boot PROM V2.X
# - sun4m Tatung COMPstation 20A clone
# - sun4u Sun Netra ct400, ct410, ct810
# - sun4u Sun SPARCengine CP2040, CP2060, CP2080, CP2160
# - sun4v Sun Netra CP3260
# - sun4v Oracle SPARC T3-1BA, T3-4, T4-1B, T4-2B, T5-8, T5-1B, T7-1, T7-2
# - sun4v Oracle SPARC M5-32, M6-32, M7-8, M7-16
# - sun4v Oracle Netra SPARC T3 systems
# - sun4v Fujitsu SPARC M10-4S
# - May not work properly on Sun clones
#
# Won't work on:
# - SPARC systems without /dev/openprom
# - sun4c Sun SS1, SS1+, SLC, IPC with Open Boot PROM V1.X (no 'memory' lines
# in devinfo/prtconf output)
# - sun4 kernel architecture, and sun3 and older systems
# - Perl 5.001 is known to have problems with hex number conversions
# - Does not detect unused VSIMMs (another FB installed) or second VSIMM
#
# To Do list and Revision History can be found on the maintainers web site at
# http://www.4schmidts.com/unix.html
# Uncomment for debugging (perl 5 only)
#use diagnostics;
$^W=1; # Enables -w warning switch, put here for SunOS4 compatibility.
$starttime=(times)[0];
$version="V3.14";
$version_date="16-Nov-2017";
$URL="http://sourceforge.net/projects/memconf/";
$newpath="/usr/sbin:/sbin:/bin:/usr/bin:/usr/ucb:/usr/local/bin:/var/local/bin";
$ENV{PATH}=(defined($ENV{PATH})) ? "$newpath:$ENV{PATH}" : $newpath;
# Force C locale so that output is in English
$ENV{LC_ALL}="C";
$_=$];
($PERL_VERSION_MAJOR)=/(\d).*/;
if ($PERL_VERSION_MAJOR < 5) {
($PERL_VERS)=/(\d\.\d)/;
($PERL_PATCH)=/(\d*)$/;
$PERL_PATCH="0$PERL_PATCH" if ($PERL_PATCH < 10);
$PERL_VERSION="$PERL_VERS$PERL_PATCH";
} else {
($PERL_VERSION)=/(\d\.\d{3}).*/;
}
$uname="/usr/bin/uname";
$uname="/bin/uname" if (-x '/bin/uname');
$running_on="";
if (-x $uname) {
$os=&mychomp(`$uname`);
$os="FreeBSD-based $os" if ($os ne "FreeBSD" && -f '/etc/freebsd-update.conf');
$running_on=$os;
$hostname=&mychomp(`$uname -n`);
if ($os eq "AIX") {
$machine=&mychomp(`$uname -M`);
# oslevel command can return stderr output, so use uname instead
$osmajor=&mychomp(`$uname -v`);
$osminor=&mychomp(`$uname -r`);
$osrel="$osmajor.$osminor";
$kernver="";
$platform=&mychomp(`$uname -p`);
} else {
$machine=&mychomp(`$uname -m`);
$osrel=&mychomp(`$uname -r`);
$kernver=&mychomp(`$uname -v`);
$platform=$machine;
}
} else {
$hostname="";
$machine="";
$os="this unsupported";
$osrel="";
$kernver="";
}
$osrelease="";
$prtdiag_cmd="";
$prtdiag_exec="";
$have_prtdiag_data=0;
$prtdiag_checked=0;
$prtdiag_memory=0;
$prtfru_cmd="";
$have_prtfru_data=0;
$have_prtfru_details=0;
$missing_prtfru_details=" ";
$prtpicl_cmd="";
$have_prtpicl_data=0;
$psrinfo_cmd="";
$have_psrinfo_data=0;
$use_psrinfo_data=1;
$psrinfo_checked=0;
$virtinfo_cmd="";
$have_virtinfo_data=0;
$virtinfoLDOMcontrolfound=0;
$cfgadm_cmd="";
$have_cfgadm_data=0;
$ipmitool_cmd="";
$have_ipmitool_data=0;
$ipmi_cpucnt=0;
$ipmi_cputype="";
@ipmi_mem=("");
$ipmi_memory=0;
$smbios_cmd="";
$have_smbios_data=0;
@smbios_mem=("");
$smbios_memory=0;
$kstat_cmd="";
$have_kstat_data=0;
@kstat_brand=();
@kstat_MHz=();
$kstat_cpubanner="";
@kstat_core_id=("");
@kstat_core=("");
@kstat_ncore_per_chip=("");
@kstat_ncpu_per_chip=("");
$kstat_checked=0;
$ldm_cmd="";
$have_ldm_data=0;
$ldm_memory=0;
$free_cmd="";
$free_checked="";
$have_free_data=0;
$meminfo_cmd="";
$have_meminfo_data=0;
$modprobe_eeprom_cmd="";
$decodedimms_cmd="";
$decodedimms_checked="";
$have_decodedimms_data=0;
@reorder_decodedimms=();
$topology_cmd="";
@topology_header=();
@topology_data=();
$topology_mfg="";
$maxmembusspeed="";
$foundspeed=0;
$mixedspeeds=0;
$have_x86_devname=0;
$manufacturer="";
$systemmanufacturer="";
$boardmanufacturer="";
$baseboard="";
$biosvendor="";
if (-d '/usr/platform') {
$platform=&mychomp(`$uname -i`);
if (-x "/usr/platform/$platform/sbin/prtdiag") {
$prtdiag_cmd="/usr/platform/$platform/sbin/prtdiag";
} elsif (-x "/usr/platform/$machine/sbin/prtdiag") {
$prtdiag_cmd="/usr/platform/$machine/sbin/prtdiag";
} elsif (-x '/usr/sbin/prtdiag') {
$prtdiag_cmd="/usr/sbin/prtdiag";
}
} elsif (-x '/usr/kvm/prtdiag') {
$platform=$machine;
$prtdiag_cmd='/usr/kvm/prtdiag';
} elsif (-x '/usr/sbin/prtdiag') {
$platform=&mychomp(`$uname -i`);
$prtdiag_cmd="/usr/sbin/prtdiag";
}
if ($prtdiag_cmd) {
if (-x $prtdiag_cmd) {
$prtdiag_exec="$prtdiag_cmd";
}
}
$buffer="";
$filename="";
$installed_memory=0;
$failed_memory=0;
$spare_memory=0;
$failing_memory=0;
$memory_error_logged=0;
$failed_fru="";
$ultra=0;
$simmbanks=0;
$bankcnt=0;
$slot0=0;
$smallestsimm=16777216;
$largestsimm=0;
$found8mb=0;
$found16mb=0;
$found32mb=0;
$found10bit=0;
$found11bit=0;
$foundbank1or3=0;
$sxmem=0;
$nvmem=0;
$nvmem1=0;
$nvmem2=0;
$memtype="SIMM";
$sockettype="socket";
$verbose=0;
$debug=0;
$recognized=1;
$untested=1;
$untested_type="";
$perlhexbug=0;
$exitstatus=0;
$meg=1048576;
@socketstr=("");
@socketlabelstr=("");
@orderstr=("");
@groupstr=("");
@bankstr=("");
@banksstr=("");
$bankname="banks";
@bytestr=("");
@slotstr=("");
$simmrangex=0;
$simmrange=1;
$showrange=1;
$start1x="";
$stop1x="";
@simmsizes=(0,16777216);
@simmsizesfound=();
@memorylines=("");
$socket="";
$socketlabel="";
$order="";
$group="";
$slotnum="";
$bank="";
$dualbank=0;
$byte="";
$gotmemory="";
$gotmodule="";
$gotmodulenames="";
$gotcpunames="";
$gotcpuboards="";
$slotname0="";
@boards_cpu="";
@boards_mem="";
$empty_banks="";
$banks_used="";
$nvsimm_banks="";
$boardslot_cpu=" ";
$boardslot_cpus=" ";
@boardslot_cpus=();
$boardslot_mem=" ";
$boardslot_mems=" ";
@boardslot_mems=();
$boardfound_cpu=0;
$boardfound_mem=0;
$prtdiag_has_mem=0;
$prtdiag_banktable_has_dimms=0;
$prtdiag_failed=0;
$prtconf_warn="";
$flag_cpu=0;
$flag_mem=0;
$flag_rewrite_prtdiag_mem=0;
$format_cpu=0;
$format_mem=0;
$foundname=0;
$sockets_used="";
$sockets_empty="";
$sortslots=1;
$devtype="";
$interleave=0;
$stacked=0;
$freq=0;
$sysfreq=0;
$cpufreq=0;
$cputype="";
$cputype_prtconf="";
$cputype_psrinfo="";
$cpuinfo_cputype="";
@cpucnt=();
$cpucntfrom="";
$cpucntflag=0;
$cpuinfo_cpucnt=0;
$have_cpuinfo_data=0;
$cpuinfo_coreidcnt=0;
$cpuinfo_cpucores=0;
@cpuinfo_physicalid=();
$cpuinfo_physicalidcnt=0;
$cpuinfo_siblings=0;
$cpuinfo_checked=0;
$xm_info_cmd="";
$have_xm_info_data=0;
$xen_ncpu=0;
$xen_nr_nodes=0;
$xen_sockets_per_node=0;
$xen_cores_per_socket=0;
$foundGenuineIntel=0;
@diagcpucnt=();
$diagthreadcnt=0;
$psrcpucnt=0;
$foundpsrinfocpu=0;
$ncpu=0; # remains 0 if using prtdiag output only
$ndcpu=0; # prtdiag cpu count
$npcpu=0; # physical cpu count
$nvcpu=0; # virtual cpu count
$necpu=0; # empty cpu socket count
$threadcnt=0;
$corecnt=1;
$hyperthread=0;
$hyperthreadcapable=0;
$header_shown=0;
$romver="";
$romvernum="";
$SUNWexplo=0;
$banner="";
$bannermore="";
$cpubanner="";
$diagbanner="";
$model="";
$systemmodel="";
$boardmodel="";
$modelmore="";
$model_checked=0;
$BSD=0; # Initially assume SunOS 5.X
$config_cmd="/usr/sbin/prtconf -vp";
$config_command="prtconf";
$config_permission=0;
$permission_error="";
$dmidecode_error="";
$freephys=0;
$isX86=0;
$HPUX=0;
$devname=""; # Sun internal development code name
$familypn=""; # Sun family part number (system code)
$clone=0;
$totmem=0;
$latest_dmidecode_ver="2.12";
$minimum_dmidecode_ver="2.8";
$dmidecode_ver="0";
$dmidecodeURL="http://www.nongnu.org/dmidecode/";
$have_dmidecode=0;
$cpuarr=-1;
$memarr=-1;
$release="";
$waitshown=0;
$totalmemshown=0;
$vmshown=0;
$controlLDOMshown=0;
$helpers_defined=0;
$picl_foundmemory=0;
@picl_mem_pn=();
@picl_mem_bank=();
@picl_mem_dimm=();
if (-x '/usr/bin/id') {
$uid=&mychomp(`/usr/bin/id`);
$uid=~s/uid=//;
$uid=~s/\(.*//;
} else {
$uid=0; # assume super-user
}
$empty_memory_printed=0;
@filelist=();
#
# Parse options
#
foreach $name (@ARGV) {
if ($name eq "-v") {
# verbose mode
$verbose=1;
} elsif ($name eq "-d") {
# more verbose debug mode
$verbose=2;
} elsif ($name eq "-debug") {
# most verbose debug mode
$debug=1;
} elsif ($name eq "-debugtime") {
# most verbose debug mode with timestamps
$debug=2;
} elsif ($name eq "-D") {
# E-mail information of system to maintainer
$verbose=3;
open(MAILFILE, ">/tmp/memconf.output") || die "can't open /tmp/memconf.output: $!";
print MAILFILE "Output from 'memconf -d' on $hostname\n";
print MAILFILE "----------------------------------------------------\n";
close(MAILFILE);
*STDERR = *STDOUT; # Redirect stderr to stdout
open(STDOUT, "| tee -a /tmp/memconf.output") || die "can't open /tmp/memconf.output: $!";
print "Gathering memconf data to E-mail to maintainer. This may take a few minutes.\nPlease wait...\n";
} elsif (-f "$name/sysconfig/prtconf-vp.out") {
# Sun/Oracle Explorer output
$SUNWexplo=1;
# Special case for regression testing Sun/Oracle Explorer data
$os="SunOS";
open(FILE, "<$name/sysconfig/prtconf-vp.out");
@config=;
close(FILE);
if (-f "$name/sysconfig/prtdiag-v.out") {
open(FILE, "<$name/sysconfig/prtdiag-v.out");
@prtdiag=;
$have_prtdiag_data=1;
$prtdiag_cmd="/usr/platform/$platform/sbin/prtdiag";
$prtdiag_exec="$prtdiag_cmd";
close(FILE);
}
if (-f "$name/fru/prtfru_-x.out") {
open(FILE, "<$name/fru/prtfru_-x.out");
@prtfru=;
$have_prtfru_data=1;
$prtfru_cmd='/usr/sbin/prtfru';
close(FILE);
}
if (-f "$name/sysconfig/prtpicl-v.out") {
open(FILE, "<$name/sysconfig/prtpicl-v.out");
@prtpicl=;
$have_prtpicl_data=1;
$prtpicl_cmd='/usr/sbin/prtpicl';
close(FILE);
}
if (-f "$name/sysconfig/psrinfo-v.out") {
open(FILE, "<$name/sysconfig/psrinfo-v.out");
@psrinfo=;
$have_psrinfo_data=1;
$psrinfo_cmd='/usr/sbin/psrinfo';
close(FILE);
}
# Sun/Oracle Explorer does not include "psrinfo -p" or
# "psrinfo -p -v" data yet.
# Is virtinfo output available in Oracle Explorer?
if (-f "$name/sysconfig/cfgadm-alv.out") {
open(FILE, "<$name/sysconfig/cfgadm-alv.out");
@cfgadm=;
$have_cfgadm_data=1;
$cfgadm_cmd='/usr/sbin/cfgadm';
close(FILE);
}
if (-f "$name/sysconfig/uname-a.out") {
open(FILE, "<$name/sysconfig/uname-a.out");
$uname=&mychomp();
close(FILE);
@unamearr=split(/\s/, $uname);
$hostname=$unamearr[1];
$machine=$unamearr[4];
$osrel=$unamearr[2];
$platform=$unamearr[6];
$prtdiag_cmd="/usr/platform/$platform/sbin/prtdiag";
$prtdiag_exec="$prtdiag_cmd";
} else {
if ($config[0] =~ /System Configuration:/) {
@machinearr=split(/\s+/, $config[0]);
$machine=$machinearr[4];
}
$osrel="";
$hostname="";
}
if (-f "$name/sysconfig/prtconf-V.out") {
open(FILE, "<$name/sysconfig/prtconf-V.out");
$romver=&mychomp();
close(FILE);
}
$filename="$name";
} elsif (-f $name) {
# Regression test file with prtconf/dmidecode output
open(FILE, "<$name");
@config=;
close(FILE);
# Regression test file may also have prtdiag, etc.
@prtdiag=@config;
@prtfru=@config;
$have_prtfru_data=1;
@prtpicl=@config;
$have_prtpicl_data=1;
@psrinfo=@config;
$have_psrinfo_data=1;
@virtinfo=@config;
$have_virtinfo_data=1;
@cfgadm=@config;
$have_cfgadm_data=1;
@ipmitool=@config;
$have_ipmitool_data=1;
@ldm=@config;
$have_ldm_data=1;
@cpuinfo=@config;
$have_cpuinfo_data=1;
@meminfo=@config;
$have_meminfo_data=1;
@free=@config;
$have_free_data=1;
@xm_info=@config;
$have_xm_info_data=1;
@decodedimms=@config;
@smbios=@config;
$have_smbios_data=1;
@kstat=@config;
$have_kstat_data=1;
@machinfo=@config;
$hostname="";
$osrel="";
# Check test file to determine OS and machine
for ($val=0; $val <= $#config; $val++) {
if ($config[$val]) {
if ($config[$val] =~ /System Configuration:/) {
@machinearr=split(/\s+/, $config[$val]);
$machine=$machinearr[4];
$machine="" if (! defined($machine));
$platform=$machine;
# Special case for regression testing SunOS prtconf files
$os="SunOS";
last;
} elsif ($config[$val] =~ / dmidecode |DMI .* present/) {
$have_dmidecode=1;
if ($config[$val] =~ / dmidecode /) {
$dmidecode_ver=&mychomp($config[$val]);
$dmidecode_ver=~s/.* dmidecode //;
}
$machine="";
$platform="";
# Special case for regression testing Linux dmidecode files
$os="Linux";
last;
}
}
}
$filename="$name";
} else {
&show_help;
}
}
&pdebug("starting");
print "memconf: $version $version_date $URL\n" if (-t STDOUT || $verbose);
&find_helpers;
if (! $filename && -r '/proc/cpuinfo') {
open(FILE, "/proc/cpuinfo");
@cpuinfo=;
close(FILE);
$have_cpuinfo_data=1;
}
if (! $filename && $xm_info_cmd) {
@xm_info=&run("$xm_info_cmd");
$have_xm_info_data=1;
}
# Check cpuinfo now on unsupported machines (arm, mips, etc.)
&check_cpuinfo if (! $filename && $machine !~ /.86|ia64|amd64|sparc/);
&check_free;
&check_dmidecode if ($have_dmidecode);
if (! $filename) {
if ($os eq "HP-UX") {
&hpux_check;
if (-x '/opt/propplus/bin/cprop') {
&hpux_cprop;
} elsif (-x '/usr/sbin/cstm') {
&hpux_cstm;
} else {
&show_header;
&show_supported;
}
} elsif ($os =~ /Linux|FreeBSD/) {
&linux_distro if (! $release);
if ($machine =~ /arm/i) {
if (-f '/etc/Alt-F' && -f '/tmp/board') {
# NAS model
open(FILE, " );
close(FILE);
} elsif (-f '/etc/model') {
# DLink NAS model
open(FILE, ");
close(FILE);
}
}
# Use dmidecode for Linux x86, not for Linux SPARC
&check_dmidecode if ($config_cmd =~ /dmidecode/ && -x "$config_cmd" && ($machine =~ /.86/ || ! -x '/usr/sbin/prtconf'));
if ($machine =~ /.86/ || ! -e '/dev/openprom') {
&show_header;
&show_supported;
}
} elsif ($os ne "SunOS") {
&show_header;
&show_supported;
}
if (-f '/vmunix') {
# SunOS 4.X (Solaris 1.X)
$BSD=1;
if (! -x '/usr/etc/devinfo') {
print "ERROR: no 'devinfo' command. Aborting.\n";
&pdebug("exit 1");
exit 1;
}
$config_cmd="/usr/etc/devinfo -pv";
$config_command="devinfo";
} else {
# Solaris 2.X or later
$BSD=0;
if (! -x '/usr/sbin/prtconf') {
print "ERROR: no 'prtconf' command. Aborting.\n";
&pdebug("exit 1");
exit 1;
}
$config_cmd="/usr/sbin/prtconf -vp";
$config_command="prtconf";
}
} else {
# Special case for regression testing SunOS4 and SunOS5 files
if ($filename =~ /\bdevinfo\./) {
$os="SunOS";
$BSD=1;
} elsif ($filename =~ /\bprtconf\./) {
$os="SunOS";
$BSD=0;
}
# Special case for regression testing Linux files
$os="Linux" if ($filename =~ /Linux/);
# Special case for regression testing HP-UX files
if ($filename =~ /\bcprop[\.+]/) {
&hpux_check;
&hpux_cprop;
} elsif ($filename =~ /\b(cstm|machinfo)[\.+]/) {
&hpux_check;
&hpux_cstm;
}
}
$kernbit="";
$hasprtconfV=0;
$solaris="";
$solaris="1.0" if ($osrel eq "4.1.1");
$solaris="1.0.1" if ($osrel eq "4.1.2");
$solaris="1.1" if ($osrel =~ /4.1.3/);
$solaris="1.1.1" if ($osrel eq "4.1.3_U1");
$solaris="1.1.2" if ($osrel eq "4.1.4");
if ($osrel =~ /^5./) {
$osminor=$osrel;
$osminor=~s/^5.//;
if ($SUNWexplo) {
if (-f "$filename/etc/release") {
open(FILE, "<$filename/etc/release");
$release=;
close(FILE);
}
} else {
if (-f '/etc/release') {
open(FILE, ";
close(FILE);
}
}
if ($release =~ "Solaris") {
$release=~s/\s+//;
$release=&mychomp($release);
$solaris="$release";
}
if ($release =~ "OmniOS") {
$release=~s/\s+//;
$release=&mychomp($release);
$solaris="$release";
}
if ($osminor =~ /^[7-9]$|^1[0-9]$/) {
$hasprtconfV=1;
$solaris=$osminor if (! $solaris);
$kernbit=32;
if ($SUNWexplo) {
$cpuarch="";
if (-f "$filename/sysconfig/isainfo.out") {
open(FILE, "<$filename/sysconfig/isainfo.out");
$cpuarch=;
close(FILE);
} elsif (-f "$filename/sysconfig/isainfo-kv.out") {
open(FILE, "<$filename/sysconfig/isainfo-kv.out");
$cpuarch=;
close(FILE);
}
$kernbit=64 if ($cpuarch =~ /sparcv9|ia64|amd64/);
} elsif (-x '/bin/isainfo') {
$kernbit=&mychomp(`/bin/isainfo -b`);
}
} elsif ($osminor =~ /^[4-6]$/) {
$hasprtconfV=1;
$solaris="2.$osminor" if (! $solaris);
} else {
$solaris="2.$osminor";
}
# x86 Solaris 2.1 through 2.5.1 has different syntax than SPARC
$config_cmd="/usr/sbin/prtconf -v" if ($machine eq "i86pc" && $osminor =~ /^[1-5]$/);
# Solaris x86 returns booting system rather than PROM version
$hasprtconfV=0 if ($machine eq "i86pc");
}
if (! $filename) {
@config=&run("$config_cmd");
if ($hasprtconfV) {
# SPARC Solaris 2.4 or later
$romver=&mychomp(`/usr/sbin/prtconf -V 2>&1`);
if ($romver eq "Cannot open openprom device") {
$prtconf_warn="ERROR: $romver";
$romver="";
} else {
@romverarr=split(/\s/, $romver);
$romvernum=$romverarr[1];
}
} else {
# SPARC Solaris 2.3 or older, or Solaris x86
# Try to use sysinfo if installed to determine the OBP version.
# sysinfo is available from http://www.MagniComp.com/sysinfo/
close(STDERR) if ($verbose != 3);
$romver=`sysinfo -show romver 2>/dev/null | tail -1`;
open(STDERR) if ($verbose != 3);
if ($romver) {
$romver=&mychomp($romver);
@romverarr=split(/\s/, $romver);
$romver=$romverarr[$#romverarr];
} else {
# Assume it is old
$romver="2.X" if ($machine =~ /sun4/);
}
$romvernum=$romver;
}
}
if ($filename && $have_prtpicl_data && ! $SUNWexplo) {
foreach $line (@prtpicl) {
$line=&dos2unix($line);
$line=&mychomp($line);
$line=~s/\s+$//;
# Parse osrel and hostname from prtpicl data
if ($line =~ /\s+:OS-Release\s/) {
$osrel=$line;
$osrel=~s/^.*:OS-Release\s+(.*)$/$1/;
if ($osrel =~ /^5./) {
$osminor=$osrel;
$osminor=~s/^5.//;
if ($osminor =~ /^[7-9]$|^1[0-9]$/) {
$solaris=$osminor;
# Solaris 10 SPARC and later is 64-bit
$kernbit=64 if ($osminor =~ /^1[0-9]$/ && $machine =~ /sun4/);
} else {
# Solaris 2.6 and earlier is 32-bit
$solaris="2.$osminor";
$kernbit=32;
}
if ($machine =~ /86/) {
$solaris .= " X86" if ($solaris !~ / X86/);
# Solaris 9 X86 and earlier is 32-bit
$kernbit=32 if ($osminor =~ /^[7-9]$/);
} elsif ($machine =~ /sun4/) {
$solaris .= " SPARC" if ($solaris !~ / SPARC/);
$kernbit=32 if ($machine =~ /sun4[cdm\b]/);
}
}
}
if ($line =~ /\s+:HostName\s/) {
$hostname=$line;
$hostname=~s/^.*:HostName\s+(.*)$/$1/;
}
}
}
sub please_wait {
return if ($waitshown);
$waitshown=1;
print "Gathering data for memconf. This may take over a minute. Please wait...\n" if (-t STDOUT);
}
sub find_helpers {
return if ($helpers_defined);
$helpers_defined=1;
if ($os eq "HP-UX") {
$config_cmd="echo 'selclass qualifier cpu;info;wait;selclass qualifier memory;info;wait;infolog'|/usr/sbin/cstm";
} elsif ($os =~ /Linux|FreeBSD/) {
if (defined($ENV{DMIDECODE}) && -x $ENV{DMIDECODE}) {
# this may be a setuid-root version of dmidecode
$config_cmd=$ENV{DMIDECODE};
} else {
foreach $bin ('/usr/local/sbin','/usr/local/bin','/usr/sbin','/usr/bin','/bin') {
if (-x "$bin/dmidecode") {
$config_cmd="$bin/dmidecode";
last;
}
}
}
} elsif (-x '/usr/sbin/prtconf') {
# Solaris 2.X or later
$config_cmd="/usr/sbin/prtconf -vp";
$prtfru_cmd='/usr/sbin/prtfru' if (-x '/usr/sbin/prtfru');
$prtpicl_cmd='/usr/sbin/prtpicl' if (-x '/usr/sbin/prtpicl');
$psrinfo_cmd='/usr/sbin/psrinfo' if (-x '/usr/sbin/psrinfo');
$virtinfo_cmd='/usr/sbin/virtinfo' if (-x '/usr/sbin/virtinfo');
$cfgadm_cmd='/usr/sbin/cfgadm' if (-x '/usr/sbin/cfgadm');
$smbios_cmd='/usr/sbin/smbios' if (-x '/usr/sbin/smbios');
$kstat_cmd='/usr/bin/kstat -m cpu_info' if (-x '/usr/bin/kstat');
$ldm_cmd='/opt/SUNWldm/bin/ldm' if (-x '/opt/SUNWldm/bin/ldm');
}
if ($os =~ /Linux|FreeBSD/) {
$free_cmd='/usr/bin/free -m' if (-x '/usr/bin/free');
$meminfo_cmd='cat /proc/meminfo' if (-r '/proc/meminfo' || $running_on !~ /Linux|FreeBSD/);
$topology_cmd='/usr/bin/topology --summary --nodes --cpus --io --routers' if (-x '/usr/bin/topology' || $running_on !~ /Linux|FreeBSD/);
if (&is_xen_hv) {
$xm_info_cmd='/usr/sbin/xm info';
$xm_info_cmd='/usr/bin/xm info' if (-x '/usr/bin/xm');
}
if (-x '/usr/bin/decode-dimms.pl' || $running_on !~ /Linux|FreeBSD/) {
$modprobe_eeprom_cmd='/sbin/modprobe eeprom';
$decodedimms_cmd='/usr/bin/decode-dimms.pl';
}
}
if ($os =~ /SunOS|Linux|FreeBSD/) {
if (defined($ENV{IPMITOOL}) && -x $ENV{IPMITOOL}) {
# this may be a setuid-root version of ipmitool
$ipmitool_cmd=$ENV{IPMITOOL};
} else {
foreach $bin ('/usr/sfw/bin','/usr/local/sbin','/usr/local/bin','/usr/sbin','/usr/bin','/bin') {
if (-x "$bin/ipmitool") {
$ipmitool_cmd="$bin/ipmitool";
last;
}
}
}
}
}
sub show_helpers {
$s=shift;
# Prefer prtconf for Linux SPARC
if ($machine =~ /sun|sparc/i || $filename =~ /LinuxSPARC/) {
print "$s/usr/sbin/prtconf -vp\n";
print "$s$config_cmd\n" if ($config_cmd =~ /dmidecode/ && -x "$config_cmd");
} else {
print "$s$config_cmd\n" if ($config_cmd);
}
if ($os eq "SunOS") {
print "$s$prtdiag_cmd -v\n" if ($prtdiag_exec);
print "$s$prtfru_cmd -x\n" if ($prtfru_cmd);
print "$s$prtpicl_cmd -v\n" if ($prtpicl_cmd);
if ($psrinfo_cmd) {
print "$s$psrinfo_cmd -v\n";
$tmp=&mychomp(`$psrinfo_cmd -p 2>/dev/null`);
if ($tmp ne "") {
print "$s$psrinfo_cmd -p\n";
print "$s$psrinfo_cmd -p -v\n";
}
}
print "$s$virtinfo_cmd -pa\n" if ($virtinfo_cmd);
print "$s$cfgadm_cmd -al\n" if ($cfgadm_cmd);
print "$s$smbios_cmd\n" if ($smbios_cmd);
print "$s$kstat_cmd\n" if ($kstat_cmd);
print "$s$ldm_cmd list-devices -a -p\n" if ($ldm_cmd);
}
if ($os =~ /Linux|FreeBSD/) {
print "${s}cat /proc/cpuinfo\n" if (-r '/proc/cpuinfo' || $running_on !~ /Linux|FreeBSD/);
print "${s}cat /proc/meminfo\n" if (-r '/proc/meminfo' || $running_on !~ /Linux|FreeBSD/);
print "$s$free_cmd\n" if ($free_cmd);
print "${s}/usr/bin/topology\n" if (-x '/usr/bin/topology' || $running_on !~ /Linux|FreeBSD/);
print "$s$xm_info_cmd\n" if ($xm_info_cmd);
print "${s}/usr/bin/xenstore-ls /local/domain/DOMID\n" if (-x '/usr/bin/xenstore-ls' || $running_on !~ /Linux|FreeBSD/);
print "$s$modprobe_eeprom_cmd; $decodedimms_cmd\n" if ($decodedimms_cmd);
}
if ($os =~ /SunOS|Linux|FreeBSD/) {
print "$s$ipmitool_cmd fru\n" if ($ipmitool_cmd && $running_on eq $os);
}
if ($os eq "HP-UX") {
print "$s/usr/contrib/bin/machinfo\n" if (-x '/usr/contrib/bin/machinfo');
}
}
sub show_help {
&find_helpers;
if ($os =~ /Linux|FreeBSD/ && $config_cmd =~ /prtconf/) {
if ($machine =~ /.86|ia64|amd64|sparc/) {
$config_cmd="dmidecode";
} else {
$config_cmd="";
}
}
print "Usage: memconf [ -v | -D | -h ] [explorer_dir]\n";
print " -v verbose mode\n";
print " -D E-mail results to memconf maintainer\n";
print " -h print help\n";
print " explorer_dir Sun/Oracle Explorer output directory\n";
print "\nThis is memconf, $version $version_date\n\nCheck my website ";
print "at $URL to get the latest\nversion of memconf.\n\n";
&show_supported if ($os !~ /SunOS|HP-UX|Linux|FreeBSD/);
print "Please send bug reports and enhancement requests along with ";
print "the output of the\nfollowing commands to tschmidt\@micron.com ";
print "as E-mail attachments so that memconf\nmay be enhanced. ";
print "You can do this using the 'memconf -D' command if this system\n";
print "can E-mail to the Internet.\n";
&show_helpers(" ");
&pdebug("exit");
exit;
}
sub check_hyperthread {
&pdebug("in check_hyperthread: corecnt=$corecnt");
if ($cputype =~ /Intel.*\sXeon.*\s(E5540|E5620|L5520|X5560|X5570)\b/ && (($corecnt == 8 && ! &is_xen_hv) || &is_xen_hv)) {
&pdebug("hyperthread=1: hack in cpubanner, cputype=$cputype") if (! $hyperthread);
$hyperthread=1;
$corecnt=4;
$cputype=~s/Eight.Core //ig;
$cputype=&multicore_cputype($cputype,$corecnt);
}
if ($cputype =~ /Intel.*\sXeon.*\s(L5640|X5670|X5675)\b/ && (($corecnt == 12 && ! &is_xen_hv) || &is_xen_hv)) {
&pdebug("hyperthread=1: hack in cpubanner, cputype=$cputype") if (! $hyperthread);
$hyperthread=1;
$corecnt=6;
$cputype=~s/Twelve.Core //ig;
$cputype=&multicore_cputype($cputype,$corecnt);
}
}
sub show_hyperthreadcapable {
if ($hyperthreadcapable && ! $hyperthread) {
print "NOTICE: CPU";
if ($npcpu > 1) {
print "s are";
} else {
print " is";
}
print " capable of Hyper-Threading, but it is not enabled in the BIOS.\n";
}
}
sub cpubanner {
# Hard-code some CPU models for hyper-threading on regression tests.
# Hyper-Thread detection in Solaris x86 is done earlier by check_kstat
# This hard-code method assumes Hyper-Threading is enabled if the
# core count matches. This is not used when kstat data is available.
if ($kstat_cpubanner && $modelmore !~ /MHz\)/) {
&pdebug("in cpubanner, using kstat_cpubanner for cpubanner");
$cpubanner=$kstat_cpubanner;
return;
}
&checkX86;
if ($filename && $os eq "SunOS" && $isX86 && ! $hyperthread && ! $kstat_checked) {
&check_hyperthread;
} elsif ($filename && &is_xen_hv) {
# Xen Hypervisor hides Hyper-Threading from /proc/cpuinfo, so
# also hard-core some CPU models for it.
&check_hyperthread;
}
&pdebug("in cpubanner, corecnt=$corecnt, npcpu=$npcpu, nvcpu=$nvcpu, cputype=$cputype");
if ($modelmore =~ /\(Solaris x86 machine\)/ && ! $cpubanner && $cputype ne "x86") {
$modelmore="";
while (($cf,$cnt)=each(%cpucnt)) {
$cf=~/^(.*) (\d+)$/;
$cputype=$1;
$cpufreq=$2;
}
&x86multicorecnt($cputype);
$ncpu=$cpucnt{"$cputype $cpufreq"};
if ($cpucntflag == 0 && $npcpu == 0) {
for $tmp (2,3,4,6,8,10,12,16) {
$ncpu /= $tmp if ($corecnt == $tmp && $ncpu % $tmp == 0);
}
}
$ncpu=$npcpu if ($npcpu);
$cpubanner="$ncpu X " if ($ncpu > 1);
$tmp=&multicore_cputype($cputype,$corecnt);
$cpubanner .= "$tmp";
$cpubanner .= " x86" if ($cputype eq "AMD");
$cpubanner .= " ${cpufreq}MHz" if ($cpufreq && $cpufreq ne "0" && $cputype !~ /Hz$/);
}
}
sub show_header {
return if ($header_shown);
&pdebug("cpucntfrom=$cpucntfrom");
&cpubanner;
$header_shown=1;
undef %saw;
@saw{@simmsizesfound}=();
@simmsizesfound=sort numerically keys %saw;
print "hostname: $hostname\n" if ($hostname);
if ($filename) {
print (($SUNWexplo) ? "Sun/Oracle Explorer directory" : "filename");
print ": $filename\n";
}
if ($manufacturer) {
$manufacturer="Sun Microsystems, Inc." if ($manufacturer =~ /Sun Microsystems/i);
}
if ($diagthreadcnt && $cpucntfrom eq "prtdiag") {
# Replace @cpucnt with @diagcpucnt
while (($cf,$tmp)=each(%cpucnt)) {
delete $cpucnt{"$cf"};
$cpucnt{"$cf"}=$diagcpucnt{"$cf"};
}
}
if ($banner) {
# See if banner includes CPU information
if ($banner !~ /\(.*SPARC/ && $banner !~ /MHz/ && ! $kstat_cpubanner) {
@cputypecnt=keys(%cpucnt);
$x=0;
while (($cf,$cnt)=each(%cpucnt)) {
$x++;
$cf=~/^(.*) (\d*)$/;
$ctype=$1;
$cfreq=$2;
&multicore_cpu_cnt("");
$cpubanner .= "$cnt X " if ($cnt > 1);
if ($ctype =~ /390Z5/) {
$cpubanner .= "SuperSPARC";
$cpubanner .= "-II" if ($cfreq > 70);
} elsif ($ctype =~ /MB86907/) {
$cpubanner .= "TurboSPARC-II";
} elsif ($ctype =~ /MB86904|390S10/) {
$cpubanner .= "microSPARC";
$cpubanner .= "-II" if ($cfreq > 70);
} elsif ($ctype =~ /L2A0925/) {
$cpubanner .= "microSPARC-IIep";
} elsif ($ctype =~ /,RT62[56]/) {
$cpubanner .= "hyperSPARC";
} else {
$cpubanner .= "$ctype";
}
$cpubanner .= " ${cfreq}MHz" if ($cfreq && $cpubanner !~ /Hz$/);
$cpubanner .= ", " if ($x < scalar(@cputypecnt));
}
} elsif ($banner =~ /\(/ && $banner !~ /MHz/) {
# CPU listed without speed
while (($cf,$cnt)=each(%cpucnt)) {
$cf=~/^(.*) (\d*)$/;
$cfreq=$2;
$banner=~s/\)/ ${cfreq}MHz\)/g if ($cfreq);
}
}
}
$modelmore="" if ($modelmore =~ /\(Solaris x86 machine\)/ && $model ne "i86pc" && $model ne "i86xpv" && $model ne "i86xen");
if ($verbose) {
if ($banner) {
print "banner: $banner";
print " $bannermore" if ($bannermore);
print " ($cpubanner)" if ($cpubanner);
print "\n";
}
if ($manufacturer) {
print "manufacturer: $manufacturer\n";
}
if ($model) {
print "model: $model";
print " $modelmore" if ($modelmore);
print " $realmodel" if ($realmodel);
print " ($cpubanner)" if ($cpubanner && ! $banner);
print "\n";
}
if ($baseboard) {
print "base board: $baseboard\n";
}
if (! $clone) {
$tmp="Sun";
if ($manufacturer) {
$tmp="Sun/Oracle" if ($manufacturer =~ /^Oracle\b/);
}
$tmp="Oracle" if ($platform =~ /^ORCL,/);
print "$tmp development codename: $devname\n" if ($devname);
print "$tmp Family Part Number: $familypn\n" if ($familypn);
}
if (! $filename || $SUNWexplo) {
if ($solaris) {
print "Solaris " if ($solaris !~ /(Solaris|OmniOS)/);
print "$solaris";
if ($machine =~ /86/) {
print " X86" if ($solaris !~ / X86/);
} elsif ($machine =~ /sun4/) {
print " SPARC" if ($solaris !~ / SPARC/);
}
print ", ${kernbit}-bit kernel, " if ($kernbit);
}
if ($os =~ /Linux|FreeBSD/ && $release) {
if (-x '/bin/busybox') {
@busybox=`/bin/busybox cat --help 2>&1`;
$busyboxver="";
for (@busybox) {
next if (! /^BusyBox/);
$busyboxver=&mychomp($_);
$busyboxver=~s/\).*$/\)/;
}
if ($busyboxver) {
print "$busyboxver, ";
} else {
print "BusyBox, ";
}
}
print "$release\n";
} else {
print "$os";
print " $osrel" if ($osrel);
print " ($osrelease)" if ($osrelease);
print ", ${kernbit}-bit kernel" if ($kernbit && $HPUX);
print "\n";
}
} elsif ($HPUX) {
print "$os";
print " $osrel" if ($osrel);
print " ($osrelease)" if ($osrelease);
print ", ${kernbit}-bit kernel" if ($kernbit);
print "\n";
} elsif ($os =~ /Linux|FreeBSD/) {
print "BusyBox " if ($filename =~ /BusyBox/); # for regression tests
if ($release) {
print "$release";
} elsif ($machine =~ /sun|sparc/i || $filename =~ /LinuxSPARC/) {
print "Linux SPARC";
} elsif ($machine =~ /arm/i) {
print "Linux ARM";
} elsif ($machine =~ /mips/i) {
print "Linux MIPS";
} elsif ($have_dmidecode) {
print "Linux x86";
}
print ", ${kernbit}-bit kernel" if ($kernbit);
print "\n";
} elsif ($BSD) {
print "Solaris 1.X SPARC, 32-bit kernel, SunOS 4.X\n";
} elsif ($osrel && $solaris) {
print "Oracle " if ($solaris !~ /Oracle/ && $platform =~ /^ORCL,/);
print "Solaris " if ($solaris !~ /(Solaris|OmniOS)/);
print "$solaris, ";
print "${kernbit}-bit kernel, " if ($kernbit);
print "SunOS $osrel\n";
} else {
print "Solaris 2.X";
if ($machine =~ /86/) {
print " X86";
} elsif ($machine =~ /sun4/) {
print " SPARC";
}
print ", SunOS 5.X\n";
}
$ncpu=1 if ($ncpu == 0); # It has at least 1 CPU
if ($kstat_cpubanner) {
$tmp=$kstat_cpubanner;
$tmp=~s/(\d) X /$1 /g;
print "1 " if ($tmp eq $kstat_cpubanner);
print "$tmp cpu";
print "s" if ($tmp ne $kstat_cpubanner);
print (($sysfreq) ? ", " : "\n");
} elsif ($cpuarr == -1 && ! &is_xen_vm) {
@cputypecnt=keys(%cpucnt);
$x=0;
$ctype="";
while (($cf,$cnt)=each(%cpucnt)) {
if ($cpucntflag == 0 && $npcpu == 0 && $cpucntfrom ne "prtdiag") {
for $tmp (2,3,4,6,8,10,12,16) {
$cnt /= $tmp if ($corecnt == $tmp && $cnt % $tmp == 0);
}
$cpucntflag=1;
}
if ($npcpu) {
$cnt=$npcpu;
} else {
$cnt=$ndcpu if ($ndcpu);
$cnt=$ncpu if ($cpucntfrom =~ /cpuinfo/);
}
$x++;
$cf=~/^(.*) (\d*)$/;
$ctype=$1;
$ctype=$cf if (! $ctype);
$cfreq=$2;
&checkX86;
$ctype=&multicore_cputype($ctype,$corecnt) if ($isX86);
&multicore_cpu_cnt("");
$ctype="" if ($ctype =~ /^\S*-Core $/);
if ($ctype) {
print "$cnt $ctype";
if ($cfreq) {
print " ${cfreq}MHz" if ($cfreq && $ctype !~ /Hz$/);
}
print " cpu";
print "s" if ($cnt > 1);
print ", " if ($x < scalar(@cputypecnt));
}
}
print (($sysfreq) ? ", " : "\n") if ($x && $ctype);
}
print "system freq: ${sysfreq}MHz\n" if ($sysfreq);
} else {
$modelbuf="";
if ($manufacturer) {
$modelbuf .= "$manufacturer " if ($banner !~ /^$manufacturer/ && $model !~ /^$manufacturer/ && ($banner || $model));
}
if ($banner && $bannermore) {
$modelbuf .= "$banner $bannermore";
} elsif ($modelmore) {
$modelbuf .= "$model $modelmore";
} elsif ($banner) {
$modelbuf .= "$banner";
} elsif ($diagbanner) {
$modelbuf .= "$diagbanner";
} elsif ($model) {
$modelbuf .= "$model";
}
if ($cpubanner) {
if ($modelbuf) {
$modelbuf .= " ($cpubanner)";
} else {
$modelbuf = "$cpubanner";
}
}
$modelbuf .= " $realmodel" if ($realmodel);
print "$modelbuf\n" if ($modelbuf);
}
# debug output
if ($verbose > 1) {
print "banner = $banner\n" if ($banner);
print "diagbanner = $diagbanner\n" if ($diagbanner);
print "cpubanner = $cpubanner\n" if ($cpubanner);
print "bannermore = $bannermore\n" if ($bannermore);
print "model = $model\n" if ($model);
print "modelmore = $modelmore\n" if ($modelmore);
print "machine = $machine\n" if ($machine);
print "platform = $platform\n" if ($platform);
print "ultra = $ultra\n" if ($ultra);
if ($ultra eq "AXi") {
print "found10bit = $found10bit\n";
print "found11bit = $found11bit\n";
}
print "systemmanufacturer = $systemmanufacturer\n" if ($systemmanufacturer);
print "systemmodel = $systemmodel\n" if ($systemmodel);
print "boardmanufacturer = $boardmanufacturer\n" if ($boardmanufacturer);
print "boardmodel = $boardmodel\n" if ($boardmodel);
print "motherboard = $motherboard\n" if ($motherboard);
print "romver = $romver\n" if ($romver);
print "freephys = $freephys\n" if ($freephys);
print "perl version: " . &mychomp($]) . "\n";
print "memory line: $gotmemory\n" if ($gotmemory);
print "module info: $gotmodule\n" if ($gotmodule);
print "dmidecode version: $dmidecode_ver\n" if ($dmidecode_ver);
# Fujitsu GP7000F and PrimePower systems
print "cpu name info: $gotcpunames\n" if ($gotcpunames);
print "cpu board info: $gotcpuboards\n" if ($gotcpuboards);
print "module name info: $gotmodulenames\n" if ($gotmodulenames);
print "simmsizes = @simmsizes\n" if ($simmsizes[0]);
print "simmsizesfound = @simmsizesfound\n" if ($simmsizesfound[0]);
}
if ($verbose && $boardfound_cpu) {
if ($format_cpu == 1) {
print "CPU Units: Frequency Cache-Size Version\n" if ($model =~ /-Enterprise/ || $ultra eq "e");
} else {
print "CPU Units:\n";
}
if ($model ne "SPARCserver-1000" && $model ne "SPARCcenter-2000") {
print @boards_cpu;
print "Memory Units:\n" if (! &is_virtualmachine);
}
}
if ($interleave && ! &is_virtualmachine) {
print "Memory Interleave Factor: $interleave";
print "-way" if ($interleave =~/^\d+$/);
print "\n";
}
print "Maximum Memory Bus Speed: $maxmembusspeed\n" if ($maxmembusspeed);
}
sub show_unrecognized {
if ($perlhexbug) {
print " This is most likely because Perl V$PERL_VERSION";
print " is buggy in hex number\n conversions. Please";
print " upgrade your perl release to Perl V5.002 or later\n";
print " for best results.\n";
} else {
print " This is most likely because memconf $version";
print " does not completely\n recognize this $os";
print " $osrel" if ($osrel);
print " $platform system.\n";
&show_request if ($untested == 0);
}
}
sub show_untested {
$osname="$os $osrel";
$osname="$os" if ($osrel eq "");
if ($untested_type eq "OS") {
print "WARNING: This is an untested $osname operating";
} elsif ($untested_type eq "OBP") {
print "ERROR: This is an untested $osname OBP $romvernum";
} elsif ($untested_type eq "CPU") {
print "ERROR: This is an untested CPU type on this $osname";
} else {
print "ERROR: This is an untested $osname";
}
print " system by memconf $version\n";
print " Please let the author know how it works.\n";
$exitstatus=1;
&show_request;
}
sub show_request {
print " Check my website at $URL\n";
print " for a newer version of memconf that may recognize this system better.\n";
print " Please run 'memconf -D' to create a tar file of the output from the\n";
print " following commands to send to Tom Schmidt (tschmidt\@micron.com) so\n";
print " memconf $version may be enhanced to properly recognize this system:\n";
print " memconf -d\n";
&show_helpers(" ");
if ($untested) {
print " If this system is a Sun clone, please also send any hardware\n";
print " documentation on the memory layout that you may have.\n";
}
}
sub show_supported {
&show_total_memory;
print "ERROR: memconf $version is not supported on this $os";
print" $osrel $machine system.\n memconf is supported on:\n";
print " Solaris (SunOS 4.X or 5.X) on SPARC\n";
print " Solaris 10 6/06 or later on x86 with /usr/platform/i86pc/sbin/prtdiag\n";
print " Linux on SPARC with sparc-utils and /dev/openprom\n";
print " Linux on x86 and x86_64 with kernel-utils or pmtools for dmidecode\n";
print " FreeBSD on x86 and x86_64 with dmidecode\n";
print " Most HP-UX systems with SysMgmtPlus (cprop) or Support Tools Manager (cstm)\n";
if ($os =~ /Linux|FreeBSD/) {
if ($machine =~ /.86|ia64|amd64|sparc/) {
if ($config_cmd =~ /dmidecode/) {
print "ERROR: dmidecode command was not found. Please install ";
print "dmidecode from\n $dmidecodeURL ";
print "to fix this issue.\n";
}
print "NOTICE: This may be corrected by installing the ";
print (($machine =~ /sparc/) ? "sparc-utils" : "kernel-utils or pmtools");
print "\n package if available for this $machine system.\n";
} else {
$config_cmd="";
}
}
print " memconf may be able to process Sun/Oracle Explorer data on this machine.\n";
print " Check my website at $URL\n";
print " for a newer version of memconf that may recognize this system better.\n";
$exitstatus=1;
&mailmaintainer if ($verbose == 3);
&pdebug("exit $exitstatus");
exit $exitstatus;
}
sub show_memory {
$mem=shift;
print "${mem}MB";
if ($mem >= $meg) {
print " (", $mem / $meg, "TB)";
} elsif ($mem >= 1024) {
print " (", $mem / 1024, "GB)";
}
print "\n";
}
sub show_memory_label {
$mem=shift;
return if (! defined($mem));
return "$mem" if ($mem =~ /[MG]B/);
return $mem / 1024 . "GB" if ($mem >= 1024);
return "${mem}MB";
}
sub show_errors {
if ($failing_memory) {
print "ERROR: Some of the installed memory has failed.\n";
print " You should consider replacing the failed memory.\n";
$exitstatus=1;
}
if ($unknown_JEDEC_ID) {
print "ERROR: An unknown memory manufacturer was detected by memconf.\n";
&show_request;
$exitstatus=1;
}
}
sub check_model {
&pdebug("in check_model, model=$model, platform=$platform, banner=$banner, diagbanner=$diagbanner");
$modelbanner=$banner;
$modelbanner=$diagbanner if ($banner eq "" && $diagbanner ne "");
&find_helpers;
# Workaround for broken "uname -i" on Oracle SPARC T3 systems
$platform=$model if ($platform eq "sun4v");
if ($filename) {
$platform=$model;
$platform="SUNW,Ultra-5_10" if ($diagbanner =~ /Sun Ultra 5\/10/);
$platform="SUNW,Sun-Fire" if ($diagbanner =~ /Sun Fire ([346]8[01]0|E[246]900)\b/);
$platform="SUNW,Sun-Fire-15000" if ($diagbanner =~ /Sun Fire E2[05]K\b/);
$platform=~s/-S$// if ($model =~ /Sun-Blade-[12]500-S\b/);
if ($prtdiag_cmd =~ /platform/) {
$prtdiag_cmd="/usr/platform/$platform/sbin/prtdiag";
$prtdiag_cmd="/usr/platform/sun4v/sbin/prtdiag" if ($platform =~ /ORCL,/);
}
}
$model=~s/.*SUNW,//g;
$model=~s/.*ORCL,//g;
$model=~s/TWS,//g;
$model=~s/CYCLE,//g;
$model=~s/Tadpole_//g;
$model=~s/ASPX,//g;
$model=~s/PFU,//g;
$model=~s/FJSV,//g;
$model=~s/CompuAdd //g;
$model=~s/RDI,//g;
$model=~s/\s+$//;
$ultra="ultra" if ($ultra eq 0 && ($model =~ /Ultra|Blade|Fire/ || ($machine eq "sun4v" && ! $filename)));
if ($model =~ /Fire[- ](X|B[12]00x)/i) {
# Sun Fire X??00 Servers, i86pc
# Sun B100x or B200x Blade Servers, i86pc
$ultra="";
$machine="x86" if ($machine ne "i86pc");
$untested=1;
&x86_devname;
}
$ultra="sparc64" if ($model =~ /SPARC64/);
$ultra="e" if ($model =~ /-Enterprise/ && $model !~ /SPARC-Enterprise/);
$ultra=1 if ($model =~ /Ultra-1\b/);
$ultra=2 if ($model =~ /Ultra-2\b/);
$ultra=5 if ($model =~ /Ultra-5\b/);
$ultra="5_10" if ($model =~ /Ultra-5_10\b/);
$ultra=30 if ($model =~ /Ultra-30\b/);
$ultra=60 if ($model =~ /Ultra-60\b/);
$ultra=80 if ($model =~ /Ultra-80\b/);
$ultra=250 if ($model =~ /Ultra-250\b/);
$ultra=450 if ($model =~ /Ultra-4\b/);
$ultra="Netra t1" if ($banner =~ /Netra t1\b/);
if ($model =~ /Ultra-4FT\b/) {
$ultra="Netra ft1800";
$bannermore="(Netra ft1800)";
$modelmore="(Netra ft1800)";
}
$ultra="Sun Blade 1000" if ($model =~ /Ultra-100\b/); # prototype
$ultra="Sun Blade 1000" if ($model =~ /Sun-Blade-1000\b/);
$ultra="Sun Blade 2000" if ($model =~ /Sun-Blade-2000\b/);
$ultra="Netra 20" if ($model =~ /Netra-20\b/);
$ultra="Netra 20" if ($model =~ /Netra-T4\b/);
# E2900/E4900 also use Netra-T12
$ultra="Netra T12" if ($model =~ /Netra-T12\b/ && $ultra !~ /Sun Fire/);
$ultra="Sun Blade 100" if ($model =~ /Grover\b/); # prototype
$ultra="Sun Blade 100" if ($model =~ /Sun-Blade-100\b/);
$ultra="Sun Fire 280R" if ($model =~ /Enterprise-820R\b/); # prototype
$ultra="Sun Fire 280R" if ($model =~ /Sun-Fire-280R\b/);
$ultra="Sun Fire" if ($model =~ /Serengeti\b/); # prototype
$ultra="Sun Fire" if ($model eq "Sun-Fire" || $model =~ /Sun-Fire-[346]8[01]0\b/);
$ultra="Sun Fire V480" if ($model =~ /Sun-Fire-480R\b/);
$ultra="Sun Fire V490" if ($model =~ /Sun-Fire-V490\b/);
$ultra="Sun Fire V880" if ($model =~ /Sun-Fire-880\b/);
$ultra="Sun Fire V890" if ($model =~ /Sun-Fire-V890\b/);
# Sun Fire 12K, E25K, etc. systems identifies itself as Sun Fire 15K
$ultra="Sun Fire 15K" if ($model =~ /Sun-Fire-15000\b/ && $ultra !~ /Sun Fire /);
$ultra="Sun Fire 12K" if ($model =~ /Sun-Fire-12000\b/);
$ultra="Serverblade1" if ($model =~ /Serverblade1\b/);
# UltraSPARC-IIIi (Jalapeno) systems
$ultra="Enchilada" if ($model =~ /Enchilada\b/); # prototype
$ultra="Enchilada" if ($model =~ /Sun-Fire-V210\b/);
$ultra="Enchilada" if ($model =~ /Netra-210\b/);
$ultra="Enchilada" if ($model =~ /Sun-Fire-V240\b/);
$ultra="Enchilada" if ($model =~ /Netra-240\b/);
$ultra="Sun Fire V440" if ($model =~ /Sun-Fire-V440\b/);
$ultra="Netra 440" if ($model =~ /Netra-440\b/);
$ultra="Sun Fire V250" if ($model =~ /Sun-Fire-V250\b/);
$ultra="Sun Blade 1500" if ($model =~ /Sun-Blade-1500\b/);
$ultra="Sun Blade 2500" if ($model =~ /Sun-Blade-2500\b/);
if ($model =~ /Sun-Blade-[12]500-S\b/) {
$model=~s/-S$//;
$modelmore="(Silver)" if ($banner !~ /\(Silver\)/);
}
$ultra="Sun Ultra 45 Workstation" if ($model =~ /Sun-Ultra-45-Workstation\b/ || $model eq "A70");
$ultra="Sun Ultra 25 Workstation" if ($model =~ /Sun-Ultra-25-Workstation\b/ || $model eq "Ultra-25");
$ultra="Sun Ultra 45 or Ultra 25 Workstation" if ($model =~ /Sun-Ultra-45-or-Ultra-25-Workstation\b/);
$ultra="Sun Fire V125" if ($model =~ /Sun-Fire-V125\b/);
$ultra="Seattle" if ($model =~ /Sun-Fire-V215\b/);
$ultra="Seattle" if ($model =~ /Sun-Fire-V245\b/);
$ultra="Boston" if ($model =~ /Sun-Fire-V445\b/);
# UltraSPARC-IV (Jaguar) or UltraSPARC-IV+ (Panther) systems
$ultra="Sun Fire E2900" if ($model =~ /Sun-Fire-E2900\b/);
$ultra="Sun Fire E4900" if ($model =~ /Sun-Fire-E4900\b/);
$ultra="Sun Fire E6900" if ($model =~ /Sun-Fire-E6900\b/);
$ultra="Sun Fire E20K" if ($model =~ /Sun-Fire-(E|Enterprise-)20K\b/);
$ultra="Sun Fire E25K" if ($model =~ /Sun-Fire-(E|Enterprise-)25K\b/);
# SPARC64-VI or SPARC64-VII systems
$ultra=$banner if ($banner =~ /SPARC Enterprise M[34589]000 Server/);
# UltraSPARC-T1 (Niagara) systems
if ($model =~ /Sun-Fire-T200\b/) {
$ultra="T2000";
$modelmore="(Sun Fire T2000)";
}
$ultra="T2000" if ($model =~ /Sun-Fire-T2000\b|SPARC-Enterprise-T2000\b|Netra-T2000\b/ || $modelbanner =~ /SPARC Enterprise T2000\b|Netra T2000\b/);
$ultra="T1000" if ($model =~ /Sun-Fire-T1000\b|SPARC-Enterprise-T1000\b/ || $modelbanner =~ /SPARC Enterprise T1000/);
$ultra="T6300" if ($model =~ /Sun-Blade-T6300\b/ || $modelbanner =~ /\bT6300\b/);
# UltraSPARC-T2 (Niagara-II) systems
$ultra="T5120" if ($model =~ /SPARC-Enterprise-T5120\b/ || $modelbanner =~ /\bT5120\b/);
$ultra="T5220" if ($model =~ /(SPARC-Enterprise|Netra)-T5220\b/ || $modelbanner =~ /\bT5220\b/);
$ultra="T6320" if ($model =~ /Sun-Blade-T6320\b/ || $modelbanner =~ /\bT6320\b/);
$ultra="CP3260" if ($model =~ /Netra-CP3260\b/ || $modelbanner =~ /\bNetra CP3260\b/);
# UltraSPARC-T2+ (Victoria Falls) systems
$ultra="T5140" if ($model =~ /\bT5140\b/ || $modelbanner =~ /\bT5140\b/);
$ultra="T5240" if ($model =~ /\bT5240\b|-USBRDT-5240\b/ || $modelbanner =~ /\bT5240\b/);
$ultra="T5440" if ($model =~ /\bT5440\b|-USBRDT-5440\b/ || $modelbanner =~ /\bT5440\b/);
$ultra="T6340" if ($model =~ /Sun-Blade-T6340\b/ || $modelbanner =~ /\bT6340\b/);
# SPARC-T3 (Rainbow Falls) systems
$ultra="T3-1" if ($model =~ /SPARC-T3-1\b/ || $modelbanner =~ /SPARC T3-1\b/);
$ultra="T3-1B" if ($model =~ /SPARC-T3-1B\b/ || $modelbanner =~ /SPARC T3-1B\b/);
$ultra="T3-1BA" if ($model =~ /SPARC-T3-1BA\b/ || $modelbanner =~ /SPARC T3-1BA\b/);
$ultra="T3-2" if ($model =~ /SPARC-T3-2\b/ || $modelbanner =~ /SPARC T3-2\b/);
$ultra="T3-4" if ($model =~ /SPARC-T3-4\b/ || $modelbanner =~ /SPARC T3-4\b/);
# SPARC-T4 systems
$ultra="T4-1" if ($model =~ /SPARC-T4-1\b/ || $modelbanner =~ /SPARC T4-1\b/);
$ultra="T4-1B" if ($model =~ /SPARC-T4-1B\b/ || $modelbanner =~ /SPARC T4-1B\b/);
$ultra="T4-2" if ($model =~ /SPARC-T4-2\b/ || $modelbanner =~ /SPARC T4-2\b/);
$ultra="T4-2B" if ($model =~ /SPARC-T4-2B\b/ || $modelbanner =~ /SPARC T4-2B\b/);
$ultra="T4-4" if ($model =~ /SPARC-T4-4\b/ || $modelbanner =~ /SPARC T4-4\b/);
# SPARC-T5 systems
$ultra="T5-2" if ($model =~ /SPARC-T5-2\b/ || $modelbanner =~ /SPARC T5-2\b/);
$ultra="T5-4" if ($model =~ /SPARC-T5-4\b/ || $modelbanner =~ /SPARC T5-4\b/);
$ultra="T5-8" if ($model =~ /SPARC-T5-8\b/ || $modelbanner =~ /SPARC T5-8\b/);
$ultra="T5-1B" if ($model =~ /SPARC-T5-1B\b/ || $modelbanner =~ /SPARC T5-1B\b/);
# SPARC M5 and M6 systems
$ultra="M5-32" if ($model =~ /SPARC-M5-32\b/ || $modelbanner =~ /SPARC M5-32\b/);
$ultra="M6-32" if ($model =~ /SPARC-M6-32\b/ || $modelbanner =~ /SPARC M6-32\b/);
# Fujitsu SPARC M10 systems
$ultra="M10-1" if ($model =~ /SPARC-M10-1\b/ || $modelbanner =~ /SPARC M10-1\b/);
$ultra="M10-4" if ($model =~ /SPARC-M10-4\b/ || $modelbanner =~ /SPARC M10-4\b/);
$ultra="M10-4S" if ($model =~ /SPARC-M10-4S\b/ || $modelbanner =~ /SPARC M10-4S\b/);
# SPARC S7 and M7 systems
$ultra="S7-2" if ($model =~ /SPARC-S7-2\b/ || $modelbanner =~ /SPARC S7-2\b/);
$ultra="S7-2L" if ($model =~ /SPARC-S7-2L\b/ || $modelbanner =~ /SPARC S7-2L\b/);
$ultra="T7-1" if ($model =~ /SPARC-T7-1\b/ || $modelbanner =~ /SPARC T7-1\b/);
$ultra="T7-2" if ($model =~ /SPARC-T7-2\b/ || $modelbanner =~ /SPARC T7-2\b/);
$ultra="T7-4" if ($model =~ /SPARC-T7-4\b/ || $modelbanner =~ /SPARC T7-4\b/);
$ultra="M7-8" if ($model =~ /SPARC-M7-8\b/ || $modelbanner =~ /SPARC M7-8\b/);
$ultra="M7-16" if ($model =~ /SPARC-M7-16\b/ || $modelbanner =~ /SPARC M7-16\b/);
# Older SPARCstations
$modelmore="SPARCstation SLC" if ($model eq "Sun 4/20");
$modelmore="SPARCstation ELC" if ($model eq "Sun 4/25");
$modelmore="SPARCstation IPC" if ($model eq "Sun 4/40");
$modelmore="SPARCstation IPX" if ($model eq "Sun 4/50");
$modelmore="SPARCstation 1" if ($model eq "Sun 4/60");
$modelmore="SPARCstation 1+" if ($model eq "Sun 4/65");
$modelmore="SPARCstation 2" if ($model eq "Sun 4/75");
$modelmore="(SPARCsystem 600)" if ($model =~ /Sun.4.600/ && $banner !~ /SPARCsystem/);
$modelmore="Sun 4/30" if ($model =~ /SPARCstation-LX/);
$modelmore="Sun 4/15" if ($model =~ /SPARCclassic/);
$modelmore="Sun 4/10" if ($model =~ /SPARCclassic-X/);
$modelmore="(SPARCstation 10SX)" if ($model =~ /Premier-24/);
if ($model eq "S240") {
$manufacturer="Sun Microsystems, Inc.";
$modelmore="SPARCstation Voyager";
}
# x86
&checkX86;
if ($isX86) {
$modelmore="(Solaris x86 machine)";
$cputype="x86";
$machine=$model;
$ultra=0;
$cpucntfrom="prtconf" if (! $cpucntfrom);
return if ($model_checked);
&check_prtdiag if ($use_psrinfo_data == 2);
&check_psrinfo;
&cpubanner;
$cpucnt{"$cputype $cpufreq"}++;
}
# Clones
if ($banner =~ /\bMP-250[(\b]/) {
$ultra="axus250";
$bannermore="Ultra-250";
$modelmore="(Ultra-250)";
}
$manufacturer="AXUS" if ($ultra =~ /axus/);
$manufacturer="Force Computers" if ($model =~ /SPARC CP/);
if ($model eq "S3GX") {
$bannermore="(SPARCbook 3GX)";
$modelmore="(SPARCbook 3GX)";
}
if ($model eq "S3XP") {
$bannermore="(SPARCbook 3XP)";
$modelmore="(SPARCbook 3XP)";
}
$manufacturer="Sun Microsystems, Inc." if ($banner !~ /Axil/ && (
$model =~ /^SPARCstation|^SPARCsystem|^SPARCclassic/ ||
$model =~ /^SPARCserver|^SPARCcenter|Enterprise|Premier 24/ ||
$model =~ /Netra|Sun.Fire|Sun.Blade|Serverblade1/));
# Oracle purchased Sun in 2010, so newer systems bear the Oracle name.
$manufacturer="Oracle Corporation" if ($platform =~ /^ORCL,/ && $manufacturer eq "Sun Microsystems, Inc.");
if ($model =~ /Auspex/) {
$manufacturer="Auspex";
$model=~s/Auspex //g;
$bannermore="Netserver";
$modelmore="Netserver";
}
$manufacturer="Fujitsu" if ($banner =~ /Fujitsu/);
$manufacturer="Fujitsu Siemens" if ($banner =~ /Fujitsu Siemens/);
$manufacturer="Fujitsu Siemens Computers" if ($banner =~ /Fujitsu Siemens Computers/);
if ($model =~ /S-4|^GPU[SZU]/ || $model eq "GP") {
$manufacturer="Fujitsu" if ($manufacturer !~ /^Fujitsu/);
$model=~s,_,/,g;
$untested=1 if ($model =~ /^GPUSC-L/);
$untested=1 if ($model =~ /^GPUU/);
}
if ($model =~ /PowerLite-/) {
$bannermore=$model;
$bannermore=~s/PowerLite-//g;
}
$model_checked=1;
}
sub check_banner {
&pdebug("in check_banner, banner=$banner, ultra=$ultra");
$ultra="ultra" if ($ultra eq 0 && ($banner =~ /Ultra|Blade|Fire/));
$ultra="sparc64" if ($banner =~ /SPARC64/);
$ultra=5 if ($banner =~ /Ultra 5\b/);
$ultra="5_10" if ($banner =~ /Ultra 5\/10\b/);
$ultra=10 if ($banner =~ /Ultra 10\b/);
$ultra="220R" if ($banner =~ /Enterprise 220R\b/);
$ultra=80 if ($banner =~ /Ultra 80\b/);
# E410 is prototype name of E420R, but may still be in the
# banner as "Sun Ultra 80/Enterprise 410 UPA/PCI"
$ultra="420R" if ($banner =~ /Enterprise 410\b/);
$ultra="420R" if ($banner =~ /Enterprise 420R\b/);
$ultra="Netra t140x" if ($banner =~ /Netra t 1400\/1405\b/);
$ultra="CP1400" if ($banner =~ /Ultra CP 1400\b/);
$ultra="CP1500" if ($banner =~ /Ultra CP 1500\b/);
$ultra="CP2000" if ($banner =~ /\bCP2000\b/);
$ultra="CP2040" if ($banner =~ /\bCP2000 model 40\b/);
$ultra="CP2060" if ($banner =~ /\bCP2000 model 60\b/);
$ultra="CP2080" if ($banner =~ /\bCP2000 model 80\b/);
$ultra="CP2140" if ($banner =~ /\bCP2000 model 140\b/);
$ultra="CP2160" if ($banner =~ /\bCP2000 model 160\b/);
$ultra="Sun Blade 1000" if ($banner =~ /Sun Excalibur\b/); # prototype
$ultra="Sun Blade 2000" if ($banner =~ /Sun Blade 2000\b/);
$ultra="Netra ct400" if ($banner =~ /Netra ct400\b/);
$ultra="Netra ct410" if ($banner =~ /Netra ct410\b/);
$ultra="Netra ct800" if ($banner =~ /Netra ct800\b/);
$ultra="Netra ct810" if ($banner =~ /Netra ct810\b/);
$ultra="Sun Blade 150" if ($banner =~ /Sun Blade 150\b/);
# Sun Fire 12K, E25K, etc. systems identifies itself as Sun Fire 15K
$ultra="Sun Fire 12K" if ($banner =~ /Sun Fire (12000|12K)\b/);
if ($banner =~ /Ultra 4FT\b/) {
$ultra="Netra ft1800";
$bannermore="(Netra ft1800)";
$modelmore="(Netra ft1800)";
}
# UltraSPARC-IIIi (Jalapeno) systems
$ultra="Sun Ultra 45 Workstation" if ($banner =~ /Sun Ultra 45 Workstation\b/);
$ultra="Sun Ultra 25 Workstation" if ($banner =~ /Sun Ultra 25 Workstation\b/);
# UltraSPARC-IV (Jaguar) or UltraSPARC-IV+ (Panther) systems
$ultra="Sun Fire E2900" if ($banner =~ /Sun Fire E2900\b/);
$ultra="Sun Fire E4900" if ($banner =~ /Sun Fire E4900\b/);
$ultra="Sun Fire E6900" if ($banner =~ /Sun Fire E6900\b/);
$ultra="Sun Fire E20K" if ($banner =~ /Sun Fire E20K\b/);
$ultra="Sun Fire E25K" if ($banner =~ /Sun Fire E25K\b/);
# SPARC64-VI or SPARC64-VII systems
$ultra=$banner if ($banner =~ /SPARC Enterprise M[34589]000 Server/);
# Clones
if ($banner =~ /\bMP-250[(\b]/) {
$ultra="axus250";
$bannermore="Ultra-250";
$modelmore="(Ultra-250)";
}
$manufacturer="Sun Microsystems, Inc." if ($banner =~ /Sun |Netra /);
$manufacturer="AXUS" if ($ultra =~ /\baxus\b/);
$manufacturer="Rave" if ($banner =~ /Axil/);
$manufacturer="Tadpole/Cycle" if ($banner =~ /Cycle|\bUP-20\b|\b520IIi\b/);
$manufacturer="Tadpole" if ($banner =~ /Tadpole|\bRDI\b|\bVoyagerIIi\b|\bSPARCLE\b/);
$manufacturer="Tatung" if ($banner =~ /COMPstation/);
$manufacturer="Twinhead" if ($banner =~ /TWINstation/);
$manufacturer="Fujitsu" if ($banner =~ /Fujitsu/);
$manufacturer="Fujitsu Siemens" if ($banner =~ /Fujitsu Siemens/);
$manufacturer="Fujitsu Siemens Computers" if ($banner =~ /Fujitsu Siemens Computers/);
}
sub check_for_prtdiag {
return if (! $prtdiag_exec && ! $filename);
return if ($have_prtdiag_data);
&find_helpers;
# Check for LDOMs
if ($ldm_cmd && ! $have_ldm_data) {
# Warn that ldm and prtdiag may take a while to run
&please_wait;
@ldm=&run("$ldm_cmd list-devices -a -p");
$have_ldm_data=1;
foreach $line (@ldm) {
$line=&dos2unix($line);
$line=&mychomp($line);
&check_LDOM;
}
}
@prtdiag=&run("$prtdiag_exec") if (! $filename);
$have_prtdiag_data=1;
foreach $line (@prtdiag) {
$line=&dos2unix($line);
# Some Solaris prtdiag outputs have malformed header, so
# handle them also.
if ($line =~ /^System Configuration: +|.BIOS Configuration: |Sun Microsystems .*Fire *X|Sun Microsystems *X|Sun Microsystems .*Blade *X|Sun Microsystems .*Memory size: |^Oracle Corporation/i || ($line =~ /Sun Microsystems .*Ultra / && $machine eq "i86pc")) {
$line=&mychomp($line);
$tmp=$line;
$line=~s/System Configuration: +//g;
$line=~s/BIOS Configuration: .*//g;
if ($line =~ /^Sun Microsystems/i) {
$manufacturer="Sun Microsystems, Inc." if ($line !~ / i86pc$/);
if ($tmp =~ /System Configuration: *W[12]00z/ && ! $model && $machine eq "i86pc") {
$diagbanner=$line;
$diagbanner=~s/^.* Inc\. *(.*)/$1/;
}
} elsif ($line =~ /^Oracle /i) {
$manufacturer="Oracle Corporation" if ($line !~ / i86pc$/);
} elsif ($line =~ /Inc\./i) {
$manufacturer=$line;
$manufacturer=~s/^(.* Inc\.).*/$1/i;
if ($tmp !~ /BIOS Configuration: / && ! $model && $machine eq "i86pc") {
$diagbanner=$line;
$diagbanner=~s/^.* Inc\. *(.*)/$1/;
}
} elsif ($line =~ /Corporation/i) {
$manufacturer=$line;
$manufacturer=~s/^(.* Corporation).*/$1/i;
if ($tmp !~ /BIOS Configuration: / && ! $model && $machine eq "i86pc") {
$diagbanner=$line;
$diagbanner=~s/^.* Corporation *(.*)/$1/;
}
} elsif ($line !~ /(To Be Filled|System Manufacturer)/i) {
$manufacturer=$line;
$manufacturer=~s/^(\w+)[ \/].*/$1/;
}
foreach $tmp ("Sun Microsystems, Inc.","Sun Microsystems","Oracle Corporation") {
if ($line =~ /^$tmp +sun\w+ +/) {
$diagbanner=$line;
$diagbanner=~s/$tmp +sun\w+ +//g;
$diagbanner=~s/Memory size: .*$//g;
} elsif ($line =~ /^$tmp *Sun +/i) {
$diagbanner=$line;
$diagbanner=~s/$tmp *Sun/Sun/ig;
$diagbanner=~s/Memory size: .*$//g;
$diagbanner=~s/ BLADE / Blade /g;
$diagbanner=~s/ FIRE / Fire /g;
$diagbanner=~s/ SERVER\b/ Server /g;
$diagbanner=~s/ MODULE*\b/ Module /g;
$diagbanner=~s/ */ /g;
} elsif ($line =~ /^$tmp.*Ultra/i) {
$diagbanner=$line;
$diagbanner=~s/$tmp.*Ultra/Ultra/ig;
$diagbanner=~s/Memory size: .*$//g;
} elsif ($line =~ /^$tmp *W[12]100z/i) {
$diagbanner=$line;
$diagbanner=~s/$tmp *//ig;
}
$diagbanner=~s/\s+$//;
}
}
$prtdiag_failed=1 if ($line =~ /Prtdiag Failed/i);
# prtdiag only works on the global zone, so find out
# if we are in a Solaris zone. solaris8 brand container shows
# kernel version of "Generic_Virtual"
$prtdiag_failed=2 if ($line =~ /prtdiag can only be run in the global /i || $kernver eq "Generic_Virtual");
}
if ($psrinfo_cmd && ! $have_psrinfo_data) {
@psrinfo=&run("$psrinfo_cmd -v");
$tmp=&mychomp(`$psrinfo_cmd -p 2>/dev/null`); # physical CPUs
if ($tmp) {
push(@psrinfo, "#psrinfo -p\n$tmp\n");
$tmp=&mychomp(`$psrinfo_cmd -p -v 2>/dev/null`);
push(@psrinfo, "#psrinfo -p -v\n$tmp\n");
}
$have_psrinfo_data=1;
}
if ($ipmitool_cmd && ! $have_ipmitool_data) {
@ipmitool=&run("$ipmitool_cmd fru");
$have_ipmitool_data=1;
}
if ($smbios_cmd && ! $have_smbios_data) {
@smbios=&run("$smbios_cmd");
$have_smbios_data=1;
}
if ($kstat_cmd && ! $have_kstat_data) {
@kstat=&run("$kstat_cmd");
$have_kstat_data=1;
}
if (! $filename && $verbose == 3) {
# Only run the following commands if E-mailing maintainer since
# this data is used by memconf only for some systems
if ($prtpicl_cmd && ! $have_prtpicl_data) {
@prtpicl=&run("$prtpicl_cmd -v");
$have_prtpicl_data=1;
}
if ($virtinfo_cmd && ! $have_virtinfo_data) {
@virtinfo=&run("$virtinfo_cmd -pa");
$have_virtinfo_data=1;
}
if ($cfgadm_cmd && ! $have_cfgadm_data) {
@cfgadm=&run("$cfgadm_cmd -al");
$have_cfgadm_data=1;
}
if ($ldm_cmd && ! $have_ldm_data) {
@ldm=&run("$ldm_cmd list-devices -a -p");
$have_ldm_data=1;
}
}
}
sub add_to_sockets_used {
$_=shift;
# strip leading slash for matching
$_=~s/^\///;
if ($sockets_used !~ /$_/) {
$sockets_used .= "," if ($sockets_used && /\s/);
$sockets_used .= " $_";
# &pdebug("in add_to_sockets_used, added $_");
}
}
sub add_to_sockets_empty {
$_=shift;
$sockets_empty .= "," if ($sockets_empty && /\s/);
$sockets_empty .= " $_";
}
sub check_prtdiag {
return if ($prtdiag_checked);
&pdebug("in check_prtdiag");
$prtdiag_checked=1;
return if (! $prtdiag_exec && ! $filename);
&check_for_prtdiag;
if ($diagbanner =~ /W1100z\b/i) {
$model=$diagbanner if ($model eq "i86pc");
}
$flag_cpu=0;
$flag_mem=0;
$build_socketstr=0;
foreach $line (@prtdiag) {
$line=&dos2unix($line);
if ($line =~ /====|\/ \(picl,|= 2) {
if ($linearr[2] =~ /\bU\d\d\d\d\b/) {
# Sun Ultra-250 format
$sockets_used .= " $linearr[2]";
} elsif ($linearr[2] =~ /\b\d\d\d\d\b/) {
# Sun Ultra-4 format
$sockets_used .= " U$linearr[2]";
}
}
if ($#linearr >= 3) {
if ($linearr[3] ne "BankIDs" && $linearr[3] ne "GroupID" && $line !~ /^0x\d[\d ]+\d.+ +\d +-$/) {
if ($linearr[1] =~ /\b\d+MB\b/) {
# Sun Blade 100/1000 format
$simmsize=$linearr[1];
$simmsize=~s/MB//g;
push(@simmsizesfound, "$simmsize");
} elsif ($linearr[1] =~ /\b\d+GB\b/) {
# Sun Blade 1000 format
$simmsize=$linearr[1];
$simmsize=~s/GB//g;
$simmsize *= 1024;
push(@simmsizesfound, "$simmsize");
}
}
if ($model eq "Ultra-250" || $ultra eq 250 || $model eq "Ultra-4" || $ultra eq 450 || $model eq "Ultra-4FT" || $ultra eq "Netra ft1800") {
if ($linearr[3] =~ /\b\d+\b/) {
$simmsize=$linearr[3];
push(@simmsizesfound, "$simmsize");
}
}
}
if ($#linearr >= 2) {
if ($linearr[$#linearr] =~ /\bDIMM\d/ && $linearr[$#linearr - 1] =~ /\bCPU\d/) {
$socket="$linearr[$#linearr - 1]_$linearr[$#linearr]";
&add_to_sockets_used("$socket") if ($linearr[1] ne "empty");
$build_socketstr=1 if ($#socketstr == 0);
push(@socketstr, ("$socket")) if ($build_socketstr);
} elsif ($linearr[$#linearr - 2] =~ /\bDIMM\d|_DIMM\d/ && $linearr[$#linearr - 1] =~ /\bBank\b/i) {
# Ultra40 and JavaWorkstation
$socket="$linearr[$#linearr - 2] $linearr[$#linearr - 1] $linearr[$#linearr]";
&add_to_sockets_used("$socket") if ($linearr[1] ne "empty");
$build_socketstr=1 if ($#socketstr == 0);
push(@socketstr, ("$socket")) if ($build_socketstr);
} elsif ($linearr[$#linearr] =~ /\b(DIMM\d|[UJ]\d\d\d\d[\b,])/ || ($linearr[$#linearr - 1] eq "Label" && $linearr[$#linearr] eq "-")) {
$sockets_used .= " $linearr[$#linearr]";
# May be multiple sockets separated by ","
$sockets_used=~s/,/ /g;
} elsif ($linearr[2] =~ /MB\/P[01]\/B[01]\/D[01]|C[0-3]\/P[01]\/B[01]\/D[01]/) {
$sockets_used .= " $linearr[2]";
# May be multiple sockets separated by ","
$sockets_used=~s/,/ /g;
}
}
if ($linearr[0] !~ /^0x/ && ($linearr[$#linearr] eq "-" || $linearr[$#linearr] =~ /^-,/)) {
# unlabeled sockets
$sockets_used .= " $linearr[$#linearr]";
# May be multiple sockets separated by ","
$sockets_used=~s/,/ /g;
}
if ($linearr[$#linearr] =~ /\/J\d\d\d\d$/) {
$linearr[$#linearr]=~s/.+\///g;
$sockets_used .= " $linearr[$#linearr]";
}
if ($ultra eq "Sun Fire 280R") {
if ($line =~ / CA +0 +[0-3] .+4-way/) {
$sockets_used="J0100 J0202 J0304 J0406 J0101 J0203 J0305 J0407";
} elsif ($line =~ / CA +0 +[02] /) {
$sockets_used .= " J0100 J0202 J0304 J0406" if ($sockets_used !~ / J0100 /);
} elsif ($line =~ / CA +[01] +[13] /) {
$sockets_used .= " J0101 J0203 J0305 J0407" if ($sockets_used !~ / J0101 /);
}
}
# Memory on Sun Fire systems
if ($line =~ /^\/N\d\/SB\d\/P\d\/B\d\b/) {
$boardslot_mem=substr($line,0,13);
push(@boardslot_mems, "$boardslot_mem");
$boardslot_mems .= $boardslot_mem . " ";
} elsif ($line =~ /^\/N\d\/SB\d\d\/P\d\/B\d\b/) {
$boardslot_mem=substr($line,0,14);
push(@boardslot_mems, "$boardslot_mem");
$boardslot_mems .= $boardslot_mem . " ";
} elsif ($line =~ /^\/SB\d\d\/P\d\/B\d\b/) {
$boardslot_mem=substr($line,0,11);
push(@boardslot_mems, "$boardslot_mem");
$boardslot_mems .= $boardslot_mem . " ";
} elsif ($line =~ /\bSB\d\/P\d\/B\d\/D\d\b,/) {
$boardslot_mem=substr($line,24,51);
push(@boardslot_mems, "$boardslot_mem");
$boardslot_mems .= $boardslot_mem . " ";
} elsif ($line =~ /\bSB\d\/P\d\/B\d\/D\d\b/) {
$boardslot_mem=substr($line,24,12);
push(@boardslot_mems, "$boardslot_mem");
$boardslot_mems .= $boardslot_mem . " ";
}
if ($ultra =~ /Sun Fire/ && $#linearr >= 5) {
if ($linearr[5] =~ /\d+MB/) {
$simmsize=$linearr[5];
$simmsize=~s/MB//g;
push(@simmsizesfound, "$simmsize");
}
}
if ($ultra =~ /Sun Fire V[48][89]0\b/) {
# Fire V480, V490, V880, V890
$bankname="groups";
if ($banks_used ne "A0 A1 B0 B1") {
$banks_used="A0 B0" if ($line =~ /^ ?[ABCD] .+ 4-way /);
$banks_used="A0 A1 B0 B1" if ($line =~ /^ ?[ABCD] .+ 8-way /);
}
}
if ($linearr[$#linearr] =~ /MB\/CMP0\/CH[0-3]\/R[01]\/D[01]/) {
# UltraSPARC-T1 systems
if ($#linearr >= 5) {
if ($linearr[5] eq "MB") {
$simmsize=$linearr[4];
$simmsize=~s/MB//g;
$simmsize /= 2;
push(@simmsizesfound, "$simmsize");
} elsif ($linearr[5] eq "GB") {
$simmsize=$linearr[4];
$simmsize=~s/GB//g;
$simmsize *= 512;
push(@simmsizesfound, "$simmsize");
}
if ($linearr[2] eq "MB") {
$prtdiag_memory += $linearr[1];
} elsif ($linearr[2] eq "GB") {
$prtdiag_memory += $linearr[1] * 1024;
}
$installed_memory=$prtdiag_memory if ($prtdiag_memory);
}
$sockets_used .= " $linearr[$#linearr]";
}
if ($linearr[$#linearr] =~ /MB\/CMP[0-3]\/BR[0-3]\/CH[01]\/D[01]|MB\/CMP[0-3]\/MR[01]\/BR[01]\/CH[01]\/D[23]/) {
# UltraSPARC-T2 systems: T5120, T5220, T6320
# UltraSPARC-T2+ systems: T5140, T5240, T5440
$sockets_used .= " $linearr[$#linearr]";
}
if ($linearr[$#linearr] =~ /MB\/CPU[0-3]\/CMP[0-3]\/BR[01]\/CH[01]\/D[01]|MB\/MEM[0-3]\/CMP[0-3]\/BR[01]\/CH[01]\/D[01]/) {
$sockets_used .= " $linearr[$#linearr]";
}
if ($linearr[$#linearr] =~ /MB\/CMP[01]\/BOB[0-3]\/CH[01]\/D[01]/) {
# SPARC T3-1, T3-1B, T4-1 or T4-1B
$sockets_used .= " $linearr[$#linearr]";
}
if ($linearr[$#linearr] =~ /MB\/CMP[01]\/MR[01]\/BOB[01]\/CH[01]\/D[01]/) {
# SPARC T3-2, T4-2
$sockets_used .= " $linearr[$#linearr]";
}
if ($linearr[$#linearr] =~ /PM[01]\/CMP[01]\/BOB[0-3]\/CH[01]\/D[01]/) {
# SPARC T3-4, T4-4
$sockets_used .= " $linearr[$#linearr]";
}
if ($linearr[$#linearr] =~ /SYS\/MB\/CM[01]\/CMP\/MR[0-3]\/BOB[01]\/CH[01]\/D[01]/) {
# SPARC T5-2
$sockets_used .= " $linearr[$#linearr]";
}
if ($linearr[$#linearr] =~ /SYS\/PM[0-3]\/CM[01]\/CMP\/BOB[0-7]\/CH[01]\/D[01]/) {
# SPARC T5-4, T5-8
$sockets_used .= " $linearr[$#linearr]";
}
if ($linearr[$#linearr] =~ /SYS\/MB\/CM0\/CMP\/BOB[0-7]\/CH[01]\/D[01]/) {
# SPARC T5-1B
$sockets_used .= " $linearr[$#linearr]";
}
if ($linearr[$#linearr] =~ /SYS\/CMU\d+\/CMP\d+\/D\d+/) {
# SPARC M5-32, M6-32
$sockets_used .= " $linearr[$#linearr]";
}
if ($linearr[$#linearr] =~ /SYS\/MBU\/CMP0\/MEM[01][0-3][AB]/) {
# Fujitsu SPARC M10-1
$sockets_used .= " $linearr[$#linearr]";
}
if ($linearr[$#linearr] =~ /BB\d+\/CMU[LU]\/CMP[01]\/MEM[01][0-7][AB]/) {
# Fujitsu SPARC M10-4, M10-4S (guess)
$sockets_used .= " $linearr[$#linearr]";
}
if ($linearr[$#linearr] =~ /SYS\/MB\/CMP\d+\/MCU\d+\/CH\d+\/D\d+/) {
# SPARC S7-2, S7-2L
$sockets_used .= " $linearr[$#linearr]";
}
}
if ($line =~ /CPU Units:/) {
$flag_cpu=1; # Start of CPU section
$flag_mem=0; # End of memory section
$format_cpu=1;
}
if ($line =~ /==== (CPU|Processor Sockets |Virtual CPU)/) {
$flag_cpu=1; # Start of CPU section
$flag_mem=0; # End of memory section
$format_cpu=2;
}
if ($line =~ /Memory Units:|==== Memory |==== Physical Memory |Used Memory:/) {
$flag_cpu=0; # End of CPU section
$flag_mem=1; # Start of memory section
}
if ($line =~ /CPU Units:/ && $line =~ /Memory Units:/) {
$flag_cpu=1; # Start of CPU section
$flag_mem=1; # Start of memory section
}
if ($flag_cpu && $line !~ /^\s*\n$/) {
if ($model eq "Ultra-5_10" || $ultra eq "5_10" || $ultra eq 5 || $ultra eq 10) {
$newline=$line;
$newline=~s/^ //g if ($line !~ /Run Ecache CPU CPU/);
push(@boards_cpu, "$newline");
} else {
push(@boards_cpu, "$line");
}
$boardfound_cpu=1;
&checkX86;
if ($flag_cpu == 2 && $isX86) {
# Solaris x86 CPU type found in prtdiag
$cputype2=&mychomp($line);
# Remove multiple spaces before some Xeon models
$cputype2=~s/\s\s+([ELWX][3-9])/ $1/;
$cputype2=~s/\s\s+.*//;
$cputype2=~s/(^.* Processor \d+) .*/$1/;
$cputype2=&cleanup_cputype($cputype2);
&x86multicorecnt($cputype2);
# rewrite %cpucnt $cputype2
$cfreq=0;
while (($cf,$cnt)=each(%cpucnt)) {
$cf=~/^(.*) (\d+)$/;
if (defined($2)) {
$cfreq=$2;
delete $cpucnt{"$1 $2"};
} else {
delete $cpucnt{"$cf"};
}
}
$ndcpu++;
if ($cpucntfrom ne "psrinfo") {
$cpucntfrom="prtdiag";
$cpucntflag=1;
$ncpu++ if ($filename);
}
$cputype=$cputype2 if ($cputype2);
$cputype=$cputype_prtconf if (($cputype eq "AMD" || $cputype eq "Opteron") && $cputype_prtconf);
$cputype=$cputype_psrinfo if ($cputype_psrinfo);
$cpucnt{"$cputype $cfreq"}=$ncpu;
}
# CPUs on Sun Fire systems
if ($line =~ /^\/N\d\/SB\d\/P\d\b/) {
$boardslot_cpu=substr($line,0,10);
push(@boardslot_cpus, "$boardslot_cpu");
$boardslot_cpus .= $boardslot_cpu . " ";
} elsif ($line =~ /^\/N\d\/SB\d\d\/P\d\b/) {
$boardslot_cpu=substr($line,0,11);
push(@boardslot_cpus, "$boardslot_cpu");
$boardslot_cpus .= $boardslot_cpu . " ";
} elsif ($line =~ /^\/SB\d\d\/P\d\b/) {
$boardslot_cpu=substr($line,0,8);
push(@boardslot_cpus, "$boardslot_cpu");
$boardslot_cpus .= $boardslot_cpu . " ";
&prtdiag_threadcount(1);
} elsif ($line =~ /^ SB\d\/P\d\b/) {
$boardslot_cpu=substr($line,4,6);
push(@boardslot_cpus, "$boardslot_cpu");
$boardslot_cpus .= $boardslot_cpu . " ";
# prtdiag does not show cpuid or cputype
} elsif ($line =~ / SB\d\/P\d$/) {
$boardslot_cpu=substr($line,length($line)-7,6);
push(@boardslot_cpus, "$boardslot_cpu");
$boardslot_cpus .= $boardslot_cpu . " ";
&prtdiag_threadcount(0);
}
}
if ($flag_cpu && $line =~ /------/) {
# Next lines are the CPUs on each system board
$flag_cpu=2;
}
if ($flag_mem && $line =~ /------/) {
# Next lines are the memory on each system board
$flag_mem=2;
}
if ($filename && $use_psrinfo_data) {
# May have "psrinfo -v" output in regression test file
if ($line =~ /.+ operates at \d+ MHz/) {
$cpufreq=&mychomp($line);
$cpufreq=~s/.+ operates at //;
$cpufreq=~s/ MHz.+//;
$cpucntfrom="psrinfo" if ($cpucntfrom ne "ldm");
$cpucntflag="0"; # reset flag
$psrcpucnt++;
# rewrite %cpucnt $cputype with frequency
while (($cf,$cnt)=each(%cpucnt)) {
$cf=~/^(.*) (\d+)$/;
$tmp=$1;
if (defined($tmp)) {
delete $cpucnt{"$1 $2"} if ($2 == 0);
}
}
if (defined($tmp)) {
$cpucnt{"$tmp $cpufreq"}=$psrcpucnt;
$ncpu=$psrcpucnt;
}
}
# May have "psrinfo -p -v" output in regression test
# file that has more detailed information about the
# CPUs. Assumes all CPUs are same.
$foundpsrinfocpu=1 if ($line =~ /.+ \d+ virtual processor/);
if ($foundpsrinfocpu && (($line =~ /.+Hz$/ && $line !~ /Speed: / && $line !~ / PCI/) || $line =~ /\bAMD .* Processor /) && $line !~ / x86 /) {
$cputype=&mychomp($line);
$cputype=&cleanup_cputype($cputype);
$cputype=~s/^Version:\s+//;
$cputype=~s/^brand\s+//;
$cputype=~s/^:brand-string\s+//;
# rewrite %cpucnt $cputype with cputype
while (($cf,$cnt)=each(%cpucnt)) {
$cf=~/^(.*) (\d+)$/;
$cpufreq=$2;
delete $cpucnt{"$1 $2"};
}
$cpucnt{"$cputype $cpufreq"}=$psrcpucnt;
}
}
if ($filename && $filename !~ /Sun/ && $line =~ /^ *Manufacturer:/ && $manufacturer =~ /^Sun\b/ && $diagbanner !~ /^Sun\b|^Ultra/) {
# Regression test file with smbios output
$manufacturer=&mychomp($line);
$manufacturer=~s/^.*Manufacturer: *//;
$manufacturer=~s/\s*$//g;
&pdebug("in check_prtdiag, smbios manufacturer=$manufacturer");
}
}
# Rewrite prtdiag output to include DIMM information on SB1X00, SB2X00,
# Enchilada, Chalupa (Sun Fire V440), Netra T12, Seattle and Boston
# systems
@new_boards_mem="";
$grpcnt=0;
$intcnt=0;
if ($ultra =~ /Sun Blade [12][05]00\b/ || $ultra eq "Sun Fire 280R" || $ultra eq "Netra 20" || $ultra eq "Sun Fire V250" || $ultra eq "Netra T12") {
foreach $line (@boards_mem) {
$line=&mychomp($line);
$newline=$line;
if ($line eq "-----------------------------------------------------------" && ! $prtdiag_banktable_has_dimms) {
$newline=$line . "------";
} elsif ($line eq "--------------------------------------------------") {
$newline=$line . "-----------";
} elsif ($line =~ /ControllerID GroupID Size/ && ! $prtdiag_banktable_has_dimms) {
$newline="ID ControllerID GroupID Size DIMMs Interleave Way";
} elsif ($line =~ /ControllerID GroupID Labels Status/) {
$newline=$line . " DIMMs";
} elsif ($line =~ /ControllerID GroupID Labels/) {
$newline=$line . " DIMMs";
} elsif ($line =~ /ControllerID GroupID Size Labels/) {
$newline=$line . " DIMMs";
} elsif ($line =~ /^\d[\d ] \d[\d ] \d /) {
&read_prtdiag_bank_table;
} elsif ($line =~ /^0x\d[\d ]+\d.+ +\d +-$| GroupID \d[\d ]$/) {
&read_prtdiag_memory_segment_table;
} elsif ($line =~ /J0100,/) {
$sz=$grpsize{0,0};
if (defined($sz)) {
$sz=~s/ //g;
$newline=$line . " 4x$sz";
}
} elsif ($line =~ /J0101,/) {
$sz=$grpsize{0,1};
if (defined($sz)) {
$sz=~s/ //g;
$newline=$line . " 4x$sz";
}
} elsif ($line =~ /\/J0[1-4]0[0246]\b/) {
$sz=$grpsize{0,0};
if (defined($sz)) {
$sz=~s/ //g;
$newline=$line . " $sz";
}
} elsif ($line =~ /\/J0[1-4]0[1357]\b/) {
$sz=$grpsize{0,1};
if (defined($sz)) {
$sz=~s/ //g;
$newline=$line . " $sz";
}
} elsif ($line =~ /\bSB\d\/P\d\/B\d\/D\d,/) {
$tmp=substr($line,0,2);
$tmp=~s/ //g;
$sz=$grpsize{$tmp,substr($line,15,1)};
$sz=$grpsize{0,substr($line,15,1)} if (! defined($sz));
if (defined($sz)) {
$sz=~s/ //g;
$newline=$line . " 4x$sz";
}
} elsif ($line =~ /\bSB\d\/P\d\/B\d\/D\d\b/) {
$tmp=substr($line,0,2);
$tmp=~s/ //g;
$sz=$grpsize{$tmp,substr($line,15,1)};
$sz=$grpsize{0,substr($line,15,1)} if (! defined($sz));
if (defined($sz)) {
$sz=~s/ //g;
$newline=$line . " $sz";
}
} elsif ($line =~ / MB\/DIMM\d,/) {
$sz=$grpsize{0,substr($line,15,1)};
$newline=$line . " 2x$sz" if (defined($sz));
} elsif ($line =~ /DIMM\d,DIMM\d/) {
@linearr=split(' ', $line);
if ($linearr[2] =~ /\d+[MG]B/) {
$sz=$linearr[2];
if ($sz =~ /\dGB/) {
$sz=~s/GB//g;
$sz *= 512;
} else {
$sz=~s/MB//g;
$sz /= 2;
}
$sz=&show_memory_label($sz);
}
$newline=$line . " 2x$sz" if (defined($sz));
if ($line =~ /DIMM[13],DIMM[24]/ && $ultra eq "Sun Blade 1500") {
# prototype has sockets DIMM1-DIMM4
@socketstr=("DIMM1".."DIMM4");
}
if ($line =~ /DIMM[1357],DIMM[2468]/ && $ultra eq "Sun Blade 2500") {
# prototype has sockets DIMM1-DIMM8
if ($line =~ /DIMM[13],DIMM[24]/) {
@socketstr=("DIMM1".."DIMM4");
} elsif ($line =~ /DIMM[57],DIMM[68]/) {
push(@socketstr, "DIMM5".."DIMM8");
}
}
}
push(@new_boards_mem, "$newline\n") if ($newline);
}
@boards_mem=@new_boards_mem;
$memfrom="prtdiag";
} elsif ($ultra eq "Enchilada" || $ultra eq "Sun Fire V440" || $ultra eq "Netra 440" || $ultra =~ /Sun Ultra [24]5 .*Workstation/ || $ultra eq "Sun Fire V125" || $ultra eq "Seattle" || $ultra eq "Boston" || $banner =~ /Sun Fire E[24]900\b/ || $diagbanner =~ /Sun Fire E[24]900/) {
foreach $line (@boards_mem) {
$line=&mychomp($line);
$newline=$line;
if ($line eq "-----------------------------------------------------------" && ! $prtdiag_banktable_has_dimms) {
$newline=$line . "------";
} elsif ($line eq "--------------------------------------------------") {
$newline=$line . "-----------";
} elsif ($line =~ /ControllerID GroupID Size/ && ! $prtdiag_banktable_has_dimms) {
$newline="ID ControllerID GroupID Size DIMMs Interleave Way";
} elsif ($line =~ /ControllerID GroupID Labels Status/) {
$newline=$line . " DIMMs";
} elsif ($line =~ /ControllerID GroupID Labels/) {
$newline=$line . " DIMMs";
} elsif ($line =~ /^\d[\d ] \d[\d ] \d /) {
&read_prtdiag_bank_table;
} elsif ($line =~ /^0x\d[\d ]+\d.+ +\d +-$| GroupID \d[\d ]$/) {
&read_prtdiag_memory_segment_table;
} elsif ($line =~ / MB\/P[01]\/B[01]\/D[01],|C[0-3]\/P[01]\/B[01]\/D[01],/) {
$sz=$grpsize{substr($line,0,1),substr($line,15,1)};
$sz=$grpsize{0,substr($line,15,1)} if (! defined($sz));
if (defined($sz)) {
$newline=$line . " 2x$sz";
} else {
$newline=$line . " Failing";
$failing_memory=1;
}
} elsif ($line =~ / MB\/P[01]\/B[01]\/D[01]\b|C[0-3]\/P[01]\/B[01]\/D[01]\b/) {
$sz=$grpsize{substr($line,0,1),substr($line,15,1)};
$sz=$grpsize{0,substr($line,15,1)} if (! defined($sz));
if (defined($sz)) {
$sz=~s/ //g;
$sz=&show_memory_label($sz);
}
$space=" ";
$space="" if ($line =~ / okay/);
if ($line =~ / failed/) {
if (defined($sz)) {
$failed_memory += $sz;
} else {
$failing_memory=1;
}
}
if (defined($sz)) {
# If interleave factor is 16, then print 4x$sz
if (defined($grpinterleave{substr($line,28,1),0})) {
if ($grpinterleave{substr($line,28,1),0} eq "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15" && ! $prtdiag_banktable_has_dimms) {
$newline=$line . "$space 4x$sz";
} else {
$newline=$line . "$space $sz";
}
} else {
$newline=$line . "$space $sz";
}
}
} elsif ($line =~ / MB\/DIMM[0-7]\b/) {
$sz=$grpsize{substr($line,0,1),substr($line,15,1)};
$sz=$grpsize{0,substr($line,15,1)} if (! defined($sz));
$newline=$line . " $sz" if (defined($sz));
} elsif ($line =~ /\bSB\d\/P\d\/B\d\/D\d,/) {
$tmp=substr($line,0,2);
$tmp=~s/ //g;
$sz=$grpsize{$tmp,substr($line,15,1)};
$sz=$grpsize{0,substr($line,15,1)} if (! defined($sz));
if (defined($sz)) {
$sz=~s/ //g;
$newline=$line . " 4x$sz";
}
} elsif ($line =~ /\bSB\d\/P\d\/B\d\/D\d\b/) {
$tmp=substr($line,0,2);
$tmp=~s/ //g;
$sz=$grpsize{$tmp,substr($line,15,1)};
$sz=$grpsize{0,substr($line,15,1)} if (! defined($sz));
if (defined($sz)) {
$sz=~s/ //g;
$newline=$line . " $sz";
}
}
push(@new_boards_mem, "$newline\n") if ($newline);
}
@boards_mem=@new_boards_mem;
$memfrom="prtdiag";
}
# Rewrite prtdiag output to exclude redundant labels
@new_boards_mem="";
$flag_group=0;
foreach $line (@boards_mem) {
$line=&mychomp($line);
$newline=$line;
$flag_group++ if ($line =~ /Memory Module Groups:/);
if ($flag_group ge 2) {
$newline="" if ($line =~ /Memory Module Groups:|--------------------------------------------------|ControllerID GroupID/);
}
push(@new_boards_mem, "$newline\n") if ($newline);
}
if ($machine eq "sun4v" && $cputype !~ /UltraSPARC-T1$/) {
if ($prtpicl_cmd && ! $have_prtpicl_data) {
# Warn that prtpicl may take a while to run
&please_wait;
@prtpicl=&run("$prtpicl_cmd -v");
$have_prtpicl_data=1;
}
&check_prtpicl if ($have_prtpicl_data);
if ($picl_foundmemory) {
@new_boards_mem="";
$memfrom="prtpicl";
$picl_bank_cnt=scalar(keys %picl_mem_bank);
if (scalar(keys %picl_mem_dimm) == 1 || $picl_bank_cnt > 1) {
while (($socket,$simmsize)=each(%picl_mem_bank)) {
if (scalar(keys %picl_mem_pn) == $picl_bank_cnt * 2 || $interleave == 8) {
# CH1 was not listed
$simmsize /= 2;
$picl_mem_dimm{"$socket"}=$simmsize;
$socket=~s/CH0/CH1/g;
$picl_mem_dimm{"$socket"}=$simmsize;
&add_to_sockets_used($socket);
} else {
$picl_mem_dimm{"$socket"}=$simmsize;
}
}
}
while (($socket,$simmsize)=each(%picl_mem_dimm)) {
$pn=$picl_mem_pn{"$socket"};
$sz=&show_memory_label($simmsize);
$newline="socket $socket has a ";
$newline .= $pn . " " if (defined($pn));
$newline .= $sz . " " if (defined($sz));
$newline .= "$memtype";
push(@new_boards_mem, "$newline\n");
push(@simmsizesfound, $simmsize) if (defined($sz));
}
@new_boards_mem=sort alphanumerically @new_boards_mem;
} elsif ($flag_rewrite_prtdiag_mem) {
# Hack: Rewrite prtdiag output better than original
if ($sockets_used =~ /MB\/CMP[0-3]\/BR[0-3]\/CH[01]\/D1/) {
# All 16 DIMMs are installed
@new_boards_mem="";
if ($sockets_used !~ /MB\/CMP[0-3]\/BR[0-3]\/CH1\/D[01]/) {
foreach $line (@boards_mem) {
$line=&mychomp($line);
$newline=$line;
if ($line =~ /MB\/CMP[0-3]\/BR[0-3]\/CH0\/D[01]/) {
$line=~s/\s+$//;
$tmp=$line;
$tmp=~s/^.*(MB\/CMP.*)/$1/;
$tmp=~s/CH0/CH1/g;
$space="";
$space=" " if ($line =~ /^MB\/CMP/);
$newline="$space$line,$tmp";
}
push(@new_boards_mem, "$newline\n") if ($newline);
}
}
$sockets_used="";
for ($cnt=0; $cnt <= $#socketstr; $cnt++) {
$sockets_used .= " $socketstr[$cnt]";
}
$simmsize=$installed_memory / 16;
} else {
# 8-DIMMs or 4-DIMMs are installed.
# Hack: assume 4-DIMM configuration since
# 8-DIMM has prtpicl output.
@new_boards_mem="";
foreach $line (@boards_mem) {
$line=&mychomp($line);
$newline=$line;
if ($line =~ /MB\/CMP[0-3]\/BR[0-3]\/CH0\/D[01]/) {
$line=~s/\s+$//;
$space="";
$space=" " if ($line =~ /^MB\/CMP/);
$newline="$space$line";
}
push(@new_boards_mem, "$newline\n") if ($newline);
}
$simmsize=$installed_memory / 4;
}
# Round up DIMM value
$simmsize=&roundup_memory($simmsize);
push(@simmsizesfound, $simmsize);
} else {
$tmp=0;
foreach $socket (sort split(' ', $sockets_used)) {
$tmp++;
}
if ($tmp) {
# Round up DIMM value
$simmsize=&roundup_memory($installed_memory / $tmp);
push(@simmsizesfound, $simmsize);
}
}
}
@boards_mem=@new_boards_mem;
# &pdebug("sockets_used=$sockets_used");
}
sub prtdiag_threadcount {
$arg=shift; # column with thread count
$diagthreadcnt++;
$tmp=$line;
$tmp=~s/,\s+/,/;
@linearr=split(' ', $tmp);
$cputype=$linearr[4];
$cputype=~s/SUNW,U/U/;
$cpufreq=$linearr[1+$arg];
if ($line =~ /\bUS-/) {
$cputype=~s/US-/UltraSPARC-/;
$cpufreq=$linearr[2];
}
$cputype=~s/UltraSPARC-IV/Dual-Core UltraSPARC-IV/;
$diagcpucnt{"$cputype $cpufreq"}++;
if ($linearr[$arg] =~ /,/) {
$tmp=$linearr[$arg];
@linearr=split(',', $tmp);
$diagthreadcnt += $#linearr;
}
$cpucntfrom="prtdiag";
}
sub check_prtpicl {
&pdebug("in check_prtpicl");
$flag_mem_seg=0;
$flag_mem_bank=0;
$flag_mem_chan=0;
$flag_mem_mod=0;
$flag_physical_platform=0;
$processorbrd="";
$cpumembrd="";
$mem_riser="";
$mem_cu="";
$picl_dimm_per_bank=0;
$max_picl_dimm_per_bank=0;
$has_picl_mem_mod=0;
foreach $line (@prtpicl) {
$line=&dos2unix($line);
$line=&mychomp($line);
$line=~s/\s+$//;
if ($line =~ /^\s+:Label\s+PM[01]/) {
# SPARC T3-4, T4-4
$processorbrd=$line;
$processorbrd=~s/^.*:Label\s+(.*)$/$1/;
}
if ($line =~ /^\s+:Label\s+CM[0-3]/) {
# SPARC T5-2, T5-4, T5-8, T5-1B
$cpumembrd=$line;
$cpumembrd=~s/^.*:Label\s+(.*)$/$1/;
}
if ($line =~ /^\s+:Label\s+(CPU[0-3]|MEM[0-3])/) {
$cpumembrd=$line;
$cpumembrd=~s/^.*:Label\s+(.*)$/$1\//;
}
if ($line =~ /^\s+:Label\s+CMP[0-3]/) {
$cmp=$line;
$cmp=~s/^.*:Label\s+(.*)$/$1/;
}
if ($line =~ /\s+:name\s+memory-module/) {
$flag_mem_mod=0; # End of memory module section
&add_to_sockets_used($mem_dimm);
}
if (($line =~ /^\s+\w.*/ && $line !~ /^\s+memory-/ && $has_picl_mem_mod) || ($line =~ /\s+:name\s/ && ! $has_picl_mem_mod)) {
$flag_mem_seg=0;
$max_picl_dimm_per_bank=$picl_dimm_per_bank if ($picl_dimm_per_bank);
if ($flag_mem_mod && $mem_dimm !~ /\//) {
if ($ultra eq "S7-2" || $ultra eq "S7-2L") {
# SPARC S7-2, S7-2L (guess)
$socket="/SYS/MB/$cpumembrd$cmp/$mem_cu/$mem_channel/$mem_dimm";
} elsif ($ultra =~ /T5-(2|1B)/) {
# SPARC T5-2, T5-1B (guess)
$socket="/SYS/MB/$cpumembrd/CMP/$mem_branch/$mem_channel/$mem_dimm";
} elsif ($ultra =~ /T5-(4|8)/) {
# SPARC T5-4, T5-8 (guess)
$socket="/SYS/$processorbrd/$cpumembrd/CMP/$mem_branch/$mem_channel/$mem_dimm";
} elsif ($processorbrd) {
# SPARC T3-4, T4-4
$socket="/SYS/$processorbrd/$cpumembrd$cmp/$mem_branch/$mem_channel/$mem_dimm";
} else {
$socket="MB/$cpumembrd$cmp/$mem_branch/$mem_channel/$mem_dimm";
}
$flag_mem_mod=0; # End of memory module section
&add_to_sockets_used($socket);
if (defined($mem_model) && defined($mem_mfg)) {
$picl_mem_pn{"$socket"}="$mem_mfg $mem_model";
} elsif (defined($mem_mfg)) {
$picl_mem_pn{"$socket"}="$mem_mfg";
}
if ($max_picl_dimm_per_bank) {
$picl_mem_dimm{"$socket"}=$picl_bank_size / $max_picl_dimm_per_bank;
push(@simmsizesfound, "$picl_mem_dimm{\"$socket\"}");
} elsif ($sockets_used =~ /\/CH1\//) {
$picl_mem_dimm{"$socket"}+=$picl_bank_size / 2;
} else {
$picl_mem_dimm{"$socket"}+=$picl_bank_size;
}
} elsif ($flag_mem_bank) {
$socket="$bank_nac" if ($bank_nac);
$flag_mem_bank=0; # End of memory bank section
$bank_nac="";
if ($socket) {
&add_to_sockets_used($socket);
$picl_mem_bank{"$socket"}=$picl_bank_size;
}
}
}
if ($line =~ /^\s+memory-segment\s/) {
$flag_mem_seg=1; # Start of memory segment section
}
if ($flag_mem_seg) {
if ($line =~ /^\s+:InterleaveFactor\s/) {
$interleave=$line;
$interleave=~s/^.*:InterleaveFactor\s+(.*)$/$1/;
$interleave=hex($interleave) if ($interleave =~ /^0x\d/);
}
if ($line =~ /^\s+:Size\s/) {
$segment_size=$line;
$segment_size=~s/^.*:Size\s+(.*)$/$1/;
if ($segment_size =~ /^0x\d/) {
$segment_size=~s/^(.*)00000$/$1/;
$segment_size=hex($segment_size);
} else {
$segment_size /= $meg;
}
}
}
if ($line =~ /^\s+memory-bank\s/) {
$flag_mem_bank=1; # Start of memory bank section
$picl_dimm_per_bank=0;
}
if ($flag_mem_bank) {
if ($line =~ /^\s+:Label\s/) {
$bank_label=$line;
$bank_label=~s/^.*:Label\s+(.*)$/$1/;
}
if ($line =~ /^\s+:nac\s/) {
$bank_nac=$line;
$bank_nac=~s/^.*:nac\s+(.*)\s*$/$1/;
}
if ($line =~ /^\s+:Size\s/) {
$picl_bank_size=$line;
$picl_bank_size=~s/^.*:Size\s+(.*)$/$1/;
if ($picl_bank_size =~ /^0x\d/) {
$picl_bank_size=~s/^(.*)00000$/$1/;
$picl_bank_size=hex($picl_bank_size);
} else {
$picl_bank_size=$segment_size / $meg;
}
}
}
if ($line =~ /^\s+memory-module\s/) {
$flag_mem_mod=1; # Start of memory module section
$has_picl_mem_mod=1;
}
if ($flag_mem_mod) {
if ($line =~ /^\s+:nac\s/) {
$mem_dimm=$line;
$mem_dimm=~s/^.*:nac\s+(.*)\s*$/$1/;
$picl_dimm_per_bank++;
}
}
if ($line =~ /^\s+MR\d\s/) {
$mem_riser=$line;
$mem_riser=~s/^.*(MR\d).*/$1/;
}
if ($line =~ /^\s+MCU\d\s/) {
$mem_cu=$line;
$mem_cu=~s/^.*(MCU\d).*/$1/;
}
if ($line =~ /^\s+(BR|BOB)\d\s/) {
$flag_mem_chan=0;
$mem_branch=$line;
$mem_branch=~s/^.*(BR\d).*/$1/;
$mem_branch=~s/^.*(BOB\d).*/$1/;
# SPARC T3-2, T4-2
$mem_branch=$mem_riser . "/" . $mem_branch if ($mem_riser);
}
if ($line =~ /^\s+CH\d\s/) {
$flag_mem_chan=1; # Start of memory channel section
$mem_channel=$line;
$mem_channel=~s/^.*(CH\d).*/$1/;
}
if ($flag_mem_chan && $line =~ /^\s+D\d\s/) {
$flag_mem_mod=1; # Start of memory module section
$picl_foundmemory=1;
$mem_dimm=$line;
$mem_dimm=~s/^.*(D\d).*/$1/;
}
if ($flag_mem_mod) {
if ($line =~ /\s+:ModelName\s/) {
$mem_model=$line;
$mem_model=~s/^.*:ModelName\s+(.*)$/$1/;
}
if ($line =~ /\s+:MfgName\s/) {
$mem_mfg=$line;
$mem_mfg=~s/^.*:MfgName\s+(.*)$/$1/;
}
}
if ($line =~ /\s+:name\s+physical-platform/) {
$flag_physical_platform=1;
} elsif ($line =~ /\s+:name\s+SYS/) {
$flag_physical_platform=0;
}
if ($flag_physical_platform) {
if ($line =~ /\s+:MfgName\s/) {
$manufacturer=$line;
$manufacturer=~s/^.*:MfgName\s+(.*)$/$1/;
}
}
}
}
sub check_prtfru {
&pdebug("in check_prtfru");
if ($prtfru_cmd && ! $have_prtfru_data) {
# Warn that prtfru may take a while to run
&please_wait;
@prtfru=&run("$prtfru_cmd -x");
$have_prtfru_data=1;
}
$flag_mem_mod=0;
$cpu_mem_slot="";
$mem_slot="";
$mem_desc="";
$mem_mfg="";
$mem_mfg_loc="";
$mem_pn="";
$sun_pn="";
$fru_details="";
$fru_sb="";
$fru_cpu="";
$fru_bank="";
$fru_dimm="";
$prevline="";
foreach $line (@prtfru) {
$line=&dos2unix($line);
$line=&mychomp($line);
$line=~s/\s+$//;
if ($line =~ //) {
$fru_sb=$prevline;
$fru_sb=~s/^.*Label=(.*)\s*\".*/$1/;
&pdebug("in check_prtfru, found fru_sb=$fru_sb");
}
if ($line =~ //) {
$flag_mem_mod=0; # End of memory module section
if ($mem_slot) {
if ($mem_desc) {
$have_prtfru_details=1;
$fru_details .= "$cpu_mem_slot " if ($cpu_mem_slot);
$fru_details .= "$mem_slot: $mem_desc";
$fru_details .= ", Sun $sun_pn" if ($sun_pn);
if ($mem_mfg && $mem_pn) {
$fru_details .= ", $mem_mfg $mem_pn";
} else {
$fru_details .= ", $mem_mfg" if ($mem_mfg);
$fru_details .= ", $mem_pn" if ($mem_pn);
}
$fru_details .= "\n";
} else {
$missing_prtfru_details .= "${cpu_mem_slot}_" if ($cpu_mem_slot);
$missing_prtfru_details .= "$mem_slot ";
}
}
$mem_slot="";
$mem_desc="";
$mem_mfg="";
$mem_mfg_loc="";
$mem_pn="";
$sun_pn="";
$fru_dimm="";
}
if ($flag_mem_mod) {
if ($line =~ /(DIMM_Capacity|Fru_Description) value=/) {
$mem_desc=$line;
$mem_desc=~s/^.*\"(.*)\s*\".*$/$1/;
}
if ($line =~ /(Fundamental_Memory_Type|DIMM_Config_Type) value=/) {
$tmp=$line;
$tmp=~s/^.*\"(.*)\s*\".*$/$1/;
if ($mem_desc) {
$mem_desc .= " $tmp";
} else {
$mem_desc="$tmp";
}
}
if ($line =~ /Manufacture_Loc value=/ && ! $mem_mfg_loc) {
$mem_mfg_loc=$line;
if ($mem_mfg_loc =~ /\".*\"/) {
$mem_mfg_loc=~s/^.*\"(.*)\s*\".*$/$1/;
} else {
$mem_mfg_loc=~s/^.*\"(.*)\s*$/$1/;
}
}
if ($line =~ /Vendor_Name value=/ && ! $mem_mfg) {
$mem_mfg=$line;
if ($mem_mfg =~ /\".*\"/) {
$mem_mfg=~s/^.*\"(.*)\s*\".*$/$1/;
} else {
$mem_mfg=~s/^.*\"(.*)\s*$/$1/;
}
$mem_mfg=&get_mfg($mem_mfg);
# Fix some unrecognized manufacturers
if ($mem_mfg =~ /(unrecognized value|UNKNOWN Invalid Value)/i) {
if ($mem_mfg =~ /[0\b]4400\b/ || $mem_mfg_loc =~ /Boise.*Idaho/i) {
$mem_mfg="Micron Technology";
} elsif ($mem_mfg =~ /[0\b]7800\b/ || $mem_mfg_loc =~ /Onyang.*Korea/i) {
$mem_mfg="Samsung";
} elsif ($mem_mfg =~ /[0\b]0551\b/ || $mem_mfg_loc =~ /\bQMY\b/) {
$mem_mfg="Qimonda";
} else {
# unrecognized manufacturer
$recognized=-3;
$exitstatus=1;
}
}
}
if ($line =~ /Manufacturer_Part_No value=/ && ! $mem_pn) {
$mem_pn=$line;
$mem_pn=~s/^.*\"(.*)\s*\".*$/$1/;
}
if ($line =~ /Sun_Part_No value=/ && ! $sun_pn) {
$sun_pn=$line;
$sun_pn=~s/^.*\"(.*)\s*\".*$/$1/;
$sun_pn=~s/^(\d\d\d)(\d\d\d\d)$/$1-$2/;
}
# This data is not always accurate, so ignore it
# if ($line =~ /Fru_Type value=/ && ! $mem_desc) {
# $mem_desc=$line;
# $mem_desc=~s/^.*\"(.*)\s*\".*$/$1/;
# }
}
$prevline=$line;
}
}
sub multicore_cputype {
$s=shift;
$tmp=shift;
return if (! defined($s) || ! defined($tmp));
$s="Hyper-Threaded $s" if ($hyperthread && $s !~ /Hyper.Thread/i);
if ($tmp == 2) {
$s="Dual-Core $s" if ($s !~ /(Dual|Two).Core/i);
} elsif ($tmp == 3) {
$s="Triple-Core $s" if ($s !~ /(Triple|Three).Core/i);
} elsif ($tmp == 4) {
$s="Quad-Core $s" if ($s !~ /(Quad|Four).Core/i);
} elsif ($tmp == 6) {
$s="Six-Core $s" if ($s !~ /(Hex|Six).Core/i);
} elsif ($tmp == 8) {
$s="Eight-Core $s" if ($s !~ /(Octal|Eight).Core/i);
} elsif ($tmp == 10) {
$s="Ten-Core $s" if ($s !~ /Ten.Core/i);
} elsif ($tmp == 12) {
$s="Twelve-Core $s" if ($s !~ /Twelve.Core/i);
} elsif ($tmp > 1) {
$s="${tmp}-Core $s" if ($s !~ /${tmp}.Core/i);
}
$s=~s/ Core/-Core/ if ($s =~ /(Dual|Two|Triple|Three|Quad|Four|Hex|Six|Octal|Eight|Ten|Twelve|[0-9]) Core/i);
return($s);
}
sub cleanup_cputype {
$_=shift;
return "" if (! defined($_));
s/ CPU//;
s/ [Pp]rocessor//;
s/ +MHz/MHz/;
s/ (\d[\d\.]*GHz) \d*MHz/ $1/;
s/\s+/ /g;
s/^\s+//;
s/\s+$//;
s/\(r\)/\(R\)/g;
s/\(tm\)/\(TM\)/g;
s/ Core/-Core/ if (/(Dual|Two|Triple|Three|Quad|Four|Hex|Six|Octal|Eight|Ten|Twelve|[0-9]) Core/i);
return($_);
}
sub multicore_cpu_cnt {
$arg=shift;
&check_psrinfo;
&pdebug("in multicore_cpu_cnt, cputype=$cputype, threadcnt=$threadcnt");
if ($cputype =~ /UltraSPARC-T1$/) {
$cputype="UltraSPARC-T1";
# Count 4-Thread (4, 6, or 8 Core) Niagara CPUs as 1 CPU
if ($npcpu && $ldm_cmd && ! $have_ldm_data) {
$ncpu=$npcpu;
} else {
# Each CPU has 8 Cores max (32 threads)
$ncpu=int(($threadcnt - 1) / 32) + 1;
}
if (defined($arg)) {
$cnt=$ncpu;
return;
}
if ($threadcnt) {
$cputype=$threadcnt / 4 / $ncpu . "-Core Quad-Thread $cputype";
$cpucnt{"$cputype $cpufreq"}=$ncpu;
}
} elsif ($cputype =~ /UltraSPARC-T2\+/) {
$cputype="UltraSPARC-T2+";
# Count 8-Thread (4, 6, or 8 Core) Victoria Falls CPUs as 1 CPU
if ($npcpu && $ldm_cmd && ! $have_ldm_data) {
$ncpu=$npcpu;
} else {
# Assume there are no single-cpu systems with the US-T2+
$ncpu=2;
# Valid configurations:
# T5140,T5240: 2 x 4-Core (64 threads), 2 x 6-Core
# (96 threads), 2 x 8-Core (128 threads)
# T5440: 4 x 4-Core (128 threads), 4 x 8-Core
# (256 threads)
# Netra-T5440: 2 x 8-Core (128 threads)
if ($ultra eq "T5140" || $ultra eq "T5240") {
$ncpu=2;
} elsif ($ultra eq "T5440") {
$ncpu=4;
$ncpu=2 if ($model =~ /Netra-T5440/);
}
}
if (defined($arg)) {
$cnt=$ncpu;
return;
}
if ($threadcnt) {
$cputype=$threadcnt / 8 / $ncpu . "-Core 8-Thread $cputype";
$cpucnt{"$cputype $cpufreq"}=$ncpu;
}
} elsif ($cputype =~ /UltraSPARC-T2$/) {
$cputype="UltraSPARC-T2";
# Count 8-Thread (4 or 8 Core) Niagara-II CPUs as 1 CPU
if ($npcpu && $ldm_cmd && ! $have_ldm_data) {
$ncpu=$npcpu;
} else {
# Each CPU has 8 Cores max (64 threads)
$ncpu=int(($threadcnt - 1) / 64) + 1;
}
if (defined($arg)) {
$cnt=$ncpu;
return;
}
if ($threadcnt) {
$cputype=$threadcnt / 8 / $ncpu . "-Core 8-Thread $cputype";
$cpucnt{"$cputype $cpufreq"}=$ncpu;
}
} elsif ($cputype =~ /SPARC-T3$/) {
$cputype="SPARC-T3";
# Count 8-Thread (8 or 16 Core) Rainbow Falls CPUs as 1 CPU
if ($npcpu && $ldm_cmd && ! $have_ldm_data) {
$ncpu=$npcpu;
} else {
# Each CPU has 16 Cores max (128 threads)
$ncpu=int(($threadcnt - 1) / 128) + 1;
}
if (defined($arg)) {
$cnt=$ncpu;
return;
}
if ($threadcnt) {
$cputype=$threadcnt / 8 / $ncpu . "-Core 8-Thread $cputype";
$cpucnt{"$cputype $cpufreq"}=$ncpu;
}
} elsif ($cputype =~ /SPARC-T4$/) {
$cputype="SPARC-T4";
# Count 8-Thread 8-Core SPARC-T4 CPUs as 1 CPU
if ($npcpu && $ldm_cmd && ! $have_ldm_data) {
$ncpu=$npcpu;
} else {
# Each CPU has 8 Cores max (64 threads)
$ncpu=int(($threadcnt - 1) / 64) + 1;
}
if (defined($arg)) {
$cnt=$ncpu;
return;
}
if ($threadcnt) {
$cputype=$threadcnt / 8 / $ncpu . "-Core 8-Thread $cputype";
$cpucnt{"$cputype $cpufreq"}=$ncpu;
}
} elsif ($cputype =~ /SPARC-T5$/) {
$cputype="SPARC-T5";
# Count 8-Thread 16-Core SPARC-T5 CPUs as 1 CPU
if ($npcpu && $ldm_cmd && ! $have_ldm_data) {
$ncpu=$npcpu;
} else {
# Each CPU has 16 Cores max (128 threads)
$ncpu=int(($threadcnt - 1) / 128) + 1;
}
if (defined($arg)) {
$cnt=$ncpu;
return;
}
if ($threadcnt) {
$cputype=$threadcnt / 8 / $ncpu . "-Core 8-Thread $cputype";
$cpucnt{"$cputype $cpufreq"}=$ncpu;
}
} elsif ($cputype =~ /SPARC.M5$/) {
$cputype="SPARC-M5";
# Count 8-Thread 6-Core SPARC-M5 CPUs as 1 CPU
if ($npcpu && $ldm_cmd && ! $have_ldm_data) {
$ncpu=$npcpu;
} else {
# Each CPU has 6 Cores max (48 threads)
$ncpu=int(($threadcnt - 1) / 48) + 1;
}
if (defined($arg)) {
$cnt=$ncpu;
return;
}
if ($threadcnt) {
$cputype=$threadcnt / 8 / $ncpu . "-Core 8-Thread $cputype";
$cpucnt{"$cputype $cpufreq"}=$ncpu;
}
} elsif ($cputype =~ /SPARC.M6$/) {
$cputype="SPARC-M6";
# Count 8-Thread 12-Core SPARC-M6 CPUs as 1 CPU
if ($npcpu && $ldm_cmd && ! $have_ldm_data) {
$ncpu=$npcpu;
} else {
# Each CPU has 12 Cores max (96 threads)
$ncpu=int(($threadcnt - 1) / 96) + 1;
}
if (defined($arg)) {
$cnt=$ncpu;
return;
}
if ($threadcnt) {
$cputype=$threadcnt / 8 / $ncpu . "-Core 8-Thread $cputype";
$cpucnt{"$cputype $cpufreq"}=$ncpu;
}
} elsif ($cputype =~ /SPARC.S7$/) {
$cputype="SPARC-S7";
# Count 8-Thread 8-Core SPARC-S7 CPUs as 1 CPU
if ($npcpu && $ldm_cmd && ! $have_ldm_data) {
$ncpu=$npcpu;
} else {
# Each CPU has 8 Cores max (64 threads)
$ncpu=int(($threadcnt - 1) / 64) + 1;
}
if (defined($arg)) {
$cnt=$ncpu;
return;
}
if ($threadcnt) {
$cputype=$threadcnt / 8 / $ncpu . "-Core 8-Thread $cputype";
$cpucnt{"$cputype $cpufreq"}=$ncpu;
}
} elsif ($cputype =~ /SPARC.M7$/) {
$cputype="SPARC-M7";
# Count 8-Thread 32-Core SPARC-M7 CPUs as 1 CPU
if ($npcpu && $ldm_cmd && ! $have_ldm_data) {
$ncpu=$npcpu;
} else {
# Each CPU has 32 Cores max (256 threads)
$ncpu=int(($threadcnt - 1) / 256) + 1;
}
if (defined($arg)) {
$cnt=$ncpu;
return;
}
if ($threadcnt) {
$cputype=$threadcnt / 8 / $ncpu . "-Core 8-Thread $cputype";
$cpucnt{"$cputype $cpufreq"}=$ncpu;
}
} elsif ($cputype =~ /SPARC64-VI$/) {
# Count Dual-Core Dual-Thread Olympus-C SPARC64-VI CPUs as 1 CPU
$ncpu=$threadcnt / 4;
$cputype="Dual-Core Dual-Thread SPARC64-VI";
if (defined($arg)) {
$cnt=$ncpu;
return;
}
$cpucnt{"$cputype $cpufreq"}=$ncpu;
} elsif ($cputype =~ /SPARC64-VII\+\+$/) {
# Count Quad-Core Dual-Thread Jupiter++ SPARC64-VII++ CPUs as 1 CPU
$ncpu=$threadcnt / 8;
$cputype="Quad-Core Dual-Thread SPARC64-VII++";
if (defined($arg)) {
$cnt=$ncpu;
return;
}
$cpucnt{"$cputype $cpufreq"}=$ncpu;
} elsif ($cputype =~ /SPARC64-VII\+$/) {
# Count Quad-Core Dual-Thread Jupiter+ SPARC64-VII+ CPUs as 1 CPU
$ncpu=$threadcnt / 8;
$cputype="Quad-Core Dual-Thread SPARC64-VII+";
if (defined($arg)) {
$cnt=$ncpu;
return;
}
$cpucnt{"$cputype $cpufreq"}=$ncpu;
} elsif ($cputype =~ /SPARC64-VII$/) {
# Count Quad-Core Dual-Thread Jupiter SPARC64-VII CPUs as 1 CPU
$ncpu=$threadcnt / 8;
$cputype="Quad-Core Dual-Thread SPARC64-VII";
if (defined($arg)) {
$cnt=$ncpu;
return;
}
$cpucnt{"$cputype $cpufreq"}=$ncpu;
} elsif ($cputype =~ /SPARC64-VIII$/) {
# Guess on the Venus SPARC64-VIII name ???
# Count 8-Core Dual-Thread Venus SPARC64-VIII CPUs as 1 CPU
$ncpu=$threadcnt / 16;
$cputype="8-Core Dual-Thread SPARC64-VIII";
if (defined($arg)) {
$cnt=$ncpu;
return;
}
$cpucnt{"$cputype $cpufreq"}=$ncpu;
} elsif ($cputype =~ /SPARC64-X$/) {
# Count 16-Core Dual-Thread SPARC64-X CPUs as 1 CPU
$ncpu=$threadcnt / 32;
$cputype="16-Core Dual-Thread SPARC64-X";
if (defined($arg)) {
$cnt=$ncpu;
return;
}
$cpucnt{"$cputype $cpufreq"}=$ncpu;
}
}
sub x86multicorecnt {
$_=shift;
return if (! defined($_));
$corecnt=2 if (/\b(Dual|Two).Core/i);
$corecnt=3 if (/\b(Triple|Three).Core/i);
$corecnt=4 if (/\b(Quad|Four).Core/i);
$corecnt=6 if (/\b(Hex|Six).Core/i);
$corecnt=8 if (/\b(Octal|Eight).Core/i);
$corecnt=10 if (/\bTen.Core/i);
$corecnt=12 if (/\bTwelve.Core/i);
}
sub checkX86 {
$isX86=1 if ($model eq "i86pc" || $machine eq "i86pc" || $model eq "i86xpv" || $machine eq "i86xpv" || $model eq "i86xen" || $machine eq "i86xen");
# Use CPU count from prtdiag (ndcpu) and thread count from psrinfo to
# get core count per cpu for i86xpv/i86xen
$use_psrinfo_data=2 if ($model eq "i86xpv" || $machine eq "i86xpv" || $model eq "i86xen" || $machine eq "i86xen");
}
sub check_psrinfo {
return if ($psrinfo_checked);
&pdebug("in check_psrinfo, ndcpu=$ndcpu, npcpu=$npcpu, nvcpu=$nvcpu");
$psrinfo_checked=1;
return if ($nvcpu || ! $use_psrinfo_data);
if ($filename) {
$npcpu=0;
$j=0;
$have_npcpu=0;
foreach $line (@psrinfo) {
$line=&dos2unix($line);
# May have "psrinfo -p" output in regression test file
# that has number of physical CPUs.
if ($line =~ /^#.*psrinfo -p$/ && $psrinfo[$j + 1] =~ /^\d+$/) {
$npcpu=&mychomp($psrinfo[$j + 1]);
$have_npcpu=1;
&pdebug("in check_psrinfo, found npcpu=$npcpu");
}
# May have "psrinfo -p -v" output in regression test
# file that has number of virtual CPUs. Assumes all
# CPUs are same.
if ($line =~ /^The .+ \d+ virtual processor/) {
&check_psrinfo_pv;
if ($use_psrinfo_data == 2 && $ndcpu > 1) {
$corecnt /= $ndcpu;
$npcpu=$ndcpu if (! $have_npcpu);
} else {
$npcpu++ if (! $have_npcpu);
}
$cpucntfrom="psrinfo" if ($cpucntfrom ne "ldm");
$cpucntflag="0"; # reset flag
&pdebug("in check_psrinfo, found nvcpu=$nvcpu, corecnt=$corecnt, npcpu=$npcpu, hyperthread=$hyperthread");
}
$j++;
}
} elsif ($psrinfo_cmd) {
$ncpu=&mychomp(`$psrinfo_cmd | wc -l`); # physical & virtual CPUs
$ncpu=~s/\s+//;
$npcpu=&mychomp(`$psrinfo_cmd -p 2>/dev/null`); # physical CPUs
if ($npcpu) {
# Find number of virtual CPUs
@tmp=`$psrinfo_cmd -p -v`;
foreach $line (@tmp) {
$line=&dos2unix($line);
if ($line =~ /^The .+ \d+ virtual processor/) {
&check_psrinfo_pv;
if ($use_psrinfo_data == 2 && $ndcpu > 1) {
$corecnt /= $ndcpu;
$npcpu=$ndcpu;
}
}
}
if ($cputype eq "x86") {
if ($tmp[2] =~ /.+Hz|\bAMD .* Processor /) {
$cputype_psrinfo=&cleanup_cputype(&mychomp($tmp[2]));
}
}
} else {
$npcpu=$ncpu;
$nvcpu=1;
}
@tmp=`$psrinfo_cmd -v`;
if ($tmp[2] =~ /MHz/) {
$cpufreq=&mychomp($tmp[2]);
$cpufreq=~s/.+ operates at //;
$cpufreq=~s/ MHz.+//;
}
$cpucntfrom="psrinfo" if ($cpucntfrom ne "ldm");
$have_psrinfo_data=1;
}
}
sub check_psrinfo_pv {
$nvcpu=&mychomp($line);
$nvcpu=~s/.+ processor has //;
$nvcpu=~s/ virtual processor.+//;
if ($nvcpu =~ / cores and /) {
$nvcpu=~s/cores and //;
$corecnt=$nvcpu;
$corecnt=~s/ \d+$//;
$nvcpu=~s/^\d+ //;
if ($nvcpu == 2 * $corecnt && $isX86) {
$hyperthread=1;
&pdebug("hyperthread=1: from psrinfo -p -v");
}
} else {
$corecnt=$nvcpu if ($nvcpu >= 2);
$corecnt /= 2 if ($hyperthread);
}
}
sub get_mfg {
$_=shift;
return "" if (! defined($_));
s/Manufacturer: *//ig;
$has_JEDEC_ID=0;
if (/JEDEC ID:/) {
s/JEDEC ID://g;
s/ //g;
$has_JEDEC_ID=1;
}
s/^\s+//;
s/\s+$//;
s/^0x//;
&pdebug("in get_mfg, JEDEC_ID=$_");
return "" if (/(^$|^\r$|^FFFFFFFFFFFF|^000000000000|^Undefined|Manufacturer\d)/i);
s/^(00|80)// if (! /^007F/);
# Based on JEDEC JEP106AT
return "Micron Technology" if (/(^2C|Micron\b)/i);
return "Micron CMS" if (/(^7F45|Micron CMS)/i);
return "Crucial Technology" if (/(^1315$|^859B|^9B|^7F7F7F7F7F9B|Crucial\b)/i);
# Inotera was a Joint Venture between Micron and Nanya
# Micron fully acquired Inotera in 2016
return "Inotera Memories" if (/Inotera/i);
# Micron acquired Elpida in August 2013
return "Elpida" if (/(^0500|^FE|^7F7FFE|^02FE|Elpida)/i);
# Micron acquired Numonyx in February 2010
return "Numonyx (Intel)" if (/(^89|Intel)/i);
return "Numonyx" if (/Numonyx/i);
return "Fujitsu" if (/(^04|Fujitsu)/i);
return "Hitachi" if (/(^07|Hitachi)/i);
return "Inmos" if (/(^08|Inmos)/i);
return "Intersil" if (/(^0B|Intersil)/i);
return "Mostek" if (/(^0D|Mostek)/i);
return "Freescale (Motorola)" if (/(^0E|Motorola)/i);
return "Freescale" if (/Freescale/i);
return "NEC" if (/^10/);
return "Conexant (Rockwell)" if (/(^13|Rockwell)/i);
return "Conexant" if (/Conexant/i);
return "NXP (Philips Semi, Signetics)" if (/(^15|Philips Semi|Signetics)/i);
return "Synertek" if (/(^16|Synertek)/i);
return "Xicor" if (/(^19|Xicor)/i);
return "Zilog" if (/(^1A|Zilog)/i);
return "Mitsubishi" if (/(^1C|Mitsubishi)/i);
return "ProMOS/Mosel Vitelic" if (/(^40|ProMOS|Mosel Vitelic)/i);
return "Qimonda" if (/(^51|^8551|Qimonda)/i);
return "Wintec Industries" if (/(^61|Wintec\b)/i);
return "Goldenram" if (/(^6A|Goldenram)/i);
return "Fairchild" if (/(^83|Fairchild)/i);
return "GTE" if (/(^85|GTE)/i);
return "DATARAM" if (/^91|^7F91/);
return "Smart Modular" if (/^94|^0194|Smart Modular/i);
return "Toshiba" if (/(^98|Toshiba)/i);
return "Corsair" if (/(^9E|Corsair)/i);
return "IBM" if (/^A4/i);
return "Hynix Semiconductor (Hyundai Electronics)" if (/(^AD|Hyundai)/i);
return "Hynix Semiconductor" if (/(HYN|Hynix)/i);
return "Infineon (Siemens)" if (/(^C1|^7F7F7F7F7F51|Siemens)/i);
return "Infineon" if (/Infineon/i);
return "Samsung" if (/(^CE|Samsung)/i);
return "Winbond Electronics" if (/(^DE|Winbond)/i);
return "LG Semiconductor (Goldstar)" if (/(^E0|Goldstar)/i);
return "LG Semiconductor" if (/LG Semi/i);
return "Kingston" if (/(^7F98|^0198|Kingston)/i);
return "SpecTek Incorporated" if (/(^7F7FB5|SpecTek)/i);
return "Nanya Technology" if (/(^7F7F7F0B|^830B|Nanya)/i);
return "Kingmax Semiconductor" if (/(^7F7F7F25|KINGMAX)/i);
return "Ramaxel Technology" if (/(^7F7F7F7F43|Ramaxel)/i);
return "A-DATA Technology" if (/(^7F7F7F7FCB|ADATA|A-DATA)/i);
return "Team Group Inc." if (/^(7F7F7F7FEF|Team\b)/i);
return "AMD" if (/^01/);
return "AMI" if (/^02/);
if ($has_JEDEC_ID || /^7F|^80|^FF/i) {
$unknown_JEDEC_ID=1;
&pdebug("in get_mfg, found unknown JEDEC ID $_");
}
return &mychomp($_);
}
# See if CPUs and memory modules are listed in "ipmitool fru" output
sub check_ipmitool {
&pdebug("in check_ipmitool");
return if (! $ipmitool_cmd && ! $filename);
$cputype2="";
$mem_mfg="";
$mem_model="";
$mem_pn="";
$flag_cpu=0;
$flag_mem=0;
$flag_mfg=0;
$socket="";
foreach $line (@ipmitool) {
$line=&dos2unix($line);
$line=&mychomp($line);
if ($line =~ /^ *$/) {
# store cpu and memory modules in hash
if ($flag_cpu) {
if ($cputype2) {
$cputype2=~s/DUAL.CORE/Dual-Core/;
$cputype2=~s/TRIPLE.CORE/Triple-Core/;
$cputype2=~s/QUAD.CORE/Quad-Core/;
$cputype2=~s/SIX.CORE/Six-Core/;
$cputype2=~s/EIGHT.CORE/Eight-Core/;
$cputype2=~s/TEN.CORE/Ten-Core/;
$cputype2=~s/TWELVE.CORE/Twelve-Core/;
$cputype2=~s/ Core/-Core/;
$cputype2=~s/OPTERON\(TM\) PROCESSOR/Opteron\(TM\)/;
$ipmi_cputype="$cputype2";
$ipmi_cpucnt++;
}
}
if ($flag_mem && $socket) {
$ipmi_mem{"$socket"}=("$mem_mfg$mem_model$mem_pn") ? "$mem_mfg $mem_model$mem_pn" : "";
}
$flag_cpu=0; # End of CPU section
$flag_mem=0; # End of memory section
$flag_mfg=0; # End of mfg section
$cputype2="";
$mem_mfg="";
$mem_model="";
$mem_pn="";
}
if ($line =~ / (cpu\d+\.vpd|p\d+\.fru )/) {
$flag_cpu=1; # Start of CPU section
$socket=$line;
$socket=~s/^.*: +(.*\S)\.[vf][pr][du].*$/$1/;
}
if ($flag_cpu && $line =~ / Product Name /) {
$cputype2=$line;
$cputype2=~s/^.*: +(.*\S) *$/$1/;
&x86multicorecnt($cputype2);
}
if ($line =~ / (cpu\d+\.mem\d+\.vpd|p\d+\.d\d+\.fru) /) {
$flag_mem=1; # Start of memory module section
$socket=$line;
$socket=~s/^.*: +(.*\S)\.[vf][pr][du].*$/$1/;
} elsif ($line =~ / P\d+C\d+\/B\d+\/C\d+\/D\d+ / && $ultra =~ /^T7-/) {
# Need what M7-8 and M7-16 format looks like
$flag_mem=1; # Start of memory module section
$socket=$line;
$socket=~s/^.*: +(.*\S)\s*.*$/$1/;
}
if ($flag_mem && $line =~ / Device not present /) {
# Ignore missing Processor Modules
$flag_mem=0 if ($ultra eq "T7-4" && $corecnt == 2 && $socket =~ /P1C\d+\/B\d+\/C\d+\/D\d+/);
# Need what M7-8 and M7-16 format looks like
}
if ($flag_mem && $line =~ / Product Manufacturer /) {
$mem_mfg=$line;
$mem_mfg=~s/^.*: +(.*\S) *$/$1/;
$mem_mfg=&get_mfg($mem_mfg);
}
if ($flag_mem && $line =~ / Product Name /) {
$mem_model=$line;
$mem_model=~s/^.*: +(.*\S) *$/$1/;
$mem_model=~s/ ADDRESS\/COMMAND//;
$mem_model=~s/PARITY/Parity/;
}
if ($flag_mem && $line =~ / Product Part Number /) {
$mem_pn=$line;
$mem_pn=~s/^.*: +(.*\S) *$/, $1/;
$mem_pn=~s/^, .*,(.*\S)$/, $1/;
}
if ($line =~ /FRU Device Description *: *\/*SYS /) {
$flag_mfg=1; # Start of mfg section
}
if ($flag_mfg && $line =~ / Product Manufacturer /) {
$manufacturer="Sun Microsystems, Inc." if ($line =~ /Sun /i);
$manufacturer="Oracle Corporation" if ($line =~ /Oracle/i);
}
}
# Is ipmitool CPU count better?
# &pdebug("ipmi_cpucnt=$ipmi_cpucnt");
if ($ncpu != $ipmi_cpucnt && $npcpu == 0 && $ipmi_cpucnt != 0) {
$ncpu=$ipmi_cpucnt;
$npcpu=$ipmi_cpucnt;
$cpucntfrom="ipmitool";
$cpucnt{"$cputype $cpufreq"}=$ipmi_cpucnt;
}
# Did ipmitool find a better cputype?
if (&lc($cputype) ne &lc($ipmi_cputype) && $ipmi_cputype) {
# rewrite %cpucnt $cputype with cputype
while (($cf,$cnt)=each(%cpucnt)) {
$cf=~/^(.*) (\d+)$/;
$cpufreq=$2;
delete $cpucnt{"$1 $2"};
}
$cpucnt{"$ipmi_cputype $cpufreq"}=$ipmi_cpucnt;
}
}
# Check for logical domains
sub check_for_LDOM {
&pdebug("in check_for_LDOM");
$kernbit=64 if (! $kernbit && $machine eq "sun4v");
# Handle control LDOM on UltraSPARC-T1 and later systems
if ($ldm_cmd && ! $have_ldm_data) {
@ldm=&run("$ldm_cmd list-devices -a -p");
$have_ldm_data=1;
}
$ldmthreadcnt=0;
if ($have_ldm_data) {
foreach $line (@ldm) {
$line=&dos2unix($line);
$line=&mychomp($line);
&check_LDOM;
# Count virtual CPUs
$ldmthreadcnt++ if ($line =~ /^\|pid=\d/);
if ($line =~ /^\|pa=\d.*\|size=\d/) {
# Add up total memory found in ldm output
$sz=$line;
$sz=~s/^.*size=(\d*).*/$1/;
$ldm_memory += $sz;
}
}
# Was ldm data found?
$have_ldm_data=0 if (! $ldmthreadcnt && ! $ldm_memory);
if ($ldmthreadcnt) {
# VCPUs found in ldm output
delete $cpucnt{"$cputype $cpufreq"};
&pdebug("ldm: ncpu=$ncpu, npcpu=$npcpu");
$cpucntfrom="ldm";
$threadcnt=$ldmthreadcnt;
&multicore_cpu_cnt;
}
$installed_memory=$ldm_memory / $meg if ($ldm_memory);
}
# Handle guest domains on UltraSPARC-T1 and later systems
if ($virtinfo_cmd && ! $have_virtinfo_data) {
@virtinfo=&run("$virtinfo_cmd -pa");
$have_virtinfo_data=1;
}
if ($cfgadm_cmd && ! $have_cfgadm_data) {
@cfgadm=&run("$cfgadm_cmd -al");
$have_cfgadm_data=1;
}
if ($have_virtinfo_data) {
foreach $line (@virtinfo) {
$line=&dos2unix($line);
if ($line =~ /Domain role: LDoms guest|DOMAINROLE\|impl=LDoms\|control=false/i) {
&found_guest_LDOM;
&pdebug("exit 1");
exit 1;
}
$virtinfoLDOMcontrolfound=1 if ($line =~ /DOMAINROLE\|impl=LDoms\|control=true/i);
}
}
if ($have_cfgadm_data) {
foreach $line (@cfgadm) {
$line=&dos2unix($line);
if ($line =~ /Configuration administration not supported/ && $ldmthreadcnt == 0 && $virtinfoLDOMcontrolfound == 0) {
# Hack: Assume cfgadm fails on guest domains.
&found_guest_LDOM;
&pdebug("exit 1");
exit 1;
}
}
}
}
sub check_LDOM {
if ($line =~ /Authorization failed|Connection refused/i) {
if ($uid eq "0") {
# No LDOMs configured
$ldm_cmd="";
$have_ldm_data=0;
} else {
&found_guest_LDOM("");
print "ERROR: ldm: $line\n";
print " This user does not have permission to run '/opt/SUNWldm/bin/ldm'.\n";
print " Run memconf as a privileged user like root on the control LDOM.\n";
&pdebug("exit 1");
exit 1;
}
}
}
sub found_guest_LDOM {
# Rewrite cputype and cpucnt hash since I don't
# know how many cores the guest domain host has
if ($cputype =~ /UltraSPARC-T1$/) {
delete $cpucnt{"$cputype $cpufreq"};
$cputype="UltraSPARC-T1";
$cpucnt{"$cputype $cpufreq"}=1;
} elsif ($cputype =~ /UltraSPARC-T2\+/) {
delete $cpucnt{"$cputype $cpufreq"};
$cputype="UltraSPARC-T2+";
$cpucnt{"$cputype $cpufreq"}=1;
} elsif ($cputype =~ /UltraSPARC-T2$/) {
delete $cpucnt{"$cputype $cpufreq"};
$cputype="UltraSPARC-T2";
$cpucnt{"$cputype $cpufreq"}=1;
} elsif ($cputype =~ /SPARC-T3$/) {
delete $cpucnt{"$cputype $cpufreq"};
$cputype="SPARC-T3";
$cpucnt{"$cputype $cpufreq"}=1;
} elsif ($cputype =~ /SPARC-T4$/) {
delete $cpucnt{"$cputype $cpufreq"};
$cputype="SPARC-T4";
$cpucnt{"$cputype $cpufreq"}=1;
} elsif ($cputype =~ /SPARC-T5$/) {
delete $cpucnt{"$cputype $cpufreq"};
$cputype="SPARC-T5";
$cpucnt{"$cputype $cpufreq"}=1;
} elsif ($cputype =~ /SPARC-M5$/) {
delete $cpucnt{"$cputype $cpufreq"};
$cputype="SPARC-M5";
$cpucnt{"$cputype $cpufreq"}=1;
} elsif ($cputype =~ /SPARC-M6$/) {
delete $cpucnt{"$cputype $cpufreq"};
$cputype="SPARC-M6";
$cpucnt{"$cputype $cpufreq"}=1;
} elsif ($cputype =~ /SPARC-S7$/) {
delete $cpucnt{"$cputype $cpufreq"};
$cputype="SPARC-S7";
$cpucnt{"$cputype $cpufreq"}=1;
}
&show_header;
$arg=shift;
return if (defined($arg));
$domaincontrol="";
if ($have_virtinfo_data) {
foreach $line (@virtinfo) {
$line=&dos2unix($line);
if ($line =~ /DOMAINCONTROL\|name=/i) {
$domaincontrol=&mychomp($line);
$domaincontrol=~s/^.*name=//;
}
}
}
print "ERROR: Guest Logical Domain (LDOM) detected.\n";
print " Run memconf on the control LDOM";
print " host \"$domaincontrol\"" if ($domaincontrol ne "");
print ".\n It cannot show system memory details on guest LDOMs.\n";
}
sub found_nonglobal_zone {
# non-global zone (container)
print "WARNING: More details can be reported if memconf is run in the global zone";
if ($filename) {
print ".\n";
} else {
$globalzone=&mychomp(`/usr/sbin/arp -a | awk '/SP/ {print \$2}' | head -1`);
print "\n on hostname '$globalzone'.\n";
}
}
sub check_smbios {
&pdebug("in check_smbios");
$flag_smb_cpudevice=0;
$flag_smb_memdevice=0;
$cpu_membank=-1;
$cpu_cnt=-1;
$physmemarray="";
foreach $line (@smbios) {
$line=&dos2unix($line);
$line=&mychomp($line);
next if ($line =~ /( *Unknown|: Other|: \.\.|: Not Specified)/i);
if ($model eq "i86pc" || $model eq "i86xpv" || $model eq "i86xen") {
if ($line =~ /^ *Manufacturer:/ && $line !~ /(To Be Filled|System Manufacturer)/i && $manufacturer eq "") {
$manufacturer=$line;
$manufacturer=~s/^ *Manufacturer: *//g;
$manufacturer=~s/\s*$//g;
&pdebug("in check_smbios, manufacturer=$manufacturer");
}
if ($line =~ /^ *Product:/ && $line !~ /(To Be Filled|System .*Name|XXXX)/i) {
$model=$line;
$model=~s/^ *Product: *//g;
$model=~s/\s*$//g;
&pdebug("in check_smbios, model=$model");
&x86_devname;
}
}
if ($line =~ /SMB_TYPE_PROCESSOR\b/) {
$flag_smb_cpudevice=1;
$cpu_cnt++;
}
if ($flag_smb_cpudevice && $line =~ /Location Tag:/) {
$CPUSocketDesignation[$cpu_cnt]=$line;
$CPUSocketDesignation[$cpu_cnt]=~s/^ *Location Tag: *//g;
$flag_smb_cpudevice=0;
}
if ($line =~ /SMB_TYPE_MEMDEVICE\b/) {
$mem_mfg="";
$socket="";
$pn="";
$simmsize=0;
$memtype="";
$formfactor="";
$smb_mdf="";
$maxmembusspeed="";
$flag_smb_cpudevice=0;
$flag_smb_memdevice=1;
}
if ($flag_smb_memdevice) {
if ($line =~ /Manufacturer:/) {
$mem_mfg=$line;
$mem_mfg=~s/^ *Manufacturer: *//g;
$mem_mfg=&get_mfg($mem_mfg);
$mem_mfg=", $mem_mfg" if ($mem_mfg);
}
if ($line =~ /Location Tag:/) {
# Ignore System ROM FLASH
if ($line =~ /SYSTEM ROM/i) {
$flag_smb_memdevice=0;
} else {
$socket=$line;
$socket=~s/^ *Location Tag: *//g;
$socket=~s/\s*$//g;
}
}
if ($line =~ /Part Number:/) {
$pn=$line;
$pn=~s/^ *Part Number: *//g;
$pn=~s/\s*$//g;
$pn="" if ($pn =~ /^0xFF|PartNum/i);
$pn=&hex2ascii($pn);
if ($pn) {
# Hack: Ballistic modules may have mfg Undefined
$mem_mfg=", Crucial Technology" if (! $mem_mfg && $pn =~ /^BL/);
if ($mem_mfg) {
$pn=" $pn";
} else {
$pn=", $pn";
}
}
}
if ($line =~ /Physical Memory Array:/) {
$tmp=&mychomp($line);
$tmp=~s/^ *Physical Memory Array: *//g;
$cpu_membank++ if ($physmemarray ne $tmp);
$physmemarray=$tmp;
}
if ($line =~ /Size:/) {
$simmsize=$line;
$simmsize=~s/^ *Size: //g;
$simmsize=~s/ bytes//g;
$simmsize=0 if ($simmsize =~ /Not Populated/);
$simmsize /= $meg;
}
if ($line =~ /Memory Type:/) {
# Ignore FLASH (System ROM)
if ($line =~ /FLASH/i) {
$flag_smb_memdevice=0;
} else {
$memtype=$line;
$memtype=~s/^ *Memory Type:.*\((.*)\).*/$1/g;
$memtype .= " " if ($formfactor);
$memtype="" if ($memtype =~ /Memory Type:|^other/);
}
}
if ($line =~ /Form Factor:/) {
$formfactor=$line;
$formfactor=~s/^ *Form Factor:.*\((.*)\).*/$1/g;
$formfactor="" if ($formfactor =~ /Form Factor:/);
}
$smb_mdf="Fast-Page " if ($line =~ /SMB_MDF_FASTPG/);
$smb_mdf="Synchronous " if ($line =~ /SMB_MDF_SYNC/);
$smb_mdf="EDO " if ($line =~ /SMB_MDF_EDO/);
if ($line =~ /^ *Speed: *\d+ *MHz/) {
$maxmembusspeed=$line;
$maxmembusspeed=~s/^ *Speed: *(\d+) *MHz/${1}MHz/g;
}
if ($line =~ /Bank Locator:|^ *ID *SIZE *TYPE/ && $socket) {
$bank_label=$line;
$bank_label=~s/^ *(Bank Locator:|ID *SIZE *TYPE) *//g;
$bank_label=~s/ *SLOT$//ig;
$bank_label="BANK $bank_label" if ($bank_label =~ /^.$/);
$bank_label="" if ($bank_label eq $socket || $bank_label eq "BANK");
if ($socket =~ /^CPU/ && $socket !~ /$bank_label/) {
$socket .= "_$bank_label";
$bank_label="";
}
$bank_label=" $bank_label" if ($bank_label);
$flag_smb_memdevice=0;
# Don't overwrite duplicate socket names
if (! defined($smbios_mem{"$socket"})) {
# Add CPU to X4170/X4270/X4275/X6270/X6275
if ($model =~ /Sun .*X(4[12]7[05]|627[05])\b/i && $socket !~ /CPU/) {
$bank_label="" if ($bank_label =~ /\/P\d+$/);
$cpu_number=$CPUSocketDesignation[$cpu_membank];
$cpu_number=~s/\s*//g;
$socket="${cpu_number}_$socket";
}
if ($model =~ /W1100z\b/i && $model !~ /2100z\b/i && $socket =~ /DIMM[5-8]/) {
# DIMM5-DIMM8 don't exist on W1100z
} else {
$smbios_mem{"$socket$bank_label"}=($simmsize) ? "${simmsize}MB $smb_mdf$memtype$formfactor$mem_mfg$pn" : "";
$sockets_used="";
}
}
}
}
}
$tmp=scalar(keys %smbios_mem);
if (defined($tmp)) {
if ($tmp) {
&pdebug("Memory found with smbios");
&show_header;
if (! &is_virtualmachine) {
for (sort alphanumerically keys %smbios_mem) {
if ($smbios_mem{$_}) {
print "$_: $smbios_mem{$_}\n";
$simmsize=$smbios_mem{$_};
$simmsize=~s/^.*\b(\d+)M[Bb].*/$1/;
$smbios_memory += $simmsize if ($simmsize);
} else {
&add_to_sockets_empty($_);
}
}
}
$totmem=$installed_memory;
&print_empty_memory("memory sockets");
&finish;
&pdebug("exit");
exit;
}
}
}
sub check_kstat {
&pdebug("in check_kstat");
$instance=0;
foreach $line (@kstat) {
$line=&dos2unix($line);
$_=&mychomp($line);
# cpu thread instance number
if (/\scpu_info\s+instance:\s+/) {
($instance)=(/.*\s(\d+)\s*$/);
}
if (/^\s*brand\s/) {
($val)=(/^\sbrand\s*(\S.*)\s*$/);
push(@kstat_brand, "$val") if ($val);
}
if (/\sclock_MHz\s/) {
($val)=(/.*\s(\d+)\s*$/);
push(@kstat_MHz, "$val") if ($val);
}
# count # of threads per unique core_id for each chip
if (/\score_id\s/) {
($val)=(/.*\s(\d+)\s*$/);
$kstat_core_id{$instance}=$val;
$kstat_core{$val}++;
}
# number of cores per chip
if (/\sncore_per_chip\s/) {
($val)=(/.*\s(\d+)\s*$/);
$kstat_ncore_per_chip{$instance}=$val;
}
# max number of cpus (threads) per chip
if (/\sncpu_per_chip\s/) {
($val)=(/.*\s(\d+)\s*$/);
$kstat_ncpu_per_chip{$instance}=$val;
}
$foundGenuineIntel=1 if (/\svendor_id\s+GenuineIntel/);
}
if ($foundGenuineIntel && $instance) {
# Assume all CPUs are same
for ($val=0; $val <= $instance; $val++) {
last if (! defined($kstat_core_id{$val}) || ! defined($kstat_ncore_per_chip{$val}) || ! defined($kstat_ncpu_per_chip{$val}));
$kstat_checked=1;
if ($kstat_ncpu_per_chip{$val} == 2 * $kstat_ncore_per_chip{$val}) {
# CPU is hyper-thread capable, but it may not be
# enabled in the BIOS
&pdebug("in check_kstat, found CPU capable of Hyper-Threading") if (! $hyperthreadcapable);
$hyperthreadcapable=1;
if ($kstat_core{$kstat_core_id{$val}} == 2) {
# Hyper-Thread is enabled in BIOS.
# Only change corecnt if not already
# done earlier in check_psrinfo_pv.
$corecnt /= 2 if (! $hyperthread);
$hyperthread=1;
&pdebug("hyperthread=1: from kstat, cputype=$cputype");
last;
}
}
}
} elsif (@kstat_brand && @kstat_MHz) {
@kstat_brandMHz=();
@kstat_brand_arr=();
@kstat_MHz_arr=();
$i=0;
foreach $brand (@kstat_brand) {
$kstat_brandMHz{$brand,$kstat_MHz[$i]}++;
push(@kstat_brand_arr, "$brand") if (! grep($_ eq $brand, @kstat_brand_arr));
push(@kstat_MHz_arr, "$kstat_MHz[$i]") if (! grep($_ eq $kstat_MHz[$i], @kstat_MHz_arr));
$i++;
}
@kstat_cpubanners=();
# return unless have mix of CPUs or is VM
return if ($#kstat_brand_arr == 0 && $#kstat_MHz_arr == 0 && ! &is_virtualmachine);
foreach $brand (@kstat_brand_arr) {
foreach $MHz (@kstat_MHz_arr) {
if ($kstat_brandMHz{$brand,$MHz}) {
$cputype=$brand;
if ($isX86) {
$cputype=&multicore_cputype($cputype,$corecnt);
} else {
&multicore_cpu_cnt;
}
$tmp="";
$cnt=$kstat_brandMHz{$brand,$MHz} / $corecnt;
$cpucntfrom="kstat";
$tmp .= "$cnt X " if ($cnt > 1);
push(@kstat_cpubanners, "$tmp$cputype ${MHz}MHz");
}
}
}
$i=0;
foreach (@kstat_cpubanners) {
$kstat_cpubanner .= ", " if ($i);
$kstat_cpubanner .= $_;
$i++;
}
$kstat_cpubanner=&cleanup_cputype($kstat_cpubanner);
&pdebug("in check_kstat, kstat_cpubanner=$kstat_cpubanner");
}
}
sub found_empty_bank {
$empty_banks .= "," if ($empty_banks);
$boardslot_mem=~s/[: ]//g;
$empty_banks .= " Board $boardslot_mem @_";
}
sub print_empty_memory {
return if (&is_virtualmachine || $empty_memory_printed);
$s=shift;
print "empty $s: ";
$sockets_empty=~s/^\s*//;
$sockets_empty=~s/^,\s*//;
print (($sockets_empty) ? "$sockets_empty\n" : "None\n");
$empty_memory_printed=1;
}
sub print_bios_error {
return if (&is_virtualmachine);
print " An upgraded BIOS from your manufacturer ";
if (&check_dmidecode_ver != 0) {
print "or a newer version of dmidecode\n from ";
print "$dmidecodeURL ";
}
print "may fix this issue.\n This is a BIOS ";
print "or dmidecode " if (&check_dmidecode_ver != 0);
print "bug, not a bug in memconf";
print " or dmidecode" if (&check_dmidecode_ver == 0);
print ".\n";
&check_dmidecode_ver(1);
$recognized=0;
$exitstatus=1;
}
sub found_nvsimm_bank {
$nvsimm_banks .= ", Board $boardslot_mem @_";
}
sub recommend_prtdiag_patch {
# Sun BugID 4664349
print " This may be corrected by installing ";
if ($osrel eq "5.9") {
print "Sun patch 113221-03 or 118558-06 or later.\n";
} elsif ($osrel eq "5.8") {
print "Sun patch 109873-26 or 111792-11 or later.\n";
} else {
print "a Sun patch on this system.\n";
}
}
sub numerically {
$a <=> $b;
}
sub alphanumerically {
local($&, $`, $', $1, $2);
# Sort numbers numerically
return $a cmp $b if ($a !~ /\D/ && $b !~ /\D/);
# Handle things like CH0/D0, p0.d0, DIMM1_A, Board 1,1A
return $a cmp $b if ($a =~ /[\/\.,_]/ && $b =~ /[\/\.,_]/);
# Handle things like DIMM 1A
return $a cmp $b if ($a =~ /\d\D$/ && $b =~ /\d\D$/);
# Handle things like DIMM 1 BANK A, ..., DIMM 12 BANK D
if ($a =~ /(.*\D)(\d+)\D+$/) {
($a1, $a2) = ($1, $2);
if ($b =~ /(.*\D)(\d+)\D+$/) {
($b1, $b2) = ($1, $2);
return $a2 <=> $b2 if ($a1 eq $b1);
}
}
# Handle things like DIMM1, ..., DIMM10
if ($a =~ /^(\D+)(\d+)\b/) {
($a1, $a2) = ($1, $2);
if ($b =~ /^(\D+)(\d+)\b/) {
($b1, $b2) = ($1, $2);
return $a2 <=> $b2 if ($a1 eq $b1);
}
}
# Default is to sort alphabetically
return $a cmp $b;
}
sub lc {
$s=shift;
return "" if (! defined($s));
$s=~tr/[A-Z]/[a-z]/;
return $s;
}
sub dos2unix {
# Convert "CR LF" or "CR" to "LF"
$s=shift;
$s=~s/\r\n/\n/g;
$s=~s/\r/\n/g;
return $s;
}
sub convert_freq {
($freqx)=@_;
if ($isX86) {
$freq=int(hex("0x$freqx") / 10000 + 0.5);
} else {
if ($freqx =~ /'/) {
$freqpack=$freqx;
$freqpack=~s/'//g;
@frequnpack=unpack("C*",$freqpack);
$freqx="";
foreach $field (@frequnpack) {
$freqx.=sprintf("%02lx", $field);
}
if ($#frequnpack < 3) {
$freqx.="00";
}
}
$freq=int(hex("0x$freqx") / 1000000 + 0.5);
}
return $freq;
}
sub mychomp {
# Used instead of chop or chomp for compatibility with perl4 and perl5
($a)=@_;
return "" if (! defined($a));
$a=~s,$/$,,g;
return $a;
}
sub hex2ascii {
$_=shift;
return $_ if (! /^0x/);
s/0x(([0-9a-f][0-9a-f])+)/pack('H*', $1)/ie;
s/[\x00|\s]+$//; # remove trailing nulls and spaces
return $_;
}
sub pdebug {
if ($debug == 1) {
print "DEBUG: @_\n";
} elsif ($debug == 2) {
printf "DEBUG time %.2f", ((times)[0] - $starttime);
print ": @_\n";
}
}
sub run {
&pdebug("Running @_");
`@_ 2>&1`;
}
sub read_prtdiag_bank_table {
# prtdiag Bank Table
$simmsize=substr($line,33,5);
if ($simmsize =~ /\dGB/) {
$simmsize=~s/GB//g;
$simmsize *= 1024;
} else {
$simmsize=~s/MB//g;
}
if (! $prtdiag_banktable_has_dimms || $line =~ / 0$/) {
# Interleave Way = 0
$simmsize /= 2;
}
if ($prtdiag_banktable_has_dimms && $line =~ / 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15/) {
# Interleave Way = 16
$simmsize *= 4;
$intcnt=1;
push(@simmsizesfound, "$simmsize");
} elsif ($intcnt) {
# Interleave Way = 16
$intcnt++;
$simmsize *= 4;
}
$a=substr($line,9,2);
$a=~s/ //g;
$b=substr($line,23,1);
$sz=&show_memory_label($simmsize);
$grpsize{$a,$b}=$sz;
$memlength=length($line);
if ($memlength > 49) {
$grpinterleave{$a,$b}=substr($line,49,40) if (substr($line,49,40));
}
if ($intcnt == 0) {
push(@simmsizesfound, "$simmsize");
$simmsize=&show_memory_label($simmsize) . " ";
if (! $prtdiag_banktable_has_dimms) {
$newline=substr($line,0,38) . " 2x" . substr($simmsize,0,5);
$newline .= substr($line,42,20) if ($memlength > 38);
}
}
$intcnt=1 if ($prtdiag_banktable_has_dimms && $line =~ / 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15/);
$intcnt=0 if ($intcnt == 16);
}
sub read_prtdiag_memory_segment_table {
# prtdiag Memory Segment Table
$simmsize=($line =~ /\dGB/) ? substr($line,19,1) * 512 : substr($line,19,3) / 2;
$grp=substr($line,-2,2);
$grp=~s/ //g;
if ($grp eq "-") {
$grp=$grpcnt;
$grpcnt++;
}
push(@simmsizesfound, "$simmsize");
$simmsize=&show_memory_label($simmsize);
$grpsize{0,$grp}=$simmsize;
}
$motherboard="";
$realmodel="";
$manufacturer="";
$i=0;
# May not have had permission to run prtconf, so see if prtdiag works
&check_for_prtdiag;
if ($diagbanner) {
if (! $filename || $SUNWexplo) {
$model=$platform;
$model=~s/SUNW,//g;
$model=~s/ORCL,//g;
} else {
$model=$diagbanner;
$model=~s/ /-/g;
# define $model for systems with $diagbanner != $model
$model="Ultra-4" if ($diagbanner =~ /Sun.Enterprise.450\b/);
$model="Sun-Blade-1000" if ($diagbanner =~ /Sun.Blade.1000\b/);
$model="Sun-Fire-280R" if ($diagbanner =~ /Sun.Fire.280R\b/);
$model="Netra t1" if ($diagbanner =~ /Netra.t1\b/);
$model="Netra-T4" if ($diagbanner =~ /Netra.T4\b/);
$model="Sun-Blade-100" if ($diagbanner =~ /Sun.Blade.1[05]0\b/);
$model="Netra-T12" if ($diagbanner =~ /Sun.Fire.V1280\b/);
$model="Serverblade1" if ($diagbanner =~ /Serverblade1\b/);
$model="Ultra-Enterprise" if ($diagbanner =~ /Enterprise.(E?[3-6][05]00|10000)\b/);
}
# Check model and banner here in case we don't have prtconf data
&check_model;
&check_banner;
}
foreach $line (@config) {
$line=&dos2unix($line);
$line=&mychomp($line);
$config_permission=1 if ($line =~ /Node /);
if ($line =~ /Permission denied/i) {
$permission_error="ERROR: $line" if (! $diagbanner || ! $prtdiag_has_mem);
}
if ($line =~ /(^\[Component\]:\s+Memory|cstm.*selclass qualifier )/) {
# for HP-UX regression test file
&hpux_check;
&hpux_cprop if ($line =~ /^\[Component\]:\s+Memory/);
&hpux_cstm;
}
if ($line =~ /banner-name:/ && ! $banner) {
$banner=$line;
$banner=~s/\s+banner-name:\s+//;
$banner=~s/'//g;
$banner=~s/SUNW,//g;
$banner=~s/ORCL,//g;
$banner=~s/TWS,//g;
$banner=~s/CYCLE,//g;
$banner=~s/\s+$//;
&check_banner;
}
if ($line =~ /model:.*AXUS/) {
# AXUS clones with their name on OBP
$manufacturer="AXUS";
}
if (($line =~ /SUNW,(Ultra-|SPARC|S240|JavaEngine1|Ultra.*[Ee]ngine)/ ||
$line =~ /SUNW,(Ultra.*Netra*|Premier-24|UltraAX-|Netra|Grover)/ ||
$line =~ /SUNW,(Enchilada|Serverblade1|Enterprise|A[0-9]|T[0-9])/ ||
$line =~ /ORCL,SPARC-|Sun.4|SUNW,Axil-|^i86pc|^i86xpv|^i86xen/ ||
$line =~ /model:\s+'(SPARC CPU|SPARC CPCI)-/ ||
$line =~ /\s+name:.*(SUNW,Sun-|'i86pc'|COMPstation|Tadpole)/ ||
$line =~ /\s+name:.*(Auspex|S-4|FJSV,GP|CompuAdd|RDI,)/) &&
$line !~ /\s+:Description\s+/ && $line !~ /\s+:*whoami:*\s+/ &&
$line !~ /\s+:*impl-arch-name:*\s+/ && $line !~ /Sun 4x Quad/i) {
$model=$line;
$model=~s/\s+name:\s+//;
$model=~s/\s+model:\s+//;
$model=~s/\s+:binding-name\s+//;
$model=~s/\s+:PlatformName\s+//;
$model=~s/'//g;
$model=~s/\s+$//;
&check_model;
if ($line =~ /CompuAdd/) {
$manufacturer="CompuAdd";
if ($model eq "SS-2") {
$banner=$model if (! $banner);
$bannermore="SPARCstation 2";
$modelmore="SPARCstation 2";
}
}
}
$foundname=1 if ($line =~ /\s+name:\s+/);
if ($line =~ /\s+model:\s+'.+,/ && ! $foundname) {
# Ultra 5/10 motherboard is 375-xxxx part number
# SS10/SS20 motherboard is Sxx,501-xxxx part number
if ($line =~ /,(375|500|501)-/) {
$motherboard=$line;
$motherboard=~s/\s+model:\s+//;
$motherboard=~s/'//g;
}
}
if ($line =~ /\sname:\s+'memory'/) {
$j=$i - 2;
if ($config[$j] =~ /\sreg:\s/) {
$gotmemory=&mychomp($config[$j]);
} elsif ($config[$j - 1] =~ /\sreg:\s/) {
$gotmemory=&mychomp($config[$j - 1]);
} elsif ($config[$j + 1] =~ /\sreg:\s/) {
$gotmemory=&mychomp($config[$j + 1]);
}
}
if ($line =~ /\sdevice_type:\s+'memory-bank'/) {
$j=$i - 3;
if ($config[$j] =~ /\sreg:\s/ && $config[$j] !~ /.00000000$/) {
$config[$j]=~s/\s+reg:\s+//;
$gotmemory=($gotmemory) ? "$gotmemory.$config[$j]" : $config[$j];
$gotmemory=&mychomp($gotmemory);
}
}
# The following is not used yet
#if ($line =~ /\sdevice_type:\s+'memory-module'/) {
# if ($config[$i - 2] =~ /\sreg:\s/) {
# $config[$i - 3]=~s/\s+socket-name:\s+//;
# if ($gotmodule) {
# $gotmodule .= ".$config[$i - 3]";
# } else {
# $gotmodule=$config[$i - 3];
# }
# $gotmodule=&mychomp($gotmodule);
# $config[$i - 2]=~s/\s+reg:\s+//;
# @module=split(/\./, $config[$i - 2]);
# $gotmodule .= ".$module[3]";
# $gotmodule=&mychomp($gotmodule);
# $config[$i + 1]=~s/\s+name:\s+//;
# $config[$i + 1] =~ y/[a-z]/[A-Z]/;
# $gotmodule .= ".$config[$i + 1]";
# $gotmodule=&mychomp($gotmodule);
# $gotmodule=~s/'//g;
# }
#}
if ($line =~ /\ssimm-use:\s+/) {
# DIMM usage on Fujitsu GP7000
$gotmodule=&mychomp($config[$i]);
$gotmodule=~s/\s+simm-use:\s+//;
$slotname0="SLOT0" if ($banner =~ /GP7000\b/);
}
if ($line =~ /\scomponent-name:\s+'.*CPU.*'/) {
# CPUs on Fujitsu GP7000F and PrimePower systems
$slotname=$line;
$slotname=~s/\s+component-name:\s+//;
$slotname=~s/'//g;
$gotcpunames=($gotcpunames) ? "$gotcpunames $slotname" : $slotname;
$boardname=$slotname;
$boardname=~s/-.*//g;
if ($boardname ne $slotname) {
if ($gotcpuboards) {
$gotcpuboards .= " $boardname" if ($gotcpuboards !~ /\b$boardname\b/);
} else {
$gotcpuboards=$boardname;
}
}
}
if ($line =~ /\sdevice_type:\s+'memory-module'/) {
# DIMM usage on Fujitsu GP7000F and PrimePower systems
$slotname="";
if ($config[$i - 3] =~ /\scomponent-name:\s/) {
$slotname=$config[$i - 3];
}
if ($config[$i - 4] =~ /\scomponent-name:\s/) {
$slotname=$config[$i - 4];
}
if ($slotname) {
$slotname=~s/\s+component-name:\s+//;
$slotname=~s/'//g;
$slotname=&mychomp($slotname);
$gotmodulenames=($gotmodulenames) ? "$gotmodulenames.$slotname" : $slotname;
$slotname0=$slotname if (! $slotname0);
$config[$i - 1]=~s/\s+reg:\s+//;
@module=split(/\./, $config[$i - 1]);
$gotmodulenames .= ".$module[1]";
$gotmodulenames=&mychomp($gotmodulenames);
}
}
if ($line =~ /\sname:\s+'cgfourteen'/) {
# Determine size of VSIMM
# Currently assumes only one VSIMM is installed
if ($config[$i - 2] =~ /\sreg:\s/) {
$sx_line=&mychomp($config[$i - 2]);
} elsif ($config[$i - 3] =~ /\sreg:\s/) {
$sx_line=&mychomp($config[$i - 3]);
}
@sxline=split(/\./, $sx_line);
$sxmem=hex("0x$sxline[5]") / $meg;
}
if ($line =~ /501-2197/) {
# 1MB Prestoserve NVSIMMs (SS1000/SC2000)
if ($config[$i + 1] =~ /\sreg:\s/) {
$nv_line=&mychomp($config[$i + 1]);
} elsif ($config[$i + 2] =~ /\sreg:\s/) {
$nv_line=&mychomp($config[$i + 2]);
}
@nvline=split(/\./, $nv_line);
$nvmem += hex("0x$nvline[2]") / $meg;
}
if ($line =~ /501-2001/) {
# 2MB Prestoserve NVSIMMs (SS10/SS20)
if ($config[$i + 1] =~ /\sreg:\s/) {
$nv_line=&mychomp($config[$i + 1]);
} elsif ($config[$i + 2] =~ /\sreg:\s/) {
$nv_line=&mychomp($config[$i + 2]);
}
@nvline=split(/\./, $nv_line);
$nvmem += hex("0x$nvline[2]") / $meg;
$nvmem1=1 if ($nvline[1] eq "10000000");
$nvmem2=1 if ($nvline[1] eq "14000000" || $nvline[1] eq "1c000000");
}
if ($line =~ /Memory size:\s/ && $installed_memory == 0) {
$installed_memory=$line;
$installed_memory=~s/^.*size: *(\d*[GM]*[Bb]*).*/$1/;
if ($installed_memory =~ /GB/) {
$installed_memory=~s/GB//g;
$installed_memory *= 1024;
} else {
$installed_memory=~s/MB//ig;
}
# prtconf sometimes reports incorrect total memory
# 32MB is minimum for sun4u machines
if ($installed_memory < 32 && $machine eq "sun4u") {
$prtconf_warn="Incorrect total installed memory (${installed_memory}MB) was reported by prtconf.";
$installed_memory=0;
}
# Round up some odd-number total memory values
$installed_memory++ if (sprintf("%3d", ($installed_memory + 1) / 2) * 2 != $installed_memory && $installed_memory >= 1023);
$BSD=0; # prtconf and prtdiag only have this output
$config_cmd="/usr/sbin/prtconf -vp" if ($config_cmd !~ /prtconf/);
$config_command="prtconf";
}
if ($sysfreq == 0 && $freq) {
$sysfreq=$freq;
$freq=0;
}
if ($devtype eq "cpu" || $line =~ /compatible: 'FJSV,SPARC64-/) {
if ($cputype =~ /SPARC64-/) {
$cpufreq=$freq if ($freq > $cpufreq);
} else {
$cpufreq=$freq;
}
$cpuline=$line;
$j=$i - 3;
while ($cpuline !~ /^$/ && $cpuline !~ /^\r$/) {
if ($cpuline =~ /clock-frequency:/) {
@freq_line=split(' ', $cpuline);
$cpufreq=&convert_freq($freq_line[1]);
$sysfreq=$freq if ($sysfreq == 0 && $freq);
} elsif ($cpuline =~ /\s(name:|compatible:)\s/ && $cpuline !~ /Sun 4/ && $cpuline !~ /SPARCstation/ && $cpuline !~ /CompuAdd/ && $cpuline !~ /'cpu/ && $cpuline !~ /'core'/) {
$cputype=&mychomp($cpuline);
$cputype=~s/\s+name:\s+//;
$cputype=~s/\s+compatible:\s+//;
$cputype=~s/'//g;
$cputype=~s/SUNW,//g;
$cputype=~s/ORCL,//g;
$cputype=~s/FJSV,//g;
$cputype=~s/ .*//g;
} elsif ($cpuline =~ /\sname:\s/ && ! $model) {
$model=&mychomp($cpuline);
$model=~s/\s+name:\s+//;
$model=~s/'//g;
$model=~s/SUNW,//g;
$model=~s/ORCL,//g;
$model=~s/FJSV,//g;
}
$j++;
$cpuline=($config[$j]) ? $config[$j] : "";
}
$freq=0;
$cpufreq=$sysfreq if ($sysfreq >= $cpufreq);
&pdebug("Checking cputype=$cputype, ncpu=$ncpu, threadcnt=$threadcnt");
if (! $cputype) {
$cputype=$machine;
$cputype="SPARC" if ($cputype =~ /^sun4/ || $model =~ /Sun 4\//);
@bannerarr=split(/\s/, $banner);
foreach $field (@bannerarr) {
if ($field =~ /SPARC/ && $field !~ /SPARCstation/) {
$cputype=$field;
} elsif ($field =~ /390Z5/) {
$field="TI,TMS$field" if ($field =~ /^390Z5/);
$cputype=($cpufreq > 70) ? "SuperSPARC-II $field" : "SuperSPARC $field";
} elsif ($field =~ /RT62[56]/) {
$cputype="hyperSPARC $field";
$machine="sun4m";
}
}
$cputype=~s/[()]//g;
} elsif ($cputype =~ /MB86907/) {
$cputype="TurboSPARC-II $cputype";
} elsif ($cputype =~ /MB86904|390S10/) {
$cputype=($cpufreq > 70) ? "microSPARC-II $cputype" : "microSPARC $cputype";
} elsif ($cputype =~ /,RT62[56]/) {
$cputype="hyperSPARC $cputype";
$machine="sun4m";
} elsif ($cputype =~ /UltraSPARC-IV/) {
# Count Dual-Core US-IV & US-IV+ as 1 CPU
$cputype="Dual-Core $cputype";
$machine="sun4u";
$threadcnt++;
$threadcnt=0 if ($threadcnt == 2);
# CPU count is better from prtdiag than psrinfo for
# US-IV & US-IV+ Dual-Core processors.
$use_psrinfo_data=0;
} elsif ($cputype =~ /UltraSPARC-T1$/) {
# Count 4-Thread (4, 6, or 8 Core) Niagara CPUs as 1 CPU
$machine="sun4v";
$threadcnt++;
# Number of cores & CPUs counted outside this loop below
} elsif ($cputype =~ /UltraSPARC-T2\+/) {
# Count 8-Thread (4, 6, or 8 Core) Victoria Falls CPUs as 1 CPU
$machine="sun4v";
$threadcnt++;
# Number of cores & CPUs counted outside this loop below
} elsif ($cputype =~ /UltraSPARC-T2$/) {
# Count 8-Thread (4 or 8 Core) Niagara-II CPUs as 1 CPU
$machine="sun4v";
$threadcnt++;
# Number of cores & CPUs counted outside this loop below
} elsif ($cputype =~ /SPARC-T3$/) {
# Count 8-Thread (8 or 16 Core) Rainbow Falls CPUs as 1 CPU
$machine="sun4v";
$threadcnt++;
# Number of cores & CPUs counted outside this loop below
} elsif ($cputype =~ /SPARC-T4$/) {
# Count 8-Thread 8-Core SPARC-T4 CPUs as 1 CPU
$machine="sun4v";
$threadcnt++;
# Number of cores & CPUs counted outside this loop below
} elsif ($cputype =~ /SPARC-T5$/) {
# Count 8-Thread 16-Core SPARC-T5 CPUs as 1 CPU
$machine="sun4v";
$threadcnt++;
# Number of cores & CPUs counted outside this loop below
} elsif ($cputype =~ /SPARC64-VI$/ && $devtype eq "cpu") {
# Count Dual-Core Dual-Thread as 1 CPU
$machine="sun4u";
$threadcnt++;
# Number of cores & CPUs counted outside this loop below
} elsif ($cputype =~ /SPARC64-VII\+\+$/ && $devtype eq "cpu") {
# Count Quad-Core Dual-Thread as 1 CPU
$machine="sun4u";
$threadcnt++;
# Number of cores & CPUs counted outside this loop below
} elsif ($cputype =~ /SPARC64-VII\+$/ && $devtype eq "cpu") {
# Count Quad-Core Dual-Thread as 1 CPU
$machine="sun4u";
$threadcnt++;
# Number of cores & CPUs counted outside this loop below
} elsif ($cputype =~ /SPARC64-VII$/ && $devtype eq "cpu") {
# Count Quad-Core Dual-Thread as 1 CPU
$machine="sun4u";
$threadcnt++;
# Number of cores & CPUs counted outside this loop below
} elsif ($cputype eq "SPARC64-VIII" && $devtype eq "cpu") {
# Guess on the Venus SPARC64-VIII name ???
# Count 8-Core Dual-Thread as 1 CPU
$machine="sun4u";
$threadcnt++;
# Number of cores & CPUs counted outside this loop below
} elsif ($cputype =~ /SPARC64-X$/ && $devtype eq "cpu") {
# Count 16-Core Dual-Thread as 1 CPU
$machine="sun4v";
$threadcnt++;
# Number of cores & CPUs counted outside this loop below
}
if ($threadcnt == 0 && $devtype eq "cpu") {
$ncpu++;
$cpucnt{"$cputype $cpufreq"}++;
$cpucntfrom=$config_command;
}
$devtype="";
if (! $kernbit) {
$kernbit=32 if ($machine =~ /sun4[cdm\b]/);
$kernbit=64 if ($machine eq "sun4v" || $cputype =~ /UltraSPARC-III|UltraSPARC-IV|SPARC64/);
}
}
if ($line =~ /device_type:/) {
@dev_line=split(/\'/, $line);
$devtype=$dev_line[1];
}
if ($line =~ /clock-frequency:/) {
@freq_line=split(' ', $line);
$freq=&convert_freq($freq_line[1]);
}
if ($line =~ /\sversion:\s+'OBP/ && ! $romver) {
$romver=$line;
$romver=~s/\s+version:\s+//;
$romver=~s/'//g;
@romverarr=split(/\s/, $romver);
$romvernum=$romverarr[1];
}
if ($line =~ /compatible:\s+'sun4.'/ && ! $osrel) {
@compatible_line=split(/\'/, $line);
$machine=$compatible_line[1];
}
if ($line =~ /value='.*AMD Opteron/ && $cputype eq "x86") {
$cputype_prtconf=$line;
$cputype_prtconf=~s/.*='//;
$cputype_prtconf=~s/'//g;
}
$i++;
}
&multicore_cpu_cnt;
&check_cpuinfo;
&check_xm_info;
if (! $osrel) {
if ($BSD) {
$osrel="4.X";
$config_cmd="/usr/etc/devinfo -pv";
$config_command="devinfo";
$cpucntfrom="devinfo";
# } elsif ($os =~ /Linux|FreeBSD/) {
# $osrel="2.X"; # Could also be 3.X Linux kernel, so leave empty
} else {
$osrel="5.X";
$solaris="2.X";
if ($machine =~ /86/) {
$solaris .= " X86";
} elsif ($machine =~ /sun4/) {
$solaris .= " SPARC";
}
$config_cmd="/usr/sbin/prtconf -vp";
$config_command="prtconf";
}
}
$memfrom=$config_command;
#$sysfreq=$freq if ($sysfreq == 0 && $freq);
#$cpufreq=$sysfreq if ($sysfreq > $cpufreq && $ncpu);
@romverarr=split(/\./, $romvernum) if ($romver);
$romvermajor=($romverarr[0]) ? $romverarr[0] : 2;
$romverminor=($romverarr[1]) ? $romverarr[1] : 0;
$romverminor=0 if (! $romverminor || $romverminor eq "X");
if ($banner =~ /^ \(/) {
# banner-name does not include the eeprom banner name. This happens
# sometimes when OBP 3.23 is installed on Ultra-60/E220R and
# Ultra-80/E420R systems.
$bannermore="Ultra 60 or Enterprise 220R" if ($model eq "Ultra-60");
$bannermore="Ultra 80, Enterprise 420R or Netra t 1400/1405" if ($model eq "Ultra-80");
}
#
# SPARCengine systems
#
$ultra="AX" if ($motherboard =~ /501-3043/);
$ultra="AX-300" if ($motherboard =~ /501-5037/);
$ultra="AXi" if ($motherboard =~ /501-4559/);
$ultra="AXmp" if ($banner =~ /UltraAX-MP/ || $model =~ /UltraAX-MP/ || $motherboard =~ /501-(5296|5487|5670)/);
$ultra="AXmp+" if ($banner =~ /UltraAX-MP\+/ || $model =~ /UltraAX-MP\+/ || $motherboard =~ /501-4324/);
$ultra="AXe" if ($banner =~ /UltraAXe\b/ || $model =~ /UltraAX-e\b/ || $motherboard =~ /375-0088/);
$ultra="AX-e2" if ($banner =~ /Netra AX1105-500\b/ || $model =~ /UltraAX-e2\b/ || $motherboard =~ /375-0128/);
$ultra="Netra X1" if ($banner =~ /Netra X1\b/ || $motherboard =~ /375-3015/);
$ultra="Netra T1 200" if ($banner =~ /Netra T1 200\b/ || $motherboard =~ /375-0132/);
$ultra="Sun Fire V100" if ($banner =~ /Sun Fire V100\b/);
# Sun Fire V120/Netra 120 can use motherboard 375-0132 like Netra T1 200 above
$ultra="Sun Fire V120" if ($banner =~ /Sun Fire V120\b/);
$ultra="Netra 120" if ($banner =~ /Netra 120\b/);
if ($ultra =~ /AX/) {
if ($banner !~ /SPARCengine.*Ultra/) {
$tmp="(SPARCengine Ultra $ultra)";
$bannermore=($bannermore) ? "$tmp $bannermore" : $tmp;
}
}
if ($model =~ /Ultra-5_10\b/) {
if ($banner =~ /\bVoyagerIIi\b/) {
# Tadpole Voyager IIi has 8 DIMM slots, but prtconf reports
# it as an Ultra 5/10
$model="VoyagerIIi";
$ultra="VoyagerIIi";
}
}
$ultra="Sun Blade 150" if ($banner =~ /Sun Blade 150\b/ || $diagbanner =~ /Sun Blade 150\b/);
$ultra="UP-20" if ($banner =~ /\bUP-20\b/); # untested ???
$ultra="UP-520IIi" if ($motherboard =~ /501-4559/ && $banner =~ /\b520IIi\b/);
$need_obp2=0;
if ($model eq "Sun 4/20" || $model eq "Sun 4/25" || $model eq "Sun 4/40" || $model eq "Sun 4/50" || $model eq "Sun 4/60" || $model eq "Sun 4/65" || $model eq "Sun 4/75" || $model eq "SS-2") {
$machine="sun4c";
$need_obp2=1 if ($model eq "Sun 4/40" || $model eq "Sun 4/60" || $model eq "Sun 4/65");
}
&check_prtdiag if ($isX86);
if ($isX86) {
# Round up Solaris x86 memory (may have 128MB or more reserved)
$installed_memory=&roundup_memory($installed_memory);
}
if (! $gotmemory && $ultra eq 0 && $machine ne "sun4d" && $boardfound_mem eq 0) {
&check_prtdiag;
&show_header;
if ($installed_memory) {
print "total memory = ";
&show_memory($installed_memory);
}
print "$permission_error\n" if ($permission_error);
print "$prtconf_warn\n" if ($prtconf_warn);
if ($prtdiag_failed == 2) {
&found_nonglobal_zone;
} else {
print "ERROR: no 'memory' line in \"$config_cmd\" output.\n" if ($machine =~ /sun4/);
if (! $config_permission && $machine =~ /sun4/ && ! $prtconf_warn) {
print " This user ";
print (($permission_error) ? "does" : "may");
print " not have permission to run $config_command.\n";
print " Try running memconf as a privileged user like root.\n" if ($uid ne "0");
} elsif ($need_obp2) {
print " Upgrading from Open Boot PROM V1.X to V2.X will ";
print "allow memconf to\n detect the memory installed.\n";
} elsif ($prtconf_warn =~ /openprom/) {
print " Please correct the problem with the openprom device.\n" if ($machine =~ /sun4/);
} else {
print " This is an unsupported system by memconf.\n" if ($machine =~ /sun4/);
}
}
&show_supported if ($machine !~ /sun4/ && $prtdiag_failed != 2);
$exitstatus=1;
&mailmaintainer if ($verbose == 3);
&pdebug("exit $exitstatus");
exit $exitstatus;
}
$gotmemory=~s/\s+reg:\s+//;
$gotmemory=~s/'//g;
@slots=split(/\./, $gotmemory);
$slot=1;
if ($machine =~ /sun4|i86pc|i86xpv|i86xen/ && $manufacturer && $manufacturer !~ /^Sun\b|^Oracle\b/ && $ultra !~ /SPARC Enterprise M[34589]000 Server/ && ! &is_virtualmachine) {
$bannermore=($bannermore) ? "$bannermore clone" : "clone" if ($manufacturer ne "Force Computers");
$modelmore=($modelmore) ? "$modelmore clone" : "clone" if (! $isX86);
$clone=1;
}
# DIMMs are installed in pairs on Ultra 1, 5 and 10; quads on
# Ultra 2, 60, 80, 220R, 420R, 450; 8's in Ultra Enterprise
#
# On 64-bit systems, prtconf format is AAAAAAAA.AAAAAAAA.SSSSSSSS.SSSSSSSS
# and on 32-bit systems, prtconf format is AAAAAAAA.AAAAAAAA.SSSSSSSS
# where A is for Address, S is for Size.
# Minimum module size is 1MB (0x00100000), so strip off last 5 hex digits of LSB
# and prepend last 5 digits of MSB, which allows recognizing up to 4500TB!
#
if ($ultra) {
$val0=3; # simmsize is in 3rd and 4th fields
$valaddr=2; # address is 2 fields before simmsize
$valinc=4; # fields per simm
$memtype="DIMM";
} else {
$val0=2; # simmsize is in 3rd field
$valaddr=1; # address is 1 field before simmsize
$valinc=3; # fields per simm
}
#
# Define memory layout for specific systems
#
if ($model eq "Sun 4/20") {
# SLC accepts 4MB SIMMs on motherboard
# 501-1676 (4MB 100ns), 501-1698 (4MB 80ns)
# 33-bit 72-pin Fast Page Mode (36-bit work also)
# Does not support Open Boot PROM V2.X, so devinfo/prtconf output will
# not have memory lines.
$devname="OffCampus";
$untested=1;
$simmrangex="00000010";
$simmbanks=4;
$simmsperbank=1;
@simmsizes=(4);
@socketstr=("U0502","U0501","U0602","U0601");
}
if ($model eq "Sun 4/25") {
# ELC accepts 4MB or 16MB SIMMs on motherboard
# 501-1698 or 501-1812 (4MB 80ns), 501-1822 (16MB 80ns)
# 33-bit 72-pin Fast Page Mode (36-bit work also)
$devname="NodeWarrior";
$untested=0;
$simmrangex="00000010";
$simmbanks=4;
$simmsperbank=1;
@simmsizes=(4,16);
@socketstr=("U0407".."U0410");
@bankstr=("MEM1".."MEM4");
}
if ($model eq "Sun 4/40") {
# IPC accepts 1MB or 4MB SIMMs on motherboard
# 501-1697 (1MB 80ns), 501-1625 (4MB 100ns), 501-1739 (4MB 80ns)
# Does not show memory with Open Boot PROM V1.X, but does with OBP V2.X
$devname="Phoenix";
$untested=0;
$simmrangex="00000010";
$simmbanks=3;
$simmsperbank=4;
@simmsizes=(1,4);
@socketstr=("U0588","U0587","U0586","U0585","U0584","U0591","U0590","U0589","U0678","U0676","U0683","U0677");
@bankstr=(0,0,0,0,1,1,1,1,2,2,2,2);
@bytestr=(0..3,0..3,0..3);
}
if ($model eq "Sun 4/50") {
# IPX accepts 4MB or 16MB SIMMs on motherboard
# 501-1812 (4MB 80ns), 501-1915 or 501-1822 (16MB 80ns)
# 33-bit 72-pin Fast Page Mode (36-bit work also)
$devname="Hobbes";
$untested=0;
$simmrangex="00000010";
$simmbanks=4;
$simmsperbank=1;
@simmsizes=(4,16);
@socketstr=("U0310","U0309","U0308","U0307");
@bankstr=(0..3);
}
if ($model eq "Sun 4/60" || $model eq "Sun 4/65") {
# SS1 and SS1+ accepts 1MB or 4MB SIMMs on motherboard
# 501-1408 (1MB 100ns), 501-1697 (SS1+ only) (1MB 80ns),
# 501-1625 (4MB 100ns), 501-1739 (4MB 80ns)
# Does not show memory with Open Boot PROM V1.X, but does with OBP V2.X
if ($model eq "Sun 4/60") {
$devname="Campus";
$untested=0;
} else {
$devname="CampusB, Campus+";
$untested=1;
}
$simmrangex="00000010";
$simmbanks=4;
$simmsperbank=4;
@simmsizes=(1,4);
@socketstr=("U0588","U0587","U0586","U0585","U0584","U0591","U0590","U0589","U0678","U0676","U0683","U0677","U0682","U0681","U0680","U0679");
@bankstr=(0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3);
@bytestr=(0..3,0..3,0..3,0..3);
}
if ($model eq "Sun 4/75" || $model eq "SS-2") {
# SS2 accepts 4MB SIMMs on motherboard and 32MB or 64MB SBus expansion
# card (501-1823 Primary and 501-1824 Secondary)
# 501-1739 (4MB 80ns)
$devname="Calvin";
$untested=0;
$simmrangex="00000010";
$simmbanks=4;
$simmsperbank=4;
@simmsizes=(4);
@socketstr=("U0311","U0309","U0307","U0322","U0312","U0310","U0308","U0321","U0313","U0314","U0315","U0320","U0319","U0318","U0317","U0316");
@bankstr=(0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3);
@bytestr=(0..3,0..3,0..3,0..3);
}
if ($model =~ /SPARCclassic|SPARCstation-LX/) {
# Classic-X (4/10) accepts 1MB, 2MB, 4MB and 16MB SIMMs on motherboard
# Classic (4/15) and LX (4/30) accepts 4MB and 16MB SIMMs on motherboard
# Can accept 32MB SIMMs in bank 1, allowing 128MB total (2x32, 4x16)
# Possibly accepts 8MB SIMMs in bank 1
# 501-2289 (1MB), 501-2433 (2MB) on Classic-X only
# 501-1991 (4MB), 501-2059 (16MB)
# 36-bit 72-pin 60ns Fast Page Mode
$devname="Sunergy";
if ($model =~ /SPARCclassic-X/) {
$untested=1;
@simmsizes=(1,2,4,8,16,32);
} else {
$untested=0;
@simmsizes=(4,8,16,32);
}
$simmrangex="00000020";
$simmbanks=3;
$simmsperbank=2;
@socketstr=("U0304","U0303","U0301","U0302","U0402","U0401");
@bankstr=(1,1,2,2,3,3);
}
if ($model eq "S240") {
# Voyager has 16MB on motherboard, plus accepts one or two 16MB or 32MB
# Memory cards (501-2327 32MB, 501-2366 16MB)
# Motherboard, address 0x00000000-0x007fffff, 0x01000000-0x017fffff
# Lower slot=Mem 1, address 0x02000000-0x07ffffff
# Upper slot=Mem 2, address 0x0a000000-0x0fffffff
$devname="Gypsy";
$untested=0;
$memtype="memory card";
$sockettype="slot";
$simmrangex="00000020";
$simmbanks=8; # Count the skipped address range
$simmsperbank=1;
@simmsizes=(16,32);
@socketstr=("motherboard","Mem 1","Mem 1","Mem 1","?","Mem 2","Mem 2","Mem 2");
@orderstr=("","lower slot","lower slot","lower slot","?","upper slot","upper slot","upper slot");
}
if ($model eq "JavaEngine1") {
# Accepts 8MB, 16MB and 32MB EDO DIMMs
$devname="Bali";
$untested=0;
$memtype="DIMM";
$simmrangex="00000020";
$simmbanks=2;
$simmsperbank=1;
@simmsizes=(8,16,32);
@socketstr=("J0501","J0502");
@bankstr=(0,1);
}
if ($model eq "SPARCstation-4") {
# Accepts 8MB and 32MB SIMMs on motherboard
# 501-2470 (8MB), 501-2471 (32MB)
# 168-pin 60ns Fast Page Mode
$devname="Perigee";
$untested=0;
$simmrangex="00000020";
$simmbanks=5;
$simmsperbank=1;
@simmsizes=(8,32);
@socketstr=("J0301".."J0305");
@bankstr=(0..4);
}
if ($model eq "SPARCstation-5" || $model eq "micro COMPstation 5" || $model =~ /Axil-255/ || $banner =~ /TWINstation 5G\b/) {
# Accepts 8MB and 32MB SIMMs on motherboard
# 501-2470 (8MB), 501-2471 (32MB)
# 168-pin 60ns Fast Page Mode
$devname="Aurora" if ($model eq "SPARCstation-5");
$untested=0;
$simmrangex="00000020";
$simmbanks=8;
$simmsperbank=1;
@simmsizes=(8,32);
@socketstr=("J0300".."J0303","J0400".."J0403");
@bankstr=(0..7);
if ($banner =~ /TWINstation 5G\b/) {
$simmbanks=6;
@socketstr=(0..5);
}
if ($model ne "SPARCstation-5") {
$bannermore="SPARCstation 5 clone";
$modelmore="SPARCstation 5 clone";
}
}
if ($model =~ /SPARCstation-10/ || $model eq "Premier-24" || $motherboard eq "SUNW,S10,501-2365") {
# Accepts 16MB and 64MB SIMMs on motherboard
# 501-1785 or 501-2273 (16MB 80ns), 501-2479 (16MB 60ns),
# 501-2622 (32MB 60ns), 501-1930 (64MB 80ns), 501-2480 (64MB 60ns)
# 200-pin 60ns or 80ns Fast Page Mode ECC
# 32MB SIMMs not supported according to Sun, but appears to work fine
# depending on the OBP revision. OBP 2.12 and older detects the 32MB
# SIMM as 16MB, OBP 2.19 and later properly detects the 32MB SIMM.
$devname="Campus2" if ($model =~ /SPARCstation-10/);
$devname="Campus2+" if ($model =~ /Premier-24/);
$untested=0;
$simmrangex="00000040";
$simmbanks=8;
$simmsperbank=1;
$romvernum="2.X" if (! $romvernum);
$romverminor=0 if (! $romverminor || $romverminor eq "X");
@simmsizes=(($romvermajor eq 2) && ($romverminor >= 19)) ? (16,32,64) : (16,64);
@socketstr=("J0201","J0203","J0302","J0304","J0202","J0301","J0303","J0305");
@orderstr=("1st","3rd","4th","2nd","8th","6th","5th","7th");
@bankstr=(0..7);
}
if ($model =~ /SPARCstation-20|COMPstation-20S/ || $banner =~ /TWINstation 20G\b/) {
# Accepts 16MB, 32MB and 64MB SIMMs on motherboard
# 501-2479 (16MB), 501-2622 (32MB), 501-2480 (64MB)
# 200-pin 60ns Fast Page Mode ECC
$devname="Kodiak" if ($model eq "SPARCstation-20");
$untested=0;
$simmrangex="00000040";
$simmbanks=8;
$simmsperbank=1;
@simmsizes=(16,32,64);
@socketstr=("J0201","J0303","J0202","J0301","J0305","J0203","J0302","J0304");
@orderstr=("1st","2nd","3rd","4th","5th","6th","7th","8th");
@bankstr=(0..7);
if ($model !~ /SPARCstation-20/) {
$bannermore="SPARCstation 20 clone";
$modelmore="SPARCstation 20 clone";
}
if ($model eq "SPARCstation-20I") {
$bannermore="(SPARCstation-20I) clone";
$modelmore="clone";
}
if ($banner =~ /TWINstation 20G\b/) {
# @socketstr=("J0201","J0303","J0202","J0301","J0305","J0203","J0302","J0304");
# @orderstr=("1st","6th","2nd","4th","8th","3rd","5th","7th");
@socketstr=(0..7);
@orderstr=("");
}
}
if ($model eq "SPARCsystem-600" || $model =~ /Sun.4.600/) {
# Accepts 4MB or 16MB SIMMs on motherboard
# Accepts 1MB, 4MB or 16MB SIMMs on VME expansion cards
# A memory bank is 16 SIMMs of the same size and speed
# Minimum memory configuration is 16 SIMMs in Bank 0 on the motherboard
# Motherboard Bank 1 must be populated before adding expansion cards
# Up to two VME memory expansion cards can be added
# Use 4MB SIMM 501-1739-01 or 501-2460-01
# Use 16MB SIMM 501-2060-01
$devname="Galaxy";
$untested=0;
$simmrangex="00000100";
$simmbanks=2; # 2 banks on CPU board, 4 banks on each expansion cards
$simmsperbank=16;
@simmsizes=(4,16);
# Sockets, banks and bytes on motherboard
@socketstr=("U1107","U1307","U1105","U1305","U1103","U1303","U1101","U1301","U1207","U1407","U1205","U1405","U1203","U1403","U1201","U1401","U1108","U1308","U1106","U1306","U1104","U1304","U1102","U1302","U1208","U1408","U1206","U1406","U1204","U1404","U1202","U1402");
@bankstr=(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
@banksstr=("Motherboard bank 0","Motherboard bank 1");
@bytestr=("0L0","0L1","1L0","1L1","2L0","2L1","3L0","3L1","4L0","4L1","5L0","5L1","6L0","6L1","7L0","7L1","0H0","0H1","1H0","1H1","2H0","2H1","3H0","3H1","4H0","4H1","5H0","5H1","6H0","6H1","7H0","7H1");
# Sockets, banks and bytes on VME expansion cards
@socketstr_exp=("U1501","U1503","U1505","U1507","U1601","U1603","U1605","U1607","U1701","U1703","U1705","U1707","U1801","U1803","U1805","U1807","U1502","U1504","U1506","U1508","U1602","U1604","U1606","U1608","U1702","U1704","U1706","U1708","U1802","U1804","U1806","U1808","U1901","U1903","U1905","U1907","U2001","U2003","U2005","U2007","U2101","U2103","U2105","U2107","U2201","U2203","U2205","U2207","U1902","U1904","U1906","U1908","U2002","U2004","U2006","U2008","U2102","U2104","U2106","U2108","U2202","U2204","U2206","U2208");
@bankstr_exp=("B0","B0","B0","B0","B0","B0","B0","B0","B0","B0","B0","B0","B0","B0","B0","B0","B1","B1","B1","B1","B1","B1","B1","B1","B1","B1","B1","B1","B1","B1","B1","B1","B2","B2","B2","B2","B2","B2","B2","B2","B2","B2","B2","B2","B2","B2","B2","B2","B3","B3","B3","B3","B3","B3","B3","B3","B3","B3","B3","B3","B3","B3","B3","B3");
@bytestr_exp=("0L0","0L1","1L0","1L1","2L0","2L1","3L0","3L1","4L0","4L1","5L0","5L1","6L0","6L1","7L0","7L1","0H0","0H1","1H0","1H1","2H0","2H1","3H0","3H1","4H0","4H1","5H0","5H1","6H0","6H1","7H0","7H1","8L0","8L1","9L0","9L1","aL0","aL1","bL0","bL1","cL0","cL1","dL0","dL1","eL0","eL1","fL0","fL1","8H0","8H1","9H0","9H1","aH0","aH1","bH0","bH1","cH0","cH1","dH0","dH1","eH0","eH1","fH0","fH1");
}
if ($model eq "Ultra-1" || $ultra eq 1) {
# Accepts 16MB, 32MB, 64MB or 128MB DIMMs on motherboard
# 501-2479 (16MB), 501-2622 (32MB), 501-2480 or 501-5691 (64MB),
# 501-3136 (128MB)
# 200-pin 60ns Fast Page Mode ECC
$devname="Neutron (Ultra 1), Electron (Ultra 1E), Dublin (Ultra 150)";
$familypn="A11 (Ultra 1), A12 (Ultra 1E)";
$untested=0;
$simmrangex="00000100";
$simmbanks=4;
$simmsperbank=2;
@simmsizes=(16,32,64,128);
@socketstr=("U0701","U0601","U0702","U0602","U0703","U0603","U0704","U0604");
@bankstr=("0L","0H","1L","1H","2L","2H","3L","3H");
@bytestr=("00-15","16-31","00-15","16-31","00-15","16-31","00-15","16-31");
}
if ($model eq "Ultra-2" || $ultra eq 2) {
# Accepts 16MB, 32MB, 64MB or 128MB DIMMs on motherboard
$devname="Pulsar";
$familypn="A14";
$untested=0;
$simmrangex="00000200";
$simmbanks=4;
$simmsperbank=4;
@simmsizes=(16,32,64,128);
@socketstr=("U0501","U0401","U0701","U0601","U0502","U0402","U0702","U0602","U0503","U0403","U0703","U0603","U0504","U0404","U0704","U0604");
@groupstr=(0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3);
@bankstr=("0L","0H","1L","1H","0L","0H","1L","1H","0L","0H","1L","1H","0L","0H","1L","1H");
@bytestr=("00-15","16-31","32-47","48-63","00-15","16-31","32-47","48-63","00-15","16-31","32-47","48-63","00-15","16-31","32-47","48-63");
}
if ($model eq "Ultra-30" || $ultra eq 30) {
# Also Netra t 1100
# Accepts 16MB, 32MB, 64MB or 128MB DIMMs on motherboard
# 501-2479 (16MB), 501-2622 (32MB), 501-2480 or 501-5691 (64MB),
# 501-3136 (128MB)
# 200-pin 60ns Fast Page Mode ECC
# Two DIMMs form a pair, two pairs of DIMMs form a quad.
# Minimum requirements is two DIMMs in any adjacent pair.
# DIMMs can be installed in any order of pairs.
# Interleaving requires a fully populated quad.
# Each quad addresses 512MB of memory.
$devname="Quark (Ultra-30), Lightweight (Netra t 1100)";
$familypn="A16 (Ultra-30), N01 (Netra t 1100)";
$untested=0;
# simmrangex, simmbanks, and simmsperbank set later after determining
# if interleaving banks using quads rather than pairs
@simmsizes=(16,32,64,128);
@socketstr=("U0701","U0801","U0901","U1001","U0702","U0802","U0902","U1002","U0703","U0803","U0903","U1003","U0704","U0804","U0904","U1004");
@bankstr=("Quad 0 Pair 0","Quad 0 Pair 0","Quad 0 Pair 1","Quad 0 Pair 1","Quad 1 Pair 0","Quad 1 Pair 0","Quad 1 Pair 1","Quad 1 Pair 1","Quad 2 Pair 0","Quad 2 Pair 0","Quad 2 Pair 1","Quad 2 Pair 1","Quad 3 Pair 0","Quad 3 Pair 0","Quad 3 Pair 1","Quad 3 Pair 1");
}
if ($model eq "Ultra-5_10" || $ultra eq "5_10" || $ultra eq 5 || $ultra eq 10) {
# Accepts 16MB, 32MB, 64MB, 128MB or 256MB DIMMs on motherboard
# 16MB DIMM uses 10-bit column addressing and was not sold
# 32, 64, 128 and 256MB DIMMs use 11-bit column addressing
# Do not mix 16MB DIMMs with other sizes
# 256MB DIMM not supported in Ultra 5 according to Sun documentation,
# but they do work as long as you use low-profile DIMMs or take out the
# floppy drive.
# Memory speed is 60ns if 50ns and 60ns DIMMs are mixed
# 2-way interleaving supported with four identical sized DIMMs
# 50ns DIMMs supported on 375-0066 & 375-0079 motherboards
# Bank 0 DIMM1/DIMM2 0x00000000-0x0fffffff, 0x20000000-0x2fffffff
# Bank 1 DIMM3/DIMM4 0x10000000-0x1fffffff, 0x30000000-0x3fffffff
$devname="Darwin/Otter (Ultra 5), Darwin/SeaLion (Ultra 10)";
$familypn="A21 (Ultra 5), A22 (Ultra 10)";
$untested=0;
$simmrangex="00000100";
$simmbanks=2;
$simmsperbank=2;
@simmsizes=(16,32,64,128,256);
@socketstr=("DIMM1".."DIMM4");
@bankstr=("0L","0H","1L","1H");
$sortslots=0;
}
if ($model eq "Ultra-60" || $ultra eq 60 || $ultra eq "220R") {
# Also Netra t1120/1125
# Accepts 16MB, 32MB, 64MB or 128MB DIMMs on motherboard
# 501-2479 (16MB), 501-2622 (32MB), 501-2480 or 501-5691 (64MB),
# 501-3136 (128MB)
# 200-pin 60ns Fast Page Mode ECC
# U1001-U1004 bank 3 address 0xa0000000-0xbfffffff
# U0901-U0904 bank 2 address 0x80000000-0x9fffffff
# U0801-U0804 bank 1 address 0x20000000-0x3fffffff
# U0701-U0704 bank 0 address 0x00000000-0x1fffffff
if ($model eq "Ultra-60" || $ultra eq 60) {
$devname="Deuterium (Ultra-60), Lightweight 2 (Netra t112x)";
$familypn="A23 (Ultra-60), N02/N04 (Netra t1120), N03 (Netra t1125)";
}
if ($ultra eq "220R") {
$devname="Razor";
$familypn="A34";
}
$untested=0;
$simmrangex="00000200";
$simmbanks=6; # Count the skipped address range
$simmsperbank=4;
@simmsizes=(16,32,64,128);
@socketstr=("U0701".."U0704","U0801".."U0804","?","?","?","?","?","?","?","?","U0901".."U0904","U1001".."U1004");
@bankstr=(0,0,0,0,1,1,1,1,"?","?","?","?","?","?","?","?",2,2,2,2,3,3,3,3);
}
#
# SPARCengine systems
#
if ($banner =~ /(Netra t1|Ultra CP 1500)\b/ || $ultra eq "Netra t1" || $model eq "Netra t1" || $ultra eq "CP1500" || $ultra eq "Netra ct400" || $ultra eq "Netra ct410" || $ultra eq "Netra ct800" || $ultra eq "Netra ct810") {
# Netra t1 100/105, Netra ct400/410/800/810, SPARCengine CP1500
# Accepts 1 or 2 64MB, 128MB, 256MB or 512MB mezzanine memory cards
# Netra ct400/800 use the Netra ct1600 DC chassis (N08)
# Netra ct410/810 use the Netra ct1600 AC chassis (N09)
# Also used in Sun Fire 12K & Sun Fire 15K
# Install the highest capacity memory board first
# The 370-4155 was sold for use in the Netra t1 100/105
# Up to four 370-4155 256MB memory boards can be installed
# Only one 370-4155 can be mixed with any other memory boards
# Cannot distinguish between 4 370-4155 256MB and 2 512MB memory boards
# Maximum memory: 768MB for 270MHz/33MHz, 1GB for 360MHz/440MHz systems
#
# Top slot -> 64MB 64MB 128MB 128MB 256MB 256MB 512MB
# Bottom slot SSF SS DSF SS SSF SS DSF SS DSF DS DSF SS DSF DS
# |
# v ------ ------ ------ ------ ------ ------ ------
# 64MB SSF SS Y N Y N N Y N
# 64MB DSF SS Y Y Y Y Y Y Y
# 128MB SSF SS Y N Y N N Y N
# 128MB DSF SS Y Y Y Y Y Y Y
# 256MB DSF SS Y Y Y Y Y Y Y
# 512MB DSF DS Y/N * Y/N * Y/N * Y/N * Y/N * Y/N * Y/N *
#
# SSF=single-sided fab, DSF=double-sided fab
# SS=stuffed on one side, DS=stuffed on both sides
# * 512MB DSF DS board is supported on 360MHz and 440MHz systems,
# 512MB DSF DS board is not supported on 270MHz and 333MHz systems
# Lower board, address 0x00000000-0x0fffffff, 0x20000000-0x2fffffff
# upper board, address 0x10000000-0x1fffffff, 0x30000000-0x3fffffff
if ($banner =~ /Netra t1\b/ || $ultra eq "Netra t1" || $model eq "Netra t1") {
$devname="Flyweight (Model 100), Flapjack (Model 105)";
$familypn="N07 (Model 100), N06 (Model 105)";
}
$devname="Tonga" if ($ultra eq "Netra ct400");
$devname="Monte Carlo" if ($ultra eq "Netra ct800");
$familypn="N08" if ($ultra =~ /Netra ct[48]00/);
if ($ultra =~ /Netra ct[48]10/) {
$devname="Makaha";
$familypn="N09";
}
$untested=0;
$untested=1 if ($ultra eq "Netra ct400" || $ultra =~ /Netra ct[48]10/);
$memtype="memory card";
$sockettype="";
$simmrangex="00000100";
$simmbanks=2;
$simmsperbank=1;
@simmsizes=(64,128,256,512);
@socketstr=("base mezzanine board","additional mezzanine board");
@orderstr=("lower board","upper board");
$sortslots=0;
}
if ($banner =~ /Ultra CP 1400\b/ || $ultra eq "CP1400") {
# Accepts 1 or 2 64MB, 128MB, 256MB or 512MB mezzanine memory cards
# Has 64MB on-board memory on motherboard
# Maximum memory: 832MB (64MB motherboard, 512MB bottom, 256MB top)
#
# Top slot -> 64MB 64MB 128MB 128MB 256MB 512MB
# Bottom slot SSF SS DSF SS SSF SS DSF SS DSF SS DSF DS
# |
# v ------ ------ ------ ------ ------ ------
# 64MB SSF SS Y N Y N Y N
# 64MB DSF SS Y Y Y Y Y N
# 128MB SSF SS Y N Y N Y N
# 128MB DSF SS Y Y Y Y Y N
# 256MB DSF SS Y Y Y Y Y N
# 512MB DSF DS Y Y Y Y Y N
#
# SSF=single-sided fab, DSF=double-sided fab
# SS=stuffed on one side, DS=stuffed on both sides
# 512MB DSF DS board is only supported in bottom slot
#
# Motherboard, address 0x00000000-0x03ffffff
# Upper board, address 0x08000000-0xffffffff, 0x28000000-0x2fffffff
# Lower board, address 0x10000000-0x17ffffff, 0x30000000-0x37ffffff
$devname="Casanova";
$untested=0;
$memtype="memory card";
$sockettype="";
$simmrangex="00000080";
$simmbanks=3;
$simmsperbank=1;
@simmsizes=(64,128,256,512);
@socketstr=("motherboard","additional mezzanine board","base mezzanine board");
@orderstr=("","upper board","lower board");
$sortslots=0;
}
if ($ultra eq "AX" || $ultra eq "AX-300") {
# SPARCengine Ultra AX and AX-300
# Accepts 8MB, 16MB, 32MB or 64MB DIMMs on motherboard
# AX-300 also accepts 128MB DIMMs on motherboard
$devname="Photon";
$untested=0; # unsure if socket order is correct
$simmrangex="00000200";
$simmbanks=2;
$simmsperbank=4;
@simmsizes=(8,16,32,64,128);
@socketstr=("U0301".."U0304","U0401".."U0404");
@bankstr=(0,0,0,0,1,1,1,1);
}
if ($ultra eq "AXi") {
# SPARCengine Ultra AXi
# Accepts 8MB, 16MB, 32MB, 64MB or 128MB single or dual bank 10-bit
# column address type DIMMs on motherboard in all socket pairs
# Accepts 8MB, 16MB, 32MB, 64MB, 128MB or 256MB dual bank 11-bit
# column address type DIMMs on motherboard in Pairs 0 & 2
# (leave Pairs 1 & 3 empty)
# DIMMs should be chosen as all 10-bit or all 11-bit column address type
# Use 60ns DIMMs only
#$devname="unknown";
$untested=0;
$simmrangex="00000100";
$simmbanks=4;
$simmsperbank=2;
@simmsizes=(8,16,32,64,128,256);
@socketstr=("U0404","U0403","U0304","U0303","U0402","U0401","U0302","U0301");
@bankstr=(0,0,2,2,1,1,3,3);
$sortslots=0;
}
if ($ultra eq "AXmp" || $ultra eq "AXmp+") {
# SPARCengine Ultra AXmp
# Accepts 8MB, 16MB, 32MB, 64MB or 128MB DIMMs on motherboard
# Accepts 256MB dual-bank DIMMs in bank 0 or 1 (not both)
# Can't distinguish dual-bank DIMMs from two banks of single bank DIMMs
# SPARCengine Ultra AXmp+
# Accepts 8MB, 16MB, 32MB, 64MB, 128MB or 256MB DIMMs on motherboard
# Accepts dual-bank DIMMs in both bank 0 and 1
# Can't distinguish dual-bank DIMMs from two banks of single bank DIMMs
$devname="Crichton";
$untested=0;
$simmbanks=2;
$simmsperbank=8;
if ($ultra eq "AXmp+") {
$simmrangex="00000400";
@simmsizes=(8,16,32,64,128,256);
} else {
$simmrangex="00000800";
@simmsizes=(8,16,32,64,128);
}
@socketstr=("U0701".."U0704","U0801".."U0804","U0901".."U0904","U1001".."U1004");
@bankstr=(0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1);
$sortslots=0;
}
if ($ultra eq "AXe") {
# SPARCengine Ultra AXe
# Accepts 32MB, 64MB, 128MB or 256MB single or dual bank DIMMs
# DIMMs should be chosen as all 10-bit or all 11-bit column address type
$devname="Topdog";
$untested=0;
$simmrangex="00000100";
$simmbanks=2;
$simmsperbank=2;
@simmsizes=(32,64,128,256);
@socketstr=("DIMM3","DIMM4","DIMM1","DIMM2");
@bankstr=(0,0,1,1);
# Assume stacked DIMMs like AXi since only 128MB DIMMs have been tested
$sortslots=0;
}
if ($ultra eq "AX-e2") {
# Netra AX1105-500
# Accepts up to 4 64MB, 128MB, 256MB or 512MB registered SDRAM PC133
# DIMMs; 128MB Minimum, 2GB Maximum
# DIMM0 & DIMM1 form Bank 0, DIMM2 & DIMM3 form Bank 1
# DIMMs don't have to be installed as pairs
$devname="Birdsnest Lite";
$untested=0;
$simmrangex="00000200";
$simmbanks=4;
$simmsperbank=1;
@simmsizes=(64,128,256,512);
@socketstr=("DIMM0".."DIMM3");
@bankstr=(0,0,1,1);
}
if ($ultra eq "Netra X1" || $ultra eq "Sun Fire V100") {
# Netra X1, Sun Fire V100, UltraAX-i2
# Accepts up to 4 128MB or 256MB PC133 DIMMs for 1GB maximum
# 500MHz model also accepts up to 4 512MB PC133 DIMMs for 2GB maximum
# Have seen slower models also work with 512MB DIMMs for 2GB maximum
# Sun Fire V100 is 500MHz only
# The memory installation sequence is Slot 3, 2, 1, and 0.
# Each DIMM slot addresses 512MB with 400MHz UltraSPARC IIe
# Each DIMM slot addresses 1GB with >= 550MHz UltraSPARC IIe
# Memory is SDRAM PC133 CL=3 ECC registered
# When equal size DIMMs are installed, the lowest slot number is
# mapped to the lowest address range.
# When mixed size DIMMs are installed, the slot number with the largest
# size DIMM is mapped to the lowest address range.
$devname="Flapjack-lite" if ($ultra eq "Netra X1");
$devname="Flapjack-liteCD500" if ($ultra eq "Sun Fire V100");
$familypn="N19";
$untested=0;
$simmrangex=($cpufreq > 520) ? "00000400" : "00000200";
$simmbanks=4;
$simmsperbank=1;
@simmsizes=(128,256,512);
@socketstr=("DIMM0".."DIMM3");
}
if ($ultra eq "Netra T1 200" || $ultra eq "Sun Fire V120" || $ultra eq "Netra 120") {
# Netra T1 200, Sun Fire V120, Netra 120, UltraAX-i2
# Accepts up to 4 256MB, 512MB or 1GB PC133 DIMMs for 4GB maximum
# Sun Fire V120 is 550MHz or 650MHz
# Netra 120 is same platform as Sun Fire V120, but is 650MHz only
# Memory is SDRAM PC133 CL=3 ECC registered
# The minimum memory requirement is one DIMM in Slot 0
# The memory installation sequence is Slot 0, 1, 2, 3
# Each DIMM slot addresses 512MB of memory with 500MHz UltraSPARC IIe
# Each DIMM slot addresses 1GB of memory with >= 550MHz UltraSPARC IIe
# When equal size DIMMs are installed, the lowest slot number is
# mapped to the lowest address range.
# When mixed size DIMMs are installed, the slot number with the largest
# size DIMM is mapped to the lowest address range.
if ($ultra eq "Netra T1 200") {
$devname="Flapjack2";
$familypn="N21";
}
if ($ultra eq "Sun Fire V120" || $ultra eq "Netra 120") {
$devname="Flapjack2+";
$familypn="N25";
}
$untested=0;
$simmrangex=($cpufreq > 520) ? "00000400" : "00000200";
$simmbanks=4;
$simmsperbank=1;
@simmsizes=(256,512,1024);
@socketstr=("DIMM0".."DIMM3");
}
if ($banner =~ /\bCP2000\b/ || $ultra =~ /^CP2[01]\d0$/) {
# Netra CP2000/CP2100 Series CompactPCI Boards (UltraSPARC-IIe)
# CP2040 (SUNW,UltraSPARC-IIe-NetraCT-40) supports 256MB, 512MB, and 1GB
# CP2060 (SUNW,UltraSPARC-IIe-NetraCT-60) has non-expandable 512MB
# CP2080 (SUNW,UltraSPARCengine_CP-80) supports 256MB, 512MB, and 1GB
# CP2140 (SUNW,UltraSPARCengine_CP-40) supports 512MB, 1GB and 2GB
# CP2160 (SUNW,UltraSPARCengine_CP-60) supports 1GB and 2GB
# 256MB Single-Wide module 375-3024
# 512MB Single-Wide module 375-3025
# 1GB Double-Wide module 375-3026
# 1GB Single-Wide module 375-3125
# 2GB Double-Wide module 375-3114
# Max number of stacked memory boards is two
# Install double wide memory first, then single wide memory
$devname="Othello" if ($ultra eq "CP2040");
$devname="Sputnik Bluesky" if ($ultra eq "CP2060");
$devname="Sputnik Orion" if ($ultra eq "CP2080");
$devname="Othello+" if ($ultra eq "CP2140");
$devname="Sputnik+" if ($ultra eq "CP2160");
$untested=1;
$untested=0 if ($ultra eq "CP2140");
if ($ultra eq "CP2060") {
$memtype="embedded memory";
$sockettype="";
$simmrangex="00001000";
$simmbanks=1;
$simmsperbank=1;
@simmsizes=(512);
} else {
$memtype="memory card";
$sockettype="";
$simmrangex="00001000";
$simmbanks=2;
$simmsperbank=1;
if ($ultra eq "CP2140") {
@simmsizes=(512,1024,2048);
} elsif ($ultra eq "CP2160") {
@simmsizes=(1024,2048);
} else {
@simmsizes=(256,512,1024);
}
@socketstr=("base mezzanine board","additional mezzanine board");
@orderstr=("lower board","upper board");
$sortslots=0;
}
}
#
# Clones: most do not have verbose output since I don't have any socket data
# on them
#
if ($ultra eq "axus250" || $modelmore =~ /Ultra-250/) {
# AXUS Microsystems, Inc. http://www.axus.com.tw
# AXUS 250 clone
# accepts up to 128MB DIMMs on motherboard
$untested=0;
$simmrangex="00000200";
$simmbanks=4;
$simmsperbank=4;
@simmsizes=(8,16,32,64,128);
@socketstr=("U0501","U0601","U0701","U0801","U0502","U0602","U0702","U0802","U0503","U0603","U0703","U0803","U0504","U0604","U0704","U0804");
@bankstr=(0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3);
}
if ($model =~ /SPARC (CPU|CPCI)-/) {
# Force Computers, http://www.forcecomputers.com
# model format: "SPARC CPU-5V/64-110-X" for 64MB w/ 110MHz CPU
$untested=1;
$untested=0 if ($model =~ /SPARC CPU-/);
if ($model =~ /\/${installed_memory}-/) {
$totmem=$installed_memory;
push(@simmsizesfound, "$totmem");
$buffer="motherboard contains ${totmem}MB on-board memory\n";
&finish;
}
}
if ($model =~ /Axil/) {
# RAVE Computer Association, http://rave.com
$untested=1;
$untested=0 if ($model =~ /Axil-(245|255|311|320)/);
}
if ($manufacturer =~ /Tadpole/) {
# Tadpole RDI, http://www.tadpole.com
$untested=1;
$untested=0 if ($banner =~ /Tadpole S3|\bVoyagerIIi\b|\bCycleQUAD\b/);
$untested=0 if ($model =~ /PowerLite-170/);
if ($ultra eq "UP-20") {
# Cycle UP-20 to upgrade SPARCstation 5/20 motherboards
# Accepts 16MB, 32MB and 64MB SIMMs from SPARCstation 20
# Install SIMMs in pairs to form each bank
$untested=1;
$simmrangex="00000040";
$simmbanks=4;
$simmsperbank=2;
@simmsizes=(16,32,64);
@bankstr=(0,0,1,1,2,2,3,3);
}
if ($ultra eq "UP-520IIi") {
# Cycle UP-520-IIi to upgrade SPARCstation 5/20 motherboards
# Accepts 8MB, 16MB, 32MB, 64MB, 128MB and 256MB DIMMs
$untested=0;
$simmrangex="00000200";
$simmbanks=4;
$simmsperbank=2;
@simmsizes=(8,16,32,64,128,256);
@socketstr=("J301".."J304");
@bankstr=(0,0,1,1);
}
if ($banner =~ /\bSPARCLE\b/) {
# UltraSPARC-IIe at 440MHz, 500MHz, or 650MHz
# 256MB - 2GB ECC SDRAM, two slots, PC-133, 144-pin SO-DIMMs
$untested=0;
$simmbanks=2;
$simmsperbank=1;
@simmsizes=(128,256,512,1024);
@socketstr=("DIMM0","DIMM1");
$memtype="SO-DIMM";
}
}
if ($manufacturer eq "Auspex") {
# Auspex Netserver, http://www.auspex.com
$memtype="Memory Module";
$untested=1;
$untested=0 if ($model eq "SPARC Processor");
if ($osrel =~ /^5./) {
$untested=1; # Untested with Solaris 2.X
$untested_type="OS";
}
}
if ($manufacturer =~ /Fujitsu/) {
# Hal Computer Systems, a Fujitsu Company, http://www.hal.com
# Fujitsu Siemens, http://www.fujitsu-siemens.com
$untested=1;
$untested=0 if ($model =~ /S-4\/10H|S-4\/20[ABLH]/);
if ($banner =~ /(GP7000|GP7000F)\b/) {
$untested=0;
if ($slotname0 =~ /SLOT[0-9]/) {
# M200
# Up to 4GB of memory
# System board has 16 DIMM slots, #00 - #15
# Banks - 0,0,1,1,2,2,2,2,3,3,3,3,4,4,4,4
# First Modules installed in Bank 0, slots 0-1
# Second Modules Installed in Bank 1, slots 2-3
# Modules in Bank 0 and 1 must be same size
# Subsequent memory expansion installed in sets of four
# modules in Bank 2 - 4 (Slots 4-7, 8-11, 12-15)
@socketstr=("SLOT0".."SLOT9","SLOT10".."SLOT15");
}
if ($slotname0 =~ /SLOT[AB][0-9]/) {
# M400 and M600
# Up to 4GB of memory
# System board has 32 DIMM slots, #00 - #15 Group A & B
# Banks - 0,0,1,1,2,2,2,2,3,3,3,3,4,4,4,4
# First Modules installed in Bank 0 Group A, slots 0-1
# Second Modules installed in Bank 0 Group B, slots 0-1
# Modules in Group A and B must be same size
# Next memory expansion installs in Bank 1 Group A & B,
# slots 2-3 using modules of same size as Bank 0
# Subsequent memory expansion installed in sets of eight
# modules in Bank 2 - 4 (Slots 4-7, 8-11, 12-15) in
# both Group A and B
@socketstr=("SLOTA0".."SLOTA9","SLOTA10".."SLOTA15","SLOTB0".."SLOTB9","SLOTB10".."SLOTB15");
}
}
if ($banner =~ /PRIMEPOWER *100N?\b/) {
# PRIMEPOWER100N, 1U rack mount
# Up to 2GB of memory
# 4 memory module slots
# 100MHz SDRAM ECC
# Mount memory modules in order from memory module slot 0
$untested=1;
}
if ($banner =~ /PRIMEPOWER *[246]00\b/) {
# Up to 8GB of memory
# Each system board has 16 DIMM slots, #00 - #15
# Four banks of 4 (0-3,4-7,8-11,12-15)
# PrimePower 200 and 400 use 1 system board
# PrimePower 600 uses 2 system boards (00, 01)
$untested=0;
foreach $brd ("00","01") {
if ($gotcpuboards =~ /\b$brd\b/) {
if ($gotmodulenames =~ /${brd}-SLOT[0-9]/) {
foreach $i (0..15) {
push(@socketstr, ("${brd}-SLOT$i"));
}
}
}
}
}
if ($banner =~ /PRIMEPOWER *(800|1000|2000)\b/) {
# 1-4 SPARC64 GP CPUs / system board
# PrimePower 800 can have 4 system boards per system
# PrimePower 1000 can have 8 system boards per system
# PrimePower 2000 can have 32 system boards per system
# Minimum Memory: 1GB / system board, 2GB / system
# Maximum Memory: 8GB / system board, 32GB / system
# 32 or 16 memory modules per system board, installed in quads
$untested=0;
@simmsizes=(128,256,512);
foreach $brd ("00".."77") {
if ($gotcpuboards =~ /\b$brd\b/) {
if ($gotmodulenames =~ /${brd}-SLOT#[AB][0-9]/) {
foreach $j ("A","B") {
foreach $i ("00".."03","10".."13","20".."23","30".."33") {
push(@socketstr, ("${brd}-SLOT#$j$i"));
}
}
}
}
}
}
if ($banner =~ /PRIMEPOWER *250\b/) {
# Pedestal, 2U or 4U rack mount
# 1-2 SPARC64 V processors at 1.1GHz, 1.32GHz, 1.87GHz
# 1GB-16GB DDR-SDRAM memory with ECC, 2-way, 8 DIMM slots
$untested=0;
@simmsizes=(256,512,1024,2048);
foreach $i ("00".."07") {
push(@socketstr, ("SLOT#$i"));
}
}
if ($banner =~ /PRIMEPOWER *450\b/) {
# Pedestal, 4U or 7U rack mount
# 1-4 SPARC64 V processors at 1.1GHz, 1.32GHz, 1.87GHz
# 1GB-32GB DDR-SDRAM memory with ECC, 4-way, 16 DIMM slots
$untested=0;
@simmsizes=(256,512,1024,2048);
foreach $i ("00".."15") {
push(@socketstr, ("SLOT#$i"));
}
}
if ($banner =~ /PRIMEPOWER *[68]50\b/) {
# PrimePower 650: 2-8 SPARC64 V processors at 1.1GHz or faster
# 2GB-64GB memory, 8-way, 1 system board, 8U rack mount
# PrimePower 850: 4-16 SPARC64 V processors at 1.1GHz or faster
# 2GB-128GB memory, 16-way, 2 system boards, 16U rack mount
# Uses DDR SDRAM ECC memory in 256MB, 512MB and 1GB sizes
# Each system board has 32 memory module slots, laid out
# with 4 DIMMs on 8 DIMM riser cards.
$untested=0;
@simmsizes=(256,512,1024,2048);
foreach $brd ("C0S00","C0S01") {
if ($gotcpuboards =~ /\b$brd\b/) {
if ($gotmodulenames =~ /${brd}-SLOT#[A-D][0-9]/) {
foreach $j ("A".."D") {
foreach $i ("00".."07") {
push(@socketstr, ("${brd}-SLOT#$j$i"));
}
}
}
}
}
}
if ($banner =~ /PRIMEPOWER *(HPC2500|900|[12]500)\b/) {
# SPARC64 V CPUs at 1.3GHz or 1.89GHz
# PRIMEPOWER HPC2500 / 2500
# 2-8 CPUs / system board, 64-128 / system
# Up to 16 8-way system boards / system
# Up to 1024GB DDR-SDRAM memory with ECC, 128-way
# Minimum Memory: 4GB / system board, 4GB / system
# Maximum Memory: 64GB / system board, 1024GB / system
# PRIMEPOWER 900
# 17U rack mount
# 1-8 CPUs / system board, 1-16 / system
# Up to 2 8-way system boards / system
# Up to 128GB DDR-SDRAM memory with ECC, 8-way
# Minimum Memory: 2GB / system board, 2GB / system
# Maximum Memory: 64GB / system board, 128GB / system
# PRIMEPOWER 1500
# 1-8 CPUs / system board, 1-32 / system
# Up to 4 8-way system boards / system
# Up to 256GB DDR-SDRAM memory with ECC, 8-way
# Minimum Memory: 2GB / system board, 2GB / system
# Maximum Memory: 64GB / system board, 256GB / system
$untested=0;
@simmsizes=(256,512,1024,2048);
foreach $cab ("C0S","C1S") {
foreach $brd ("00".."07") {
if ($gotcpuboards =~ /\b$cab$brd\b/) {
foreach $j ("A","B") {
foreach $i ("00".."15") {
push(@socketstr, ("$cab${brd}-SLOT#$j$i"));
}
}
}
}
}
}
}
if ($model =~ /COMPstation.10/) {
# Tatung Science and Technology, http://www.tsti.com
# Accepts 16MB and 64MB SIMMs on motherboard
# Bank 0 must be filled first
# Layout is like SPARCstation-10, but I don't know if it can accept
# 32MB SIMMs or NVSIMMs
$untested=0;
$simmrangex="00000040";
$simmbanks=8;
$simmsperbank=1;
@simmsizes=(16,64);
@socketstr=("J0201","J0203","J0302","J0304","J0202","J0301","J0303","J0305");
@bankstr=(0,2,4,6,1,3,5,7);
}
if ($model =~ /COMPstation-20A\b/) {
# Tatung Science and Technology, http://www.tsti.com
# Accepts 16MB, 32MB and 64MB SIMMs on motherboard
$untested=1;
$simmrangex="00000040";
$simmbanks=8;
$simmsperbank=1;
@simmsizes=(16,32,64);
@socketstr=("J0201","J0304","J0203","J0302","J0303","J0301","J0305","J0202");
@orderstr=("1st","2nd","3rd","4th","5th","6th","7th","8th");
@bankstr=(1..8);
}
if ($model =~ /COMPstation-20AL/) {
# Tatung Science and Technology, http://www.tsti.com
# Accepts 16MB, 32MB and 64MB SIMMs on motherboard
$untested=0;
$simmrangex="00000040";
$simmbanks=8;
$simmsperbank=1;
@simmsizes=(16,32,64);
@socketstr=("J0201","J0203","J0302","J0304","J0202","J0301","J0303","J0305");
@orderstr=("1st","2nd","3rd","4th","5th","6th","7th","8th");
@bankstr=(0..7);
}
if ($banner =~ /COMPstation_U(60|80D)_Series/) {
# Tatung Science and Technology, http://www.tsti.com
# Accepts 16MB, 32MB, 64MB, 128MB or 256MB DIMMs on motherboard
# 4 banks with 4 DIMMs per bank
$untested=0;
if ($banner =~ /COMPstation_U60_Series/) {
$simmrangex="00000200"; # use "00000400" with 256MB DIMMs
$simmbanks=6; # Count the skipped address range
} else {
$simmrangex="00000400";
$simmbanks=4;
}
$simmsperbank=4;
@simmsizes=(16,32,64,128,256);
}
if ($model =~ /\bVoyagerIIi\b/) {
# Tadpole Voyager IIi has 8 DIMM slots, but otherwise appears
# to look like an Ultra 5. It allows 256MB to 1GB of memory.
$untested=0;
$simmrangex="00000100";
$simmbanks=4;
$simmsperbank=2;
@simmsizes=(16,32,64,128);
@socketstr=("DIMM1","DIMM2","DIMM5","DIMM6","DIMM3","DIMM4","DIMM7","DIMM8");
$sortslots=1;
}
#
# systems below may have memory information available in prtdiag output
#
if ($model eq "SPARCserver-1000" || $model eq "SPARCcenter-2000") {
$devname="Scorpion" if ($model eq "SPARCserver-1000");
$devname="Scorpion+" if ($banner =~ "1000E");
$devname="Dragon" if ($model eq "SPARCcenter-2000");
$devname="Dragon+" if ($banner =~ "2000E");
# Accepts 8MB and 32MB SIMMs on motherboard
$untested=0;
@simmsizes=(8,32);
$prtdiag_has_mem=1;
&check_prtdiag;
if ($boardfound_mem) {
$memfrom="prtdiag";
&pdebug("displaying memory from prtdiag");
foreach $line (@boards_mem) {
if ($line =~ /Board/) {
$boardslot_mem=substr($line,5,1);
$simmsize=int substr($line,46,3) / 4;
if ($simmsize == 0) {
&found_empty_bank("Group 0");
} elsif ($simmsize == 1) {
&found_nvsimm_bank("Group 0");
} else {
push(@simmsizesfound, "$simmsize");
}
$simmsize=int substr($line,54,3) / 4;
if ($simmsize == 0) {
&found_empty_bank("Group 1");
} elsif ($simmsize == 1) {
&found_nvsimm_bank("Group 1");
} else {
push(@simmsizesfound, "$simmsize");
}
$simmsize=int substr($line,62,3) / 4;
if ($simmsize == 0) {
&found_empty_bank("Group 2");
} elsif ($simmsize == 1) {
&found_nvsimm_bank("Group 2");
} else {
push(@simmsizesfound, "$simmsize");
}
$simmsize=int substr($line,70,3) / 4;
if ($simmsize == 0) {
&found_empty_bank("Group 3");
} elsif ($simmsize == 1) {
&found_nvsimm_bank("Group 3");
} else {
push(@simmsizesfound, "$simmsize");
}
}
}
&show_header;
print @boards_mem;
print "Each memory unit group is comprised of 4 SIMMs\n";
$empty_banks=" None" if (! $empty_banks);
print "empty memory groups:$empty_banks\n";
} else {
&show_header;
$recognized=0;
}
$totmem=$installed_memory;
&finish;
&pdebug("exit");
exit;
}
if ($model eq "Ultra-4" || $ultra eq 450 || $model eq "Ultra-4FT" || $ultra eq "Netra ft1800") {
# Accepts 32MB, 64MB, 128MB or 256MB DIMMs on motherboard
# 16MB DIMMs are not supported and may cause correctable ECC errors
# 501-2622 (32MB), 501-2480 or 501-5691 (64MB), 501-3136 (128MB),
# 501-4743 or 501-5896 (256MB)
# 200-pin 60ns Fast Page Mode ECC
# Netra ft1800 is based on Ultra 450
$devname="Tazmo (Tazmax/Tazmin)";
$familypn="A20, A25";
$familypn="N05" if ($model eq "Ultra-4FT" || $ultra eq "Netra ft1800");
$untested=0;
$simmrangex="00000400";
$simmbanks=4;
$simmsperbank=4;
@simmsizes=(16,32,64,128,256);
@socketstr=("U1901".."U1904","U1801".."U1804","U1701".."U1704","U1601".."U1604");
@groupstr=("A","A","A","A","B","B","B","B","C","C","C","C","D","D","D","D");
@bankstr=(2,2,2,2,3,3,3,3,0,0,0,0,1,1,1,1);
}
if ($model eq "Ultra-250" || $ultra eq 250) {
# Accepts 16MB, 32MB, 64MB, or 128MB DIMMs on motherboard
# 501-2479 (16MB), 501-2622 (32MB), 501-2480 or 501-5691 (64MB),
# 501-3136 (128MB)
# 200-pin 60ns Fast Page Mode ECC
$devname="Javelin";
$familypn="A26";
$untested=0;
$simmrangex="00000200";
$simmbanks=4;
$simmsperbank=4;
@simmsizes=(16,32,64,128);
@socketstr=("U0701","U0801","U0901","U1001","U0702","U0802","U0902","U1002","U0703","U0803","U0903","U1003","U0704","U0804","U0904","U1004");
@bankstr=("A","A","A","A","B","B","B","B","C","C","C","C","D","D","D","D");
}
if ($model eq "Ultra-80" || $ultra eq 80 || $ultra eq "420R" || $ultra eq "Netra t140x") {
# Accepts 64MB or 256MB DIMMs
# 501-5691 (64MB), 501-4743 501-5936 501-6005 501-6056 (256MB)
# 200-pin 60ns 5V Fast Page Mode ECC, 576 bits data width
# 64MB DIMMs same as in Ultra-60, 256MB DIMMs same as in Enterprise-450
# U0403,U0404,U1403,U1404 bank 3 address 0xc0000000-0xffffffff
# U0303,U0304,U1303,U1304 bank 2 address 0x80000000-0xbfffffff
# U0401,U0402,U1401,U1402 bank 1 address 0x40000000-0x7fffffff
# U0301,U0302,U1301,U1302 bank 0 address 0x00000000-0x3fffffff
# The minimum requirement is four DIMMs in any bank. The recommended
# installation sequence is Bank 0,2,1,3. DIMMs are required on both the
# Riser Board (U0[34]0?) and the System Board (U1[34]0?). Two-way and
# four-way memory bank interleaving is supported. Memory is 2-way
# interleaved when the same size DIMMs are installed in Banks 0 and 1.
# Memory is 4-way interleaved when the same size DIMMs are installed in
# Banks 0, 1, 2 and 3.
#
# prtconf does not reliably show the size of DIMMs in each slot when
# 1GB of total memory is installed. It shows this:
# reg: 00000000.00000000.00000000.40000000
# A system with 1GB is reported as having 4 256MB DIMMs, but may be
# using 16 64MB DIMMs in a 4-way interleave.
# This is an issue that Sun could fix in the OBP.
# It is broken with OBP 3.33.0 2003/10/07 (patch 109082-06) and older.
# prtfru (Solaris 8 and later) also does not work.
#
# Sun shipped U80 1GB configurations w/ 4x256MB DIMMs
# Sun shipped U80 256MB configurations w/ 4x64MB DIMMs
# Sun shipped E420R with 501-5936 256MB DIMMs
# 64MB DIMM 501-2480 and 128MB DIMM 501-3136 are not supported.
# 16MB and 32MB DIMMs are not sold for the Ultra 80.
#
$devname="Quasar (U80), Quahog (420R), Lightweight 3 (Netra t140x)";
$familypn="A27 (U80), A33 (420R), N14 (Netra t1405), N15 (Netra t1400)";
if ($ultra eq 80) {
$devname="Quasar";
$familypn="A27";
}
if ($ultra eq "420R") {
$devname="Quahog";
$familypn="A33";
}
if ($ultra eq "Netra t140x") {
$devname="Lightweight 3";
$familypn="N14 (Netra t1405), N15 (Netra t1400)";
}
$untested=0;
$simmrangex="00000400";
$simmbanks=4;
$simmsperbank=4;
@simmsizes=(64,256); # Sun only supports 64MB and 256MB DIMMs
@socketstr=("U0301","U0302","U1301","U1302","U0401","U0402","U1401","U1402","U0303","U0304","U1303","U1304","U0403","U0404","U1403","U1404");
@bankstr=(0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3);
}
if ($ultra eq "Sun Blade 1000" || $ultra eq "Sun Blade 2000" || $ultra eq "Sun Fire 280R" || $ultra eq "Netra 20") {
# Accepts up to 8 128MB, 256MB, 512MB, 1GB or 2GB DIMMs installed in
# groups of four DIMMs per bank on motherboard
# Uses 232-pin 3.3V ECC 7ns SDRAM
# J0407 Group 1 Bank 1/3 address 0x0fa000000 - 0x1f3ffffff
# J0406 Group 0 Bank 0/2 address 0x000000000 - 0x0f9ffffff
# J0305 Group 1 Bank 1/3 address 0x0fa000000 - 0x1f3ffffff
# J0304 Group 0 Bank 0/2 address 0x000000000 - 0x0f9ffffff
# J0203 Group 1 Bank 1/3 address 0x0fa000000 - 0x1f3ffffff
# J0202 Group 0 Bank 0/2 address 0x000000000 - 0x0f9ffffff
# J0101 Group 1 Bank 1/3 address 0x0fa000000 - 0x1f3ffffff
# J0100 Group 0 Bank 0/2 address 0x000000000 - 0x0f9ffffff
# The minimum memory requirement is four DIMMs in any Group
# DIMMs can be installed in any group order
# Each group addresses 4GB of memory
# Memory slots (Jxxxx) map to same-numbered DIMMs (Uxxxx)
# For maximum 4-way interleaving, install 8 DIMMs of identical sizes
$devname="Excalibur (Sun Blade 1000), Littleneck (Sun Fire 280R), Lightweight 2+ (Netra 20/Netra T4), Sun Blade 2000 (Sun Blade 2000)";
$familypn="A28 (Sun Blade 1000), A35 (Sun Fire 280R), N28 (Netra 20/Netra T4), A29 (Sun Blade 2000)";
if ($ultra eq "Sun Blade 1000") {
$devname="Excalibur (Sun Blade 1000), Sun Blade 2000 (Sun Blade 2000)";
$familypn="A28 (Sun Blade 1000), A29 (Sun Blade 2000)";
}
if ($ultra eq "Sun Fire 280R") {
$devname="Littleneck";
$familypn="A35";
}
if ($ultra eq "Netra 20") {
$devname="Lightweight 2+";
$familypn="N28";
}
if ($ultra eq "Sun Blade 2000") {
$devname="Sun Blade 2000";
$familypn="A29";
}
$untested=0;
# SB1000/2000 uses 501-4143, 501-5938, 501-6230 or 501-6560 motherboards
# SB1000 can use 600, 750 and 900MHz UltraSPARC-III CPUs
# SB1000 can use 900MHz and faster UltraSPARC-III+ Cu CPUs
# SB2000 only shipped with 900MHz and faster UltraSPARC-III+ Cu CPUs
# SB2000 can use any of the SB1000 motherboards
if ($ultra eq "Sun Blade 1000") {
$modelmore=$banner;
$modelmore=~s/Sun-Blade-1000/or Sun-Blade-2000/g;
$modelmore=~s/\s+$//;
while (($cf,$cnt)=each(%cpucnt)) {
$cf=~/^(.*) (\d*)$/;
$cfreq=$2;
$modelmore=~s/\)/ ${cfreq}MHz\)/g if ($cfreq);
}
}
$prtdiag_has_mem=1;
$simmrangex="00001000";
$simmbanks=2;
$simmsperbank=4;
@simmsizes=(128,256,512,1024,2048);
@socketstr=("J0100","J0202","J0304","J0406","J0101","J0203","J0305","J0407");
@bankstr=(0,0,0,0,1,1,1,1);
}
if ($model eq "Sun-Blade-100" || $ultra eq "Sun Blade 100" || $ultra eq "Sun Blade 150") {
# Accepts 128MB, 256MB or 512MB DIMMs on motherboard
# Uses 168-pin 3.3V ECC PC133 CL=3 SDRAM
# U5 DIMM3 address 0x60000000 - 0x7fffffff or 0xc0000000 - 0xffffffff
# U4 DIMM2 address 0x40000000 - 0x5fffffff or 0x80000000 - 0xbfffffff
# U3 DIMM1 address 0x20000000 - 0x3fffffff or 0x40000000 - 0x7fffffff
# U2 DIMM0 address 0x00000000 - 0x1fffffff or 0x00000000 - 0x3fffffff
# The minimum memory requirement is one DIMM in U2
# The memory installation sequence is U2, U3, U4, U5
# Each bank addresses 512MB of memory with 500MHz UltraSPARC
# Each bank addresses 1GB of memory with >= 550MHz UltraSPARC
if ($model eq "Sun-Blade-100" || $ultra eq "Sun Blade 100") {
$devname="Grover";
$familypn="A36";
}
if ($ultra eq "Sun Blade 150") {
$devname="Grover+";
$familypn="A41";
}
$untested=0;
$prtdiag_has_mem=1;
$simmrangex=($cpufreq > 520) ? "00000400" : "00000200";
$simmbanks=4;
$simmsperbank=1;
@simmsizes=(128,256,512);
@socketstr=("DIMM0".."DIMM3");
@bankstr=(0..3);
}
if ($ultra eq "Sun Fire" || $ultra eq "Sun Fire 15K" || $ultra eq "Sun Fire 12K" || $ultra =~ /Sun Fire ([346]8[01]0|E[246]900|E2[05]K)\b/) {
# Sun Fire 3800 system
# 2-8 UltraSPARC-III processors
# Up to 2 CPU/Memory boards
# Sun Fire 4800, 4810 and 6800 system
# 2-12 UltraSPARC-III processors
# Up to 3 CPU/Memory boards
# Sun Fire 6800 system
# 2-24 UltraSPARC-III processors
# Up to 6 CPU/Memory boards
# Sun Fire 15K system
# 16-106 UltraSPARC-III+, IV or IV+ processors
# Up to 18 CPU/Memory boards
# Sun Fire 12K system
# up to 56 UltraSPARC-III+, IV or IV+ processors and 288GB memory
# Sun Fire E2900 & E4900 system
# 4, 8, or 12 UltraSPARC-IV or IV+ processors, up to 3 Uniboards
# E4900 adds dynamic system domains when compared to E2900
# Sun Fire E6900 system
# 4-24 UltraSPARC-IV or IV+ processors, up to 6 Uniboards
# Sun Fire E20K system
# 4-36 UltraSPARC-IV or IV+ processors, up to 9 Uniboards
# Sun Fire E25K system
# Up to 72 UltraSPARC-IV or IV+ processors, up to 18 Uniboards
# Each CPU/Memory board holds up to 4 processors and up to 32GB memory
# (32 DIMMs per board, 8 banks of 4 DIMMs)
# Accepts 256MB, 512MB or 1GB DIMMs
# 1GB DIMM not supported at 750MHz
# 256MB DIMM only supported on US-III
# 2GB DIMMs supported on 48x0/6800/E2900/E4900/E6900/E20K/E25K
# System Board slots are labeled SB0 and higher
# A populated DIMM bank requires an UltraSPARC CPU.
# DIMMs are 232-pin 3.3V ECC 7ns SDRAM
# prtdiag output shows the memory installed.
#
# CPU1 and CPU0 Memory CPU3 and CPU2 Memory
# -------------------- --------------------
# Socket CPU Bank DIMM Socket CPU Bank DIMM
# ------ --- ---- ---- ------ --- ---- ----
# J14600 P1 B0 D3 J16600 P3 B0 D3
# J14601 P1 B1 D3 J16601 P3 B1 D3
# J14500 P1 B0 D2 J16500 P3 B0 D2
# J14501 P1 B1 D2 J16501 P3 B1 D2
# J14400 P1 B0 D1 J16400 P3 B0 D1
# J14401 P1 B1 D1 J16401 P3 B1 D1
# J14300 P1 B0 D0 J16300 P3 B0 D0
# J14301 P1 B1 D0 J16301 P3 B1 D0
# J13600 P0 B0 D3 J15600 P2 B0 D3
# J13601 P0 B1 D3 J15601 P2 B1 D3
# J13500 P0 B0 D2 J15500 P2 B0 D2
# J13501 P0 B1 D2 J15501 P2 B1 D2
# J13400 P0 B0 D1 J15400 P2 B0 D1
# J13401 P0 B1 D1 J15401 P2 B1 D1
# J13300 P0 B0 D0 J15300 P2 B0 D0
# J13301 P0 B1 D0 J15301 P2 B1 D0
#
$devname="Serengeti" if ($ultra eq "Sun Fire");
if ($banner =~ /Sun Fire 3800\b/ || $diagbanner =~ /Sun Fire 3800\b/) {
$devname="Serengeti8, SF3800 or SP";
$familypn="F3800";
}
if ($banner =~ /Sun Fire 4800\b/ || $diagbanner =~ /Sun Fire 4800\b/) {
$devname="Serengeti12, SF4800 or MD";
$familypn="F4800";
}
if ($banner =~ /Sun Fire 4810\b/ || $diagbanner =~ /Sun Fire 4810\b/) {
$devname="Serengeti12i, SF4810 or ME";
$familypn="F4810";
}
if ($banner =~ /Sun Fire 6800\b/ || $diagbanner =~ /Sun Fire 6800\b/) {
$devname="Serengeti24, SF6800 or DC";
$familypn="F6800";
}
if ($ultra eq "Sun Fire 15K") {
$devname="Starcat, Serengeti72";
$familypn="F15K";
}
$devname="Starkitty" if ($ultra eq "Sun Fire 12K");
if ($banner =~ /Sun Fire E2900\b/ || $diagbanner eq "Sun Fire E2900") {
$devname="Amazon 2";
$familypn="E29";
}
if ($banner =~ /Sun Fire E4900\b/ || $diagbanner eq "Sun Fire E4900") {
$devname="Amazon 4";
$familypn="E49";
}
$devname="Amazon 6" if ($banner =~ /Sun Fire E6900\b/ || $diagbanner eq "Sun Fire E6900");
$devname="Amazon 20" if ($banner =~ /Sun Fire E20K\b/ || $diagbanner eq "Sun Fire E20K");
$devname="Amazon 25" if ($banner =~ /Sun Fire E25K\b/ || $diagbanner eq "Sun Fire E25K");
$untested=0;
$prtdiag_has_mem=1;
@simmsizes=(256,512,1024);
@simmsizes=(256,512,1024,2048) if ($ultra =~ /Sun Fire ([46]8[01]0|E[246]900|E2[05]K)\b/);
}
if ($ultra eq "Sun Fire V880") {
# Accepts 128MB, 256MB, 512MB or 1GB DIMMs in groups of four per CPU
# 128MB DIMMs only supported on 750MHz CPU/memory boards
# 1GB DIMMs only supported on 900MHz or faster CPU/memory boards
# 2-8 UltraSPARC-III processors, 750MHz or faster
# Up to 64GB memory, 8GB max per CPU, 4 DIMMs per CPU, 2 CPUs per board
# DIMMs must be added four-at-a-time within the same group of DIMM
# slots; every fourth slot belongs to the same DIMM group.
# Each CPU/Memory board must be populated with a minimum of eight DIMMs,
# installed in groups A0 and B0.
# For 1050MHz and higher system boards, each CPU/Memory board must be
# populated with all sixteen DIMMs, installed in groups A0,A1,B0,B1.
# Each group used must have four identical DIMMs installed (all four
# DIMMs must be from the same manufacturing vendor and must have the
# same capacity).
# DIMMs are 232-pin 3.3V ECC 7ns SDRAM
# Uses 128-bit-wide path to memory, 150MHz DIMMs, 2.4GB/sec
# bandwidth to processor and an aggregate memory bw of 9.6GB/sec
# prtdiag output shows the memory installed.
#
# CPU CPU/Memory Slot Associated DIMM Group
# --- --------------- ---------------------
# 0 Slot A A0,A1
# 2 Slot A B0,B1
# 1 Slot B A0,A1
# 3 Slot B B0,B1
# 4 Slot C A0,A1
# 6 Slot C B0,B1
# 5 Slot D A0,A1
# 7 Slot D B0,B1
#
$devname="Daktari (V880), Nandi (V880z)";
$familypn="A30 (V880), A47 (V880z)";
$untested=0;
@simmsizes=($cpufreq < 800) ? (128,256,512) : (256,512,1024,2048);
@banksstr=("A0","A1","B0","B1");
$prtdiag_has_mem=1;
}
if ($ultra eq "Sun Fire V480") {
# Accepts 256MB, 512MB or 1GB DIMMs in groups of four per CPU
# 2 or 4 UltraSPARC-III processors, 900MHz or faster
# Up to 32GB memory, 8GB max per CPU, 4 DIMMs per CPU, 2 CPUs per board
# Smaller version of Sun Fire V880 above
$devname="Cherrystone";
$familypn="A37";
$untested=0;
@simmsizes=(256,512,1024,2048);
@banksstr=("A0","A1","B0","B1");
$prtdiag_has_mem=1;
}
if ($ultra eq "Sun Fire V490" || $ultra eq "Sun Fire V890") {
# Accepts 512MB or 1GB DIMMs in groups of four per CPU
# 2 or 4 UltraSPARC-III, IV or IV+ processors, 1050MHz or faster
# Up to 32GB memory, 8GB max per CPU, 4 DIMMs per CPU, 2 CPUs per board
# Similar memory contraints as Sun Fire V880 above
if ($ultra eq "Sun Fire V490") {
$devname="Sebring";
$familypn="A52";
}
if ($ultra eq "Sun Fire V890") {
$devname="Silverstone";
$familypn="A53";
}
$untested=0;
@simmsizes=(512,1024,2048);
@banksstr=("A0","A1","B0","B1");
$prtdiag_has_mem=1;
}
if ($ultra eq "Netra T12") {
# Sun Fire V1280, Netra 1280
# Essentially the same as a Sun Fire 4810, but is marketed as a low cost
# single domain system.
# 2-12 UltraSPARC-IIIcu processors using up to 3 CPU/Memory boards
# Each CPU/Memory board holds up to 4 processors and up to 32GB memory
# (32 DIMMs per board, 8 banks of 4 DIMMs)
# Accepts 256MB, 512MB, 1GB or 2GB DIMMs
# System Board slots are labeled SB0 and higher
# A populated DIMM bank requires an UltraSPARC III CPU.
# DIMMs are 232-pin 3.3V ECC 7ns SDRAM
# prtdiag output shows the memory installed.
$devname="Lightweight 8";
$familypn="A40 (Sun Fire V1280), N40 (Netra 1280)";
$untested=0;
$prtdiag_has_mem=1;
@simmsizes=(256,512,1024,2048);
}
if ($ultra eq "Enchilada") {
# Sun Fire V210, V240, Netra 210, 240
# 1-2 UltraSPARC-IIIi (Jalapeno) processors
# UltraSPARC IIIi supports 128MB to 1GB single bank DIMMs.
# UltraSPARC IIIi supports 256MB to 2GB dual bank DIMMs.
# DDR-1 SDRAM PC2100 DIMMs, 8 DIMM slots, 4 DIMMs per processor,
# 2 banks per processor, 2 DIMMs per bank
# V210 accepts 1GB & 2GB DIMMs by installing Fan Upgrade Kit, X7418A
# Mixing DIMM sizes and capacities is not supported.
# prtdiag output can show the memory installed.
$devname="Enchilada"; # Enxs
if ($banner =~ /Sun Fire V210\b/ || $model =~ /Sun-Fire-V210/) {
$devname="Enchilada 1U";
$familypn="N31";
}
if ($model =~ /Netra-210\b/) {
$devname="Salsa 19";
$familypn="N79";
}
if ($banner =~ /Sun Fire V240\b/ || $model =~ /Sun-Fire-V240/) {
$devname="Enchilada 2U";
$familypn="N32";
}
if ($model =~ /Netra-240\b/) {
$devname="Enchilada 19";
$familypn="N54";
}
$untested=0 if ($banner =~ /Sun Fire (V210|240)\b/ || $model =~ /Sun-Fire-(V210|V240)/ || $model =~ /Netra-2[14]0\b/);
$prtdiag_has_mem=1;
$prtdiag_banktable_has_dimms=1;
$simmrangex="00002000";
# Count the skipped address range for dual CPU
$simmbanks=($ncpu > 1) ? 10 : 2;
$simmsperbank=2;
@simmsizes=(128,256,512,1024,2048);
@socketstr=("MB/P0/B0/D0","MB/P0/B0/D1","MB/P0/B1/D0","MB/P0/B1/D1","?","?","?","?","?","?","?","?","?","?","?","?");
push(@socketstr, "MB/P1/B0/D0","MB/P1/B0/D1","MB/P1/B1/D0","MB/P1/B1/D1") if ($ncpu > 1);
}
if ($ultra eq "Sun Fire V440" || $ultra eq "Netra 440") {
# 1-4 UltraSPARC-IIIi (Jalapeno) processors
# UltraSPARC IIIi supports 128MB to 1GB single bank DIMMs.
# UltraSPARC IIIi supports 256MB to 2GB dual bank DIMMs.
# DDR-1 SDRAM PC2100 DIMMs, 16 DIMM slots, 4 DIMMs per processor,
# 2 banks per processor, 2 DIMMs per bank
# prtdiag output can show the memory installed.
$devname="Chalupa";
$familypn="A42";
if ($ultra eq "Netra 440") {
$devname="Chalupa 19";
$familypn="N42";
}
$untested=0;
$prtdiag_has_mem=1;
$prtdiag_banktable_has_dimms=1;
$simmrangex="00002000";
$simmbanks=26; # Count the skipped address range for each CPU
$simmsperbank=2;
@simmsizes=(128,256,512,1024,2048);
# Each CPU card has 4 DIMM slots labeled J0601 (B0/D0), J0602 (B0/D1),
# J0701 (B1/D0) and J0702 (B1/D1).
@socketstr=("C0/P0/B0/D0","C0/P0/B0/D1","C0/P0/B1/D0","C0/P0/B1/D1","?","?","?","?","?","?","?","?","?","?","?","?");
push(@socketstr, "C1/P0/B0/D0","C1/P0/B0/D1","C1/P0/B1/D0","C1/P0/B1/D1","?","?","?","?","?","?","?","?","?","?","?","?") if ($ncpu > 1);
push(@socketstr, "C2/P0/B0/D0","C2/P0/B0/D1","C2/P0/B1/D0","C2/P0/B1/D1","?","?","?","?","?","?","?","?","?","?","?","?") if ($ncpu > 2);
push(@socketstr, "C3/P0/B0/D0","C3/P0/B0/D1","C3/P0/B1/D0","C3/P0/B1/D1") if ($ncpu > 3);
}
if ($ultra eq "Sun Blade 1500") {
# 1 UltraSPARC-IIIi (Jalapeno) processor
# UltraSPARC IIIi supports 128MB to 1GB single bank DIMMs.
# UltraSPARC IIIi supports 256MB to 2GB dual bank DIMMs.
# 184-pin DDR-1 SDRAM PC2100 DIMMs installed in pairs, 4 DIMM slots
# prtdiag output can show the memory installed.
$devname="Taco";
$devname .= "+" if ($modelmore =~ /\(Silver\)/ || $banner =~ /\(Silver\)/);
$familypn="A43";
$untested=0;
$prtdiag_has_mem=1;
$prtdiag_banktable_has_dimms=1;
$simmrangex="00002000";
$simmbanks=2;
$simmsperbank=2;
@simmsizes=(128,256,512,1024,2048);
@socketstr=("DIMM0".."DIMM3"); # DIMM1-DIMM4 on prototype
}
if ($ultra eq "Sun Blade 2500" || $ultra eq "Sun Fire V250") {
# 1-2 UltraSPARC-IIIi (Jalapeno) processors
# UltraSPARC IIIi supports 128MB to 1GB single bank DIMMs.
# UltraSPARC IIIi supports 256MB to 2GB dual bank DIMMs.
# 184-pin DDR-1 SDRAM PC2100 DIMMs, 8 DIMM slots, 4 DIMMs per processor,
# 2 banks per processor, 2 DIMMs per bank
# prtdiag output can show the memory installed.
if ($ultra eq "Sun Blade 2500") {
$devname="Enchilada Workstation";
$devname .= " Silver" if ($modelmore =~ /\(Silver\)/ || $banner =~ /\(Silver\)/);
$familypn="A39";
}
if ($ultra eq "Sun Fire V250") {
$devname="Enchilada 2P Tower";
$familypn="A50";
}
$untested=0;
$prtdiag_has_mem=1;
$prtdiag_banktable_has_dimms=1;
$simmrangex="00002000";
# Count the skipped address range for dual CPU
$simmbanks=($ncpu > 1) ? 20 : 2;
$simmsperbank=2;
@simmsizes=(128,256,512,1024,2048);
if ($ultra eq "Sun Blade 2500") {
@socketstr=("DIMM0".."DIMM3");
push(@socketstr, "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "DIMM4".."DIMM7") if ($ncpu > 1);
} else {
@socketstr=("MB/DIMM0","MB/DIMM1","MB/DIMM2","MB/DIMM3");
push(@socketstr, "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "MB/DIMM4","MB/DIMM5","MB/DIMM6","MB/DIMM7") if ($ncpu > 1);
}
}
if ($ultra eq "Sun Ultra 45 Workstation" || $ultra eq "Sun Ultra 45 or Ultra 25 Workstation") {
# 1-2 UltraSPARC-IIIi (Jalapeno) 1.6GHz processors
# 1GB to 16GB of DDR1 SDRAM 266 or 333MHz registered ECC memory using
# matched pairs of 512MB, 1GB and 2GB DIMMs
# maximum of 4 DIMMs (8GB) per CPU
# CPU0 Bank0 DIMM1&DIMM3 blue sockets, Bank1 DIMM0&DIMM2 black sockets
# CPU1 Bank0 DIMM4&DIMM6 blue sockets, Bank1 DIMM5&DIMM7 black sockets
# prtdiag output can show the memory installed.
$devname="Chicago"; # also "Netra Salsa-19" development name
$familypn="A70";
$untested=0;
$prtdiag_has_mem=1;
$prtdiag_banktable_has_dimms=1;
$simmrangex="00002000";
# Count the skipped address range for dual CPU
$simmbanks=($ncpu > 1) ? 20 : 2;
$simmsperbank=2;
@simmsizes=(512,1024,2048);
@socketstr=("MB/DIMM1","MB/DIMM3","MB/DIMM0","MB/DIMM2");
push(@socketstr, "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "?", "MB/DIMM4","MB/DIMM6","MB/DIMM5","MB/DIMM7") if ($ncpu > 1);
}
if ($ultra eq "Sun Ultra 25 Workstation") {
# 1 UltraSPARC-IIIi (Jalapeno) 1.34GHz processors
# 1GB to 8GB of DDR1 SDRAM 266 or 333MHz registered ECC memory using
# matched pairs of 512MB, 1GB and 2GB DIMMs
# maximum of 4 DIMMs (8GB)
# Bank0 DIMM1&DIMM3 blue sockets, Bank1 DIMM0&DIMM2 black sockets
# prtdiag output can show the memory installed.
$devname="Southside";
$familypn="A89";
$untested=0;
$prtdiag_has_mem=1;
$prtdiag_banktable_has_dimms=1;
$simmrangex="00002000";
$simmbanks=2;
$simmsperbank=2;
@simmsizes=(512,1024,2048);
@socketstr=("MB/DIMM1","MB/DIMM3","MB/DIMM0","MB/DIMM2");
}
if ($ultra eq "Sun Fire V125") {
# 1 UltraSPARC-IIIi (Jalapeno) processor
# UltraSPARC IIIi supports 128MB to 1GB single bank DIMMs.
# UltraSPARC IIIi supports 256MB to 2GB dual bank DIMMs.
# DDR-1 SDRAM PC2100 DIMMs, 4 DIMM slots, 2 DIMMs per bank
# Mixing DIMM sizes and capacities is not supported.
# prtdiag output can show the memory installed.
$devname="El Paso";
$familypn="125";
$untested=0;
$prtdiag_has_mem=1;
$prtdiag_banktable_has_dimms=1;
$simmrangex="00002000";
$simmbanks=2;
$simmsperbank=2;
@simmsizes=(128,256,512,1024,2048);
@socketstr=("MB/P0/B0/D0","MB/P0/B0/D1","MB/P0/B1/D0","MB/P0/B1/D1");
}
if ($ultra eq "Seattle") {
# Sun Fire V215, V245
# 1-2 UltraSPARC-IIIi (Jalapeno) processors
# UltraSPARC IIIi supports 128MB to 1GB single bank DIMMs.
# UltraSPARC IIIi supports 256MB to 2GB dual bank DIMMs.
# DDR-1 SDRAM PC2100 DIMMs, 8 DIMM slots, 4 DIMMs per processor,
# 2 banks per processor, 2 DIMMs per bank
# Mixing DIMM sizes and capacities is not supported.
# prtdiag output can show the memory installed.
$devname="Seattle"; # Enxs
if ($banner =~ /Sun Fire V215\b/ || $model =~ /Sun-Fire-V215/) {
$devname="Seattle 1U";
$familypn="215";
}
if ($banner =~ /Sun Fire V245\b/ || $model =~ /Sun-Fire-V245/) {
$devname="Seattle 2U";
$familypn="245";
}
$untested=0;
$prtdiag_has_mem=1;
$prtdiag_banktable_has_dimms=1;
$simmrangex="00002000";
# Count the skipped address range for dual CPU
$simmbanks=($ncpu > 1) ? 10 : 2;
$simmsperbank=2;
@simmsizes=(128,256,512,1024,2048);
@socketstr=("MB/P0/B0/D0","MB/P0/B0/D1","MB/P0/B1/D0","MB/P0/B1/D1","?","?","?","?","?","?","?","?","?","?","?","?");
push(@socketstr, "MB/P1/B0/D0","MB/P1/B0/D1","MB/P1/B1/D0","MB/P1/B1/D1") if ($ncpu > 1);
}
if ($ultra eq "Boston") {
# Sun Fire V445
# 2-4 UltraSPARC-IIIi (Jalapeno) processors
# UltraSPARC IIIi supports 128MB to 1GB single bank DIMMs.
# UltraSPARC IIIi supports 256MB to 2GB dual bank DIMMs.
# DDR-1 SDRAM PC2100 DIMMs, 16 DIMM slots, 4 DIMMs per processor,
# 2 banks per processor, 2 DIMMs per bank
# prtdiag output can show the memory installed.
$devname="Boston";
$familypn="445, A77";
$untested=0;
$prtdiag_has_mem=1;
$prtdiag_banktable_has_dimms=1;
$simmrangex="00002000";
$simmbanks=26; # Count the skipped address range for each CPU
$simmsperbank=2;
@simmsizes=(128,256,512,1024,2048);
# Each CPU card has 4 DIMM slots labeled J0601 (B0/D0), J0602 (B0/D1),
# J0701 (B1/D0) and J0702 (B1/D1).
@socketstr=("C0/P0/B0/D0","C0/P0/B0/D1","C0/P0/B1/D0","C0/P0/B1/D1","?","?","?","?","?","?","?","?","?","?","?","?");
push(@socketstr, "C1/P0/B0/D0","C1/P0/B0/D1","C1/P0/B1/D0","C1/P0/B1/D1","?","?","?","?","?","?","?","?","?","?","?","?") if ($ncpu > 1);
push(@socketstr, "C2/P0/B0/D0","C2/P0/B0/D1","C2/P0/B1/D0","C2/P0/B1/D1","?","?","?","?","?","?","?","?","?","?","?","?") if ($ncpu > 2);
push(@socketstr, "C3/P0/B0/D0","C3/P0/B0/D1","C3/P0/B1/D0","C3/P0/B1/D1") if ($ncpu > 3);
}
if ($ultra eq "Serverblade1") {
# Sun Fire B100s Blade Server
# 1 UltraSPARC-IIi 650MHz processors
# Two PC-133 DIMM slots holding up to 2GB memory
# Up to 16 Blade Servers in a single B1600 Intelligent Shelf
# prtdiag output shows the memory installed.
$bannermore="(Sun Fire B100s Blade Server)";
$modelmore=$bannermore;
$devname="Stiletto";
$familypn="A44";
$untested=0;
$prtdiag_has_mem=1;
$simmrangex="00000400";
$simmbanks=2;
$simmsperbank=1;
@simmsizes=(256,512,1024);
@socketstr=("Blade/DIMM0","Blade/DIMM1");
}
if ($ultra eq "T2000") {
# 1 UltraSPARC-T1 (Niagara) processor with "CoolThreads" multithreading
# 8 Core 1.2GHz (9.6GHz clock speed rating) or 4, 6, or 8 Core 1.0GHz
# or 8 Core 1.4GHz
# Up to 64GB DDR2 memory in 16 slots w/ Chipkill and DRAM sparing, ECC
# registered DIMMs. Supports 512MB, 1GB, 2GB and 4GB DIMMs.
# Option X7800A - 1GB (2x512MB DDR2) 370-6207, 512MB DDR2 DIMM, 533MHz
# Option X7801A - 2GB (2x1GB DDR2) 370-6208, 1GB DDR2 DIMM, 533MHz
# Option X7802A - 4GB (2x2GB DDR2) 370-6209, 2GB DDR2 DIMM, 533MHz
# DIMMs must be installed in sets of 8. Two basic memory configurations
# are supported: 8-DIMM or 16-DIMM. All DIMMs must have identical
# capacity. An 8 DIMM configuration fully populates Rank 0 (R0) slots.
# Base configurations sold by Sun use all 16 DIMM slots (2 ranks) except
# smallest memory configuration (4GB, 8 x 512MB in Rank 0).
# The minimum T2000 memory requirement is 8 Rank 0 DIMMs.
# 4 memory controllers embedded in UltraSPARC-T1 (CH0-CH3)
#
# T2000 Memory Map
# +----------------------------------------+
# | J0901 Channel 0 Rank 1 DIMM 1 | DIMM 1
# Install 1st | J0701 Channel 0 Rank 0 DIMM 1 | DIMM 2
# | J0801 Channel 0 Rank 1 DIMM 0 | DIMM 3
# Install 1st | J0601 Channel 0 Rank 0 DIMM 0 | DIMM 4
# | J1401 Channel 1 Rank 1 DIMM 1 | DIMM 5
# Install 1st | J1201 Channel 1 Rank 0 DIMM 1 | DIMM 6
# | J1301 Channel 1 Rank 1 DIMM 0 | DIMM 7
# Install 1st | J1101 Channel 1 Rank 0 DIMM 0 | DIMM 8
# +----------------------------------------+
# +---------------+
# | UltraSPARC T1 |
# +---------------+
# +----------------------------------------+
# Install 1st | J2101 Channel 3 Rank 0 DIMM 0 | DIMM 9
# | J2301 Channel 3 Rank 1 DIMM 0 | DIMM 10
# Install 1st | J2201 Channel 3 Rank 0 DIMM 1 | DIMM 11
# | J2401 Channel 3 Rank 1 DIMM 1 | DIMM 12
# Install 1st | J1601 Channel 2 Rank 0 DIMM 0 | DIMM 13
# | J1801 Channel 2 Rank 1 DIMM 0 | DIMM 14
# Install 1st | J1701 Channel 2 Rank 0 DIMM 1 | DIMM 15
# | J1901 Channel 2 Rank 1 DIMM 1 | DIMM 16
# +----------------------------------------+
$devname="Ontario";
$familypn="T20";
if ($model =~ /Netra-T2000\b/ || $banner =~ /Netra T2000\b/) {
$devname="Pelton";
$familypn="N20";
}
$familypn="T20, SEB" if ($model =~ /SPARC-Enterprise-T2000/ || $banner =~ /SPARC Enterprise T2000/);
$untested=0;
$simmrangex="00002000";
if (scalar(@slots) == 8) {
# Two ranks reported
$simmbanks=2;
$simmsperbank=8;
} else {
# One rank reported, but default base configurations ship with
# two ranks (16 DIMMs)
$simmbanks=1;
$simmsperbank=16;
}
@simmsizes=(512,1024,2048,4096);
@socketstr=("MB/CMP0/CH0/R0/D0","MB/CMP0/CH0/R0/D1","MB/CMP0/CH1/R0/D0","MB/CMP0/CH1/R0/D1","MB/CMP0/CH2/R0/D0","MB/CMP0/CH2/R0/D1","MB/CMP0/CH3/R0/D0","MB/CMP0/CH3/R0/D1","MB/CMP0/CH0/R1/D0","MB/CMP0/CH0/R1/D1","MB/CMP0/CH1/R1/D0","MB/CMP0/CH1/R1/D1","MB/CMP0/CH2/R1/D0","MB/CMP0/CH2/R1/D1","MB/CMP0/CH3/R1/D0","MB/CMP0/CH3/R1/D1");
&check_for_LDOM;
}
if ($ultra eq "T1000") {
# 1 UltraSPARC-T1 (Niagara) processor with "CoolThreads" multithreading
# 6 or 8 Core 1.0GHz
# Up to 32GB DDR2 memory in 8 slots w/ Chipkill and DRAM sparing, ECC
# registered DIMMs. Supports 512MB, 1GB, 2GB and 4GB DIMMs.
# Option X7800A - 1GB (2x512MB DDR2) 370-6207, 512MB DDR2 DIMM, 533MHz
# Option X7801A - 2GB (2x1GB DDR2) 370-6208, 1GB DDR2 DIMM, 533MHz
# Option X7802A - 4GB (2x2GB DDR2) 370-6209, 2GB DDR2 DIMM, 533MHz
# DIMMs must be installed in sets of 4.
# Base configurations sold by Sun use all 8 DIMM slots (2 ranks) except
# smallest memory configuration (2GB, 4 x 512MB in Rank 0).
# The minimum T1000 memory requirement is 4 Rank 0 DIMMs.
# 4 memory controllers embedded in UltraSPARC-T1 (CH0-CH3)
#
# T1000 Memory Map
# +----------------------------------------+
# | J1301 Channel 3 Rank 1 DIMM 1 |
# Install 1st | J1101 Channel 3 Rank 0 DIMM 1 |
# | J1201 Channel 3 Rank 1 DIMM 0 |
# Install 1st | J1001 Channel 3 Rank 0 DIMM 0 |
# +----------------------------------------+
# +---------------+
# | UltraSPARC T1 |
# +---------------+
# +----------------------------------------+
# Install 1st | J0501 Channel 0 Rank 0 DIMM 0 |
# | J0701 Channel 0 Rank 1 DIMM 0 |
# Install 1st | J0601 Channel 0 Rank 0 DIMM 1 |
# | J0801 Channel 0 Rank 1 DIMM 1 |
# +----------------------------------------+
$devname="Erie";
$familypn="T10";
$familypn="T10, SEA" if ($model =~ /SPARC-Enterprise-T1000/ || $banner =~ /SPARC Enterprise T1000/);
$untested=0;
$simmrangex="00002000";
if (scalar(@slots) == 8) {
# Two ranks reported
$simmbanks=2;
$simmsperbank=4;
} else {
$simmbanks=1;
$simmsperbank=8;
}
@simmsizes=(512,1024,2048,4096);
@socketstr=("MB/CMP0/CH0/R0/D0","MB/CMP0/CH0/R0/D1","MB/CMP0/CH3/R0/D0","MB/CMP0/CH3/R0/D1","MB/CMP0/CH0/R1/D0","MB/CMP0/CH0/R1/D1","MB/CMP0/CH3/R1/D0","MB/CMP0/CH3/R1/D1");
&check_for_LDOM;
}
if ($ultra eq "T6300") {
# 1 UltraSPARC-T1 (Niagara) processor with "CoolThreads" multithreading
# 6-Core 1.0GHz, 8-Core 1.0GHz, 1.2GHz or 1.4GHz
# Up to 32GB ECC Registered DDR2 PC4200
# Supports 1GB, 2GB and 4GB DIMMs.
# DIMMs must be installed in sets of 4.
# Supported memory configurations:
# 4 FB-DIMMs (Channel 0 and Channel 3)
# 4 FB-DIMMs (Channel 1 and Channel 2)
# 8 FB-DIMMs (Channel 0, 1, 2 and 3) (fully populated configuration)
# Due to interleaving rules for the CPU, the system will operate at
# the lowest capacity of all the DIMMs installed. Therefore, it is
# ideal to install eight identical DIMMs (not four DIMMs of one
# capacity and four DIMMs of another capacity).
$devname="St. Paul";
$familypn="A94";
$untested=0;
$memtype="FB-DIMM";
$simmrangex="00002000";
$showrange=0;
$simmbanks=2;
$simmsperbank=4;
@simmsizes=(1024,2048,4096);
@socketstr=("MB/CMP0/CH0/R0/D0","MB/CMP0/CH0/R0/D1","MB/CMP0/CH3/R0/D0","MB/CMP0/CH3/R0/D1","MB/CMP0/CH1/R0/D0","MB/CMP0/CH1/R0/D1","MB/CMP0/CH2/R0/D0","MB/CMP0/CH2/R0/D1");
@socketlabelstr=("J6301","J6401","J7201","J7301","J6601","J6701","J6901","J7001");
&check_for_LDOM;
}
if ($ultra eq "T5120" || $ultra eq "T5220" || $ultra eq "T6320") {
# 1 UltraSPARC-T2 (Niagara-II) multicore processor with "CoolThreads"
# multithreading, 1.2GHz 4 or 8-Core or 1.4GHz 8-Core
# Up to 64GB Fully Buffered ECC-registered DDR2 @ 667MHz
# Supports 1GB, 2GB, 4GB and 8GB DIMMs.
# DIMMs must be installed in sets of 4.
# All FB-DIMMs must be the same density (same type and Sun part number)
# Supported memory configurations:
# 4 FB-DIMMs (Group 1) MB/CMP0/BR[0-3]/CH0/D0
# 8 FB-DIMMs (Groups 1-2) MB/CMP0/BR[0-3]/CH[01]/D0
# 16 FB-DIMMs (Groups 1-3) MB/CMP0/BR[0-3]/CH[01]/D[01]
#
# FB-DIMM Configuration:
# Install FB-DIMM
# Branch Channel FRU Name FB-DIMM Order Pair
#
# 0 0 MB/CMP0/BR0/CH0/D0 J1001 1 A
# MB/CMP0/BR0/CH0/D1 J1101 3 B
# 1 MB/CMP0/BR0/CH1/D0 J1201 2 A
# MB/CMP0/BR0/CH1/D1 J1301 3 B
# 1 0 MB/CMP0/BR1/CH0/D0 J1401 1 C
# MB/CMP0/BR1/CH0/D1 J1501 3 D
# 1 MB/CMP0/BR1/CH1/D0 J1601 2 C
# MB/CMP0/BR1/CH1/D1 J1701 3 D
# 2 0 MB/CMP0/BR2/CH0/D0 J2001 1 E
# MB/CMP0/BR2/CH0/D1 J2101 3 F
# 1 MB/CMP0/BR2/CH1/D0 J2201 2 E
# MB/CMP0/BR2/CH1/D1 J2301 3 F
# 3 0 MB/CMP0/BR3/CH0/D0 J2401 1 G
# MB/CMP0/BR3/CH0/D1 J2501 3 H
# 1 MB/CMP0/BR3/CH1/D0 J2601 2 G
# MB/CMP0/BR3/CH1/D1 J2701 3 H
#
# Note - FB-DIMM names in ILOM messages are displayed with the full FRU
# name, such as /SYS/MB/CMP0/BR0/CH0/D0.
$devname="Huron";
if ($ultra eq "T5120") {
$devname="Huron 1U";
$familypn="SEC";
}
if ($ultra eq "T5220") {
$devname="Huron 2U";
$familypn="SED";
}
if ($banner =~ /Netra T5220\b/) {
$devname="Turgo";
$familypn="NT52";
}
if ($ultra eq "T6320") {
$devname="Glendale";
$familypn="A95";
}
$untested=0;
$memtype="FB-DIMM";
$simmrangex="00008000";
$showrange=0;
$simmbanks=4;
$simmsperbank=4;
@simmsizes=(1024,2048,4096,8192);
@socketstr=("MB/CMP0/BR0/CH0/D0","MB/CMP0/BR1/CH0/D0","MB/CMP0/BR2/CH0/D0","MB/CMP0/BR3/CH0/D0","MB/CMP0/BR0/CH1/D0","MB/CMP0/BR1/CH1/D0","MB/CMP0/BR2/CH1/D0","MB/CMP0/BR3/CH1/D0","MB/CMP0/BR0/CH0/D1","MB/CMP0/BR1/CH0/D1","MB/CMP0/BR2/CH0/D1","MB/CMP0/BR3/CH0/D1","MB/CMP0/BR0/CH1/D1","MB/CMP0/BR1/CH1/D1","MB/CMP0/BR2/CH1/D1","MB/CMP0/BR3/CH1/D1");
&check_for_LDOM;
}
if ($ultra eq "CP3260") {
# 1 UltraSPARC-T2 (Niagara-II) multicore processor with "CoolThreads"
# multithreading, 6 or 8 core with 8 threads per core
# 8 FB-DIMM slots, 8GB or 16GB, using 1GB or 2GB DIMMs, 8 channels
# Fully Buffered ECC-registered DDR2 @ 667MHz
# All FB-DIMMs must be the same density (same type and Sun part number)
# Supported memory configurations:
# FB0B FB0A FB1B FB1A FB2A FB2B FB3A FB3B
# DIMM Pair 0 DIMM Pair 1 DIMM Pair 2 DIMM Pair 3
$devname="Monza";
$untested=1;
$memtype="FB-DIMM";
$simmrangex="00008000";
$showrange=0;
$simmbanks=1;
$simmsperbank=8;
@simmsizes=(1024,2048);
@socketstr=("FB0A","FB0B","FB1A","FB1B","FB2A","FB2B","FB3A","FB3B");
&check_for_LDOM;
}
if ($ultra eq "T5140" || $ultra eq "T5240" || $ultra eq "T6340") {
# T5140 has 2 UltraSPARC-T2+ (Victoria Falls) multicore processors with
# "CoolThreads" multithreading, 1.2GHz 4, 6, or 8-Core
# T5240 has 2 UltraSPARC-T2+ (Victoria Falls) multicore processors with
# "CoolThreads" multithreading, 1.2GHz 4, 6, or 8-Core or 1.4GHz 8-Core
# T6340 has 2 UltraSPARC-T2+ (Victoria Falls) multicore processors with
# "CoolThreads" multithreading, 1.4GHz 8-Core
# 8GB to 64GB Fully Buffered ECC-registered DDR2 @ 667MHz
# Supports 1GB, 2GB, 4GB and 8GB DIMMs.
# T5240 also supports optional mezzanine memory board doubling memory
# with an additional 16 FB-DIMM sockets
# All FB-DIMMs must be the same density (same type and Sun part number)
#
# T5140,T5240 Supported memory configurations:
# 8 FB-DIMMs (Group 1) MB/CMP[01]/BR[01]/CH[01]/D0
# 12 FB-DIMMs (Groups 1-2) MB/CMP[01]/BR[01]/CH[01]/D0,MB/CMP0/BR[01]/CH[01]/D1
# 16 FB-DIMMs (Groups 1-3) MB/CMP[01]/BR[01]/CH[01]/D[01]
# T5240 with memory mezzanine assembly supports these additional
# memory configurations once the motherboard is fully populated:
# 24 FB-DIMMs (Groups 1-4) MB/CMP[01]/MR0/BR[01]/CH[01]/D[23]
# 32 FB-DIMMs (Groups 1-5) MB/CMP[01]/MR[01]/BR[01]/CH[01]/D[23]
#
# FB-DIMM Configuration:
# Install FB-DIMM
# Branch Channel FRU Name FB-DIMM Order Pair
#
# CMP0,0 0 MB/CMP0/BR0/CH0/D0 J0500 1 A
# MB/CMP0/BR0/CH0/D1 J0600 2 B
# 1 MB/CMP0/BR0/CH1/D0 J0700 1 A
# MB/CMP0/BR0/CH1/D1 J0800 2 B
# CMP0,1 0 MB/CMP0/BR1/CH0/D0 J0900 1 C
# MB/CMP0/BR1/CH0/D1 J1000 2 D
# 1 MB/CMP0/BR1/CH1/D0 J1100 1 C
# MB/CMP0/BR1/CH1/D1 J1200 2 D
# CMP1,0 0 MB/CMP1/BR0/CH0/D0 J1800 1 E
# MB/CMP1/BR0/CH0/D1 J1900 3 F
# 1 MB/CMP1/BR0/CH1/D0 J2000 1 E
# MB/CMP1/BR0/CH1/D1 J2100 3 F
# CMP1,1 0 MB/CMP1/BR1/CH0/D0 J2200 1 G
# MB/CMP1/BR1/CH0/D1 J2300 3 H
# 1 MB/CMP1/BR1/CH1/D0 J2400 1 G
# MB/CMP1/BR1/CH1/D1 J2500 3 H
# CMP0,0 0 MB/CMP0/MR0/BR0/CH0/D2 J0201 4
# MB/CMP0/MR0/BR0/CH0/D3 J0301 4
# 1 MB/CMP0/MR0/BR0/CH1/D2 J0401 4
# MB/CMP0/MR0/BR0/CH1/D3 J0501 4
# CMP0,1 0 MB/CMP0/MR0/BR1/CH0/D2 J0601 4
# MB/CMP0/MR0/BR1/CH0/D3 J0701 4
# 1 MB/CMP0/MR0/BR1/CH1/D2 J0801 4
# MB/CMP0/MR0/BR1/CH1/D3 J0901 4
# CMP1,0 0 MB/CMP1/MR1/BR0/CH0/D2 J0201 5
# MB/CMP1/MR1/BR0/CH0/D3 J0301 5
# 1 MB/CMP1/MR1/BR0/CH1/D2 J0401 5
# MB/CMP1/MR1/BR0/CH1/D3 J0501 5
# CMP1,1 0 MB/CMP1/MR1/BR1/CH0/D2 J0601 5
# MB/CMP1/MR1/BR1/CH0/D3 J0701 5
# 1 MB/CMP1/MR1/BR1/CH1/D2 J0801 5
# MB/CMP1/MR1/BR1/CH1/D3 J0901 5
#
# Note - FB-DIMM names in ILOM messages are displayed with the full FRU
# name, such as /SYS/MB/CMP0/BR0/CH0/D0.
$devname="Maramba";
if ($ultra eq "T5140") {
$devname="Maramba 1U";
$familypn="SET";
}
if ($ultra eq "T5240") {
$devname="Maramba 2U";
$familypn="SEU";
}
$untested=0;
if ($model =~ /-USBRDT-5240/) {
$devname="Thunder";
$untested=1;
}
if ($ultra eq "T6340") {
$devname="Scottsdale";
$familypn="T6340";
}
if ($model =~ /Netra.*T6340/) {
$familypn="NT6340";
$untested=1;
}
$memtype="FB-DIMM";
$simmrangex="00008000";
$showrange=0;
$simmbanks=4;
$simmbanks=8 if ($ultra eq "T5240" || $ultra eq "T6340");
$simmsperbank=4;
@simmsizes=(1024,2048,4096,8192);
@socketstr=("MB/CMP0/BR0/CH0/D0","MB/CMP0/BR0/CH1/D0","MB/CMP0/BR1/CH0/D0","MB/CMP0/BR1/CH1/D0","MB/CMP1/BR0/CH0/D0","MB/CMP1/BR0/CH1/D0","MB/CMP1/BR1/CH0/D0","MB/CMP1/BR1/CH1/D0","MB/CMP0/BR0/CH0/D1","MB/CMP0/BR0/CH1/D1","MB/CMP0/BR1/CH0/D1","MB/CMP0/BR1/CH1/D1","MB/CMP1/BR0/CH0/D1","MB/CMP1/BR0/CH1/D1","MB/CMP1/BR1/CH0/D1","MB/CMP1/BR1/CH1/D1");
push(@socketstr, "MB/CMP0/MR0/BR0/CH0/D2","MB/CMP0/MR0/BR0/CH0/D3","MB/CMP0/MR0/BR0/CH1/D2","MB/CMP0/MR0/BR0/CH1/D3","MB/CMP0/MR0/BR1/CH0/D2","MB/CMP0/MR0/BR1/CH0/D3","MB/CMP0/MR0/BR1/CH1/D2","MB/CMP0/MR0/BR1/CH1/D3","MB/CMP1/MR1/BR0/CH0/D2","MB/CMP1/MR1/BR0/CH0/D3","MB/CMP1/MR1/BR0/CH1/D2","MB/CMP1/MR1/BR0/CH1/D3","MB/CMP1/MR1/BR1/CH0/D2","MB/CMP1/MR1/BR1/CH0/D3","MB/CMP1/MR1/BR1/CH1/D2","MB/CMP1/MR1/BR1/CH1/D3") if ($ultra eq "T5240");
push(@socketstr, "MB/CMP0/BR0/CH0/D2","MB/CMP0/BR0/CH0/D3","MB/CMP0/BR0/CH1/D2","MB/CMP0/BR0/CH1/D3","MB/CMP0/BR1/CH0/D2","MB/CMP0/BR1/CH0/D3","MB/CMP0/BR1/CH1/D2","MB/CMP0/BR1/CH1/D3","MB/CMP1/BR0/CH0/D2","MB/CMP1/BR0/CH0/D3","MB/CMP1/BR0/CH1/D2","MB/CMP1/BR0/CH1/D3","MB/CMP1/BR1/CH0/D2","MB/CMP1/BR1/CH0/D3","MB/CMP1/BR1/CH1/D2","MB/CMP1/BR1/CH1/D3") if ($ultra eq "T6340");
&check_for_LDOM;
}
if ($ultra eq "T5440") {
# T5440 has 4 UltraSPARC-T2+ (Victoria Falls) multicore processors
# Netra-T5440 has 2 UltraSPARC-T2+ (Victoria Falls) multicore processors
# 16GB to 256GB Fully Buffered ECC-registered DDR2 @ 667MHz
# Supports 2GB, 4GB and 8GB DIMMs.
# All FB-DIMMs must be the same density (same type and Sun part number)
#
# Note - FB-DIMM names in ILOM messages are displayed with the full FRU
# name, such as /SYS/MB/CMP0/BR0/CH0/D0.
$devname="Batoka" if ($ultra eq "T5440");
$devname="Congo" if ($model =~ /Netra-T5440/);
$devname="Lightning" if ($model =~ /-USBRDT-5440/);
$untested=0;
$untested=1 if ($model =~ /-USBRDT-5440/);
$memtype="FB-DIMM";
$simmrangex="00004000";
$showrange=0;
$simmbanks=4;
$simmsperbank=4;
@simmsizes=(2048,4096,8192);
if ($model =~ /Netra-T5440/) {
$familypn="NT544";
@socketstr=("MB/CMP0/BR0/CH0/D0","MB/CMP0/BR0/CH1/D0","MB/CMP0/BR1/CH0/D0","MB/CMP0/BR1/CH1/D0","MB/CMP1/BR0/CH0/D0","MB/CMP1/BR0/CH1/D0","MB/CMP1/BR1/CH0/D0","MB/CMP1/BR1/CH1/D0","MB/CMP0/BR0/CH0/D1","MB/CMP0/BR0/CH1/D1","MB/CMP0/BR1/CH0/D1","MB/CMP0/BR1/CH1/D1","MB/CMP1/BR0/CH0/D1","MB/CMP1/BR0/CH1/D1","MB/CMP1/BR1/CH0/D1","MB/CMP1/BR1/CH1/D1","MB/CMP0/MR0/BR0/CH0/D2","MB/CMP0/MR0/BR0/CH0/D3","MB/CMP0/MR0/BR0/CH1/D2","MB/CMP0/MR0/BR0/CH1/D3","MB/CMP0/MR0/BR1/CH0/D2","MB/CMP0/MR0/BR1/CH0/D3","MB/CMP0/MR0/BR1/CH1/D2","MB/CMP0/MR0/BR1/CH1/D3","MB/CMP1/MR1/BR0/CH0/D2","MB/CMP1/MR1/BR0/CH0/D3","MB/CMP1/MR1/BR0/CH1/D2","MB/CMP1/MR1/BR0/CH1/D3","MB/CMP1/MR1/BR1/CH0/D2","MB/CMP1/MR1/BR1/CH0/D3","MB/CMP1/MR1/BR1/CH1/D2","MB/CMP1/MR1/BR1/CH1/D3");
} else {
$familypn="SEV";
@socketstr=("MB/CPU0/CMP0/BR0/CH0/D0","MB/CPU0/CMP0/BR0/CH1/D0","MB/CPU0/CMP0/BR1/CH0/D0","MB/CPU0/CMP0/BR1/CH1/D0","MB/MEM0/CMP0/BR0/CH0/D1","MB/MEM0/CMP0/BR0/CH1/D1","MB/MEM0/CMP0/BR1/CH0/D1","MB/MEM0/CMP0/BR1/CH1/D1","MB/CPU1/CMP1/BR0/CH0/D0","MB/CPU1/CMP1/BR0/CH1/D0","MB/CPU1/CMP1/BR1/CH0/D0","MB/CPU1/CMP1/BR1/CH1/D0","MB/MEM1/CMP1/BR0/CH0/D1","MB/MEM1/CMP1/BR0/CH1/D1","MB/MEM1/CMP1/BR1/CH0/D1","MB/MEM1/CMP1/BR1/CH1/D1","MB/CPU2/CMP2/BR0/CH0/D0","MB/CPU2/CMP2/BR0/CH1/D0","MB/CPU2/CMP2/BR1/CH0/D0","MB/CPU2/CMP2/BR1/CH1/D0","MB/MEM2/CMP2/BR0/CH0/D1","MB/MEM2/CMP2/BR0/CH1/D1","MB/MEM2/CMP2/BR1/CH0/D1","MB/MEM2/CMP2/BR1/CH1/D1","MB/CPU3/CMP3/BR0/CH0/D0","MB/CPU3/CMP3/BR0/CH1/D0","MB/CPU3/CMP3/BR1/CH0/D0","MB/CPU3/CMP3/BR1/CH1/D0","MB/MEM3/CMP3/BR0/CH0/D1","MB/MEM3/CMP3/BR0/CH1/D1","MB/MEM3/CMP3/BR1/CH0/D1","MB/MEM3/CMP3/BR1/CH1/D1");
}
&check_for_LDOM;
}
if ($ultra eq "T3-1" || $ultra eq "T3-1B") {
# SPARC T3-1 and T3-1B have 1 SPARC-T3 (Rainbow Falls) multicore
# processor with 8-Threads, 16-Core, 1.65GHz
# 16 DIMM slots for up to 128GB memory (16 x 8GB), 8GB min (4 x 2GB)
# supports 2GB, 4GB & 8GB DDR3 DIMMs, dual-rank
# DIMM slots are organized into four branches, with each branch
# connected to a separate Buffer-on-Board (BOB) ASIC, designated BOB0
# through BOB3. Each BOB ASIC has two DDR3 channels, with each channel
# supporting two DIMMs.
# Populate the 4 blue slots first (CH1/D0), the 4 white slots second
# (CH0/D0), and the 8 black slots third (D1).
$memtype="DDR3 DIMM";
$simmrangex="00004000";
$showrange=0;
$simmbanks=4;
# Assume largest DIMMs installed for prtconf-only data
$simmsperbank=&roundup_memory($installed_memory) / 8192;
@simmsizes=(2048,4096,8192);
$familypn="SE3" if ($ultra eq "T3-1");
$familypn="T31B" if ($ultra eq "T3-1B");
$familypn="NST3" if ($ultra eq "T3-1" && $banner =~ /Netra/i);
$untested=0 if ($ultra eq "T3-1" || $ultra eq "T3-1B");
$untested=1 if ($banner =~ /Netra/i);
@socketstr=("MB/CMP0/BOB0/CH1/D0","MB/CMP0/BOB1/CH1/D0","MB/CMP0/BOB2/CH1/D0","MB/CMP0/BOB3/CH1/D0","MB/CMP0/BOB0/CH0/D0","MB/CMP0/BOB1/CH0/D0","MB/CMP0/BOB2/CH0/D0","MB/CMP0/BOB3/CH0/D0","MB/CMP0/BOB0/CH1/D1","MB/CMP0/BOB1/CH1/D1","MB/CMP0/BOB2/CH1/D1","MB/CMP0/BOB3/CH1/D1","MB/CMP0/BOB0/CH0/D1","MB/CMP0/BOB1/CH0/D1","MB/CMP0/BOB2/CH0/D1","MB/CMP0/BOB3/CH0/D1");
&check_for_LDOM;
}
if ($ultra eq "T3-1BA") {
# Netra SPARC T3-1BA has 1 SPARC-T3 (Rainbow Falls) multicore processor
# with 8-Threads, 12-Core, 1.4GHz
# 8 DIMM slots, 2GB or 4GB DDR3, all slots must be populated same
# 16GB min (8 x 2GB), 32GB max (8 x 4GB)
$memtype="DDR3 DIMM";
$simmrangex="00004000";
$showrange=0;
$simmbanks=1;
$simmsperbank=8;
@simmsizes=(2048,4096);
$untested=1;
@socketstr=("DIMM0".."DIMM7"); # Guess
&check_for_LDOM;
}
if ($ultra eq "T3-2") {
# SPARC T3-2 has 2 SPARC-T3 (Rainbow Falls) multicore processors, each
# with 8-Threads, 16-Core, 1.65GHz
# 32 DIMM slots for up to 256GB memory (32 x 8GB), 64GB min (16 x 4GB)
# supports 4GB & 8GB DDR3 DIMMs, dual-rank
# A maximum of two memory risers (MR0 & MR1) supported per CPU, thus
# allowing up to four memory risers total.
# Each memory riser slot in the server chassis must be filled with
# either a memory riser or filler panel, and each memory riser must be
# filled with DIMMs and/or DIMM filler panels.
# Each memory riser has 8 DIMM slots (D0-D3 for MB1, D4-D7 for MB0)
# Install D0/D4 (blue), then D2/D6 (white), then D1/D5 (black), and
# then D3/D7 (green).
# Performance-oriented configurations should be configured with two
# memory risers per CPU. In configurations that do not require two
# memory risers per CPU, the following guidelines should be followed:
# - Populate riser slot MR0 for each CPU, starting with the lowest
# numbered CPU (P0).
# - Populate riser slot MR1 for each CPU, starting with the lowest
# numbered CPU (P0).
$memtype="DDR3 DIMM";
$simmrangex="00004000";
$showrange=0;
$simmbanks=4;
# Assume largest DIMMs installed for prtconf-only data
$simmsperbank=&roundup_memory($installed_memory) / 8192;
@simmsizes=(4096,8192);
$familypn="SE4";
$untested=0;
$untested=1 if ($banner =~ /Netra/i);
@socketstr=("MB/CMP0/MR0/BOB0/CH0/D0","MB/CMP0/MR0/BOB0/CH1/D0","MB/CMP0/MR0/BOB1/CH0/D0","MB/CMP0/MR0/BOB1/CH1/D0","MB/CMP1/MR0/BOB0/CH0/D0","MB/CMP1/MR0/BOB0/CH1/D0","MB/CMP1/MR0/BOB1/CH0/D0","MB/CMP1/MR0/BOB1/CH1/D0","MB/CMP0/MR1/BOB0/CH0/D0","MB/CMP0/MR1/BOB0/CH1/D0","MB/CMP0/MR1/BOB1/CH0/D0","MB/CMP0/MR1/BOB1/CH1/D0","MB/CMP1/MR1/BOB0/CH0/D0","MB/CMP1/MR1/BOB0/CH1/D0","MB/CMP1/MR1/BOB1/CH0/D0","MB/CMP1/MR1/BOB1/CH1/D0","MB/CMP0/MR0/BOB0/CH0/D1","MB/CMP0/MR0/BOB0/CH1/D1","MB/CMP0/MR0/BOB1/CH0/D1","MB/CMP0/MR0/BOB1/CH1/D1","MB/CMP1/MR0/BOB0/CH0/D1","MB/CMP1/MR0/BOB0/CH1/D1","MB/CMP1/MR0/BOB1/CH0/D1","MB/CMP1/MR0/BOB1/CH1/D1","MB/CMP0/MR1/BOB0/CH0/D1","MB/CMP0/MR1/BOB0/CH1/D1","MB/CMP0/MR1/BOB1/CH0/D1","MB/CMP0/MR1/BOB1/CH1/D1","MB/CMP1/MR1/BOB0/CH0/D1","MB/CMP1/MR1/BOB0/CH1/D1","MB/CMP1/MR1/BOB1/CH0/D1","MB/CMP1/MR1/BOB1/CH1/D1");
&check_for_LDOM;
}
if ($ultra eq "T3-4") {
# SPARC T3-4 has 2 or 4 SPARC-T3 (Rainbow Falls) multicore processors,
# each with 8-Threads, 16-Core, 1.65GHz
# 64 DIMM slots for up to 512GB memory (64 x 8GB), 128GB min (32 x 4GB)
# supports 4GB & 8GB DDR3 DIMMs, dual-rank
$memtype="DDR3 DIMM";
$simmrangex="00004000";
$showrange=0;
$simmbanks=4;
# Assume largest DIMMs installed for prtconf-only data
$simmsperbank=&roundup_memory($installed_memory) / 8192;
@simmsizes=(4096,8192);
$familypn="SE5";
$untested=1;
$untested=1 if ($banner =~ /Netra/i);
# Guess on socket name order ???
@socketstr=("PM0/CMP1/BOB0/CH0/D0","PM0/CMP1/BOB0/CH1/D0","PM0/CMP1/BOB1/CH0/D0","PM0/CMP1/BOB1/CH1/D0","PM0/CMP1/BOB2/CH0/D0","PM0/CMP1/BOB2/CH1/D0","PM0/CMP1/BOB3/CH0/D0","PM0/CMP1/BOB3/CH1/D0","PM0/CMP0/BOB0/CH0/D0","PM0/CMP0/BOB0/CH1/D0","PM0/CMP0/BOB1/CH0/D0","PM0/CMP0/BOB1/CH1/D0","PM0/CMP0/BOB2/CH0/D0","PM0/CMP0/BOB2/CH1/D0","PM0/CMP0/BOB3/CH0/D0","PM0/CMP0/BOB3/CH1/D0");
push(@socketstr, "PM0/CMP1/BOB0/CH0/D1","PM0/CMP1/BOB0/CH1/D1","PM0/CMP1/BOB1/CH0/D1","PM0/CMP1/BOB1/CH1/D1","PM0/CMP1/BOB2/CH0/D1","PM0/CMP1/BOB2/CH1/D1","PM0/CMP1/BOB3/CH0/D1","PM0/CMP1/BOB3/CH1/D1","PM0/CMP0/BOB0/CH0/D1","PM0/CMP0/BOB0/CH1/D1","PM0/CMP0/BOB1/CH0/D1","PM0/CMP0/BOB1/CH1/D1","PM0/CMP0/BOB2/CH0/D1","PM0/CMP0/BOB2/CH1/D1","PM0/CMP0/BOB3/CH0/D1","PM0/CMP0/BOB3/CH1/D1");
# Need to determine if PM1 is installed, its DIMMs are next
push(@socketstr, "PM1/CMP1/BOB0/CH0/D0","PM1/CMP1/BOB0/CH1/D0","PM1/CMP1/BOB1/CH0/D0","PM1/CMP1/BOB1/CH1/D0","PM1/CMP1/BOB2/CH0/D0","PM1/CMP1/BOB2/CH1/D0","PM1/CMP1/BOB3/CH0/D0","PM1/CMP1/BOB3/CH1/D0","PM1/CMP0/BOB0/CH0/D0","PM1/CMP0/BOB0/CH1/D0","PM1/CMP0/BOB1/CH0/D0","PM1/CMP0/BOB1/CH1/D0","PM1/CMP0/BOB2/CH0/D0","PM1/CMP0/BOB2/CH1/D0","PM1/CMP0/BOB3/CH0/D0","PM1/CMP0/BOB3/CH1/D0");
push(@socketstr, "PM1/CMP1/BOB0/CH0/D1","PM1/CMP1/BOB0/CH1/D1","PM1/CMP1/BOB1/CH0/D1","PM1/CMP1/BOB1/CH1/D1","PM1/CMP1/BOB2/CH0/D1","PM1/CMP1/BOB2/CH1/D1","PM1/CMP1/BOB3/CH0/D1","PM1/CMP1/BOB3/CH1/D1","PM1/CMP0/BOB0/CH0/D1","PM1/CMP0/BOB0/CH1/D1","PM1/CMP0/BOB1/CH0/D1","PM1/CMP0/BOB1/CH1/D1","PM1/CMP0/BOB2/CH0/D1","PM1/CMP0/BOB2/CH1/D1","PM1/CMP0/BOB3/CH0/D1","PM1/CMP0/BOB3/CH1/D1");
&check_for_LDOM;
}
if ($ultra eq "T4-1" || $ultra eq "T4-1B") {
# SPARC T4-1 and T4-1B have 1 SPARC-T4 multicore processor with
# 8-Threads, 8-Core, 2.85GHz
# 16 DIMM slots for up to 256GB memory (16 x 16GB), 16GB min (4 x 4GB)
# supports 4GB, 8GB & 16GB DDR3 DIMMs
# DIMM slots are organized into four branches, with each branch
# connected to a separate Buffer-on-Board (BOB) ASIC, designated BOB0
# through BOB3. Each BOB ASIC has two DDR3 channels, with each channel
# supporting two DIMMs.
# Populate the 4 blue slots first (CH1/D0), the 4 white slots second
# (CH0/D0), and the 8 black slots third (D1).
$memtype="DDR3 DIMM";
$simmrangex="00008000"; # Guess
$showrange=0;
$simmbanks=4;
# Assume largest DIMMs installed for prtconf-only data
$simmsperbank=&roundup_memory($installed_memory) / 16384;
@simmsizes=(4096,8192,16384);
$familypn="T41B" if ($ultra eq "T4-1B");
$untested=0 if ($ultra eq "T4-1");
@socketstr=("MB/CMP0/BOB0/CH1/D0","MB/CMP0/BOB1/CH1/D0","MB/CMP0/BOB2/CH1/D0","MB/CMP0/BOB3/CH1/D0","MB/CMP0/BOB0/CH0/D0","MB/CMP0/BOB1/CH0/D0","MB/CMP0/BOB2/CH0/D0","MB/CMP0/BOB3/CH0/D0","MB/CMP0/BOB0/CH1/D1","MB/CMP0/BOB1/CH1/D1","MB/CMP0/BOB2/CH1/D1","MB/CMP0/BOB3/CH1/D1","MB/CMP0/BOB0/CH0/D1","MB/CMP0/BOB1/CH0/D1","MB/CMP0/BOB2/CH0/D1","MB/CMP0/BOB3/CH0/D1");
&check_for_LDOM;
}
if ($ultra eq "T4-2" || $ultra eq "T4-2B") {
# SPARC T4-2 and T4-2B have 2 SPARC-T4 multicore processor with
# 8-Threads, 8-Core, 2.85GHz
# 32 DIMM slots for up to 512GB memory (32 x 16GB), 64GB min (16 x 4GB)
# supports 4GB, 8GB & 16GB DDR3 DIMMs
$memtype="DDR3 DIMM";
$simmrangex="00008000"; # Guess
$showrange=0;
$simmbanks=8;
# Assume largest DIMMs installed for prtconf-only data
$simmsperbank=&roundup_memory($installed_memory) / 16384;
@simmsizes=(4096,8192,16384);
$untested=0 if ($ultra eq "T4-2");
$untested=1 if ($banner =~ /Netra/i);
@socketstr=("MB/CMP0/MR0/BOB0/CH0/D0","MB/CMP0/MR0/BOB0/CH1/D0","MB/CMP0/MR0/BOB1/CH0/D0","MB/CMP0/MR0/BOB1/CH1/D0","MB/CMP1/MR0/BOB0/CH0/D0","MB/CMP1/MR0/BOB0/CH1/D0","MB/CMP1/MR0/BOB1/CH0/D0","MB/CMP1/MR0/BOB1/CH1/D0","MB/CMP0/MR1/BOB0/CH0/D0","MB/CMP0/MR1/BOB0/CH1/D0","MB/CMP0/MR1/BOB1/CH0/D0","MB/CMP0/MR1/BOB1/CH1/D0","MB/CMP1/MR1/BOB0/CH0/D0","MB/CMP1/MR1/BOB0/CH1/D0","MB/CMP1/MR1/BOB1/CH0/D0","MB/CMP1/MR1/BOB1/CH1/D0","MB/CMP0/MR0/BOB0/CH0/D1","MB/CMP0/MR0/BOB0/CH1/D1","MB/CMP0/MR0/BOB1/CH0/D1","MB/CMP0/MR0/BOB1/CH1/D1","MB/CMP1/MR0/BOB0/CH0/D1","MB/CMP1/MR0/BOB0/CH1/D1","MB/CMP1/MR0/BOB1/CH0/D1","MB/CMP1/MR0/BOB1/CH1/D1","MB/CMP0/MR1/BOB0/CH0/D1","MB/CMP0/MR1/BOB0/CH1/D1","MB/CMP0/MR1/BOB1/CH0/D1","MB/CMP0/MR1/BOB1/CH1/D1","MB/CMP1/MR1/BOB0/CH0/D1","MB/CMP1/MR1/BOB0/CH1/D1","MB/CMP1/MR1/BOB1/CH0/D1","MB/CMP1/MR1/BOB1/CH1/D1");
&check_for_LDOM;
}
if ($ultra eq "T4-4") {
# SPARC T4-4 has 4 SPARC-T4 multicore processor with
# 8-Threads, 8-Core, 3.0GHz
# 64 DIMM slots for up to 1TB memory (64 x 16GB), 64GB min (16 x 4GB)
# supports 4GB, 8GB & 16GB DDR3 DIMMs
$memtype="DDR3 DIMM";
$simmrangex="00008000"; # Guess
$showrange=0;
$simmbanks=16;
# Assume largest DIMMs installed for prtconf-only data
$simmsperbank=&roundup_memory($installed_memory) / 16384;
@simmsizes=(4096,8192,16384);
$untested=0;
$untested=1 if ($banner =~ /Netra/i);
@socketstr=("/SYS/PM0/CMP0/BOB0/CH0/D0","/SYS/PM0/CMP0/BOB0/CH1/D0","/SYS/PM0/CMP0/BOB1/CH0/D0","/SYS/PM0/CMP0/BOB1/CH1/D0","/SYS/PM0/CMP0/BOB2/CH0/D0","/SYS/PM0/CMP0/BOB2/CH1/D0","/SYS/PM0/CMP0/BOB3/CH0/D0","/SYS/PM0/CMP0/BOB3/CH1/D0","/SYS/PM0/CMP1/BOB0/CH0/D0","/SYS/PM0/CMP1/BOB0/CH1/D0","/SYS/PM0/CMP1/BOB1/CH0/D0","/SYS/PM0/CMP1/BOB1/CH1/D0","/SYS/PM0/CMP1/BOB2/CH0/D0","/SYS/PM0/CMP1/BOB2/CH1/D0","/SYS/PM0/CMP1/BOB3/CH0/D0","/SYS/PM0/CMP1/BOB3/CH1/D0","/SYS/PM1/CMP0/BOB0/CH0/D0","/SYS/PM1/CMP0/BOB0/CH1/D0","/SYS/PM1/CMP0/BOB1/CH0/D0","/SYS/PM1/CMP0/BOB1/CH1/D0","/SYS/PM1/CMP0/BOB2/CH0/D0","/SYS/PM1/CMP0/BOB2/CH1/D0","/SYS/PM1/CMP0/BOB3/CH0/D0","/SYS/PM1/CMP0/BOB3/CH1/D0","/SYS/PM1/CMP1/BOB0/CH0/D0","/SYS/PM1/CMP1/BOB0/CH1/D0","/SYS/PM1/CMP1/BOB1/CH0/D0","/SYS/PM1/CMP1/BOB1/CH1/D0","/SYS/PM1/CMP1/BOB2/CH0/D0","/SYS/PM1/CMP1/BOB2/CH1/D0","/SYS/PM1/CMP1/BOB3/CH0/D0","/SYS/PM1/CMP1/BOB3/CH1/D0");
&check_for_LDOM;
}
if ($ultra eq "T5-2") {
# SPARC T5-2 has 2 SPARC-T5 multicore processor with
# 8-Threads, 16-Core, 3.6GHz
# 32 DIMM slots for up to 1TB memory (32 x 32GB), 256GB min (32 x 8GB)
# supports 8GB, 16GB & 32GB DDR3 DIMMs
# Each slot on a memory riser must be filled with a DIMM
# All memory risers must contain the same type of DIMM
$memtype="DDR3 DIMM";
$showrange=0;
@simmsizes=(8192,16384,32768);
$untested=0;
# /SYS/MB/CM0/CMP/MR0/BOB0/CH0/D0 - /SYS/MB/CM1/CMP/MR3/BOB1/CH1/D0
for $s_cm (0,1) {
for $s_mr (0..3) {
for $s_bob (0,1) {
for $s_ch (0,1) {
push(@socketstr, "/SYS/MB/CM$s_cm/CMP/MR$s_mr/BOB$s_bob/CH$s_ch/D0");
}
}
}
}
&check_for_LDOM;
}
if ($ultra eq "T5-4") {
# SPARC T5-4 has 4 SPARC-T5 multicore processor with
# 8-Threads, 16-Core, 3.6GHz
# 64 DIMM slots for 2TB memory (64 x 32GB) or 1TB min (64 x 16GB)
# supports 16GB & 32GB DDR3 DIMMs
# All DIMMs installed in the server must have identical capacities
# All DIMMs installed in each processor module must be identical
$memtype="DDR3 DIMM";
$showrange=0;
@simmsizes=(16384,32768);
$untested=0;
# /SYS/PM0/CM0/CMP/BOB0/CH0/D0 - /SYS/PM1/CM1/CMP/BOB7/CH1/D0
for $s_pm (0,1) {
for $s_cm (0,1) {
for $s_bob (0..7) {
for $s_ch (0,1) {
push(@socketstr, "/SYS/PM$s_pm/CM$s_cm/CMP/BOB$s_bob/CH$s_ch/D0");
}
}
}
}
&check_for_LDOM;
}
if ($ultra eq "T5-8") {
# SPARC T5-8 has 8 SPARC-T5 multicore processor with
# 8-Threads, 16-Core, 3.6GHz
# 128 DIMM slots for 4TB memory (128 x 32GB) or 2TB min (128 x 16GB)
# supports 16GB & 32GB DDR3 DIMMs
# All DIMMs installed in the server must have identical capacities
# All DIMMs installed in each processor module must be identical
$memtype="DDR3 DIMM";
$showrange=0;
@simmsizes=(16384,32768);
$untested=1;
# /SYS/PM0/CM0/CMP/BOB0/CH0/D0 - /SYS/PM3/CM1/CMP/BOB7/CH1/D0
for $s_pm (0..3) {
for $s_cm (0,1) {
for $s_bob (0..7) {
for $s_ch (0,1) {
push(@socketstr, "/SYS/PM$s_pm/CM$s_cm/CMP/BOB$s_bob/CH$s_ch/D0");
}
}
}
}
&check_for_LDOM;
}
if ($ultra eq "T5-1B") {
# SPARC T5-1B has 1 SPARC-T5 multicore processor with
# 8-Threads, 16-Core, 3.6GHz
# 16 DIMM slots for up to 512GB memory (16 x 32GB), 128GB min (16 x 8GB)
# supports 8GB, 16GB & 32GB DDR3 DIMMs
# Install quantities of 16 DIMMs
# Ensure that all DIMMs are the same capacity and rank classification
$memtype="DDR3 DIMM";
$showrange=0;
@simmsizes=(8192,16384,32768);
$untested=1;
# /SYS/MB/CM0/CMP/BOB0/CH0/D0 - /SYS/MB/CM0/CMP/BOB7/CH1/D0
for $s_bob (0..7) {
for $s_ch (0,1) {
push(@socketstr, "/SYS/MB/CM0/CMP/BOB$s_bob/CH$s_ch/D0");
}
}
&check_for_LDOM;
}
if ($ultra eq "M5-32" || $ultra eq "M6-32") {
# SPARC M5-32 has 8 to 32 SPARC M5 processor at 3.6GHz, each with:
# 6 cores, 48 threads
# 32 DIMM slots for up to 1TB memory (32 x 32GB)
# supports 16GB & 32GB 1066MHz DDR3 DIMMs
# SPARC M6-32 has 8 to 32 SPARC M5 processor at 3.6GHz, each with:
# 12 cores, 96 threads
# 32 DIMM slots for up to 1TB memory (32 x 32GB)
# supports 16GB & 32GB 1066MHz DDR3 DIMMs
# Each CMU (CPU Memory Unit) includes 2 CMPs and 64 DIMM slots
# Each CMU can be Quarter, Half, or Fully-Populated
# Quarter-Populated: CMP[01]/D0000-D1101 (16 DIMMs)
# Half-Populated: CMP[01]/D0000-D1103 (32 DIMMs)
# Fully-Populated: CMP[01]/D0000-D1113 (64 DIMMs)
$memtype="DDR3 DIMM";
$showrange=0;
@simmsizes=(16384,32768);
$untested=1;
# /SYS/CMU0/CMP0/D0000 - /SYS/CMU15/CMP1/D1113
$s_cmu=int(($npcpu/2)-1);
for (0..$s_cmu) {
for $s_cmp (0,1) {
for $s_d1 (0,1) {
for $s_d2 (0,1) {
for $s_d3 (0,1) {
for $s_d4 (0..3) {
push(@socketstr, "/SYS/CMU$s_cmu/CMP$s_cmp/D$s_d1$s_d2$s_d3$s_d4");
}
}
}
}
}
}
&check_for_LDOM;
}
if ($ultra eq "M10-1") {
# Fujitsu SPARC M10-1 has 1 SPARC64-X processor at 2.8GHz
# 16 cores, 32 threads
# 16 DIMM slots for up to 512GB memory (16 x 32GB), 128GB min (16 x 8GB)
# supports 8GB, 16GB & 32GB R-DIMM or 64GB LR-DIMM
# Mount memory in units of four or eight modules
# Within a unit of four or eight modules, all the DIMMs must be of the
# same capacity and rank
# First mount memory group A, then mount memory group B
$memtype="DIMM";
$showrange=0;
@simmsizes=(8192,16384,32768,65536);
$untested=0;
# /SYS/MBU/CMP0/MEM[01][0-3][AB]
for $s_memAB ("A","B") {
for $s_cmp (0,1) {
for $s_memN (0..3) {
push(@socketstr, "/SYS/MBU/CMP0/MEM$s_cmp$s_memN$s_memAB");
}
}
}
&check_for_LDOM;
}
if ($ultra eq "M10-4" || $ultra eq "M10-4S") {
# Fujitsu SPARC M10-4 has up to 4 SPARC64-X processor at 2.8GHz
# 16 cores, 32 threads each
# 32 DIMM slots per memory unit for up to 2TB memory (32 x 64GB), 64GB min (8 x 8GB)
# supports 8GB, 16GB & 32GB R-DIMM or 64GB LR-DIMM
# Mount memory in units of eight modules
# Within a unit of eight modules, all the DIMMs must be of the same
# capacity and rank
# First mount memory group A, then mount memory group B
# M10-4S is a modular system that combines up to 16 M10-4 servers for
# up to 64 processors and up to 32TB memory
$memtype="DIMM";
$showrange=0;
@simmsizes=(8192,16384,32768,65536);
$untested=0;
$untested=1 if ($ultra eq "M10-4S");
if ($npcpu > 4) { # M10-4S
$ultra="M10-4S";
$untested=1;
}
# M10-4: /BB0/CMUL/CMP0/MEM0[0-7]A - /BB0/CMUU/CMP1/MEM1[0-7]B
# M10-4S: /BB00/CMUL/CMP0/MEM0[0-7]A - /BB15/CMUU/CMP1/MEM1[0-7]B # Guess
$bb=int(($npcpu/4)-1); # BB: Building Block
for (0..$bb) {
$bb="0$bb" if ($ultra eq "M10-4S" && $bb < 10); # Guess
if (($npcpu/2) % 2) {
push(@cmus, "/BB$bb/CMUL");
} else {
push(@cmus, "/BB$bb/CMUU");
}
for $s_cmu (@cmus) {
for $s_cmp (0,1) {
for $s_memAB ("A","B") {
for $s_memN (0..7) {
push(@socketstr, "$s_cmu/CMP$s_cmp/MEM$s_cmp$s_memN$s_memAB");
}
}
}
}
}
&check_for_LDOM;
}
if ($ultra eq "S7-2" || $ultra eq "S7-2L") {
# SPARC S7-2 has 1 or 2 SPARC S7 processors at 4.267GHz
# SPARC S7-2L has 2 SPARC S7 processors at 4.267GHz
# Each SPARC S7 processor supports:
# 8 cores, 8 threads.
# 16 DIMM slots for up to 1TB memory (16 x 64GB).
# supports 16GB, 32GB & 64GB DDR4 DIMMs.
# Do not mix DIMMs sizes.
# Can be half populated (D0 white sockets), 4 DIMMs per CPU, or
# fully populated (D0 white & D1 black sockets), 8 DIMMs per CPU.
$memtype="DDR4 DIMM";
$showrange=0;
@simmsizes=(16384,32768,65536);
$untested=1;
$untested=0 if ($ultra eq "S7-2");
$cmp_range=0;
$cmp_range=1 if ($ncpu eq 2 || $corecnt eq 2);
# /SYS/MB/CMP0/MCU0/CH0/D0 - /SYS/MB/CMP1/MCU1/CH1/D1
for $s_d (0,1) {
for ($s_cmp=0; $s_cmp <= $cmp_range; $s_cmp++) {
for $s_mcu (0,1) {
for $s_ch (0,1) {
push(@socketstr, "/SYS/MB/CMP$s_cmp/MCU$s_mcu/CH$s_ch/D$s_d");
}
}
}
}
&check_for_LDOM;
}
if ($ultra eq "T7-1") {
# SPARC T7-1 has 1 SPARC M7 processors at 4.13GHz
# SPARC M7 processor supports:
# 32 cores, 8 threads
# 16 DIMM slots for up to 1TB memory (16 x 64GB)
# SPARC T7-1 supports:
# 16GB, 32GB & 64GB DDR4 DIMMs
# Left Memory Riser: /SYS/MB/CM/CMP/MR1/BOB[01]0/CH[01]
# Left Motherboard: /SYS/MB/CM/CMP/BOB[13]1/CH[01]
# Right Motherboard: /SYS/MB/CM/CMP/BOB[02]1/CH[01]
# Right Memory Riser: /SYS/MB/CM/CMP/MR0/BOB[23]0/CH[01]
# CH0 Black sockets, CH1 White sockets
# In base configuration, all DIMM slots on motherboard must be
# fully occupied (8 DIMMs).
# In upgrade configuration (16 DIMMs), both memory risers are
# added and must be fully occupied.
$memtype="DDR4 DIMM";
$showrange=0;
@simmsizes=(16384,32768,65536);
$untested=1;
for $s_bob (0..3) { # Motherboard
for $s_ch (0,1) {
push(@socketstr, "/SYS/MB/CM/CMP/BOB${s_bob}1/CH$s_ch");
}
}
for $s_bob (0,1) { # MR1
for $s_ch (0,1) {
push(@socketstr, "/SYS/MB/CM/CMP/MR1/BOB${s_bob}0/CH$s_ch");
}
}
for $s_bob (2,3) { # MR0
for $s_ch (0,1) {
push(@socketstr, "/SYS/MB/CM/CMP/MR0/BOB${s_bob}0/CH$s_ch");
}
}
&check_for_LDOM;
}
if ($ultra eq "T7-2") {
# SPARC T7-2 has 2 SPARC M7 processors at 4.13GHz
# SPARC M7 processor supports:
# 32 cores, 8 threads
# 16 DIMM slots for up to 1TB memory (16 x 64GB)
# SPARC T7-2 supports:
# 16GB, 32GB & 64GB DDR4 DIMMs
# /SYS/MB/CM[01]/CMP/MR[0-3]/BOB[01]/CH[01]/DIMM
# CH0 Black sockets, CH1 White sockets
# All 8 memory risers must be installed in all configurations
# Half-populated configurations populate CH0 Black sockets (16 DIMMs)
# Full-populated configurations fill CH0 and CH1 sockets (32 DIMMs)
$memtype="DDR4 DIMM";
$showrange=0;
@simmsizes=(16384,32768,65536);
$untested=1;
for $s_ch (0,1) {
for $s_cm (0,1) {
for $s_mr (0..3) {
for $s_bob (0,1) {
push(@socketstr, "/SYS/MB/CM$s_cm/CMP/MR$s_mr/BOB$s_bob/CH$s_ch/DIMM");
}
}
}
}
&check_for_LDOM;
}
if ($ultra eq "T7-4") {
# SPARC T7-4 has 2 or 4 SPARC M7 processors at 4.13GHz
# SPARC M7 processor supports:
# 32 cores, 8 threads
# 16 DIMM slots for up to 1TB memory (16 x 64GB)
# SPARC T7-4 supports:
# 16GB, 32GB & 64GB DDR4 DIMMs
# /SYS/PM[0-3]/CM[01]/CMP/BOB[0-3][01]/CH[01]/DIMM
# CH0 Black sockets, CH1 White sockets
# Half-populated configurations populate CH0 Black sockets (16 DIMMs)
# Full-populated configurations fill CH0 and CH1 sockets (32 DIMMs)
$memtype="DDR4 DIMM";
$showrange=0;
@simmsizes=(16384,32768,65536);
$untested=0;
for $s_pm (0..$npcpu-1) {
for $s_ch (0,1) {
for $s_cm (0,1) {
for $s_boba (0..3) {
for $s_bobb (0,1) {
push(@socketstr, "/SYS/PM$s_pm/CM$s_cm/CMP/BOB$s_boba$s_bobb/CH$s_ch/DIMM");
}
}
}
}
}
&check_for_LDOM;
}
if ($ultra eq "M7-8" || $ultra eq "M7-16") {
# SPARC M7-8 has 2 to 8 SPARC M7 processors at 4.13GHz
# SPARC M7-16 has 4 to 16 SPARC M7 processors at 4.13GHz
# Each SPARC M7 processor has 32 cores, 8 threads
# SPARC M7-8 & M7-16 supports:
# 16 DIMM slots for up to 512GB memory (16 x 32GB)
# supports 16GB & 32GB DDR4 DIMMs
# SPARC M7-8, has CMIOU_0 to CMIOU_7
# SPARC M7-16, has CMIOU_0 to CMIOU_15
# /SYS/CMIOU[0-15]/CM/CMP/BOB[0-3][01]/CH[01]/DIMM
# CH0 Black sockets, CH1 White sockets
# Half-populated configurations populate CH0 Black sockets (8 DIMMs)
# Full-populated configurations fill CH0 and CH1 sockets (16 DIMMs)
$memtype="DDR4 DIMM";
$showrange=0;
@simmsizes=(16384,32768);
$untested=1;
for $s_cmiou (0..$npcpu-1) {
for $s_ch (0,1) {
for $s_boba (0..3) {
for $s_bobb (0,1) {
push(@socketstr, "/SYS/CM$s_cmiou/CM/CMP/BOB$s_boba$s_bobb/CH$s_ch/DIMM");
}
}
}
}
&check_for_LDOM;
}
if ($model eq "SPARC-Enterprise" || $ultra =~ /SPARC Enterprise M[34589]000 Server/) {
# CPUs: Dual-Core Dual-Thread SPARC64-VI or
# Quad-Core Dual-Thread SPARC64-VII, VII+, VII++
# M3000: 2RU rack, single SPARC64-VII 2.52GHz cpu
# up to 32GB, uses DDR2-533 4GB or 8GB memory DIMMs
# M4000: 6RU rack, up to 4 SPARC64-VI or SPARC64-VII cpus
# Up to 2 CPU (CMU), 2 CPUs per board
# Main memory Up to 128 GB per domain / system, up to 4 memory
# boards w/ maximum 32GB per board using 8 DDR2 4GB memory DIMMs
# M5000: 10RU rack, up to 8 SPARC64-VI or SPARC64-VII cpus
# Up to 4 CPU (CMU), 2 CPUs per board
# Main memory Up to 256 GB per domain / system, up to 8 memory
# boards w/ maximum 32GB per board using 8 DDR2 4GB memory DIMMs
# M8000: up to 16 SPARC64-VI or SPARC64-VII cpus
# Up to 4 CPU memory boards (CMU), Up to 4 processors and up to
# 128 GB memory per board based on 32 4GB DIMMs
# Main memory Up to 512GB per domain / system
# M9000: 32 or 64 SPARC64-VI or SPARC64-VII cpus
# 32 CPU
# Up to 8 CPU memory boards (CMU), Up to 4 processors and up to
# 128 GB memory per board based on 32 4GB DIMMs
# Main memory Up to 1TB per domain / system
# 64 CPU
# Up to 16 CPU memory boards (CMU), Up to 4 processors and up to
# 128 GB memory per board based on 32 4GB DIMMs
# Main memory Up to 2TB per domain / system
$familypn="SEW" if ($ultra =~ /Sun SPARC Enterprise M3000 Server/);
if ($ultra =~ /Sun SPARC Enterprise M4000 Server/) {
$devname="OPL FF1";
$familypn="SEE";
}
if ($ultra =~ /Sun SPARC Enterprise M5000 Server/) {
$devname="OPL FF2";
$familypn="SEF";
}
$familypn="SEG" if ($ultra =~ /Sun SPARC Enterprise M8000 Server/);
$familypn="SEH/SEJ" if ($ultra =~ /Sun SPARC Enterprise M9000 Server/);
$untested=1;
$untested=0 if ($ultra =~ /SPARC Enterprise M[34589]000 Server/);
$prtdiag_has_mem=1;
@simmsizes=(1024,2048,4096);
}
if (($model =~ /-Enterprise/ || $ultra eq "e") && $model !~ /SPARC-Enterprise/) {
# E3x00/E4x00/E5x00/E6x00 accepts 8MB, 32MB, 128MB or 256MB DIMMs on
# motherboard, 2 banks of 8 DIMMs per board.
# 256MB DIMMs (2GB kit X7026A) can be used with OBP 3.2.24 or later and
# Solaris 2.5.1 11/97, Solaris 2.6 3/98 or later
# 501-2652 (8MB), 501-2653 (32MB), 501-2654 (128MB), 501-5658 (256MB)
# 168-pin 60ns 3.3V ECC
# E10000 accepts 32MB or 128MB DIMMs on motherboard,
# using 2 or 4 banks of 8 DIMMs per board.
# 501-2653 (32MB), 501-2654 (128MB)
# 168-pin 60ns 3.3V ECC
$devname="Duraflame" if ($banner =~ /\bE?3[05]00\b/);
$devname="Campfire Rack" if ($banner =~ /\bE?5[05]00\b/);
$devname="Campfire" if ($banner =~ /\bE?4[05]00\b/);
$devname="Sunfire" if ($banner =~ /\bE?6[05]00\b/);
$devname .= "+" if ($banner =~ /\bE?[3-6]500\b/);
$devname="Starfire" if ($model =~ /-10000\b/);
$familypn="E3000, A17" if ($banner =~ /\bE?3000\b/);
$familypn="E3500" if ($banner =~ /\bE?3500\b/);
$familypn="E4000, A18" if ($banner =~ /\bE?4000\b/);
$familypn="E4500" if ($banner =~ /\bE?4500\b/);
$familypn="E5000" if ($banner =~ /\bE?5000\b/);
$familypn="E5500" if ($banner =~ /\bE?5500\b/);
$familypn="E6000" if ($banner =~ /\bE?6000\b/);
$familypn="E6500" if ($banner =~ /\bE?6500\b/);
$familypn="E10000" if ($model =~ /-10000\b/);
$untested=1;
if ($banner =~ /\bE?[3-6][05]00\b/ || $model =~ /-Enterprise-E?[3-6][05]00/ || $model eq "Ultra-Enterprise") {
$untested=0;
@simmsizes=(8,32,128,256);
}
if ($model =~ /-Enterprise-10000\b/) {
$untested=0;
@simmsizes=(32,128);
}
$prtdiag_has_mem=1;
@prtdiag=&run("$prtdiag_exec") if (! $filename);
$i=0;
$flag_cpu=0;
$flag_mem=0;
foreach $line (@prtdiag) {
$line=&dos2unix($line);
if ($line =~ /Memory Units:/) {
# Start of memory section, Solaris 2.5.1 format
$flag_mem=1;
$format_mem=1;
$flag_cpu=0; # End of CPU section
}
if ($line =~ /====( | Physical )Memory /) {
# Start of memory section, Solaris 2.6 and later format
$flag_mem=1;
$format_mem=2;
$flag_cpu=0; # End of CPU section
}
if ($line =~ /Factor/) {
# No interleave factor on E10000
$format_mem += 2 if ($format_mem == 1 || $format_mem == 2);
}
if ($line =~ /Failed Field Replaceable Unit/) {
$tmp=$line;
$tmp=~s/^\t/ /g;
$failed_fru .= $tmp;
}
if ($line =~ /IO Cards/) {
$flag_cpu=0; # End of CPU section
$flag_mem=0; # End of memory section
}
if ($flag_cpu && $line !~ /^\s*\n$/) {
push(@boards_cpu, "$line");
$boardfound_cpu=1;
$boardslot_cpu=($line =~ /Board/) ? substr($line,6,2) : substr($line,0,2);
$boardslot_cpu=~s/[: ]//g;
if ($flag_cpu == 2 && $boardslot_cpus !~ /\s$boardslot_cpu\s/ && $boardslot_cpu) {
push(@boardslot_cpus, "$boardslot_cpu");
$boardslot_cpus .= $boardslot_cpu . " ";
}
}
if ($line =~ /CPU Units:/) {
$flag_cpu=1; # Start of CPU section
$flag_mem=0; # End of memory section
$format_cpu=1;
}
if ($line =~ /====( | Virtual )CPUs ====/) {
$flag_cpu=1; # Start of CPU section
$flag_mem=0; # End of memory section
$format_cpu=2;
}
if ($flag_mem == 2 && $line !~ /^\s*\n$/) {
$memfrom="prtdiag";
$boardslot_mem=($line =~ /Board/) ? substr($line,5,2) : substr($line,0,2);
$boardslot_mem=~s/[: ]//g;
if ($boardslot_mems !~ /\s$boardslot_mem\s/) {
push(@boardslot_mems, "$boardslot_mem");
$boardslot_mems .= $boardslot_mem . " ";
}
if ($format_mem == 1) {
# Memory on each system board, E10000
$mem0=substr($line,12,4);
$mem0=0 if ($mem0 !~ /\d+/);
$dimm0=$mem0 / 8;
if ($dimm0) {
$dimms0=sprintf("8x%3d", $dimm0);
push(@simmsizesfound, "$dimm0");
} else {
$dimms0=" ";
&found_empty_bank("Bank 0");
}
$mem1=substr($line,20,4);
$mem1=0 if ($mem1 !~ /\d+/);
$dimm1=$mem1 / 8;
if ($dimm1) {
$dimms1=sprintf("8x%3d", $dimm1);
push(@simmsizesfound, "$dimm1");
} else {
$dimms1=" ";
&found_empty_bank("Bank 1");
}
$mem2=substr($line,28,4);
$mem2=0 if ($mem2 !~ /\d+/);
$dimm2=$mem2 / 8;
if ($dimm2) {
$dimms2=sprintf("8x%3d", $dimm2);
push(@simmsizesfound, "$dimm2");
} else {
$dimms2=" ";
&found_empty_bank("Bank 2");
}
$mem3=substr($line,36,4);
$mem3=0 if ($mem3 !~ /\d+/);
$dimm3=$mem3 / 8;
if ($dimm3) {
$dimms3=sprintf("8x%3d", $dimm3);
push(@simmsizesfound, "$dimm3");
} else {
$dimms3=" ";
&found_empty_bank("Bank 3");
}
$newline=substr($line,0,10);
$newline .= " " . $mem0 . " " . $dimms0;
$newline .= " " . $mem1 . " " . $dimms1;
$newline .= " " . $mem2 . " " . $dimms2;
$newline .= " " . $mem3 . " " . $dimms3;
$newline .= "\n";
push(@boards_mem, "$newline");
$boardfound_mem=1;
}
if ($format_mem == 2) {
# Memory on each system board, E10000
# untested ??? reporting of empty banks
$untested=1;
$bank_slot=substr($line,6,2);
$mem=substr($line,12,4);
$mem=0 if ($mem !~ /\d+/);
$dimm=$mem / 8;
if ($dimm) {
$dimms=sprintf("8x3d", $dimm);
push(@simmsizesfound, "$dimm");
$newline=substr($line,0,18) . $dimms;
$newline .= substr($line,16,47);
push(@boards_mem, "$newline");
$boardfound_mem=1;
$failed_memory += $mem if ($newline =~ /\b\bFailed\b\b/);
$spare_memory += $mem if ($newline =~ /\b\bSpare\b\b/);
} else {
$flag_mem=0;
&found_empty_bank("Bank $bank_slot");
}
if ($bank_slot == 0) {
$next_boardslot_mem=substr($prtdiag[$i + 1],0,2);
$next_boardslot_mem=~s/[: ]//g;
&found_empty_bank("Bank 1") if ($next_boardslot_mem ne $boardslot_mem);
}
if ($bank_slot == 1) {
$prev_boardslot_mem=substr($prtdiag[$i - 1],0,2);
$prev_boardslot_mem=~s/[: ]//g;
&found_empty_bank("Bank 0") if ($prev_boardslot_mem ne $boardslot_mem);
}
}
if ($format_mem == 3) {
# Memory on each system board, E[3456]x00
$mem0=substr($line,10,4);
$mem0=0 if ($mem0 !~ /\d+/);
$dimm0=$mem0 / 8;
if ($dimm0) {
$dimms0=sprintf("8x%3d", $dimm0);
push(@simmsizesfound, "$dimm0");
} else {
$dimms0=" ";
&found_empty_bank("Bank 0");
}
$memlength=length($line);
$mem1=($memlength > 34) ? substr($line,34,4) : 0;
$mem1=0 if ($mem1 !~ /\d+/);
$dimm1=$mem1 / 8;
if ($dimm1) {
$dimms1=sprintf("8x%3d", $dimm1);
push(@simmsizesfound, "$dimm1");
} else {
$dimms1=" ";
&found_empty_bank("Bank 1");
}
$newline=substr($line,0,16) . $dimms0;
$newline .= substr($line,16,24);
if ($dimm1) {
$newline .= $dimms1;
$newline .= substr($line,39,16);
}
push(@boards_mem, "$newline");
$boardfound_mem=1;
}
if ($format_mem == 4) {
# Memory on each system board, E[3456]x00
$bank_slot=substr($line,7,1);
$mem=substr($line,12,4);
$mem=0 if ($mem !~ /\d+/);
$dimm=$mem / 8;
if ($dimm) {
$dimms=sprintf("8x%3d", $dimm);
push(@simmsizesfound, "$dimm");
$newline=substr($line,0,18) . $dimms;
$newline .= substr($line,16,47);
push(@boards_mem, "$newline");
$boardfound_mem=1;
$failed_memory += $mem if ($newline =~ /\b\bFailed\b\b/);
$spare_memory += $mem if ($newline =~ /\b\bSpare\b\b/);
} else {
$flag_mem=0;
&found_empty_bank("Bank $bank_slot");
}
if ($bank_slot == 0) {
$next_boardslot_mem=substr($prtdiag[$i + 1],0,2);
$next_boardslot_mem=~s/[: ]//g;
&found_empty_bank("Bank 1") if ($next_boardslot_mem ne $boardslot_mem);
}
if ($bank_slot == 1) {
$prev_boardslot_mem=substr($prtdiag[$i - 1],0,2);
$prev_boardslot_mem=~s/[: ]//g;
&found_empty_bank("Bank 0") if ($prev_boardslot_mem ne $boardslot_mem);
}
}
}
if ($flag_cpu == 1 && $line =~ /-----/) {
# Next lines are the CPUs on each system board
$flag_cpu=2;
}
if ($flag_mem == 1 && $line =~ /-----/) {
# Next lines are the memory on each system board
$flag_mem=2;
}
$i++;
}
&show_header;
if ($boardfound_mem) {
if ($boardfound_cpu) {
foreach $board (@boardslot_cpus) {
if ($boardslot_mems !~ /\s$board\s/) {
$boardslot_mem=$board;
if ($format_mem <= 2) {
# E10000
&found_empty_bank("Bank 0");
&found_empty_bank("Bank 1");
&found_empty_bank("Bank 2");
&found_empty_bank("Bank 3");
} else {
# E3x00/E4x00/E5x00/E6x00
&found_empty_bank("Bank 0");
&found_empty_bank("Bank 1");
}
}
}
}
if ($format_mem == 1) {
# E10000 running Solaris 2.5.1
print " Bank 0 Bank 1 Bank 2 Bank 3\n";
print " MB DIMMs MB DIMMs MB DIMMs MB DIMMs\n";
print " ---- ----- ---- ----- ---- ----- ---- -----\n";
print @boards_mem;
}
if ($format_mem == 2) {
# E10000 running Solaris 2.6 or later
print "Brd Bank MB DIMMs Status Condition Speed\n";
print "--- ----- ---- ----- ------- ---------- -----\n";
print @boards_mem;
}
if ($format_mem == 3) {
# E3x00/E4x00/E5x00/E6x00 running Solaris 2.5.1
print " Bank 0 Bank 1\n";
print " J3100-J3800 Interleave J3101-J3801 Interleave\n";
print " MB DIMMs Factor With MB DIMMs Factor With\n";
print " ---- ----- ------ ---- ---- ----- ------ ----\n";
print @boards_mem;
}
if ($format_mem == 4) {
# E3x00/E4x00/E5x00/E6x00 running Solaris 2.6 or later
print " Intrlv. Intrlv.\n";
print "Brd Bank MB DIMMs Status Condition Speed Factor With\n";
print "--- ----- ---- ----- ------- ---------- ----- ------- -------\n";
print @boards_mem;
print "Bank 0 uses sockets J3100-J3800, Bank 1 uses sockets J3101-J3801\n";
}
$empty_banks=" None" if (! $empty_banks);
print "empty memory banks:$empty_banks\n";
}
$totmem=$installed_memory;
&finish;
&pdebug("exit");
exit;
}
#
# Check to see if this system has memory defined in the prtdiag output
#
&check_prtdiag;
$model=$diagbanner if ($diagbanner && $isX86);
$untested=0 if ($boardfound_mem && $isX86 && ! $have_x86_devname);
&x86_devname;
# Don't use prtdiag data on this clone
$boardfound_mem=0 if ($manufacturer eq "AXUS");
#
# Check to see if this system has module information in prtconf output
# (Seen on Fujitsu GP7000, GP7000F, PrimePower)
#
if ($gotmodule || $gotmodulenames) {
@simmslots=($gotmodulenames) ? split(/\./, $gotmodulenames) : split(/\./, $gotmodule);
$totmem=0;
for ($val=0; $val < scalar(@simmslots); $val += 2) {
$socket=($gotmodulenames) ? $simmslots[$val] : "SLOT" . $val / 2;
$simmsz=$simmslots[$val + 1];
$simmsize=hex("0x$simmsz") / $meg;
$perlhexbug=1 if ($simmsize <= 0 && $simmsz ne "00000000");
$totmem += $simmsize;
if ($simmsize) {
push(@simmsizesfound, "$simmsize");
if (! $boardfound_mem) {
push(@memorylines, "$socket has a ${simmsize}MB");
if ($simmsize > 1023) {
push(@memorylines, " (");
push(@memorylines, $simmsize/1024);
push(@memorylines, "GB)");
}
push(@memorylines, " $memtype\n");
}
$sockets_used .= " $socket";
}
}
&show_header;
&pdebug("displaying memory from $memfrom") if ($memfrom);
print (($boardfound_mem) ? @boards_mem : @memorylines);
$totmem=$installed_memory;
&finish;
&pdebug("exit");
exit;
}
#
# Check to see if this system has module information in ipmitool output
#
if ($have_ipmitool_data) {
&check_ipmitool;
$tmp=scalar(keys %ipmi_mem);
if (defined($tmp)) {
if ($tmp) {
&pdebug("Memory found with ipmitool");
&show_header;
for (sort alphanumerically keys %ipmi_mem) {
if ($ipmi_mem{$_}) {
print "socket $_: $ipmi_mem{$_}\n";
$simmsize=$ipmi_mem{$_};
$simmsize=~s/^.*\b(\d+)M[Bb].*/$1/;
$ipmi_memory += $simmsize if ($simmsize);
} else {
&add_to_sockets_empty($_);
}
}
$totmem=$installed_memory;
&print_empty_memory("memory sockets");
&finish;
&pdebug("exit");
exit;
}
}
}
#
# Check to see if this system has cpu information in kstat output to recognize
# Hyper-Threaded Intel CPUs
#
&check_kstat if ($have_kstat_data);
#
# Check to see if this system has module information in smbios output
#
&check_smbios if ($have_smbios_data);
#
# Check to see if this system has module information in prtfru output
#
&check_prtfru;
#
# Display memory if found in prtdiag and/or prtfru output
#
if ($boardfound_mem) {
&show_header;
&pdebug("displaying memory from $memfrom") if ($memfrom);
&pdebug("displaying memory from prtfru") if ($fru_details && $memfrom ne "prtfru");
# Rewrite prtdiag output to exclude DIMM5-DIMM8 on W1100z
if ($model =~ /W1100z\b/i && $model !~ /2100z\b/i) {
@new_boards_mem="";
foreach $line (@boards_mem) {
push(@new_boards_mem, "$line") if ($line !~ /DIMM[5-8]/);
}
@boards_mem=@new_boards_mem;
}
print @boards_mem if (! &is_virtualmachine);
if ($have_prtfru_details) {
print "FRU Memory Data:\n-----------------------------------------------------------------------\n$fru_details";
if ($missing_prtfru_details ne " ") {
print "NOTICE: Not all memory modules reported detailed FRU data\n";
}
print "-----------------------------------------------------------------------\n";
}
$totmem=$installed_memory;
}
#
# Look for empty memory banks on Sun Fire 3800, 4800, 4810, 6800, 12K, 15K and
# Netra T12 systems. Also Sun Fire E2900, E4900, E6900, E20K and E25K.
#
if ($ultra eq "Sun Fire" || $ultra eq "Sun Fire 15K" || $ultra eq "Sun Fire 12K" || $ultra eq "Netra T12" || $ultra =~ /Sun Fire ([346]8[01]0|E[246]900|E2[05]K)\b/) {
foreach $cpu (@boardslot_cpus) {
$empty_banks .= " $cpu/B0" if ($boardslot_mems !~ /$cpu\/B0/);
$empty_banks .= " $cpu/B1" if ($boardslot_mems !~ /$cpu\/B1/);
}
$empty_banks=" None" if (! $empty_banks);
if ($boardslot_mems eq " ") {
$empty_banks=" Unknown";
$exitstatus=1;
}
print "empty memory banks:$empty_banks\n" if ($boardfound_mem);
}
if ($boardfound_mem) {
&finish;
&pdebug("exit");
exit;
}
#
# OK, get ready to print out results
#
for ($val=$val0; $val < scalar(@slots); $val += $valinc) {
$newaddrmsb=substr($slots[$val - $valaddr - 1],3,5);
$newaddrlsb=substr($slots[$val - $valaddr],0,3);
$newsizemsb=($valinc == 4) ? substr($slots[$val - 1],3,5) : "";
$newsizelsb=substr($slots[$val],0,3);
# Round up for DIMM value seen on US-T1 and US-T2 Niagara systems
# Two Ranks of DIMMs appear as one in prtconf
if ($newsizelsb eq "ff8") {
if ($newsizemsb eq "00000") {
$newsizemsb="00001"; # 512MB
if ($ultra eq "T2000") {
# Hack: 1 rank of smallest DIMMs
$simmbanks=2;
$simmsperbank=8;
}
# Hack: Could be 1 Rank of 1GB on T1000
$recognized=-1 if ($ultra eq "T1000" && scalar(@slots) == 4);
} elsif ($newsizemsb eq "00001") {
$newsizemsb="00002"; # 1GB
# Hack: Could be 1 Rank of 1GB on T2000
$recognized=-1 if ($ultra eq "T2000" && scalar(@slots) == 4);
# Hack: Could be 1 Rank of 2GB on T1000
$recognized=-1 if ($ultra eq "T1000" && scalar(@slots) == 4);
} elsif ($newsizemsb eq "00003") {
$newsizemsb="00004"; # 2GB
# Hack: Could be 1 Rank of 2GB on T2000
$recognized=-1 if ($ultra eq "T2000" && scalar(@slots) == 4);
} elsif ($newsizemsb eq "00007") {
$newsizemsb="00008"; # Fully stuffed 2 Ranks of 2GB
}
$newsizelsb="000";
$installed_memory += 8;
} elsif ($newsizelsb eq "7f8" && $newsizemsb eq "00000") {
if ($ultra eq "T1000") {
# Hack: 1 rank of smallest DIMMs
$newsizelsb="800"; # 512MB
$simmbanks=2;
$simmsperbank=4;
} else {
$newsizelsb="800"; # Hack: unsupported 256MB DIMM
}
$installed_memory += 8;
} elsif ($newsizelsb eq "f80") {
if ($newsizemsb eq "00001") {
$newsizemsb="00002"; # 1GB
} elsif ($newsizemsb eq "00003") {
$newsizemsb="00004"; # 2GB
} elsif ($newsizemsb eq "00007") {
$newsizemsb="00008"; # 4GB
} elsif ($newsizemsb eq "0000f") {
$newsizemsb="00010"; # 8GB
}
$newsizelsb="000";
$installed_memory += 128;
}
if ($sortslots) {
$mods{"$newaddrmsb$newaddrlsb"}="$newsizemsb$newsizelsb";
} else {
push(@newslots, "$newaddrmsb$newaddrlsb");
push(@newslots, "$newsizemsb$newsizelsb");
}
}
if ($sortslots) {
for (sort alphanumerically keys %mods) {
push(@newslots, $_);
push(@newslots, $mods{$_});
}
}
# For Ultra-30, determine if interleaving of banks using four DIMMs
if ($model eq "Ultra-30" || $ultra eq 30) {
$interleave=2;
# pairs show up in odd numbered address ranges
for ($val=0; $val < scalar(@newslots); $val += 2) {
$interleave=1 if ($newslots[$val] =~ /00000[1357]00/);
}
if ($interleave eq 2) {
$simmrangex="00000200";
$simmbanks=4;
$simmsperbank=4;
} else {
$simmrangex="00000100";
$simmbanks=8;
$simmsperbank=2;
}
}
# Check if SPARCsystem-600 has VME memory expansion boards
if ($model eq "SPARCsystem-600" || $model =~ /Sun.4.600/) {
for ($val=0; $val < scalar(@newslots); $val += 2) {
if ($newslots[$val] =~ /00000[4-9ab]00/) {
@simmsizes=(1,4,16);
push(@socketstr, @socketstr_exp);
push(@bankstr, @bankstr_exp);
push(@bytestr, @bytestr_exp);
$exp=($newslots[$val] =~ /00000[4-7]00/) ? "Expansion board 0 bank" : "Expansion board 1 bank";
push(@banksstr, ("$exp B0","$exp B1", "$exp B2","$exp B3"));
}
}
}
# Hack: Rewrite interleaved memory line for Ultra-80 or Enterprise 420R
if (($model eq "Ultra-80" || $ultra eq 80 || $ultra eq "420R" || $ultra eq "Netra t140x") && $newslots[0] eq "00000000") {
if ($newslots[1] eq "00001000" && $installed_memory eq 4096) {
# 4GB of memory (maximum) using 16x256MB in Banks 0-3
$newslots[1]="00000400";
$newslots[2]="00000400";
$newslots[3]="00000400";
$newslots[4]="00000800";
$newslots[5]="00000400";
$newslots[6]="00000c00";
$newslots[7]="00000400";
$interleave=4;
} elsif ($newslots[1] eq "00000800" && $installed_memory eq 2048) {
# 2GB of memory using 8x256MB in Banks 0,1
$newslots[1]="00000400";
$newslots[2]="00000400";
$newslots[3]="00000400";
$interleave=2;
} elsif ($newslots[1] =~ /00000[97653]00/) {
# Early OBP releases showed total memory as a single bank
$recognized=-1;
} elsif ($newslots[1] eq "00000400" && $installed_memory eq 1024) {
# 1GB of memory can be 4x256MB in Bank 0 or 16x64MB in Banks 0-3
# so flag OBP bug
$recognized=-1;
} elsif ($newslots[1] eq "00000200" && $installed_memory eq 512) {
# 512MB of memory using 8x64MB in Banks 0,1
$newslots[1]="00000100";
$newslots[2]="00000400";
$newslots[3]="00000100";
$interleave=2;
}
}
# Hack: Fix address ranges for Tatung COMPstation U60 and U80D
if ($banner =~ /COMPstation_U(60|80D)_Series/) {
# Tatung Science and Technology, http://www.tsti.com
for ($val=0; $val < scalar(@newslots); $val += 2) {
$simmbanks=4 if ($newslots[$val] =~ /00000[46]00/);
# Check for 256MB DIMMs or 256MB address range per bank
if ($newslots[$val + 1] =~ /00000400/ || $newslots[$val] =~ /00000c00/) {
$simmrangex="00000400";
$simmbanks=4;
}
}
if ($simmbanks eq 6) {
# Skipped address range similar to Sun Ultra 60
@socketstr=("J17","J32","J36","J40","J18","J33","J37","J41","?","?","?","?","?","?","?","?","J19","J34","J38","J42","J20","J35","J39","J43");
@slotstr=(1..8,"?","?","?","?","?","?","?","?",9..16);
@bankstr=(0,0,0,0,1,1,1,1,"?","?","?","?","?","?","?","?",2,2,2,2,3,3,3,3);
} else {
@socketstr=("J17","J32","J36","J40","J18","J33","J37","J41","J19","J34","J38","J42","J20","J35","J39","J43");
@slotstr=(1..16);
@bankstr=(0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3);
}
}
# Hack: Try to rewrite memory line for Sun Blade 1000 & 2000 if prtdiag output
# did not show the memory. This does not expect 2GB DIMMs to be used.
if (($ultra eq "Sun Blade 1000" || $ultra eq "Sun Blade 2000" || $ultra eq "Sun Fire 280R") && ! $boardfound_mem) {
# Assume 8GB is 8x1GB instead of 4x2GB
if ($newslots[1] eq "00002000") {
$newslots[1]="00001000";
$newslots[2]="00001000";
$newslots[3]="00001000";
$recognized=-2;
}
# Assume 6GB is 4x1GB + 4x512MB instead of 4x1.5GB
if ($newslots[1] eq "00001800") {
$newslots[1]="00001000";
$newslots[2]="00001000";
$newslots[3]="00000800";
$recognized=-1;
}
# Assume 5GB is 4x1GB + 4x256MB instead of 4x1280MB
if ($newslots[1] eq "00001400") {
$newslots[1]="00001000";
$newslots[2]="00001000";
$newslots[3]="00000400";
$recognized=-1;
}
# Assume 4.5GB is 4x1GB + 4x128MB instead of 4x1152MB
if ($newslots[1] eq "00001200") {
$newslots[1]="00001000";
$newslots[2]="00001000";
$newslots[3]="00000200";
$recognized=-1;
}
# Assume 3GB is 4x512MB + 4x256MB instead of 4x768MB
if ($newslots[1] eq "00000c00") {
$newslots[1]="00000800";
$newslots[2]="00001000";
$newslots[3]="00000400";
$recognized=-1;
}
# Assume 2.5GB is 4x512MB + 4x128MB instead of 4x640MB
if ($newslots[1] eq "00000a00") {
$newslots[1]="00000800";
$newslots[2]="00001000";
$newslots[3]="00000200";
$recognized=-1;
}
# Assume 1.5GB is 4x256MB + 4x128MB instead of 4x384MB
if ($newslots[1] eq "00000600") {
$newslots[1]="00000400";
$newslots[2]="00001000";
$newslots[3]="00000200";
$recognized=-1;
}
}
# for prtconf output only, or fully stuffed LDOM servers
if ($ultra eq "T5120" || $ultra eq "T5220" || $ultra eq "T6320" || $ultra eq "T5140") {
# Hack: Rewrite fully stuffed memory line
if ($installed_memory >= 130816) {
$newslots[0]="00000000";
$newslots[1]="00008000";
$newslots[2]="00008000";
$newslots[3]="00008000";
$newslots[4]="00010000";
$newslots[5]="00008000";
$newslots[6]="00018000";
$newslots[7]="00008000";
}
}
if ($ultra eq "T5240" || $ultra eq "T6340") {
# Hack: Rewrite fully stuffed memory line
if ($installed_memory >= 261632) {
$newslots[0]="00000000";
$newslots[1]="00008000";
$newslots[2]="00008000";
$newslots[3]="00008000";
$newslots[4]="00010000";
$newslots[5]="00008000";
$newslots[6]="00018000";
$newslots[7]="00008000";
$newslots[8]="00020000";
$newslots[9]="00008000";
$newslots[10]="00028000";
$newslots[11]="00008000";
$newslots[12]="00030000";
$newslots[13]="00008000";
$newslots[14]="00038000";
$newslots[15]="00008000";
}
}
# Check for dual bank DIMMs on Ultra AXmp+
if ($ultra eq "AXmp+") {
if ($#newslots eq 1 && $newslots[0] eq "00000c00") {
$simmsperbank=4;
$dualbank=1;
}
if ($#newslots eq 3) {
if ($newslots[2] =~ /00000[8c]00/) {
$simmrangex="00000800";
$dualbank=1 if ($newslots[1] eq $newslots[3]);
}
}
if ($#newslots ge 5) {
$dualbank=1 if ($newslots[4] =~ /00000[8c]00/);
}
if ($dualbank eq 1) {
@bankstr=("0,2","0,2","0,2","0,2","0,2","0,2","0,2","0,2","1,3","1,3","1,3","1,3","1,3","1,3","1,3","1,3");
# Rearrange slots if necessary
if ($#newslots ge 5) {
if ($newslots[4] eq "00000800") {
$tmp=$newslots[2];
$newslots[2]=$newslots[4];
$newslots[4]=$tmp;
$tmp=$newslots[3];
$newslots[3]=$newslots[5];
$newslots[5]=$tmp;
}
}
}
}
$totmem=0;
for ($val=0; $val < scalar(@newslots); $val += 2) {
&pdebug("displaying memory from $memfrom") if ($memfrom);
$simmaddr=$newslots[$val];
$simmsz=$newslots[$val + 1];
$simmsize=hex("0x$simmsz");
$simmsize=&roundup_memory($simmsize) if ($simmsize > 16384);
$perlhexbug=1 if ($simmsize <= 0 && $simmsz ne "00000000");
$totmem += $simmsize;
if (($model eq "Sun 4/75" || $model eq "SS-2") && ($simmbanks < $bankcnt + 2)) {
# SS2 SBus memory card
$buffer=($simmaddr eq "00000080") ? "${buffer}SBus primary" : "${buffer}SBus secondary";
$start1=hex("0x$simmaddr") * $meg;
$perlhexbug=1 if ($start1 < 0);
$simmrange=hex("0x$simmrangex") * $meg;
$perlhexbug=1 if ($simmrange <= 0 && $simmrangex ne "00000000");
$start1x=sprintf("%08lx", $start1);
$stop1x=sprintf("%08lx", $start1 + (2 * $simmrange) - 1);
$totmem += $simmsize;
$simmsize *= 2;
$val += 2;
$buffer .= " contains ${simmsize}MB";
$buffer .= " (address 0x${start1x}-0x$stop1x)" if ($verbose);
$buffer .= "\n";
} elsif ($simmbanks) {
$start1=hex("0x$simmaddr") * $meg;
$perlhexbug=1 if ($start1 < 0);
if ($simmrangex ne "0") {
$simmrange=hex("0x$simmrangex") * $meg;
$perlhexbug=1 if ($simmrange <= 0 && $simmrangex ne "00000000");
if ($simmrange < hex("0x00001000") * $meg) {
$start1x=sprintf("%08lx", $start1);
$stop1x=sprintf("%08lx", $start1 + ($simmsize * $meg) - 1);
} else {
# Systems with > 4GB of memory
$start1x=$simmaddr . "00000";
$start1x=~s/^0000//;
$stop1x=sprintf("%08lx", ($start1 / $meg) + $simmsize - 1) . "fffff";
$stop1x=~s/^0000//;
}
}
$cnt=0;
while ($cnt < $simmbanks * $simmsperbank) {
if ($start1 >= $simmrange * $cnt && $start1 < $simmrange * ($cnt + 1)) {
$bankcnt=$cnt;
$cnt3=$bankcnt * $simmsperbank;
if ($#socketstr) {
$socket=$socketstr[$cnt3];
if ($#socketlabelstr) {
$socketlabel=" ($socketlabelstr[$cnt3])" if (defined($socketlabelstr[$cnt3]));
}
if ($found10bit && $newslots[$val] !~ /00000[0-3]00/) {
$socket=$socketstr[$cnt3 + 4];
if ($#socketlabelstr) {
$socketlabel=" ($socketlabelstr[$cnt3 + 4])" if (defined($socketlabelstr[$cnt3 + 4]));
}
}
}
$order=$orderstr[$cnt3] if ($#orderstr);
$group=$groupstr[$cnt3] if ($#groupstr);
$slotnum=$slotstr[$cnt3] if ($#slotstr);
if ($#bankstr) {
$bank=$bankstr[$cnt3];
$bank=$bankstr[$cnt3 + 4] if ($found10bit && $newslots[$val] !~ /00000[0-3]00/);
}
$banks=$banksstr[$cnt3/$simmsperbank] if ($#banksstr);
$byte=$bytestr[$cnt3] if ($#bytestr);
}
$cnt++;
}
#
# Check for stacked DIMMs. A 128MB DIMM is sometimes seen as 2
# 64MB DIMMs with a hole in the address range. This may report
# more slots than are really in a system. (i.e. a SS20 with
# 8 32MB SIMMs reports 16 slots of 16MB each).
# Special handling for $sortslots == 0 systems (Ultra 5/10,
# Netra t1, Ultra CP 1400/1500, Ultra AXi/AXe/AXmp/AXmp+)
#
$stacked=0;
if ($val < $#newslots - 2) {
if ($sortslots == 0) {
$start2=$start1 + ($simmrange * 2);
$start2=$start1 + ($simmrange * 4) if ($banner =~ /Ultra CP 1400\b/ || $ultra eq "CP1400");
$start2x=sprintf("%08lx", $start2 / $meg);
$stacked=2 if ($stacked == 0 && $newslots[$val + 2] eq $start2x && $newslots[$val + 3] eq $simmsz);
if ($memtype eq "memory card") {
# Some 256MB mezzanine boards are seen
# as 4 64MB memory blocks with holes in
# the address range.
$start3=$start1 + ($simmsize * 2 * $meg) if ($simmsize eq 64);
# Some 512MB mezzanine boards are seen
# as 4 128MB memory blocks.
$start3=$start1 + ($simmsize * $meg) if ($simmsize eq 128 && $banner !~ /Ultra CP 1400\b/ && $ultra ne "CP1400");
if ($banner =~ /\bCP2000\b/ || $ultra =~ /^CP2[01]\d0$/) {
# 1GB mezzanine boards are seen
# as 4 256MB memory blocks.
$start3=$start1 + ($simmsize * $meg);
$stacked=4;
}
$start3x=sprintf("%08lx", $start3 / $meg);
if ($val < $#newslots - 6 && $stacked != 0) {
$stacked=4 if ($newslots[$val + 4] eq $start3x && $newslots[$val + 5] eq $simmsz && $simmrange != $start3);
}
}
if ($ultra eq "AXi") {
# Check for 10-bit column address DIMMs
if ($newslots[$val] =~ /00000[0-3]80/) {
$found10bit=1;
} elsif ($stacked == 0) {
$found11bit=1;
}
if ($found10bit && $newslots[$val] !~ /00000[0-3]00/) {
$socket=$socketstr[$cnt3 + 4];
if ($#socketlabelstr) {
$socketlabel=" ($socketlabelstr[$cnt3 + 4])" if (defined($socketlabelstr[$cnt3 + 4]));
}
$bank=$bankstr[$cnt3 + 4];
}
}
} else {
$start2=$start1 + ($simmrange / 2);
$start2x=sprintf("%08lx", $start2 / $meg);
$stacked=2 if ($newslots[$val + 2] eq $start2x && $newslots[$val + 3] eq $simmsz && ($simmsize ne 64));
}
#
# Check for 32MB SIMMs in bank 1 on Classic or LX.
# They look like 16MB SIMMs at 0x0000000 and 0x06000000
# Also check for 8MB SIMMs in bank 1 on Classic or LX.
# They look like 4MB SIMMs at 0x0000000 and 0x06000000
#
if ($model =~ /SPARCclassic|SPARCstation-LX/) {
if ($start1 == 0 && ($simmsize == 32 || $simmsize == 8)) {
if ($newslots[$#newslots - 1] eq "00000060") {
$totmem += $simmsize;
$start2=hex("0x$newslots[$#newslots - 1]") * $meg;
$start2x=sprintf("%08lx", $start2);
$stop2x=sprintf("%08lx", $start2 + ($simmsize * $meg) - 1);
$stop1x .= ", 0x${start2x}-0x$stop2x";
$simmsize *= 2;
pop(@newslots);
pop(@newslots);
}
}
}
if ($stacked == 2) {
$totmem += $simmsize;
$start2=hex("0x$newslots[$val + 2]") * $meg;
if ($simmrange < hex("0x00001000") * $meg) {
$start2x=sprintf("%08lx", $start2);
$stop2x=sprintf("%08lx", $start2 + ($simmsize * $meg) - 1);
} else {
# Systems with > 4GB of memory
$start2x=sprintf("%08lx", ($start2 / $meg)) . "00000";
$start2x=~s/^0000//;
$stop2x=sprintf("%08lx", ($start2 / $meg) + $simmsize - 1) . "fffff";
$stop2x=~s/^0000//;
}
$stop1x .= ", 0x${start2x}-0x$stop2x";
$simmsize *= 2;
$val += 2;
}
if ($stacked == 4) {
$totmem += $simmsize * 3;
$start2=hex("0x$newslots[$val + 2]") * $meg;
$start2x=sprintf("%08lx", $start2);
$stop2x=sprintf("%08lx", $start2 + ($simmsize * $meg) - 1);
$stop1x .= ", 0x${start2x}-0x$stop2x";
$start3=hex("0x$newslots[$val + 4]") * $meg;
$start3x=sprintf("%08lx", $start3);
$stop3x=sprintf("%08lx", $start3 + ($simmsize * $meg) - 1);
$stop1x .= ", 0x${start3x}-0x$stop3x";
$start4=hex("0x$newslots[$val + 6]") * $meg;
$start4x=sprintf("%08lx", $start4);
$stop4x=sprintf("%08lx", $start4 + ($simmsize * $meg) - 1);
$stop1x .= ", 0x${start4x}-0x$stop4x";
$simmsize *= 4;
$val += 6;
}
}
#
# Check for Voyager memory cards. A 32MB memory card is seen
# as 4 8MB memory blocks with holes in the address range.
#
if ($model eq "S240" && $start1 && $simmsize == 16 && $val < $#newslots - 4) {
$start=hex("0x$newslots[$val + 4]") - hex("0x$newslots[$val]");
$perlhexbug=1 if ($start < 0);
$startx=sprintf("%08lx", $start);
if ($newslots[$val + 1] eq "008" && $newslots[$val + 3] eq "008" && $startx eq "00000040") {
$totmem += $simmsize;
$startx=$newslots[$val + 2];
$start=hex("0x$startx") * $meg;
$startx=sprintf("%08lx", $start);
$perlhexbug=1 if ($start < 0);
$stopx=sprintf("%08lx", $start + ($simmsize * $meg) - 1);
$stop1x .= ", 0x${startx}-0x$stopx";
$startx=$newslots[$val + 4];
$start=hex("0x$startx") * $meg;
$startx=sprintf("%08lx", $start);
$perlhexbug=1 if ($start < 0);
$stopx=sprintf("%08lx", $start + ($simmsize * $meg) - 1);
$stop1x .= ", 0x${startx}-0x$stopx";
$simmsize *= 2;
$val += 4;
}
}
$slot0=$simmsize if ($start1 == 0);
$simmsizeperbank=$simmsize / $simmsperbank;
$smallestsimm=$simmsizeperbank if ($simmsize < $smallestsimm);
$largestsimm=$simmsizeperbank if ($simmsize > $largestsimm);
$found8mb=1 if ($simmsizeperbank == 8);
$found16mb=1 if ($simmsizeperbank == 16);
$found32mb=1 if ($simmsizeperbank == 32);
push(@simmsizesfound, "$simmsizeperbank");
$cnt2=0;
while ($cnt2 < $simmsperbank) {
$socket='?' if (! defined($socket));
$bank='' if (! defined($bank));
$byte='' if (! defined($byte));
$socket='?' if ($socket eq "");
$recognized=0 if ($socket eq "?");
$sockets_used .= " $socket";
if ($socket eq "motherboard") {
$buffer .= "$socket has ";
$buffer .= $simmsize/$simmsperbank . "MB";
} else {
if ($model eq "SPARCsystem-600" || $model =~ /Sun.4.600/) {
$exp="Expansion board 0" if ($newslots[$val] =~ /00000[4-7]00/);
$exp="Expansion board 1" if ($newslots[$val] =~ /00000[89ab]00/);
if ($newslots[$val] =~ /00000[4-9ab]00/) {
$buffer .= "$exp ";
$banks="$exp bank $bank";
}
$banks_used .= " $banks" if ($banks && $banks_used !~ /$banks/);
}
# prtconf-only data displayed here
$buffer=($sockettype) ? "$buffer$sockettype $socket$socketlabel has a " : "$buffer$socket$socketlabel is a ";
$buffer .= $simmsize/$simmsperbank . "MB";
$buffer .= " (" . $simmsize/$simmsperbank/1024 . "GB)" if ($simmsize/$simmsperbank > 1023);
$buffer .= " $memtype";
push(@simmsizesfound, $simmsize/$simmsperbank);
}
if ($verbose) {
$buf="";
if ($order) {
$buf .= "$order";
$buf .= " $memtype" if ($memtype !~ /memory card/);
}
$slotnum="" if (! defined($slotnum));
$buf .= "slot $slotnum" if ($slotnum ne "");
$buf .= ", " if ($order || $slotnum ne "");
$buf .= "group $group, " if ($group ne "");
if ($bank ne "") {
if ($bank =~ /Quad/) {
$buf .= "$bank, ";
} elsif ($dualbank eq 1) {
$buf .= "banks $bank, ";
} else {
$buf .= "bank $bank, ";
}
$foundbank1or3=1 if ($bank eq 1 || $bank eq 3);
}
$buf .= "byte $byte, " if ($byte ne "");
$buf .= "address 0x${start1x}-0x$stop1x" if ($start1x && $showrange eq 1);
$buffer .= " ($buf)" if ($buf);
}
$buffer .= "\n";
$cnt2++;
$cnt3=($bankcnt * $simmsperbank) + $cnt2;
if ($#socketstr) {
$socket=$socketstr[$cnt3];
if ($#socketlabelstr) {
$socketlabel=" ($socketlabelstr[$cnt3])" if (defined($socketlabelstr[$cnt3]));
}
if ($found10bit && $newslots[$val] !~ /00000[0-3]00/) {
$socket=$socketstr[$cnt3 + 4];
if ($#socketlabelstr) {
$socketlabel=" ($socketlabelstr[$cnt3 + 4])" if (defined($socketlabelstr[$cnt3 + 4]));
}
}
# &pdebug("socketstr[$cnt3], bankcnt=$bankcnt, cnt2=$cnt2");
}
$order=$orderstr[$cnt3] if ($#orderstr);
$group=$groupstr[$cnt3] if ($#groupstr);
$slotnum=$slotstr[$cnt3] if ($#slotstr);
if ($#bankstr) {
$bank=$bankstr[$cnt3];
$bank=$bankstr[$cnt3 + 4] if ($found10bit && $newslots[$val] !~ /00000[0-3]00/);
}
$banks=$banksstr[$cnt3/$simmsperbank] if ($#banksstr);
$byte=$bytestr[$cnt3] if ($#bytestr);
}
} elsif ($ultra eq 1 || $ultra eq 5 || $ultra eq 10 || $ultra eq 30) {
$buffer .= "bank $slot has a pair of " . $simmsize/2 . "MB DIMMs\n";
push(@simmsizesfound, $simmsize/2);
} elsif ($ultra eq 2 || $ultra eq 250 || $ultra eq 450 || $ultra eq 80 || $ultra eq "420R" || $ultra eq "Netra t140x" || $ultra eq "Netra ft1800") {
$buffer .= "group $slot has four " . $simmsize/4 . "MB DIMMs\n";
push(@simmsizesfound, $simmsize/4);
} elsif ($ultra eq 60 || $ultra eq "220R") {
$buffer .= "group $slot has four " . $simmsize/2 . "MB DIMMs\n";
push(@simmsizesfound, $simmsize/2);
} elsif ($ultra eq "e") {
$buffer .= "group $slot has eight " . $simmsize/8 . "MB DIMMs\n";
push(@simmsizesfound, $simmsize/8);
} elsif ($socket eq "motherboard") {
$buffer .= "$slot has ${simmsize}MB\n";
push(@simmsizesfound, $simmsize);
} else {
$buffer .= "slot $slot has a ${simmsize}MB";
$buffer .= " (" . $simmsize/1024 . "GB)" if ($simmsize > 1023);
$buffer .= " $memtype\n";
push(@simmsizesfound, $simmsize);
}
$slot++;
}
#
# Try to distinguish Ultra 5 from Ultra 10
# Cannot distinguish Ultra 5/333MHz from Ultra 10/333MHz (375-0066 motherboard)
# Cannot distinguish Ultra 5/440MHz from Ultra 10/440MHz (375-0079 motherboard)
#
if ($model eq "Ultra-5_10" || $ultra eq "5_10" || $ultra eq 5 || $ultra eq 10) {
if ($motherboard =~ /375-0009/) {
$ultra=($sysfreq > 91) ? 10 : 5;
$realmodel=($ultra eq 5) ? "(Ultra 5)" : "(Ultra 10)";
}
# Determine if interleaving of banks using four identical sized DIMMs
# Assume 1-way interleaving with mix of stacked and unstacked DIMMs
$interleave=1;
if ($#newslots == 3 && $stacked == 0) {
$interleave=2 if ($newslots[1] eq $newslots[3]);
}
if ($#newslots == 7 && $stacked == 2) {
$interleave=2 if ($newslots[1] eq $newslots[5]);
}
}
&finish;
&pdebug("exit");
exit;
sub hpux_check {
&pdebug("in hpux_check");
$HPUX=1;
$model=$machine;
if ($filename) {
$model="";
$machine="";
$platform="";
$os="HP-UX";
} else {
$osmajor=$osrel;
$osmajor=~s/[^.]*.[0B]*//;
$osmajor=~s/\..*//;
&hpux_osrelease;
$model=&mychomp(`/usr/bin/model`) if (-x '/usr/bin/model');
$cpuversion="";
if (-x '/usr/bin/getconf') {
$kernbit=&mychomp(`/usr/bin/getconf KERNEL_BITS`);
$cpuversion=&mychomp(`/usr/bin/getconf CPU_VERSION`);
}
$kernbit=32 if ($osmajor <= 10);
if (-x '/usr/contrib/bin/machinfo') {
@machinfo=&run("/usr/contrib/bin/machinfo");
&hpux_machinfo;
} elsif (-x '/usr/sbin/ioscan') {
$ncpu=&mychomp(`/usr/sbin/ioscan -kfnC processor | grep '^processor' | wc -l`);
$cpucntfrom="ioscan";
} else {
# Get CPU count from kernel
if ($machine eq "ia64") {
$ncpu=&hpux_kernelval("active_processor_count");
} else {
$ncpu=&hpux_kernelval("processor_count");
}
$cpucntfrom="kernel";
}
$ncpu=1 if (! defined($ncpu)); # It has at least 1 CPU
$cpubanner .= "$ncpu X " if ($ncpu > 1);
if ($machine =~ /^9000\//) {
$schedmodel=$model;
$schedmodel=~s/^.*\/(.*$)/$1/;
if (! $cputype && -r '/usr/sam/lib/mo/sched.models') {
$cputype=&myawk('/usr/sam/lib/mo/sched.models',"^$schedmodel\\b",2);
}
if (! $cputype && -r '/opt/langtools/lib/sched.models') {
$cputype=&myawk('/opt/langtools/lib/sched.models',"^$schedmodel\\b",2);
}
if (! $cputype && -r '/usr/lib/sched.models') {
$cputype=&myawk('/usr/lib/sched.models',"^$schedmodel\\b",2);
}
if ($cputype) {
$cpubanner .= "$cputype ";
&pdebug(" cputype=$cputype");
}
if ($cpuversion == 768) {
$cpubanner .= "Itanium[TM] 1";
} elsif ($cpuversion == 524) {
$cpubanner .= "Motorola MC68020";
} elsif ($cpuversion == 525) {
$cpubanner .= "Motorola MC68030";
} elsif ($cpuversion == 526) {
$cpubanner .= "Motorola MC68040";
} else {
$cpubanner .= "PA-RISC";
if ($cpuversion == 532) {
$cpubanner .= " 2.0";
} elsif ($cpuversion == 529) {
$cpubanner .= " 1.2";
} elsif ($cpuversion == 528) {
$cpubanner .= " 1.1";
} elsif ($cpuversion == 523) {
$cpubanner .= " 1.0";
} elsif (&hpux_kernelval("cpu_arch_is_2_0")) {
$cpubanner .= " 2.0";
} elsif (&hpux_kernelval("cpu_arch_is_1_1")) {
$cpubanner .= " 1.1";
} elsif (&hpux_kernelval("cpu_arch_is_1_0")) {
$cpubanner .= " 1.0";
}
}
} elsif ($cputype) {
$cpubanner .= "$cputype";
} else {
$cpubanner .= "$machine";
}
if (! defined($cfreq)) {
# Get CPU speed from kernel
$cfreq=&hpux_kernelval("itick_per_usec");
if (! defined($cfreq)) {
$cfreq=&hpux_kernelval("itick_per_tick");
$cfreq /= 10000 if (defined($cfreq));
}
&pdebug(" cfreq=$cfreq found in kernel") if (defined($cfreq));
}
$cpubanner .= ", ${cfreq}MHz" if (defined($cfreq));
}
$model="HP $model" if ($model !~ /\bHP\b/i);
$model=~s/ +$//;
$is_hpvm=0;
&hpux_machinfo if ($filename);
}
sub hpux_kernelval {
return if (! -r '/dev/kmem');
$_=shift;
$kernel="/hp_ux";
$kernel="/stand/vmunix" if (-f '/stand/vmunix');
$adb="/usr/bin/adb";
$adb .= " -o" if ($machine eq "ia64");
$kernelval=`echo "$_/D" | $adb $kernel /dev/kmem 2>/dev/null | tail -1`;
@linearr=split(' ', $kernelval);
return $linearr[1];
}
sub hpux_machinfo {
&pdebug("in hpux_machinfo");
$flag_cpu=0;
$flag_platform=0;
$flag_os=0;
# parse machinfo output for CPU and other information
foreach $line (@machinfo) {
$line=&dos2unix($line);
$line=&mychomp($line);
if (! $line || $line =~ /^ +$/) {
# End of sections
$flag_cpu=0;
$flag_platform=0;
$flag_os=0;
next;
}
if ($line =~ /^CPU info:/) {
$flag_cpu=1; # Start of CPU section
next;
}
if ($flag_cpu == 1) {
# Parse CPU count, type and frequency for cpubanner
if ($line =~ /^\s*\d*\s+.*[Pp]rocessor.* \(\d.*Hz,/) {
$ncpu=$line;
$ncpu=~s/^\s*(\d+)\s+.*/$1/;
$ncpu=1 if ($ncpu eq $line);
$cpucntfrom="machinfo 'CPU info'";
$cputype=$line;
$cputype=~s/^\s*\d*\s+(.*)$/$1/;
$cputype=~s/ processors.*$//;
$cputype=~s/^(.*)\s+\(\d.*Hz.*/$1/;
$cputype=~s/\s+/ /g;
$cfreq=$line;
$cfreq=~s/^.*[Pp]rocessor.* \((\d.* [GM]Hz),/$1/;
if ($cfreq =~ /GHz/) {
$cfreq=~s/ GHz.*$//;
$cfreq *= 1000;
} else {
$cfreq=~s/ MHz.*$//;
}
&pdebug(" cputype=$cputype, cfreq=$cfreq");
next;
} elsif ($line =~ /logical processors \(\d+ per socket/) {
# Report multicore processors
$tmp=$line;
$tmp=~/(\d+) logical processors \((\d+) per socket/;
$cputype=&multicore_cputype($cputype,$2) if (defined($2));
next;
} elsif ($line =~ /Number of CPUs = /) {
@linearr=split('=', $line);
$ncpu=$linearr[1];
$ncpu=~s/^ *//;
$cpucntfrom="machinfo 'Number of CPUs'";
next;
} elsif ($line =~ /^\s*\d+ sockets\s*$/) {
$tmp=$line;
$tmp=~/(\d+) sockets/;
$ncpu=$1;
$cpucntfrom="machinfo 'sockets'";
next;
} elsif ($line =~ /processor model: /) {
@linearr=split(':', $line);
$cputype=$linearr[1];
$cputype=~s/^ *\d+ +//;
$cputype=~s/ processor$//;
&pdebug(" cputype=$cputype");
next;
} elsif ($line =~ /Clock speed = \d+ [GM]Hz/) {
@linearr=split('=', $line);
$cfreq=$linearr[1];
$cfreq=~s/^ *//;
if ($cfreq =~ /GHz/) {
$cfreq=~s/ GHz//;
$cfreq *= 1000;
} else {
$cfreq=~s/ MHz//;
}
next;
} elsif ($line =~ /LCPU attribute is /) {
$hyperthreadcapable=1;
if ($line =~ /enabled/i) {
$hyperthread=1;
$cputype=~s/ Intel/ Hyper-Threaded Intel/ if ($cputype !~ /Hyper.Thread/i);
}
next;
}
}
if ($line =~ /^Memory:\s/) {
$installed_memory=$line;
$installed_memory=~s/^Memory:\s*(\d*\s*[GM]*[Bb]*).*/$1/;
if ($installed_memory =~ /GB/) {
$installed_memory=~s/\s*GB//g;
$installed_memory *= 1024;
} else {
$installed_memory=~s/MB//ig;
}
$totmem=&roundup_memory($installed_memory);
next;
}
if ($line =~ /^Platform info:/) {
$flag_platform=1; # Start of Platform section
next;
}
if ($flag_platform == 1 && $model eq "HP" && $line =~ /\bModel/i) {
@linearr=split('[:=]', $line);
$model=$linearr[1];
$model=~s/^ +//;
$model=~s/"//g;
$model=~s/ +$//;
if ($model =~ /^ia64/) {
$machine="ia64";
$platform="ia64";
$kernbit=64;
}
$model="HP $model" if ($model !~ /\bHP\b/i);
next;
}
if ($line =~ /^OS info:/) {
$flag_os=1; # Start of OS section
next;
}
if ($flag_os == 1 && ! $osrel && $line =~ /\bRelease/i) {
@linearr=split('[:=]', $line);
$osrel=$linearr[1];
$osrel=~s/^ +//;
$osrel=~s/^HP-UX //;
&hpux_osrelease;
next;
}
}
$is_hpvm=1 if ($model =~ /Virtual Machine/);
}
sub hpux_osrelease {
if ($osrel eq "B.11.11") {
$osrelease="11i v1";
} elsif ($osrel eq "B.11.20") {
$osrelease="11i v1.5";
} elsif ($osrel eq "B.11.22") {
$osrelease="11i v1.6";
} elsif ($osrel eq "B.11.23") {
$osrelease="11i v2";
} elsif ($osrel eq "B.11.31") {
$osrelease="11i v3";
}
}
sub hpux_cprop {
&pdebug("in hpux_cprop");
$config_cmd="/opt/propplus/bin/cprop -summary -c Memory";
$config_command="cprop";
# Use HP-UX SysMgmtPlus software to attempt to report memory
if ($filename) {
$cprop_out="<$filename";
} else {
&show_header;
$cprop_out="$config_cmd 2>&1 |";
}
$cnt=0;
open(FILE, $cprop_out);
while() {
next if (/^[\s\*\-]+$/);
next if (/(| Unknown|: Other|: \.\.|: Not Specified|:\s*$)/i);
($permission_error)=(/(.*)/) if (/Permission denied|does not have privileges|is not authorized to run/i);
if (/not supported on HPVM guest/i) {
$is_hpvm=1;
last;
}
$memarr++ if (/^\[Instance\]:\s+\d+/);
if ($memarr >= 0) {
($Status[$memarr])=(/:\s+(.*)$/) if (/\[Status\]:\s+/);
if (/\[Location\]:\s+/) {
($Location[$memarr])=(/Location\]:\s+(.*)$/);
$Location[$memarr]=~s/^.*details\s+://;
$Location[$memarr]=~s/\s+:\s+/:/g;
$Location[$memarr]=~s/\.$//;
}
($Size[$memarr])=(/:\s+(.*)$/) if (/\[Size\]:\s+/);
($ModType[$memarr])=(/:\s+(.*)$/) if (/\[Module Type\]:\s+/);
($MemType[$memarr])=(/:\s+(.*)$/) if (/\[Memory Type\]:\s+/);
if (/\[Part Number\]:\s+/) {
($PN[$memarr])=(/:\s+(.*)$/);
$PN[$memarr]=&hex2ascii($PN[$memarr]);
}
}
}
close(FILE);
$installed_memory=0;
for ($cnt=0; $cnt <= $memarr; $cnt++) {
$buffer="";
if (defined($Size[$cnt])) {
$buffer="$Location[$cnt]:" if (defined($Location[$cnt]));
$buffer.=" $PN[$cnt]" if (defined($PN[$cnt]));
$simmsize=$Size[$cnt];
if ($simmsize =~ /GB/) {
$simmsize=~s/GB//g;
$simmsize *= 1024;
} else {
$simmsize=~s/MB//ig;
}
$installed_memory += $simmsize;
$buffer.=" $Size[$cnt]";
$buffer.=" $MemType[$cnt]" if (defined($MemType[$cnt]));
$buffer.=" $ModType[$cnt]" if (defined($ModType[$cnt]));
if (defined($Status[$cnt])) {
if ($Status[$cnt] !~ /OK/i) {
$buffer.=" - $Status[$cnt]";
$failing_memory=1;
}
}
$buffer=~s/^\s+//;
if ("$buffer" ne "") {
push(@boards_mem, "$buffer\n");
$boardfound_mem=1;
$memfrom="cprop";
}
} elsif (defined($Location[$cnt])) {
# Empty socket
$sockets_empty .= ";" if ($sockets_empty);
$sockets_empty .= " $Location[$cnt]";
}
}
$totmem=$installed_memory if (! $totmem);
if ($installed_memory && $totmem && $installed_memory != $totmem) {
print "ERROR: Total installed memory (${totmem}MB) does not ";
print "match the total of the\n memory modules found ";
print "(${installed_memory}MB).\n";
}
&hpux_finish;
}
sub hpux_cstm {
&pdebug("in hpux_cstm");
$config_cmd="echo 'selclass qualifier memory;info;wait;infolog'|/usr/sbin/cstm 2>&1";
if (! $filename && $verbose == 3) {
# Include CPU information when E-mailing maintainer since this
# data is used by memconf for regression testing.
$config_cmd="echo 'selclass qualifier cpu;info;wait;selclass qualifier memory;info;wait;infolog'|/usr/sbin/cstm 2>&1";
}
$config_command="cstm";
# Use HP-UX Support Tool Manager software to attempt to report memory
if (! $filename) {
&show_header;
@config=&run("$config_cmd");
}
$flag_memerr=0;
foreach $line (@config) {
$line=&dos2unix($line);
next if ($line eq "\n" || $line =~ /^ +$/ || $line =~ /^ +=+$/);
if ($line =~ /Internal Application error/i) {
$cstm_error=$line;
$cstm_error=~s/^ *//;
next;
}
if ($line =~ /=\-\+\-=/) {
$flag_mem=0; # End of section
next;
}
if ($line =~ /\bPA [78]\d+.* CPU\b/) {
$cputype=&mychomp($line);
$cputype=~s/^.* (PA [78]\d+).*/$1/;
$cputype=~s/ //g;
&pdebug(" cputype=$cputype");
$ncpu++;
}
if ($line =~ /^'9000\// && $model eq "HP" && ! $machine) {
@linearr=split(' ', $line);
$machine=$linearr[0];
$machine=~s/\'//g;
$platform=$machine;
$model="HP $machine";
}
if ($flag_mem == 1) {
next if ($line =~ /Log creation time/);
if ($line =~ /^-- Information Tool Log for /) {
$flag_mem=0; # End of memory section
next;
}
if ($line =~ /^Memory Error Log Summary/) {
$flag_memerr=1; # Start of memory error log
}
if ($line =~ / errors logged | memory error log |Last error /) {
$flag_memerr=0; # End of memory error log
}
if ($flag_memerr == 0 || $verbose) {
push(@boards_mem, "$line");
} elsif ($verbose == 0 && $line =~ /^Memory Error Log Summary| errors logged | memory error log |Last error /) {
# Only display the memory errors if verbose
push(@boards_mem, "$line");
}
$memory_error_logged=1 if ($line =~ / errors logged | Last error detected/);
$boardfound_mem=1;
$memfrom="cstm";
}
if ($line =~ /^-- Information Tool Log for .*MEMORY / && $flag_mem == 0) {
$flag_mem=1; # Start of memory section
}
}
&hpux_finish;
}
sub hpux_finish {
if ($machine =~ /^9000\/7/) {
$modelmore="workstation";
} elsif ($machine =~ /^9000\/8/) {
$modelmore="server";
}
if ($filename) {
if ($cputype) {
$cpubanner="$ncpu X " if ($ncpu > 1);
$cpubanner .= "$cputype";
} else {
$cpubanner="$ncpu cpus" if ($ncpu > 1);
}
if (defined($cfreq)) {
$cpubanner .= ", ${cfreq}MHz";
}
&show_header;
}
if ($boardfound_mem) {
&pdebug("displaying memory from $memfrom") if ($memfrom);
print @boards_mem;
&print_empty_memory("memory slots") if ($sockets_empty);
&show_total_memory;
} else {
if ($filename) {
&show_total_memory;
} else {
if (! $totmem) {
# Get total memory from kernel
if ($osmajor > 10) {
$totmem=&hpux_kernelval("memory_installed_in_machine");
} else {
$totmem=&hpux_kernelval("physmem");
}
if (defined($totmem)) {
$totmem /= 256; # Convert pages to MB
} else {
$totmem=0;
}
if (-r '/var/adm/syslog/syslog.log' && $totmem == 0) {
open(FILE, ";
close(FILE);
@physical=grep(/Physical:/,@syslog);
foreach $line (@physical) {
@linearr=split(' ', $line);
$totmem=$linearr[6] / 1024;
last;
}
}
}
&show_total_memory;
# Check if on a virtual machine (HPVM guest)
if (-x '/opt/hpvm/bin/hpvminfo') {
&pdebug("Checking hpvminfo");
$tmp=`/opt/hpvm/bin/hpvminfo 2>&1`;
if ($tmp =~ /HPVM guest/i) {
$is_hpvm=1;
} elsif ($tmp =~ /Permission denied|does not have privileges|is not authorized to run/i) {
print "ERROR: $tmp";
print " This user does not have permission to run '/opt/hpvm/bin/hpvminfo'.\n";
print " Run memconf as a privileged user like root on the HPVM host.\n";
}
}
}
if ($is_hpvm) {
print "NOTICE: Details shown are for the configuration of this HPVM guest, not the\n physical CPUs and memory of the HPVM host it is running on.\n";
} elsif ($config_command eq "cstm") {
print "ERROR: /usr/sbin/cstm $cstm_error" if (defined($cstm_error));
print "ERROR: /usr/sbin/cstm did not report the memory installed in this HP-UX system.\n";
print " Cannot display detailed memory configuration. A newer version of\n";
print " Diagnostic and Support Tools for HP-UX may fix this issue. Aborting.\n";
}
$exitstatus=1;
}
#
# Post notice if X86 machine is Hyper-Thread capable, but not enabled
#
&show_hyperthreadcapable;
if ($permission_error) {
print "ERROR: $permission_error\n";
print " This user does not have permission to run $config_command.\n";
print " Try running memconf as a privileged user like root.\n" if ($uid ne "0");
$exitstatus=1;
}
# Flag untested CPU types (machine="" on regression test files)
if (! $machine || $machine =~ /^9000\// || $machine eq "ia64") {
# Tested HP-UX on PA-RISC and Itanium
$untested=0;
} else {
$untested=1;
$untested_type="CPU" if (! $untested_type);
}
&show_untested if ($untested);
&show_errors;
if ($memory_error_logged && $verbose == 0) {
print "WARNING: Memory errors have been logged.\n";
print " Run 'memconf -v' to display the memory error log.\n";
}
&mailmaintainer if ($verbose == 3);
&pdebug("exit $exitstatus");
exit $exitstatus;
}
sub myawk {
$awkfile=shift;
$awksearch=shift;
$awkfield=shift;
open(FILE, "<$awkfile");
@tmp=;
close(FILE);
foreach $line (@tmp) {
if ($line =~ /$awksearch/) {
@linearr=split(' ', $line);
return $linearr[$awkfield];
}
}
return "";
}
sub x86_devname {
return if ($have_x86_devname || $machine =~ /sun4|sparc/ || ! defined($model));
# x86 Sun development names and family part number
$m=(defined($manufacturer)) ? "$manufacturer $model" : $model;
$m=~s/-/ /g;
&pdebug("in x86_devname, model=$m");
$untested=1 if ($m =~ /(Blade|Server) X\d/i);
$untested=2 if ($m =~ /Sun |Netra /i);
if ($m =~ /Sun .*W1100z.*2100z\b/i || $m =~ /Sun .*W[12]100z\b/i) {
&cpubanner;
# Check for Opteron 200 Series in case one CPU is disabled
if ($cpubanner =~ /Opteron.* 2\d\d\b/i || $ncpu == 2) {
# W2100z uses Opteron 200 Series 2-way processors.
$devname="Metropolis 2P";
$familypn="A59";
$diagbanner="W2100z";
@socketstr=("DIMM2 Bank 0","DIMM1 Bank 0","DIMM4 Bank 1","DIMM3 Bank 1","DIMM6 Bank 2","DIMM5 Bank 2","DIMM8 Bank 3","DIMM7 Bank 3");
@reorder_decodedimms=(4,3,2,1,8,7,6,5);
} elsif ($cpubanner) {
# W1100z uses Opteron 100 Series 1-way processor.
# W1100z is not upgradable to dual processors, so
# don't show empty CPU2 or DIMM5-DIMM8 slots.
$devname="Metropolis 1P";
$familypn="A58";
$diagbanner="W1100z";
@socketstr=("DIMM2 Bank 0","DIMM1 Bank 0","DIMM4 Bank 1","DIMM3 Bank 1");
@reorder_decodedimms=(4,3,2,1);
}
$model="Java Workstation $diagbanner";
$diagbanner=$model;
$untested=0;
}
if ($m =~ /Sun .*V20z.*40z\b/i) {
$devname="Stinger";
$familypn="A55 (V20z), A57 (V40z)";
} elsif ($m =~ /Sun .*V20z\b/i) {
$devname="Stinger 2P";
$familypn="A55";
$untested=0;
} elsif ($m =~ /Sun .*V40z\b/i) {
$devname="Stinger 4P";
$familypn="A57";
$untested=0;
}
if ($m =~ /\bX2100 M2\b/i) {
$devname="Leo";
$familypn="A84";
$untested=0;
} elsif ($m =~ /Sun .*X2100\b/i) {
$devname="Aquarius";
$familypn="A75";
$untested=0;
}
if ($m =~ /Sun .*X2200 (speedbump|M2\b.*Quad.*Core)/i) {
# AMD Quad-Core Barcelona processor
$devname="Taurus2";
$familypn="A85";
$untested=0;
} elsif ($m =~ /Sun .*X2200 M2\b/i) {
$devname="Taurus";
$familypn="A85";
$untested=0;
}
if ($m =~ /Sun .*X2250\b/i) {
$devname="Venus";
$familypn="X2250";
$untested=0;
}
if ($m =~ /Sun .*X2270 M2\b/i) {
# X2270 has 1 or 2 CPUs
$familypn="X2270M2";
$untested=0 if ($os eq "SunOS");
} elsif ($m =~ /Sun .*X2270\b/i) {
# X2270 has 1 or 2 Quad-Core hyper-threaded CPUs
$familypn="X227";
$untested=0 if ($os eq "SunOS");
}
if ($m =~ /Sun .*X4100 M2\b/i) {
$devname="Galaxy 1F";
$familypn="A86";
$untested=0;
} elsif ($m =~ /Sun .*X4100\b/i) {
$devname="Galaxy 1U";
$familypn="A64";
$untested=0;
}
if ($m =~ /Sun .*X4100E\b/i) {
$devname="Galaxy 1E"; # Cancelled
$familypn="A72";
}
if ($m =~ /Sun .*X4140\b/i) {
$devname="Dorado 1U";
$familypn="B12";
$untested=0;
}
if ($m =~ /Sun .*X4150\b/i) {
$devname="Doradi 1U";
$familypn="B13";
$untested=0;
}
if ($m =~ /Sun .*X4170\b/i) {
# X4170 has 1 or 2 Quad-Core hyper-threaded CPUs
$devname="Lynx 1U";
$familypn="X4170";
$untested=0;
}
if ($m =~ /Sun .*X4200 M2\b/i) {
$devname="Galaxy 2F";
$familypn="A87";
$untested=0;
} elsif ($m =~ /Sun .*X4200\b/i) {
$devname="Galaxy 2U";
$familypn="A65";
$untested=0;
}
if ($m =~ /Netra .*X4200\b/i) {
$devname="Draco";
$familypn="N87";
}
if ($m =~ /Sun .*X4200E\b/i) {
$devname="Galaxy 2E"; # Cancelled
$familypn="A73";
}
if ($m =~ /Sun .*X4240\b/i) {
$devname="Dorado 2U";
$familypn="B14";
$untested=0;
}
if ($m =~ /Netra .*X4250\b/i) {
$devname="Aries";
$familypn="NX425";
}
if ($m =~ /Sun .*X4250\b/i) {
$devname="Doradi 2U";
$familypn="X4250";
$untested=0 if ($os eq "SunOS");
}
if ($m =~ /Sun .*X4270 M2\b/i) {
# X4270 has 1 or 2 Quad-Core hyper-threaded CPUs
$devname="Lynx 2U";
$familypn="X4270M2";
$untested=0;
} elsif ($m =~ /Sun .*X4270\b/i) {
$devname="Lynx 2U";
$familypn="X4270";
$untested=0;
}
if ($m =~ /Sun .*X4275\b/i) {
# X4275 has 1 or 2 Quad-Core hyper-threaded CPUs
$devname="Lynx 2U";
$familypn="X4275";
}
if ($m =~ /Netra .*X4270\b/i) {
$familypn="NX4270";
}
if ($m =~ /Sun .*X4440\b/i) {
$devname="Tucana";
$familypn="B16";
$untested=0 if ($os eq "SunOS");
}
if ($m =~ /Sun .*X4450\b/i) {
$devname="Tucani";
$familypn="B15";
$untested=0;
}
if ($m =~ /Netra .*X4450\b/i) {
$devname="Argo";
}
if ($m =~ /Sun .*X4470 M2\b/i) {
# X4470 has 4 CPU sockets
$familypn="X4470M2";
$untested=0 if ($os eq "SunOS");
} elsif ($m =~ /Sun .*X4470\b/i) {
$familypn="X4470";
$untested=0 if ($os eq "SunOS");
}
if ($m =~ /Sun .*X4500\b/i) {
$devname="Thumper";
$familypn="A76";
$untested=0;
}
if ($m =~ /Sun .*X4540\b/i) {
$devname="Thor";
$familypn="B24";
$untested=0 if ($os eq "SunOS");
}
if ($m =~ /Sun .*X4600\b/i) {
$devname="Galaxy 4U";
$familypn="A67"; # Same for X4600 M2
$devname="Galaxy 4F" if ($m =~ /Sun .*X4600 M2\b/);
$untested=0;
}
if ($m =~ /Sun .*X4640\b/i) {
# Replacement for Sun Fire X4600 M2
$familypn="X4640";
$untested=0 if ($os eq "SunOS");
}
if ($m =~ /Sun .*X4800 M2\b/i) {
# X4800 has 8 CPU sockets
$familypn="X4800M2";
} elsif ($m =~ /Sun .*X4800\b/i) {
# X4800 has 8 CPU sockets
$familypn="X4800";
$untested=0 if ($os eq "SunOS");
}
if ($m =~ /Sun .*X4950\b/i) {
$devname="Streamstar StreamSwitch 2";
$familypn="A91";
}
# The Sun Blade 8000 Modular System uses the Sun Blade
# X8420/X8440/X8450 Server Modules
if ($m =~ /Sun .*Blade 8000\b/i) {
$devname="Andromeda 19";
$familypn="A81";
if ($m =~ /Sun .*Blade 8000 P\b/i) {
$devname="Andromeda 14";
$familypn="A82";
}
$untested=2;
}
if ($m =~ /Sun .*Fire V60x\b|Sun .*Fire\(tm\) V60\b/i) {
$devname="Grizzly";
$familypn="A48";
}
if ($m =~ /Sun .*Fire V65x\b|Sun .*Fire\(tm\) V65\b/i) {
$devname="Grizzly 2U";
$familypn="A48";
$untested=0 if ($os eq "SunOS");
}
if ($m =~ /Sun .*Ultra *20 M2\b/i) {
$devname="Munich";
$familypn="A88";
$untested=2;
$untested=0 if ($os eq "SunOS");
} elsif ($m =~ /Sun .*Ultra *20\b/i) {
$devname="Marrakesh";
$familypn="A63";
$untested=2;
$untested=0 if ($os eq "SunOS");
}
if ($m =~ /Sun .*Ultra *24\b/i) {
$devname="Ursa";
$familypn="B21";
$untested=0;
}
if ($m =~ /Sun .*Ultra *27\b/i) {
$familypn="B27";
$untested=0;
}
if ($m =~ /Sun .*Ultra *40 M2\b/i) {
$devname="Stuttgart";
$familypn="A83";
$untested=0;
} elsif ($m =~ /Sun .*Ultra *40\b/i) {
$devname="Sirius";
$familypn="A71";
$untested=0;
}
# The Sun Blade 6000 and 6048 Modular Systems use the Sun Blade
# X6220, X6250 or T6300 Server Modules.
if ($m =~ /Sun .*Blade 6000\b/i) {
$devname="Constellation 10";
$familypn="A90";
$untested=2;
}
if ($m =~ /Sun .*Blade 6048\b/i) {
$devname="Constellation 48";
$familypn="B22";
$untested=2;
}
if ($m =~ /Sun .*X6220\b/i) {
$devname="Gemini";
$familypn="A92";
}
if ($m =~ /Sun .*X6240\b/i) {
$devname="Gemini+";
$familypn="X6240";
$untested=0 if ($os eq "SunOS");
}
if ($m =~ /Sun .*X6250\b/i) {
$devname="Wolf";
$familypn="A93";
$untested=0;
}
if ($m =~ /Sun .*X6270 M2\b/i) {
# X6270 has 1 or 2 CPUs
$familypn="X6270M2";
$untested=0;
} elsif ($m =~ /Sun .*X6270\b/i) {
# X6270 has 1 or 2 Quad-Core hyper-threaded CPUs
$familypn="X6270";
$untested=0;
}
if ($m =~ /Sun .*X6275 M2\b/i) {
# X6275 M2 has 2 Quad-Core or Six-Core hyper-threaded CPUs
$familypn="X6275M2";
} elsif ($m =~ /Sun .*X6275\b/i) {
# X6275 has 2 or 4 Quad-Core hyper-threaded CPUs
$familypn="X6275";
}
if ($m =~ /Sun .*X6420\b/i) {
$devname="Pegasus";
}
if ($m =~ /Sun .*X6440\b/i) {
$devname="Pegasus+";
$familypn="X6440";
}
if ($m =~ /Sun .*X6450\b/i) {
$devname="Hercules2";
$familypn="X6450";
}
if ($m =~ /Sun .*X8400\b/i) {
$devname="Andromeda";
$familypn="X8400";
}
if ($m =~ /Sun .*X8420\b/i) {
$devname="Capella";
}
if ($m =~ /Sun .*X8440\b/i) {
$devname="Mira";
$familypn="A98";
}
if ($m =~ /Sun .*X8450\b/i) {
# Quad-Core CPU for Sun Blade 8000 chassis
$devname="Scorpio";
$familypn="X8450";
}
if ($m =~ /Sun .*X8600\b/i) {
$devname="Antares";
}
$untested=1 if ($m =~ /Netra Server X3.2\b/i); # X3-2
$untested=0 if ($m =~ /Sun Server X4.2\b/i && $os eq "SunOS"); # X4-2
$untested=0 if ($m =~ /Sun Server X4.2L\b/i && $os eq "SunOS"); # X4-2L
$untested=1 if ($m =~ /Sun Server X4.4\b/i); # X4-4
$untested=1 if ($m =~ /Sun Server X4.8\b/i); # X4-8
$untested=1 if ($m =~ /Netra Blade X3.2B\b/i); # X3-2B
$untested=1 if ($m =~ /Sun Blade X4.2B\b/i); # X4-2B
$untested=0 if ($m =~ /Oracle Server X5.2\b/i && $os eq "SunOS"); # X5-2
$untested=0 if ($m =~ /Oracle Server X5.2L\b/i && $os eq "SunOS"); # X5-2L
$untested=0 if ($m =~ /Oracle Server X6.2L\b/i && $os eq "SunOS"); # X6-2L
$have_x86_devname=1 if ($devname);
}
sub releasefile {
# Check file for release information
$arg=shift;
&pdebug("in releasefile, checking $arg");
open(FILE, $arg);
while() {
$tmp=&mychomp($_);
next if ($tmp =~ /^[\s\*\-\_\\\/\|]*$/);
# Ignore line if it starts with Escape sequence
next if ($tmp =~ /^\e\[/);
$tmp=~s/\s*\\[nr].*//;
$tmp=~s/^Welcome to //;
$tmp=~s/\s+-\s+.*//;
&pdebug("in releasefile $arg, found $tmp");
return($tmp);
}
close(FILE);
return("");
}
sub linux_distro {
$release="";
$osname="$os $osrel";
$osname="$os" if ($osrel eq "");
$kernbit="";
$kernbit="32-bit kernel" if ($machine =~ /i.86|sparc/);
$kernbit="64-bit kernel" if ($machine =~ /x86_64|sparc64|ia64|amd64/);
if (-f '/etc/freebsd-update.conf') {
# FreeBSD
@linearr=split(' ', $kernver);
$release="$linearr[0] $linearr[1], $kernbit";
return;
}
$kernbit .= ", " if ($kernbit);
foreach $relfile ('/etc/pclinuxos-release',
'/etc/centos-release',
'/etc/distro-release',
'/etc/enterprise-release',
'/etc/fedora-release',
'/etc/frugalware-release',
'/etc/kate-version',
'/etc/myah-version',
'/etc/pardus-release',
'/etc/parsix-version',
'/etc/sabayon-release',
'/etc/vector-version',
'/etc/whitebox-release',
'/etc/yellowdog-release',
'/etc/yoper-release',
'/etc/UnitedLinux-release',
'/etc/gentoo-release',
'/etc/mandriva-release',
'/etc/mandrakelinux-release','/etc/mandrake-release',
'/etc/slackware-version','/etc/slackware-release',
'/etc/redhat-release','/etc/redhat_version',
'/etc/SuSE-release') {
if (-f "$relfile") {
$release=&releasefile($relfile);
$release .= ", $kernbit$osname";
return;
}
}
if (-d '/KNOPPIX') {
if (-r '/cdrom/index.html') {
open(FILE, ") {
if (//) {
$release=&mychomp($_);
$release=~s///;
$release=~s/<\/TITLE.*//;
}
}
close(FILE);
} elsif (-r '/init') {
open(FILE, ") {
if (/DISTRO=/) {
$release=&mychomp($_);
$release=~s/.*DISTRO="*(.*)$/$1/;
$release=~s/"//g;
}
}
close(FILE);
}
$release="Knoppix" if (! $release);
$release .= ", $kernbit$osname";
$release .= ", " . &releasefile("/etc/issue") if (-f '/etc/issue');
return;
} elsif (-f '/gos/gOS/gos.html') {
$release="gOS, $kernbit$osname";
$release .= ", " . &releasefile("/etc/issue") if (-f '/etc/issue');
return;
} elsif (-f '/etc/motd.static') {
$release=&releasefile("/etc/motd.static");
$release .= ", $kernbit$osname";
if (-f '/etc/issue') {
$tmp=&releasefile("/etc/issue");
if ($release =~ /Knoppix/i) {
$release="Knoppix, $kernbit$osname, $tmp";
} else {
$release .= ", $tmp";
}
}
return;
} elsif (-d '/ffp/etc') {
$release="fun_plug";
if (-f '/ffp/etc/ffp-version') {
$tmp=&mychomp(`grep FFP_VERSION= /ffp/etc/ffp-version`);
$tmp=~s/^.*=//;
$release .= " $tmp" if ($tmp);
}
if (-f '/etc/Alt-F') {
$tmp=&releasefile('/etc/Alt-F');
$release="Alt-F $tmp with $release";
}
} elsif (-f '/etc/Alt-F') {
$tmp=&releasefile('/etc/Alt-F');
$release="Alt-F $tmp";
}
# Debian, Ubuntu, BusyBox, etc.
foreach $relfile ('/etc/issue.net','/etc/issue','/etc/motd') {
$release=&releasefile("$relfile") if (! $release && -f "$relfile");
}
$release=(defined($release)) ? "$release, $kernbit$osname" : "";
$release=~s/^, //;
}
sub check_mixedspeeds {
$_=shift;
return if ($_ !~ /(\dMHz|\dns)/);
s/^.* (\d*)MHz.*$/$1/;
s/^(\d*)MHz.*$/$1/;
s/^.* (\d*)ns.*$/$1/;
s/^(\d*)ns.*$/$1/;
return if (! $_);
&pdebug("in check_mixedspeeds, value=$_");
# round some memory speeds
$_=266 if ($_ >= 265 && $_ <= 285); # DDR-266 PC-2100
$_=667 if ($_ >= 665 && $_ <= 668); # DDR2-667 PC2-5300
$_=1066 if ($_ >= 1065 && $_ <= 1068); # DDR2-1066 PC2-8500, DDR3-1066 PC3-8500
$_=1866 if ($_ >= 1865 && $_ <= 1868); # DDR3-1866 PC3-14900
if ($foundspeed) {
$mixedspeeds=1 if ($foundspeed ne $_);
} else {
$foundspeed=$_;
}
}
sub roundup_memory {
$newval=shift;
# &pdebug("in roundup_memory $newval");
# Round up memory (may have 128MB or more reserved)
# Works for up to 16777216GB (16TB)
for ($val=16; $val <= 64; $val += 16) {
$newval=$val if ($newval >= $val-8 && $newval < $val);
}
for ($val=64; $val <= 1024; $val += 32) {
$newval=$val if ($newval >= $val-16 && $newval < $val);
}
for ($val=1024; $val <= 4096; $val += 512) {
$newval=$val if ($newval >= $val-128 && $newval < $val);
}
for ($val=4096; $val <= 14336; $val += 1024) {
$newval=$val if ($newval >= $val-512 && $newval < $val);
}
for ($val=14336; $val <= 32768; $val += 2048) {
$newval=$val if ($newval >= $val-1024 && $newval < $val);
}
for ($val=32768; $val <= 262144; $val += 4096) {
$newval=$val if ($newval >= $val-2048 && $newval < $val);
}
for ($val=262144; $val <= 1048576; $val += 8192) {
$newval=$val if ($newval >= $val-4096 && $newval < $val);
}
for ($val=1048576; $val <= 4194304; $val += 16384) {
$newval=$val if ($newval >= $val-8192 && $newval < $val);
}
for ($val=4194304; $val <= 16777216; $val += 32768) {
$newval=$val if ($newval >= $val-16384 && $newval < $val);
}
for ($val=16777216; $val <= 67108864; $val += 65536) {
$newval=$val if ($newval >= $val-32768 && $newval < $val);
}
for ($val=67108864; $val <= 268435456; $val += 131072) {
$newval=$val if ($newval >= $val-65536 && $newval < $val);
}
return($newval);
}
sub check_dmidecode_ver {
$tmp=shift;
@dmidecode_verarr=split(/\./, $dmidecode_ver);
if (defined($tmp)) {
@latest_dmidecode_verarr=split(/\./, $latest_dmidecode_ver);
if (($dmidecode_verarr[0] < $latest_dmidecode_verarr[0]) ||
($dmidecode_verarr[0] == $latest_dmidecode_verarr[0] &&
$dmidecode_verarr[1] < $latest_dmidecode_verarr[1])) {
print " Your dmidecode package is an old version";
print " ($dmidecode_ver)" if ($dmidecode_ver);
print ", so consider upgrading\n";
print " to dmidecode-$latest_dmidecode_ver or later.\n";
} elsif ($dmidecode_ver) {
print " Your dmidecode version is $dmidecode_ver.\n" if (defined($tmp));
}
}
@minimum_dmidecode_verarr=split(/\./, $minimum_dmidecode_ver);
if (($dmidecode_verarr[0] < $minimum_dmidecode_verarr[0]) ||
($dmidecode_verarr[0] == $minimum_dmidecode_verarr[0] &&
$dmidecode_verarr[1] < $minimum_dmidecode_verarr[1])) {
return 1;
} else {
return 0;
}
}
sub check_free {
return if ($free_checked);
&pdebug("in check_free");
$free_checked=1;
if (! $filename && $free_cmd) {
# Check memory detected by OS
@free=&run("$free_cmd");
$have_free_data=1;
}
if (! $filename && $meminfo_cmd) {
# Check memory detected by kernel
@meminfo=&run("$meminfo_cmd");
$have_meminfo_data=1;
}
if ($have_meminfo_data) {
foreach $line (@meminfo) {
$line=&dos2unix($line);
if ($line =~ /MemTotal:\s+\d+ kB/) {
@linearr=split(' ', $line);
$freephys=int($linearr[1] / 1024);
$totmem=&roundup_memory($freephys) if ($totmem == 0);
last;
}
}
}
if ($have_free_data && ! $freephys) {
foreach $line (@free) {
$line=&dos2unix($line);
if ($line =~ /Mem:/) {
@linearr=split(' ', $line);
$freephys=$linearr[1];
$totmem=&roundup_memory($freephys) if ($totmem == 0);
last;
}
}
}
}
sub check_for_decodedimms {
return if (&is_virtualmachine);
# Need root permissions to load eeprom kernel module
return if ($uid ne "0" && ! $filename);
&pdebug("in check_for_decodedimms");
if (! $filename && $decodedimms_cmd) {
$flag=1;
# Some systems lockup when loading eeprom module, avoid them
# Avoid running on systems with PIIX4 like Dell PowerEdge 2650
@tmp=&run("/sbin/modprobe i2c_dev");
@tmp=&run("/usr/sbin/i2cdetect -l | grep -w PIIX4");
$flag=0 if (@tmp);
# See if eeprom module is already loaded in kernel
@tmp=&run("/sbin/lsmod | grep -w eeprom");
$flag=2 if (@tmp);
if ($flag) {
# Check memory SPD data from EEPROM
@tmp=&run("$modprobe_eeprom_cmd") if ($flag == 1);
@decodedimms=&run("$decodedimms_cmd");
$have_decodedimms_data=1;
}
}
}
sub check_topology {
# Stoutland Platform (SGI Blade Chassis) topology command
return if (&is_virtualmachine);
&pdebug("in check_topology");
if ($filename) {
@topology=@config;
} else {
@topology=&run("$topology_cmd");
}
$flag_mem=0;
$partition_cnt=0;
foreach (@topology) {
$_=&dos2unix($_);
$_=&mychomp($_);
if (/^System type: /) {
push(@topology_header, "$_\n");
$topology_mfg="SGI.COM" if (/ UV/);
}
if (/^Serial number: /) {
push(@topology_header, "$_\n");
$topology_mfg="SGI.COM" if (/ UV/);
}
if (/^Partition number: /) {
push(@topology_header, "$_\n");
$partition_cnt++;
}
push(@topology_header, "$_\n") if (/^\s*\d+ Blades$/);
push(@topology_header, "$_\n") if (/^\s*\d+ CPUs$/);
push(@topology_header, "$_\n") if (/^\s*\d+.* GB Memory Total/i);
push(@topology_header, "$_\n") if (/^\s*\d+.* GB Max Memory.*/i);
$flag_mem=1 if (/(Idx|Index)\s.*\sNASID\s+CPUS\s+Memory/);
$flag_mem=0 if (/^\s*$/);
push(@topology_data, "$_\n") if ($flag_mem);
}
}
sub check_decodedimms {
return if ($decodedimms_checked);
return if (&is_virtualmachine);
&pdebug("in check_decodedimms");
$decodedimms_checked=1;
# TLS - uncomment to not use decode-dimms.pl data - 19-Apr-2012
# $have_decodedimms_data=0;
# TLS - If decode-dimms.pl is not available, suggest that it can be installed
# with lmsensors to get more detailed memory information.
if ($have_decodedimms_data) {
$flag_mem=0;
$flag_unknown=0;
$mem_mfg="";
$pn="";
$simmsize=0;
$memtype="";
$dimmspeed="";
$cnt=0;
foreach $line (@decodedimms) {
$line=&dos2unix($line);
$line=&mychomp($line);
if ($line =~ /^Guessing DIMM is in/i) {
$tmp=$line;
$tmp=~s/^.*\s+(\d+)\s*$/$1/;
$cnt=($tmp - 1) if ($tmp);
$flag_mem=1;
}
$flag_mem=0 if ($line =~ /^(Decoding EEPROM|EEPROM Checksum of bytes.*Bad|Number of SDRAM DIMMs detected and decoded)/i);
if ($flag_mem) {
if ($line =~ /^Fundamental Memory type/i) {
# Required data from SPD EEPROM
$memtype=$line;
$memtype=~s/^Fundamental Memory type\s+(.*\S)\s*$/ $1/;
&pdebug("in check_decodedimms, cnt=$cnt, memtype=$memtype");
$flag_unknown=($memtype =~ /^ *Unknown/i) ? 1 : 0;
if ($flag_unknown) {
&pdebug("in check_decodedimms, cnt=$cnt, Unknown memtype detected - failing DIMM");
}
}
if ($line =~ /^Maximum module speed/i) {
$dimmspeed=$line;
$dimmspeed=~s/^Maximum module speed\s+\D+\s+(.*\S)\s*$/ $1/;
&check_mixedspeeds($dimmspeed);
&pdebug("in check_decodedimms, cnt=$cnt, dimmspeed=$dimmspeed");
}
$simmsize=$sizearr[$cnt] if (defined($sizearr[$cnt]) && ! $simmsize);
if ($line =~ /^Size\s+.*MB/i) {
$simmsize=$line;
$simmsize=~s/^Size\s+(\d+)\s*MB.*$/$1/;
&pdebug("in check_decodedimms, cnt=$cnt, simmsize=$simmsize");
}
if ($line =~ /^Manufacturer\s+/i) {
$mem_mfg=$line;
$mem_mfg=~s/^Manufacturer\s+(.*\S)\s*$/ $1/;
$mem_mfg=&get_mfg($mem_mfg);
$mem_mfg="" if ($mem_mfg =~ /^\s+(FFFFFFFFFFFF|000000000000|Undefined)/i);
$mem_mfg=" $mem_mfg" if ($mem_mfg);
&pdebug("in check_decodedimms, cnt=$cnt, mem_mfg=$mem_mfg");
}
if ($line =~ /^Part Number\s+/i) {
$pn=$line;
$pn=~s/^Part Number\s+(.*\S)\s*$/ $1/;
$pn="" if ($pn =~ /^\s+(FFFFFFFFFFFF|000000000000|Undefined)/i);
&pdebug("in check_decodedimms, cnt=$cnt, pn=$pn");
}
} elsif ($simmsize && $memtype) {
if ($reorder_decodedimms[$cnt]) {
$tmp=$reorder_decodedimms[$cnt]-1;
&pdebug("in check_decodedimms, reorder cnt=$tmp");
} else {
$tmp=$cnt;
}
if (defined($socketlabelarr[$tmp])) {
$socket=$socketlabelarr[$tmp];
$offset=-1;
$incr=0;
foreach (@boards_mem) {
if (/\b$socket\b/) {
if ($MemPartNum[$incr-1]) {
# make sure pn matches
$offset=$incr if (" $MemPartNum[$incr-1]" eq "$pn");
} else {
$offset=$incr;
}
}
$incr++;
}
if ($offset >= 0) {
($old)=grep(/$socket/,@boards_mem);
chop($old);
if ($flag_unknown) {
$tmp="$old - FAILING";
$failing_memory=1;
} else {
$tmp="$socket: ${simmsize}MB$dimmspeed$memtype";
$tmp .= ",$mem_mfg$pn" if ($mem_mfg || $pn);
}
@tmp=("$tmp\n");
# Replace socket data from dmidecode
# with socket data from decode-dimms.pl
&pdebug("in check_decodedimms, replace socket data '$old' with '$tmp'");
splice(@boards_mem, $offset, 1, @tmp);
$memfrom="decode-dimms.pl" if ($memfrom !~ /decode-dimms.pl/);
}
} else {
$memfrom="dmidecode and decode-dimms.pl";
}
$mem_mfg="";
$pn="";
$simmsize=0;
$memtype="";
$dimmspeed="";
$cnt++;
}
}
}
}
sub check_dmidecode {
&pdebug("in check_dmidecode");
$DMI6=0;
$DMI6cnt=0;
$DMI6totmem=0;
$DMI17=0;
$DMI17totmem=0;
$DMI17end=0;
$DMItype=0;
$platform="";
$FoundEnd=0;
$BrokenTable="";
$unknown_JEDEC_ID=0;
$ECCDIMM=0;
$config_command="dmidecode";
if ($filename) {
$DmiFile="<$filename";
} else {
$DmiFile="$config_cmd 2>&1 |";
&linux_distro if (! $release);
if ($ipmitool_cmd && ! $have_ipmitool_data) {
@ipmitool=&run("$ipmitool_cmd fru");
$have_ipmitool_data=1;
}
}
$cpu_membank=-1;
$physmemarray="";
$memfrom="dmidecode";
&check_for_decodedimms;
&check_topology;
open(FILE, $DmiFile);
while() {
next if (/(| Unknown|: Other|: \.\.|: Not Specified|:\s*$)/i);
# for regression tests
$have_decodedimms_data=1 if (/^Guessing DIMM is in/i);
($dmidecode_ver)=(/.* dmidecode (.*)/i) if (/ dmidecode /i);
($permission_error)=(/(.*)/) if (/Permission denied/i);
($dmidecode_error)=(/# *(.*)/) if (/No SMBIOS nor DMI entry point found/i && ! &is_xen_vm);
# Detect end of DMI type 17 blocks
# &pdebug("In DMI type 17, $_") if ($DMItype == 17);
if (/(^Handle|^\s*$)/i && $DMItype == 17 && $memarr >= 0 && ! $DMI17end) {
$DMI17end=1;
$DMItype=0;
# Ignore Flash chips for DMI17totmem
$Size17[$memarr]=0 if (! defined($Size17[$memarr]));
$Type17[$memarr]="" if (! defined($Type17[$memarr]));
&pdebug("End of DMI type 17 block, $Size17[$memarr] $Type17[$memarr] detected") if ($Type17[$memarr] =~ /Flash/i);
if ($Size17[$memarr] !~ /Not Installed/i && $Size17[$memarr] !~ /No Module Installed/i && $Type17[$memarr] !~ /Flash/i) {
&pdebug("End of DMI type 17 block, adding $Size17[$memarr] memory to total");
$simmsize=$Size17[$memarr];
if ($simmsize =~ / *GB.*/i) {
$simmsize=~s/ *GB.*//ig;
$simmsize *= 1024;
} else {
$simmsize=~s/ *MB.*//ig;
}
$DMI17totmem += $simmsize if ($simmsize);
}
}
($DMItype)=(/DMI type (\d+)/i) if (/\bDMI type /i);
if (/Handle .* DMI type 16,/i) {
($tmp)=(/Handle (.*), DMI type 16,/i);
$cpu_membank++ if ($physmemarray ne $tmp);
$physmemarray=$tmp;
}
$DMI17end=0 if ($DMItype != 17);
# Type Information
# ----------------------------------------
# 0 BIOS
# 1 System
# 2 Base Board
# 3 Chassis
# 4 Processor
# 5 Memory Controller
# 6 Memory Module
# 7 Cache
# 8 Port Connector
# 9 System Slots
# 10 On Board Devices
# 11 OEM Strings
# 12 System Configuration Options
# 13 BIOS Language
# 14 Group Associations
# 15 System Event Log
# 16 Physical Memory Array
# 17 Memory Device
# 18 32-bit Memory Error
# 19 Memory Array Mapped Address
# 20 Memory Device Mapped Address
# 21 Built-in Pointing Device
# 22 Portable Battery
# 23 System Reset
# 24 Hardware Security
# 25 System Power Controls
# 26 Voltage Probe
# 27 Cooling Device
# 28 Temperature Probe
# 29 Electrical Current Probe
# 30 Out-of-band Remote Access
# 31 Boot Integrity Services
# 32 System Boot
# 33 64-bit Memory Error
# 34 Management Device
# 35 Management Device Component
# 36 Management Device Threshold Data
# 37 Memory Channel
# 38 IPMI Device
# 39 Power Supply
# 40 Additional Information
# 41 Onboard Device
# Additionally, type 126 is used for disabled entries and type
# 127 is an end-of-table marker. Types 128 to 255 are for
# OEM-specific data.
# Keep walking the dmidecode output for more about the system
# Check system information
if ($DMItype == 0) {
($biosvendor)=(/: +(.*\S) *$/) if (/^\s*Vendor: /i);
}
if ($DMItype == 1) {
($systemmanufacturer)=(/: +(.*\S) *$/) if (/^\s*(Manufacturer|Vendor): /i);
($systemmodel)=(/: +(.*\S) *$/) if (/^\s*Product( Name|): /i);
}
if ($DMItype == 2) {
($boardmanufacturer)=(/: +(.*\S) *$/) if (/^\s*(Manufacturer|Vendor): /i);
($boardmodel)=(/: +(.*\S) *$/) if (/^\s*Product( Name|): /i);
$boardmodel=~s/^$boardmanufacturer // if ($boardmanufacturer && $boardmodel);
# use DMItype2 manufacturer if Oracle (for VirtualBox)
($systemmanufacturer)=(/: +(.*\S) *$/) if (/^\s*(Manufacturer|Vendor): *Oracle */i);
}
# Check CPU information
if ($DMItype == 4) {
if (/^\s*Processor( Information|)$/i) {
$cpuarr++;
$ncpu++;
}
if (/^\s*Socket Designation: /i) {
($CPUSocketDesignation[$cpuarr])=(/: +(.*\S) *$/);
$CPUSocketDesignation[$cpuarr]="CPU $cpuarr" if ($CPUSocketDesignation[$cpuarr] eq "Microprocessor");
}
($CPUFamily[$cpuarr])=(/: +(.*\S) *$/) if (/^\s*(Processor |)Family: /i);
if (/^\s*(Processor |)Manufacturer: /i) {
($CPUManufacturer[$cpuarr])=(/: +(.*\S) *$/);
$CPUManufacturer[$cpuarr]=~s/GenuineIntel/Intel/;
}
($CPUVersion[$cpuarr])=(/: +(.*\S) *$/) if (/^\s*(Processor |)Version: /i);
($ExtSpeed[$cpuarr])=(/: +(.*\S) *$/) if (/^\s*External Clock: /i);
($CPUSpeed[$cpuarr])=(/: +(.*\S) *$/) if (/^\s*Current Speed: /i);
if (/^\s*Status: /i) {
($CPUStatus[$cpuarr])=(/: +(.*\S) *$/);
if ($CPUStatus[$cpuarr] =~ /(Unpopulated|Disabled By BIOS)/i) {
$ncpu--;
$necpu++;
$CPUVersion[$cpuarr]="";
}
}
}
# Check memory controller information
if ($DMItype == 5) {
($ECCBIOS)=(/: +(.*\S) *$/) if (/^\s*Error Detecting Method: /i && ! $ECCBIOS);
($interleave)=(/: +(.*\S) *$/) if (/^\s*Current Interleave: /i && $interleave eq "0");
($MAXMEM)=(/: +(.*\S) *$/) if (/^\s*Maximum Total Memory Size: /i && ! $MAXMEM);
}
# Check each memory device
if ($DMItype == 6) {
$DMI6=1;
$memarr++ if (/^\s*Memory (Module Information|Bank)$/i);
($Locator6[$memarr])=(/: +(.*\S) *$/) if (/^\s*Socket( Designation|): /i);
($Speed6[$memarr])=(/: +(.*\S) *$/) if (/^\s*Current Speed: /i);
($Type6[$memarr])=(/: +(.*\S) *$/) if (/^\s*Type: /i);
if (/^\s*Installed Size: /i) {
($Size6[$memarr])=(/: +(.*\S) *$/);
if ($Size6[$memarr] !~ /Not Installed/i && $Size6[$memarr] !~ /No Module Installed/i) {
$simmsize=$Size6[$memarr];
$simmsize=~s/ *MB.*//ig;
$DMI6totmem += $simmsize if ($simmsize);
$SizeDetail[$memarr]=$Size6[$memarr];
$Size6[$memarr]=$simmsize . "MB";
$SizeDetail[$memarr]=~s/\d+ *MBy*t*e* *//i;
}
}
($BankConnections6[$memarr])=(/: +(.*\S) *$/) if (/^\s*Bank Connections: /i);
$DMI6cnt=$memarr + 1;
}
# SMBIOS 2.1 added DMI Types 16 & 17, obsoleting Types 5 & 6
# Check physical memory array
if ($DMItype == 16) {
($ECCBIOS)=(/: +(.*\S) *$/) if (/^\s*Error Correction Type: /i && ! $ECCBIOS);
($MAXMEM)=(/: +(.*\S) *$/) if (/^\s*Maximum Capacity: /i && ! $MAXMEM);
($NUMMOD)=(/: +(.*\S) *$/) if (/^\s*Number Of Devices: /i && ! $NUMMOD);
}
# Check each memory device
if ($DMItype == 17) {
if ($DMI6) {
# Prefer DMI type 17 information over DMI type 6
$memarr=-1 if (! $DMI17);
}
$DMI17=1;
$memarr++ if (/^\s*Memory Device$/i);
($FormFactor[$memarr])=(/: +(.*\S) *$/) if (/^\s*Form Factor: /i);
($TotalWidth[$memarr])=(/: +(\d*) */) if (/^\s*Total Width: /i);
($DataWidth[$memarr])=(/: +(\d*) */) if (/^\s*Data Width: /i);
if (/^\s*Locator: /i) {
($Locator17[$memarr])=(/: +(.*\S) *$/);
$Locator17[$memarr]=~s/ */ /g;
# Add CPU to X4170/X4270/X4275/X6270/X6275
if ($systemmodel =~ /Sun .*X(4[12]7[05]|627[05])\b/i && $Locator17[$memarr] !~ /CPU/) {
$cpu_number=$CPUSocketDesignation[$cpu_membank];
$cpu_number=~s/\s*//g;
$Locator17[$memarr]="${cpu_number}_$Locator17[$memarr]";
}
}
($BankLocator[$memarr])=(/: +(.*\S) *$/) if (/^\s*Bank Locator: /i);
($Type17[$memarr])=(/: +(.*\S) *$/) if (/^\s*Type: /i);
($TypeDetail[$memarr])=(/: +(.*\S) *$/) if (/^\s*Type Detail: /i);
($Size17[$memarr])=(/: +(.*\S) *$/) if (/^\s*Size: /i);
($Speed17[$memarr])=(/: +(.*\S) *$/) if (/^\s*Speed: /i);
($MemManufacturer[$memarr])=&get_mfg(/: +(.*\S) *$/) if (/^\s*Manufacturer: /i && $Size17[$memarr] =~ /( MB|GB)/);
if (/^\s*Part Number: /i && ! /PartNum/i && ! /NOT AVAILABLE/i) {
($MemPartNum[$memarr])=(/: +(.*\S) *$/);
$MemPartNum[$memarr]=&hex2ascii($MemPartNum[$memarr]);
# Hack: Ballistic modules may have mfg Undefined
$MemManufacturer[$memarr]="Crucial Technology" if (! $MemManufacturer[$memarr] && $MemPartNum[$memarr] =~ /^BL/);
}
}
$BrokenTable=&mychomp($_) if (/DMI table is broken/i);
$FoundEnd=1 if (/End.Of.Table/i);
}
close(FILE);
# Determine best manufacturer and model to display (or both) from
# DMI type 1 (System) or DMI type 2 (Base Board)
$baseboard="$boardmanufacturer $boardmodel" if ("$boardmanufacturer$boardmodel" ne "");
$baseboard="" if ($boardmanufacturer eq $systemmanufacturer && ($boardmodel eq $systemmodel || $boardmodel eq ""));
if ($systemmanufacturer) {
$manufacturer=$systemmanufacturer;
} else {
$manufacturer=$boardmanufacturer;
$baseboard="";
}
if ($systemmodel) {
$model=$systemmodel;
} else {
$model=$boardmodel;
}
if ($manufacturer =~ /To Be Filled|System Manufacturer/i) {
$manufacturer=$boardmanufacturer;
$baseboard="";
}
if ($model =~ /To Be Filled|System .*Name|XXXX/i) {
$model=$boardmodel;
$baseboard="";
}
$baseboard="" if (&is_virtualmachine);
# Check kernel to see how many processors it sees (for multi-core and
# hyper-threaded CPUs)
&check_cpuinfo;
# Check Xen hardware for processors it sees (for multi-core and
# hyper-threaded CPUs)
&check_xm_info;
# Check topology for manufacturer
$manufacturer=$topology_mfg if ($topology_mfg);
# Check Xenstore for manufacturer and model if not known
if (&is_xen_vm && ! -f $filename && -x '/usr/bin/xenstore-ls' && -x '/usr/bin/xenstore-read') {
$domid=&mychomp(`/usr/bin/xenstore-read domid 2>/dev/null`);
if ($domid) {
@xenstore=`/usr/bin/xenstore-ls /local/domain/$domid 2>/dev/null`;
foreach (@xenstore) {
if ($manufacturer eq "" && /\bsystem-manufacturer = */) {
($manufacturer)=(/= *"(.*)"$/);
}
if ($model eq "" && /\bsystem-product-name = */) {
($model)=(/= *"(.*)"$/);
}
}
}
}
# hash CPUs
$range=$ncpu;
# Only display allocated CPUs on Virtual Machines
$range=$cpuinfo_cpucnt if ($cpuinfo_cpucnt && &is_virtualmachine);
for ($val=0; $val < $range; $val++) {
$cputype="";
$cpufreq="";
if ($CPUVersion[$val]) {
if ($CPUVersion[$val] eq "AMD" && $cpuinfo_cputype && ! &is_virtualmachine) {
$cputype .= "$CPUManufacturer[$val] " if ($CPUManufacturer[$val] && $cpuinfo_cputype !~ /$CPUManufacturer[$val]/i);
&pdebug("Adding AMD \$cpuinfo_cputype=$cpuinfo_cputype to cputype");
$cputype .= "$cpuinfo_cputype ";
} else {
$cputype .= "$CPUManufacturer[$val] " if ($CPUManufacturer[$val] && $CPUVersion[$val] !~ /$CPUManufacturer[$val]/i);
$CPUVersion[$val]=&cleanup_cputype($CPUVersion[$val]);
&pdebug("Adding \$CPUVersion[$val]=$CPUVersion[$val] to cputype");
$cputype .= "$CPUVersion[$val] ";
}
} elsif ($cpuinfo_cputype && ! &is_virtualmachine) {
if ($CPUManufacturer[$val]) {
$cputype .= "$CPUManufacturer[$val] " if ($cpuinfo_cputype !~ /$CPUManufacturer[$val]/i);
}
&pdebug("Adding \$cpuinfo_cputype=$cpuinfo_cputype to cputype");
$cputype .= "$cpuinfo_cputype ";
} else {
$cputype .= "$CPUManufacturer[$val] " if ($CPUManufacturer[$val]);
$cputype .= "$CPUFamily[$val] " if ($CPUFamily[$val]);
}
if (! $machine && $CPUFamily[$val]) {
$machine="ia64" if ($CPUFamily[$val] eq "Itanium");
}
$cputype=~s/^\s+//;
$cputype=~s/\s+$//;
$cputype=~s/ +/ /g;
if ($ncpu < $cpuinfo_cpucnt && $cpuinfo_cpucnt && $foundGenuineIntel) {
# Distinguish Multi-Core from hyper-threading
if ($cpuinfo_cpucores && $cpuinfo_physicalidcnt && $cpuinfo_cpucnt) {
if ($cpuinfo_cpucnt / ($cpuinfo_cpucores * $cpuinfo_physicalidcnt) == 2) {
$hyperthread=1;
$ncpu=$cpuinfo_physicalidcnt;
$range=$ncpu; # Adjust the range of this "for" loop
&pdebug("hyperthread=1: from cpuinfo physical id, ncpu=$ncpu, cpuinfo_cpucnt=$cpuinfo_cpucnt, cpuinfo_physicalidcnt=$cpuinfo_physicalidcnt, cpuinfo_cpucores=$cpuinfo_cpucores, cputype=$cputype");
}
} elsif ($cpuinfo_cpucores && $cpuinfo_coreidcnt > 1) {
if ($cpuinfo_coreidcnt != $ncpu * $cpuinfo_cpucores) {
if ($cpuinfo_cpucnt == $cpuinfo_coreidcnt && $cpuinfo_cpucores == 1 && $cpuinfo_cpucnt / $ncpu > 2) {
$cpuinfo_cpucores=$cpuinfo_cpucnt / $ncpu;
} else {
$hyperthread=1;
&pdebug("hyperthread=1: from cpuinfo, cputype=$cputype");
}
} elsif ($cpuinfo_siblings) {
if ($cpuinfo_coreidcnt / ($ncpu * $cpuinfo_siblings) == 2) {
$hyperthread=1;
&pdebug("hyperthread=1: from cpuinfo siblings, ncpu=$ncpu, cpuinfo_cpucnt=$cpuinfo_cpucnt, cpuinfo_coreidcnt=$cpuinfo_coreidcnt, cpuinfo_siblings=$cpuinfo_siblings, cputype=$cputype");
}
}
} elsif ($cpuinfo_siblings && ! ($cpuinfo_cpucores == 0 && $cputype =~ /Pentium.* 4\b/)) {
if ($cpuinfo_cpucores == 0 && $cpuinfo_cpucnt / $cpuinfo_siblings == 2) {
$hyperthread=1;
if ($cpuinfo_physicalidcnt) {
$ncpu=$cpuinfo_physicalidcnt;
$cpuinfo_cpucores=$cpuinfo_cpucnt / $cpuinfo_physicalidcnt / 2;
$range=$ncpu; # Adjust the range of this "for" loop
&pdebug("hyperthread=1: from cpuinfo physical id, ncpu=$ncpu, cpuinfo_cpucnt=$cpuinfo_cpucnt, cpuinfo_physicalidcnt=$cpuinfo_physicalidcnt, cpuinfo_siblings=$cpuinfo_siblings, cputype=$cputype");
} else {
&pdebug("hyperthread=1: from cpuinfo siblings, ncpu=$ncpu, cpuinfo_cpucnt=$cpuinfo_cpucnt, cpuinfo_physicalidcnt=$cpuinfo_physicalidcnt, cpuinfo_siblings=$cpuinfo_siblings, cputype=$cputype");
}
}
} elsif ($cpuinfo_cpucores == 0 && $cputype =~ /Pentium.* 4\b/) {
# Can't tell RHEL3 Hyper-Threaded Pentium 4
# from Dual-Core Pentium D
$hyperthread=1;
&pdebug("hyperthread=1: hack in cpuinfo, cputype=$cputype");
}
if ($xen_cores_per_socket) {
$cputype=&multicore_cputype($cputype,$xen_cores_per_socket);
} elsif ($cpuinfo_cpucores) {
$cputype=&multicore_cputype($cputype,$cpuinfo_cpucores);
} elsif ($hyperthread && $cpuinfo_siblings) {
$cputype=&multicore_cputype($cputype,$cpuinfo_physicalidcnt);
} else {
$cputype=&multicore_cputype($cputype,$cpuinfo_cpucnt / $ncpu);
}
}
if ($CPUSpeed[$val]) {
$cpufreq="$CPUSpeed[$val]";
$cpufreq=~s/ *MHz$//;
$CPUSpeed[$val]=~s/ *MHz$/MHz/;
}
&x86multicorecnt($cputype);
$cpucnt{"$cputype $cpufreq"}++ if (! $xen_ncpu || $val < $xen_ncpu);
$cpucntfrom="dmidecode" if ($cpucntfrom !~ /cpuinfo/ && $cpucntfrom ne "xm_info");
$ExtSpeed[$val]=~s/ *MHz$/MHz/ if ($ExtSpeed[$val]);
}
@cputypecnt=keys(%cpucnt);
$x=0;
while (($cf,$cnt)=each(%cpucnt)) {
$x++;
$cf=~/^(.*) (\d*)$/;
$ctype=$1;
$cfreq=$2;
if ($cpucntflag == 0 && $cpucntfrom !~ /cpuinfo/ && $cpucntfrom ne "xm_info") {
for $tmp (2,3,4,6,8,10,12,16) {
$cnt /= $tmp if ($corecnt == $tmp && $cnt % $tmp == 0);
}
$cpucntflag=1;
}
$ctype="" if ($ctype =~ /^\S*-Core $/);
if ($ctype) {
$ctype=&multicore_cputype($ctype,$corecnt) if (&is_xen_hv);
$cpubanner .= "$cnt X " if ($cnt > 1);
$cpubanner .= "$ctype";
$cpubanner .= " ${cfreq}MHz" if ($cfreq && $ctype !~ /Hz$/);
$cpubanner .= ", " if ($x < scalar(@cputypecnt));
}
}
if (&is_virtualmachine && $cpubanner eq "") {
$cpubanner .= "$cpuinfo_cpucnt X " if ($cpuinfo_cpucnt > 1);
$_=$cpuinfo_cputype;
($vcpu_type)=(/^(\w*)/);
($vcpu_freq)=(/(\d[\d\.]*[GM]Hz)/);
$cpubanner .= "$vcpu_type $vcpu_freq";
}
$machine="x86" if (! $machine);
&x86_devname;
#
# Print information
#
&show_header;
if (@topology_data) {
print @topology_header;
print @topology_data;
$untested=0 if ($partition_cnt == 1 && $topology_mfg); # SGI UV
$totmem=$installed_memory;
&finish;
&pdebug("exit");
exit;
}
# CPU information
if ($verbose) {
print "WARNING: CPU Information Unknown\n" if ($cpuarr < 0 && $cpucntfrom !~ /cpuinfo/);
$range=$cpuarr;
$range=$cpuinfo_cpucnt - 1 if ($cpucntfrom =~ /cpuinfo/ && ! $permission_error && &is_virtualmachine);
# Second CPU doesn't exist on W1100z
$range=0 if ($model =~ /W1100z\b/i);
# Third & fourth CPUs don't exist on Ultra 40
$range=1 if ($familypn eq "A71");
for ($cnt=0; $cnt <= $range; $cnt++) {
# Only display allocated CPUs on Virtual Machines
next if ($CPUStatus[$cnt] && &is_virtualmachine && $CPUStatus[$cnt] =~ /(Unpopulated|Disabled By BIOS)/i);
if ($CPUSocketDesignation[$cnt]) {
print "$CPUSocketDesignation[$cnt]: ";
} else {
print "v" if (&is_virtualmachine);
print "CPU $cnt: ";
}
if ($cpucntfrom =~ /cpuinfo/ && &is_virtualmachine) {
$_=$cpuinfo_cputype;
($vcpu_type)=(/^(\w*)/);
($vcpu_freq)=(/(\d[\d\.]*[GM]Hz)/);
print "$vcpu_type $vcpu_freq cpu\n";
next;
}
if ($CPUStatus[$cnt]) {
if ($CPUStatus[$cnt] =~ /(Unpopulated|Disabled By BIOS)/i) {
print "$CPUStatus[$cnt]\n";
next;
}
}
$ctype="";
if ($CPUVersion[$cnt]) {
$ctype .= "$CPUManufacturer[$cnt] " if ($CPUManufacturer[$cnt] && $CPUVersion[$cnt] !~ /$CPUManufacturer[$cnt]/i);
$ctype .= "$CPUVersion[$cnt] ";
} else {
$ctype .= "$CPUManufacturer[$cnt] " if ($CPUManufacturer[$cnt]);
$ctype .= "$CPUFamily[$cnt] " if ($CPUFamily[$cnt]);
}
$ctype=~s/ +/ /g;
print "$ctype";
if ($CPUSpeed[$cnt]) {
print "$CPUSpeed[$cnt] " if ($ctype !~ /Hz $/);
}
print "cpu";
print ", system freq: $ExtSpeed[$cnt]" if ($ExtSpeed[$cnt]);
print "\n";
}
}
if ($ncpu > 1 && $foundGenuineIntel && $cpucntfrom =~ /cpuinfo/ && ! $permission_error && ! &is_xen_vm) {
print "WARNING: Cannot detect if Hyper-Threading is enabled, ";
print "CPU count may be half of\n what is shown if ";
print "Hyper-Threading is enabled.\n";
}
# Memory information
if ($permission_error) {
print "ERROR: $permission_error\n";
print " This user does not have permission to run $config_command.\n";
print " Try running memconf as a privileged user like root.\n" if ($uid ne "0");
&pdebug("exit 1");
exit 1;
}
$max=0;
if ($MAXMEM) {
if ($MAXMEM =~ /\d+ MB/) {
$max=$MAXMEM;
$max=~s/ MB//g;
} elsif ($MAXMEM =~ /\d+ GB/) {
$max=$MAXMEM;
$max=~s/ GB//g;
$max *= 1024;
} elsif ($MAXMEM =~ /\d+ TB/) {
$max=$MAXMEM;
$max=~s/ TB//g;
$max *= $meg;
}
}
$DMItypeshown=0;
$memarr=3 if ($model =~ /W1100z\b/i); # DIMM5-DIMM8 don't exist on W1100z
for ($cnt=0; $cnt <= $memarr; $cnt++) {
$buf="";
# Prefer DMI type 17 information over DMI type 6
$DMI=17;
$DMI=6 if ($DMI6 && ! $DMI17);
# Prefer DMI type 6 information if DMI type 6 reports different
# total memory than DMI type 17 (BIOS bug)
$DMI=6 if ($DMI6 && $DMI17 && $DMI6totmem > $DMI17totmem && &roundup_memory($freephys) == $DMI6totmem && ! &is_virtualmachine);
&pdebug("using DMI type $DMI data for memory: DMI6totmem=$DMI6totmem, DMI17totmem=$DMI17totmem") if (! $DMItypeshown);
$DMItypeshown=1;
if ($DMI == 6) {
next if (! $Size6[$cnt]);
if ($Type6[$cnt]) {next if ($Type6[$cnt] =~ /Flash/i);}
if (defined($Locator6[$cnt]) && defined($BankLocator[$cnt])) {
$BankLocator[$cnt]="" if ($Locator6[$cnt] eq $BankLocator[$cnt]);
if ($Locator6[$cnt] =~ /:/ && $BankLocator[$cnt] =~ /:/) {
$Loc1=$Locator6[$cnt];
$Loc1=~s/.*://;
$Loc2=$BankLocator[$cnt];
$Loc2=~s/.*://;
$Locator6[$cnt]=~s/:.*// if ($Loc1 eq $Loc2);
}
}
if ($#socketstr && ! $have_decodedimms_data) {
$socketlabelarr[$cnt]="$socketstr[$cnt]";
} else {
$socketlabelarr[$cnt]=$Locator6[$cnt];
}
if ($Size6[$cnt] =~ /Not Installed|No Module Installed|^0 *MB.*/i) {
&add_to_sockets_empty($socketlabelarr[$cnt]);
} else {
$buf="$socketlabelarr[$cnt]";
$simmsize=$Size6[$cnt];
$simmsize=~s/ *MB.*//ig;
$sizearr[$cnt]=$simmsize;
$Size6[$cnt]=~s/MByte/ MB/ig;
$Size6[$cnt]=~s/ +MB/MB/g;
if (defined($BankConnections6[$cnt])) {
if ($Locator6[$cnt] =~ /BANK *\d/i && $BankConnections6[$cnt] =~ / /) {
$tmp=$simmsize / 2;
$buf .= ": 2 X ${tmp}MB";
} else {
$buf .= ": $Size6[$cnt]";
}
} else {
$buf .= ": $Size6[$cnt]";
}
$buf .= " $SizeDetail[$cnt]" if ($SizeDetail[$cnt]);
if ($Speed6[$cnt]) {
$Speed6[$cnt]=~s/ +MHz/MHz/;
$Speed6[$cnt]=~s/ +ns/ns/;
$buf .= " $Speed6[$cnt]";
&check_mixedspeeds($Speed6[$cnt]);
} elsif ($Speed17[$cnt]) {
$Speed17[$cnt]=~s/ +MHz/MHz/;
$Speed17[$cnt]=~s/ +ns/ns/;
$buf .= " $Speed17[$cnt]";
&check_mixedspeeds($Speed17[$cnt]);
}
if ($TypeDetail[$cnt]) {
$buf .= " $TypeDetail[$cnt]" if ($TypeDetail[$cnt] !~ /None/i);
}
if ($FormFactor[$cnt] && defined($Type17[$cnt])) {
$buf .= " $Type17[$cnt]";
$buf .= " $FormFactor[$cnt]" if ($Type17[$cnt] !~ /$FormFactor[$cnt]/);
} elsif ($Type6[$cnt]) {
$buf .= " $Type6[$cnt]";
}
if ($MemManufacturer[$cnt]) {
$buf .= ", $MemManufacturer[$cnt]" if ($MemManufacturer[$cnt] !~ /None/i);
if ($MemPartNum[$cnt]) {
$buf .= " $MemPartNum[$cnt]" if ($MemPartNum[$cnt] !~ /None/i);
}
} elsif ($MemPartNum[$cnt]) {
$buf .= ", $MemPartNum[$cnt]" if ($MemPartNum[$cnt] !~ /None/i);
}
}
$totmem=$DMI6totmem;
} else {
next if (! $Size17[$cnt]);
if ($Type17[$cnt]) {next if ($Type17[$cnt] =~ /Flash/i);}
if (defined($Locator17[$cnt]) && defined($BankLocator[$cnt])) {
$BankLocator[$cnt]="" if ($Locator17[$cnt] eq $BankLocator[$cnt]);
if ($Locator17[$cnt] =~ /:/ && $BankLocator[$cnt] =~ /:/) {
$Loc1=$Locator17[$cnt];
$Loc1=~s/.*://;
$Loc2=$BankLocator[$cnt];
$Loc2=~s/.*://;
$Locator17[$cnt]=~s/:.*// if ($Loc1 eq $Loc2);
}
}
if ($BankLocator[$cnt]) {
$bank_label="$BankLocator[$cnt]";
# Don't include bank label if memory label also
# includes the CPU
$bank_label="" if ($Locator17[$cnt] =~ /CPU/ && $BankLocator[$cnt] =~ /\/P\d+$/);
}
if ($#socketstr && ! $have_decodedimms_data) {
$socketlabelarr[$cnt]="$socketstr[$cnt]";
} else {
$socketlabelarr[$cnt]=$Locator17[$cnt];
$socketlabelarr[$cnt] .= " $bank_label" if ($bank_label);
}
if ($Size17[$cnt] =~ /Not Installed|No Module Installed|^0 *MB.*/i) {
&add_to_sockets_empty($socketlabelarr[$cnt]);
} else {
$buf="$socketlabelarr[$cnt]";
$simmsize=$Size17[$cnt];
if ($simmsize =~ / *GB.*/i) {
$simmsize=~s/ *GB.*//ig;
$simmsize *= 1024;
} else {
$simmsize=~s/ *MB.*//ig;
}
$sizearr[$cnt]=$simmsize;
$Size17[$cnt]=~s/MByte/ MB/ig;
$Size17[$cnt]=~s/ +MB/MB/g;
$buf .= ": $Size17[$cnt]";
$buf .= " $SizeDetail[$cnt]" if ($SizeDetail[$cnt]);
if ($Speed17[$cnt]) {
$Speed17[$cnt]=~s/ +MHz/MHz/;
$Speed17[$cnt]=~s/ +ns/ns/;
$buf .= " $Speed17[$cnt]";
&check_mixedspeeds($Speed17[$cnt]);
} elsif ($Speed6[$cnt]) {
$Speed6[$cnt]=~s/ +MHz/MHz/;
$Speed6[$cnt]=~s/ +ns/ns/;
$buf .= " $Speed6[$cnt]";
&check_mixedspeeds($Speed6[$cnt]);
}
if ($TypeDetail[$cnt]) {
$buf .= " $TypeDetail[$cnt]" if ($TypeDetail[$cnt] !~ /None/i);
}
$buf .= " $Type17[$cnt]" if ($Type17[$cnt]);
if ($FormFactor[$cnt]) {
if ($Type17[$cnt]) {
$buf .= " $FormFactor[$cnt]" if ($Type17[$cnt] !~ /$FormFactor[$cnt]/);
} else {
$buf .= " $FormFactor[$cnt]";
}
}
if ($TotalWidth[$cnt] && $DataWidth[$cnt]) {
$ECCDIMM=1 if ($TotalWidth[$cnt] > $DataWidth[$cnt]);
}
if ($MemManufacturer[$cnt]) {
$buf .= ", $MemManufacturer[$cnt]" if ($MemManufacturer[$cnt] !~ /None/i);
if ($MemPartNum[$cnt]) {
# Don't repeat MFG if it is in Partnumber
$MemPartNum[$cnt]=~s/$MemManufacturer[$cnt] //;
$buf .= " $MemPartNum[$cnt]" if ($MemPartNum[$cnt] !~ /None/i);
}
} elsif ($MemPartNum[$cnt]) {
$buf .= ", $MemPartNum[$cnt]" if ($MemPartNum[$cnt] !~ /None/i);
}
}
$totmem=$DMI17totmem;
}
push(@boards_mem, "$buf\n") if ($buf);
}
# Check memory SPD data from EEPROM if available, it can be more
# accurate and detailed than the dmidecode data
&check_decodedimms;
&pdebug("displaying memory from $memfrom") if ($memfrom);
if (! &is_virtualmachine) {
# Only show ECC enabled in BIOS if ECC memory is installed
if ($ECCBIOS) {
$ECCBIOS="None" if (! $ECCDIMM);
print "Memory Error Correction: $ECCBIOS\n";
}
print "Maximum Memory: ";
if (! $MAXMEM || $max < $totmem || $max == 0) {
$MAXMEM="Unknown";
$MAXMEM .= " (DMI incorrectly reports ${max}MB)" if ($max < $totmem && $max);
print "$MAXMEM\n";
} else {
&show_memory($max);
}
print "Maximum Memory Bus Speed: $maxmembusspeed\n" if ($maxmembusspeed);
print @boards_mem if (@boards_mem);
}
#
# Print total memory
#
$sockettype="sockets";
$sockettype="banks" if ($sockets_empty =~ /BANK *\d/i && $sockets_empty !~ /DIMM/);
if ($memarr < 0 || $totmem == 0) {
if (&is_virtualmachine) {
if ($totmem) {
print "total memory = ";
&show_memory($totmem);
} else {
$exitstatus=1;
}
&check_virtualmachine;
} else {
&print_empty_memory("memory $sockettype") if ($sockets_empty);
print "ERROR: Memory Information Unknown\n";
if ((! $FoundEnd || $BrokenTable ne "") && $dmidecode_ver) {
print "WARNING: dmidecode output is truncated\n" if (! $FoundEnd);
if ($BrokenTable ne "") {
print "ERROR: $BrokenTable\n";
print " Your BIOS may be corrupted or have an invalid checksum.\n";
}
}
&print_bios_error;
$exitstatus=1;
}
} else {
&print_empty_memory("memory $sockettype");
print "total memory = ";
&show_memory($totmem);
}
if ($ECCBIOS) {
if ($ECCBIOS eq "None" && $ECCDIMM) {
print "WARNING: ECC memory detected, but ECC is not enabled in the BIOS.\n";
$exitstatus=1;
}
}
print "WARNING: Mixed speeds of memory modules found.\n" if ($mixedspeeds);
print "ERROR: $dmidecode_error\n" if ($dmidecode_error);
if ($freephys > $totmem && $totmem && ! &is_virtualmachine) {
print "ERROR: Total physical memory (${freephys}MB) is ";
print "greater than the total memory found.\n The total ";
print "physical memory reported by 'free -m' does not match ";
print "the\n memory reported by 'dmidecode'.\n";
&print_bios_error;
}
# See if half of the memory is unused due to missing a second CPU
if ($totmem && $totmem == &roundup_memory($freephys) * 2 && $ncpu == 1 && $necpu == 1) {
print "WARNING: Half of the installed memory is not being ";
print "used due to only having a\n single CPU ";
print "installed in this dual-CPU capable system.\n";
}
if ($os =~ /Linux|FreeBSD/ && &roundup_memory($freephys) < $totmem && $totmem > 4096) {
$tmp=0;
@tmp=("");
if (-r '/var/log/dmesg' && ! $filename) {
open(FILE, ";
close(FILE);
} elsif ($filename) {
@tmp=@config;
}
foreach $line (@tmp) {
if ($line =~ /Warning only \d.*B will be used/) {
$line=~s/Warning o/WARNING: O/;
print $line;
$tmp=1;
}
if ($line =~ /Use a PAE enabled kernel/) {
print "WARNING: " . $line;
if (-r '/etc/grub.conf' && $osrel) {
$tmp=`grep ${osrel}PAE /etc/grub.conf`;
$tmp=($tmp) ? 2 : 1;
} else {
$tmp=1;
}
}
}
if ($tmp) {
print "WARNING: Total memory available to the OS is ";
print "less than the total memory found.\n";
$recognized=0;
$exitstatus=1;
}
if ($tmp >=1 && $osrel) {
$osrelk=$osrel;
$osrelk=~s/smp//;
$osrelk=~s/hugemem//;
if ($tmp == 1) {
if ($osrel =~ /smp$/) {
if (`grep ${osrelk}hugemem /etc/grub.conf 2>/dev/null`) {
print "WARNING: Boot the ${osrelk}hugemem kernel to use the full memory.\n";
} else {
print "WARNING: Using a 'hugemem' kernel may fix this issue (supports up to 64GB).\n";
}
} elsif ($osrel =~ /hugemem$/) {
print "WARNING: An upgraded BIOS may fix this issue.\n";
print "WARNING: This is not a bug in memconf.\n";
} else {
if ($totmem < 16384) {
if (`grep ${osrelk}smp /etc/grub.conf 2>/dev/null`) {
print "WARNING: Boot the ${osrelk}smp kernel to use the full memory.\n";
} elsif (`grep ${osrelk}hugemem /etc/grub.conf 2>/dev/null`) {
print "WARNING: Boot the ${osrelk}hugemem kernel to use the full memory.\n";
} else {
print "WARNING: Using an 'smp' or 'hugemem' kernel may fix this issue ('smp' supports\n";
print " up to 16GB, 'hugemem' supports up to 64GB).\n";
}
} else {
if (`grep ${osrelk}hugemem /etc/grub.conf 2>/dev/null`) {
print "WARNING: Boot the ${osrelk}hugemem kernel to use the full memory.\n";
} else {
print "WARNING: Using a 'hugemem' kernel may fix this issue (supports up to 64GB).\n";
}
}
}
}
if ($tmp == 2) {
print "WARNING: Boot the ${osrelk}PAE kernel ";
print "to use the full memory.\n";
}
} elsif ($tmp == 1) {
if ($totmem < 16384) {
print "WARNING: Using an 'smp' or 'hugemem' kernel may fix this issue ('smp' supports\n";
print " up to 16GB, 'hugemem' supports up to 64GB).\n";
} else {
print "WARNING: Using a 'hugemem' kernel may fix this issue (supports up to 64GB).\n";
}
}
}
# Flag untested CPU types (machine="" or "x86" on regression test files)
# Tested so far on x86, i86pc, x86_64, Itanium ia64, and amd64
if (! $machine || $machine eq "x86" || $machine =~ /i.86/ || $machine eq "x86_64" || $machine eq "ia64" || $machine eq "amd64") {
$untested=0 if ($untested == 1);
# Linux on SPARC with dmidecode
# } elsif ($machine eq "sparc64" || $machine eq "sun4u") {
# $untested=0 if ($untested == 1);
} else {
$untested=1;
$untested_type="CPU" if (! $untested_type);
}
&check_virtualmachine;
&show_untested if ($untested);
&show_errors;
&mailmaintainer if ($verbose == 3);
&pdebug("exit $exitstatus");
exit $exitstatus;
}
sub show_total_memory {
return if ($totalmemshown || ! $totmem);
$totalmemshown=1;
#
# Print total memory
#
print "total memory = ";
&show_memory($totmem);
print "$permission_error\n" if ($permission_error && ! $HPUX);
if ($prtconf_warn) {
print "WARNING: $prtconf_warn\n";
print " This may be corrected by installing ";
print "a Sun patch on this system.\n";
}
}
sub show_control_LDOM_message {
return if ($controlLDOMshown);
$controlLDOMshown=1;
#
# Post notice if on control LDOM
#
print "NOTICE: Control Logical Domain (LDOM) detected. ";
$picl_bank_cnt=scalar(keys %picl_mem_bank);
if ($picl_foundmemory || $picl_bank_cnt) {
print "The cpus and memory modules\n";
print " reported are for the system, not necessarily the control LDOM.\n";
} else {
print "The SUNWldm software package\n";
print " may need updated for prtpicl to be able to report the installed cpus and\n";
print " memory for the system.\n";
}
}
sub is_virtualmachine {
if ($uid ne "0") {
# In case non-root user is running memconf
$tmp=($os =~ /Linux|FreeBSD/ && ! $filename) ? `lspci 2>/dev/null | egrep -i '(VMware|VirtualBox|VirtualPC)'` : "";
# Include special case for regression testing VM files
if ((! $filename && $tmp =~ /VMware/i) || $filename =~ /VMware/i) {
$manufacturer="VMware, Inc." if (! $manufacturer);
$model="VMware Virtual Platform" if (! $model);
return(1);
} elsif ((! $filename && $tmp =~ /VirtualBox|VBox/i) || $filename =~ /VirtualBox/i) {
$manufacturer="Oracle Corporation" if (! $manufacturer);
$model="VirtualBox" if (! $model);
return(1);
} elsif ((! $filename && $tmp =~ /VirtualPC/i) || $filename =~ /VirtualPC/i) {
$manufacturer="Microsoft Corporation" if (! $manufacturer);
$model="Virtual Machine" if (! $model);
return(1);
}
}
return(1) if ($manufacturer =~ /VMware/ || $model =~ /VMware|Virtual Platform|Virtual Machine|VirtualBox|VBox/ || $diagbanner =~ /Virtual Machine/);
return(1) if (&is_xen_vm);
return(0);
}
sub is_xen_hv {
return(1) if (-d '/proc/xen' && -f '/proc/xen/xsd_port'); # Linux Hypervisor
# Special case for regression testing Xen files
return(1) if ($filename =~ /Xen_dom0/i);
}
sub is_xen_vm {
return(1) if (-d '/proc/xen' && ! -f '/proc/xen/xsd_port'); # Linux
return(1) if ($model =~ /HVM domU/); # Linux
return(1) if ($model eq "i86xpv" || $machine eq "i86xpv" || $model eq "i86xen" || $machine eq "i86xen"); # Solaris
# Special case for regression testing Xen files
return(1) if ($filename =~ /Xen_domU/i);
}
sub check_virtualmachine {
return if ($vmshown);
$vmshown=1;
if (&is_virtualmachine) {
if (&is_xen_vm) {
$vmh="Xen dom0 hypervisor";
$vms="Xen server";
$vmg="Xen domU guest";
} else {
$vmh="VM hypervisor";
$vms="VM server";
$vmg="Virtual Machine (VM)";
}
print "NOTICE: Details shown may be for the configuration of this $vmg,\n not the physical CPUs and memory of the $vms it is running on.\n";
print "WARNING: More details can be reported if memconf is run on the $vmh.\n";
print " $vms CPU: $cpuinfo_cputype\n" if ($cpuinfo_cputype);
}
}
sub check_xm_info {
if ($have_xm_info_data) {
&pdebug("in check_xm_info");
foreach $line (@xm_info) {
$line=&dos2unix($line);
$_=$line;
($xen_nr_nodes)=(/: (\d*) */) if (/^nr_nodes\s*: \d+/);
($xen_sockets_per_node)=(/: (\d*) */) if (/^sockets_per_node\s*: \d+/);
($xen_cores_per_socket)=(/: (\d*) */) if (/^cores_per_socket\s*: \d+/);
$hyperthread=1 if (/^threads_per_core\s*: 2/);
}
$xen_ncpu=$xen_nr_nodes * $xen_sockets_per_node;
&pdebug("xen_ncpu=$xen_ncpu, ncpu=$ncpu, xen_nr_nodes=$xen_nr_nodes, xen_sockets_per_node=$xen_sockets_per_node, xen_cores_per_socket=$xen_cores_per_socket, hyperthread=$hyperthread");
if ($xen_ncpu) {
$cpucntfrom="xm_info";
$corecnt=$xen_cores_per_socket;
$nvcpu=$xen_cores_per_socket;
$nvcpu=$nvcpu * 2 if ($hyperthread);
}
}
}
sub check_cpuinfo {
if ($have_cpuinfo_data) {
return if ($cpuinfo_checked);
&pdebug("in check_cpuinfo");
$cpuinfo_checked=1;
foreach $line (@cpuinfo) {
$line=&dos2unix($line);
$_=$line;
$cpuinfo_cpucnt++ if (/^processor\s*: \d+/);
$cpuinfo_coreidcnt++ if (/^core id\s*: \d+/);
if (/^physical id\s*: \d+/) {
($physicalid)=(/: (\d*) */);
$cpuinfo_physicalid{$physicalid}++;
}
($cpuinfo_cpucores)=(/: (\d*) */) if (/^cpu cores\s*: \d+/);
($cpuinfo_siblings)=(/: (\d*) */) if (/^siblings\s*: \d+/);
# Only GenuineIntel x86 has hyper-threading capability
$foundGenuineIntel=1 if (/^vendor_id\s*: GenuineIntel/);
# Linux on x86 or ARM CPU model
if (/^model name\s*: /) {
($cpuinfo_cputype)=(/: (.*)$/);
$cpuinfo_cputype=&cleanup_cputype($cpuinfo_cputype);
if (/.*(ARM|Feroceon|Marvell)/) {
if ($filename) {
# Special case for regression testing
$machine="arm";
$platform=$machine;
$os="Linux";
}
$cpucnt{"$cpuinfo_cputype"}=$corecnt;
}
}
# Linux on SPARC CPU model
if (/^cpu\s+: \D/) {
($cpuinfo_cputype)=(/: (.*)$/);
$cpuinfo_cputype=&cleanup_cputype($cpuinfo_cputype);
$machine="sparc" if ($cpuinfo_cputype =~ /sparc/i);
$os="Linux";
}
# Linux on SPARC OBP version
if (/^prom\s+: /) {
($romver)=(/: (.*)$/);
@romverarr=split(/\s/, $romver);
$romvernum=$romverarr[1];
}
# Linux on SPARC CPU type
($machine)=(/: (.*)$/) if (/^type\s+: sun/);
# Linux on SPARC
if (/^ncpus active\s*: \d+/) {
($cpuinfo_cpucnt)=(/: (.*)$/);
# Assume single core
$cpuinfo_cpucores=1;
}
# Linux on SPARC CPU freq
if (/^Cpu\dClkTck\s*: \d+/ && $cpufreq == 0) {
($freq)=(/: (.*)$/);
$cpufreq=&convert_freq($freq);
$cpuinfo_cputype.= " ${cpufreq}MHz" if ($cpuinfo_cputype !~ /MHz/ && $cpufreq);
}
# Linux on unsupported CPU models (arm, mips, etc.)
if (($machine !~ /.86|ia64|amd64|sparc/ && ! $filename) || $filename) {
if (/^Processor\s+: /) {
($cpuinfo_cputype)=(/: (.*)$/);
if ($filename && /^Processor\s+: .*(ARM|Feroceon|Marvell)/) {
# Special case for regression testing
$machine="arm";
$platform=$machine;
}
$os="Linux";
$cpucnt{"$cpuinfo_cputype"}=$corecnt;
} elsif (/^cpu model\s+: /) {
($cpuinfo_cputype)=(/: (.*)$/);
if ($filename && /^cpu model\s+: .*MIPS/) {
# Special case for regression testing
$machine="mips";
$platform=$machine;
}
$os="Linux";
$cpucnt{"$cpuinfo_cputype"}=$corecnt;
}
}
if ($filename) {
($hostname)=(/: (.*)$/) if (/^host\s*: / && $hostname eq "");
if (/^machine\s*: /) {
($machine)=(/: (.*)$/);
if (! defined($kernbit)) {
$kernbit=32 if ($machine =~ /i.86|sparc/);
$kernbit=64 if ($machine =~ /x86_64|sparc64|ia64|amd64/);
}
}
if (/^release\s*: / && $release eq "") {
($release)=(/: (.*)$/);
$release="Linux $release";
}
}
}
$cpuinfo_physicalidcnt=keys %cpuinfo_physicalid;
$cpuinfo_physicalidcnt=0 if (! defined($cpuinfo_physicalidcnt));
if ($cpuinfo_cpucnt > $ncpu && (! $foundGenuineIntel || $foundGenuineIntel && ! $ncpu)) {
# Prefer cpuinfo over dmidecode for CPU info
$cpucntfrom=$config_command if (! $cpucntfrom);
&pdebug("Preferring CPU count from cpuinfo ($cpuinfo_cpucnt) over $cpucntfrom ($ncpu)");
if ($ncpu) {
$cpucntfrom="dmidecode and cpuinfo";
} else {
$cpucntfrom="cpuinfo";
}
if ($cpuinfo_cpucores) {
$ncpu=$cpuinfo_cpucnt / $cpuinfo_cpucores;
} else {
$ncpu=$cpuinfo_cpucnt;
}
}
&pdebug("cpuinfo_cputype=$cpuinfo_cputype, ncpu=$ncpu, cpuinfo_cpucnt=$cpuinfo_cpucnt, cpuinfo_coreidcnt=$cpuinfo_coreidcnt, cpuinfo_cpucores=$cpuinfo_cpucores, cpuinfo_physicalidcnt=$cpuinfo_physicalidcnt, cpuinfo_siblings=$cpuinfo_siblings, foundGenuineIntel=$foundGenuineIntel");
}
}
sub finish {
&show_header;
#print "newslots=@newslots\n" if ($#newslots && $verbose > 1);
# Large memory system like SPARC T7-4 can mismatch memory in prtconf and ipmitool
if ($isX86 || $ultra =~ /^T7-/) {
# smbios and ipmitool memory data is more accurate than prtconf
if ($smbios_memory && $smbios_memory > $installed_memory) {
$installed_memory=$smbios_memory;
$totmem=$installed_memory;
} elsif ($ipmi_memory && $ipmi_memory > $installed_memory) {
$installed_memory=$ipmi_memory;
$totmem=$installed_memory;
}
}
# Cannot accurately determine installed memory unless information is
# is in prtpicl output, or if system is fully stuffed
$picl_bank_cnt=scalar(keys %picl_mem_bank);
if ($ldm_memory && ! ($picl_foundmemory || $picl_bank_cnt)) {
$totmem=&roundup_memory($installed_memory);
&show_total_memory;
&show_control_LDOM_message;
return;
}
print $buffer if ($buffer);
#
# Special memory options
#
if ($sxmem) {
# Currently assumes only one VSIMM is installed.
# Auxiliary Video Board 501-2020 (SS10SX) or 501-2488 (SS20)
# required if two VSIMMs are installed.
if ($model eq "SPARCstation-20" || $model eq "SuperCOMPstation-20S") {
# SS20 1st VSIMM in J0304/J0407, 2nd in J0305/J0406
print "sockets J0304/J0407 have";
$sockets_used .= " J0304";
} elsif ($model =~ /COMPstation-20A\b/) {
# 1st VSIMM in J0202, 2nd in J0301
print "socket J0202 has";
$sockets_used .= " J0202";
} else {
# SS10SX 1st VSIMM in J0301/J1203, 2nd in J0202/J1201
print "sockets J0301/J1203 have";
$sockets_used .= " J0301";
}
print " a ${sxmem}MB VSIMM installed for SX (CG14) graphics\n";
}
if ($nvmem) {
# NVSIMMs for Prestoserve
if ($model eq "SPARCstation-20" || $model eq "SuperCOMPstation-20S") {
# SS20 1st 2MB NVSIMM in J0305/J0406, 2nd in J0304/J0407
if ($nvmem1) {
$sockets_used .= " J0305";
print "sockets J0305/J0406 have a 2MB NVSIMM";
print " installed for Prestoserve\n";
}
if ($nvmem2) {
$sockets_used .= " J0304";
print "sockets J0304/J0407 have a 2MB NVSIMM";
print " installed for Prestoserve\n";
}
} elsif ($model =~ /COMPstation-20A\b/) {
# 1st 2MB NVSIMM in J0301, 2nd in J0202
if ($nvmem1) {
$sockets_used .= " J0301";
print "socket J0301 has a 2MB NVSIMM";
print " installed for Prestoserve\n";
}
if ($nvmem2) {
$sockets_used .= " J0202";
print "socket J0202 has a 2MB NVSIMM";
print " installed for Prestoserve\n";
}
} elsif ($model =~ /SPARCstation-10/ || $model eq "Premier-24") {
# SS10 1st 2MB NVSIMM in J0202/J1201, 2nd in J0301/J1203
if ($nvmem1) {
$sockets_used .= " J0202";
print "sockets J0202/J1201 have a 2MB NVSIMM";
print " installed for Prestoserve\n";
}
if ($nvmem2) {
$sockets_used .= " J0301";
print "sockets J0301/J1203 have a 2MB NVSIMM";
print " installed for Prestoserve\n";
}
} else {
# SS1000 supports two banks of four 1MB NVSIMMs
# SC2000 supports one bank of eight 1MB NVSIMMs
print "Has ${nvmem}MB of NVSIMM installed for Prestoserve ";
if ($model eq "SPARCserver-1000") {
print "(1 bank of 4" if ($nvmem == 4);
print "(2 banks of 4" if ($nvmem == 8);
} else {
print "(1 bank of 8";
}
print " 1MB NVSIMMs$nvsimm_banks)\n";
}
}
#
# Check for empty banks or sockets
#
if ($#banksstr) {
foreach $banks (@banksstr) {
if ($banks ne "?") {
if ($banks_used !~ /\b$banks\b/ &&
$sockets_empty !~ /\b$banks\b/) {
&add_to_sockets_empty($banks);
}
}
}
&print_empty_memory($bankname);
} elsif ($#socketstr) {
foreach $socket (@socketstr) {
if ($socket ne "?") {
# strip leading slash for matching
$tmp=$socket;
$tmp=~s/^\///;
if ($sockets_used !~ /$tmp/ &&
$sockets_empty !~ /$tmp/) {
&add_to_sockets_empty($socket);
}
}
}
if ($sockettype) {
&print_empty_memory("${sockettype}s");
} else {
&print_empty_memory("memory slots");
}
} elsif ($verbose > 1 && $sockets_used) {
print "memory sockets used: $sockets_used\n";
}
# Look for duplicate sockets
if ($sockets_used && $have_prtdiag_data) {
$dup_sockets="";
if ($sockets_used =~ /;/) {
$sep=';';
} elsif ($sockets_used =~ /,/) {
$sep=',';
} else {
$sep=' ';
}
foreach $socket (sort split($sep, $sockets_used)) {
next if ($socket eq "board" || $socket eq "mezzanine");
next if ($model eq "SPARCsystem-600" || $model =~ /Sun.4.600/);
$pos=-1;
$cnt=0;
while (($pos=index(" $sockets_used ", " $socket ", $pos)) > -1) {
$pos++;
$cnt++;
if ($cnt == 2 && $socket ne "-" && $socket ne "?") {
# strip leading slash for matching
$tmp=$socket;
$tmp=~s/^\///;
if ($dup_sockets !~ /$tmp/) {
$dup_sockets .= " $socket";
print "ERROR: Duplicate socket $socket found\n";
$exitstatus=1;
}
}
}
}
if ($dup_sockets) {
print "WARNING: Memory was not properly reported by";
print " the 'prtdiag' command.\n";
&recommend_prtdiag_patch;
}
}
# Look for unlabeled sockets
if ($sockets_used =~ /\s-\s|^-\s|\s-$|^-$/) {
print "WARNING: Unlabeled socket found";
print " in the 'prtdiag' command output" if ($have_prtdiag_data);
print ".\n This may cause the reported empty sockets";
print " to be incorrect.\n";
&recommend_prtdiag_patch;
}
# Make sure Sun Fire V480/V490/V880/V890 is fully stuffed if >= 1050MHz
if ($ultra =~ /Sun Fire V[48][89]0\b/) {
print "ERROR: System should not have any empty banks since CPU is >= 1050MHz.\n" if ($cpufreq >= 1050 && $banks_used ne "A0 A1 B0 B1");
}
if ($machine eq "sun4v") {
# Round up Solaris memory (may have 128MB or more reserved)
$installed_memory=&roundup_memory($installed_memory);
$totmem=$installed_memory;
}
#
# Print total memory
#
&show_total_memory;
#
# Post notice if on control LDOM
#
&show_control_LDOM_message if ($ldm_memory);
#
# Post notice if on a virtual machine
#
&check_virtualmachine;
#
# Post notice if X86 machine is Hyper-Thread capable, but not enabled
#
&show_hyperthreadcapable;
#
# Check for illegal memory stuffings
#
if ($model eq "Sun 4/50" || $model eq "Sun 4/25") { # IPX, ELC
if ($slot0 != 16 && $largestsimm == 16 && $osrel =~ /4.1.1/) {
print "ERROR: Install the highest capacity 16MB SIMM";
print " in socket $socketstr[0] under SunOS 4.1.1.\n";
$exitstatus=1;
}
}
if ($model =~ /SPARCclassic|SPARCstation-LX/) {
if ($found32mb) {
# Reportedly can accept 32MB SIMMs in bank 1, allowing
# 128MB total (2x32, 4x16)
print "NOTICE: The 32MB SIMM is not supported in the";
print " $model according to\n Sun. However it does";
print " appear to work in bank 1 only, allowing a";
print " maximum of\n 128MB of total memory (2x32MB";
print " bank 1 + 4x16MB banks 2 & 3).\n";
}
if ($found8mb) {
# Possibly can accept 8MB SIMMs in bank 1
print "NOTICE: The 8MB SIMM is not supported in the";
print " $model according to\n Sun. However it does";
print " appear to work in bank 1 only.\n";
}
}
if ($model =~ /SPARCstation-10/ || $model eq "Premier-24") {
if ($slot0 < $largestsimm && $BSD) {
print "ERROR: Install the highest capacity SIMM in";
print " socket $socketstr[0] under Solaris 1.X.\n";
$exitstatus=1;
}
if (! $found32mb && $found16mb && ($romvermajor eq 2) && ($romverminor < 19)) {
print "WARNING: The 32MB SIMM is not supported in the";
print " SS10 or SS10SX according to\n Sun. However";
print " it does work correctly depending on the Open";
print " Boot PROM\n version. This system is running";
print " OBP $romvernum, so 32MB SIMMs will only be\n";
print " recognized as 16MB SIMMs. You should";
print " upgrade to OBP 2.19 or later in order\n to";
print " be able to detect and utilize 32MB SIMMs.\n";
# OBP 2.14 and earlier see the 32MB SIMM as 16MB.
# OBP 2.15 on a SS20 does see the 32MB SIMM as 32MB.
# Have not tested 32MB SIMMs on SS10 with OBP 2.15-2.18
if ($romverminor > 14) {
$untested=1;
$untested_type="OBP";
}
}
if ($found32mb && ($romvermajor eq 2) && ($romverminor < 19)) {
print "NOTICE: The 32MB SIMM is not supported in the";
print " SS10 or SS10SX according to\n Sun. However";
print " it does work correctly depending on the Open";
print " Boot PROM\n version. This system is running";
print " OBP $romvernum, and 32MB SIMMs were properly\n";
print " recognized.\n";
@simmsizes=(16,32,64);
if ($romvernum ne "2.X") {
$untested=1;
$untested_type="OBP";
}
}
if (! $nvmem1 && $nvmem2) {
print "ERROR: First NVSIMM should be installed in";
print " socket J0202, not socket J0301\n";
$exitstatus=1;
}
}
if ($model eq "SPARCstation-20" || $model eq "SuperCOMPstation-20S") {
if (! $nvmem1 && $nvmem2) {
print "ERROR: First NVSIMM should be installed in";
print " socket J0305, not socket J0304\n";
$exitstatus=1;
}
}
if ($model eq "SPARCstation-5") {
if ($slot0 < $largestsimm && $BSD) {
print "ERROR: Install the highest capacity SIMM in";
print " socket $socketstr[0] under Solaris 1.X.\n";
$exitstatus=1;
}
if ($osrel eq "4.1.3_U1" && $found32mb) {
# Look to see if patch 101508-07 or later is installed
# for 32MB SIMMs to work properly (bug 1176458)
$what=&mychomp(`/usr/ucb/what /sys/sun4m/OBJ/module_vik.o`);
if ($what !~ /module_vik.c 1.38 94\/08\/22 SMI/) {
print "WARNING: Install SunOS 4.1.3_U1 patch";
print " 101508-07 or later in order for 32MB\n";
print " SIMMs to work reliably on the";
print " SPARCstation 5.\n";
}
}
}
if ($model eq "Ultra-5_10" || $ultra eq "5_10" || $ultra eq 5 || $ultra eq 10) {
if ($smallestsimm == 16 && $largestsimm > 16) {
print "ERROR: 16MB DIMMs cannot be mixed with larger";
print " DIMMs on Ultra 5/10 systems.\n";
$exitstatus=1;
}
}
if ($ultra eq 5) {
if ($largestsimm == 256) {
print "NOTICE: The 256MB DIMM is not supported in the";
print " Ultra 5 according to\n Sun. However it does";
print " work correctly as long as you use low-profile";
print "\n DIMMs or take out the floppy drive.\n";
}
}
if ($ultra eq "AXi") {
# DIMMs should be chosen as all 10-bit or all 11-bit column
# address type. If using 11-bit, then only use Bank 0 & 2.
if ($found10bit && $found11bit) {
print "ERROR: You should not mix 10-bit and 11-bit";
print " column address type DIMMs in the\n ";
print "SPARCengine Ultra AXi.\n";
$exitstatus=1;
}
if ($found11bit) {
if ($foundbank1or3) {
print "ERROR";
$exitstatus=1;
} else {
print "WARNING";
}
print ": Do not use Bank 1 (sockets U0402 & U0401) &";
print " Bank 3 (sockets U0302 &\n U0301) since";
print " 11-bit column address type DIMMs are";
print " installed. You should\n only use Bank 0";
print " (sockets U0404 & U0403) & Bank 2 (sockets";
print " U0304 & U0303).\n";
}
}
if ($model eq "Ultra-4" || $ultra eq 450 || $model eq "Ultra-4FT" || $ultra eq "Netra ft1800") {
if ($found16mb) {
print "WARNING: 16MB DIMMs are not supported and may";
print " cause correctable ECC errors.\n";
}
}
#
# Check for unsupported memory sizes
#
foreach $i (@simmsizesfound) {
$smallestsimm=$i if ($i < $smallestsimm);
$largestsimm=$i if ($i > $largestsimm);
$simmsizelegal=0;
foreach $j (@simmsizes) {
$simmsizelegal=1 if ($i == $j);
}
if (! $simmsizelegal && $simmsizes[0]) {
print "ERROR: Unsupported ${i}MB $memtype found (supported ";
if ($#simmsizes == 0) {
print "size is @{simmsizes}MB)\n";
} else {
print "MB sizes are: @simmsizes)\n";
}
$exitstatus=1;
}
}
if ($smallestsimm < $simmsizes[0]) {
print "ERROR: Smaller than expected $memtype found ";
print "(found ${smallestsimm}MB, smallest expected ";
print "${simmsizes[0]}MB)\n";
$exitstatus=1;
}
if ($largestsimm > $simmsizes[$#simmsizes]) {
print "ERROR: Larger than expected $memtype found ";
print "(found ${largestsimm}MB, largest expected ";
print "${simmsizes[$#simmsizes]}MB)\n";
$exitstatus=1;
}
#
# Check for buggy perl version
#
if ($perlhexbug) {
print "ERROR: This Perl V$PERL_VERSION is buggy in hex number";
print " conversions.\n";
$exitstatus=1;
}
if ($PERL_VERSION == 5.001) {
print "WARNING: Perl V5.001 is known to be buggy in hex number";
print " conversions.\n";
}
if ($PERL_VERSION < 5.002) {
print "WARNING: Perl V5.002 or later is recommended for best";
print " results.\n";
print " You are running Perl V$PERL_VERSION\n";
}
#
# Check for bad eeprom banner-name. This happens sometimes when OBP 3.23
# or later is installed on Ultra-60/E220R and Ultra-80/E420R systems.
#
if ($banner =~ /^ \(/) {
print "ERROR: banner-name not set in EEPROM (BugID 4257412).";
print " Cannot distinguish an\n ";
print "Ultra 60 from an Enterprise 220R" if ($model eq "Ultra-60");
print "Ultra 80 from an Enterprise 420R or Netra t 1400/1405" if ($model eq "Ultra-80");
print "Sun Blade 1000/2000 from a Sun Fire 280R or Netra 20" if ($ultra eq "Sun Blade 1000" || $ultra eq "Sun Blade 2000" || $ultra eq "Sun Fire 280R" || $ultra eq "Netra 20");
print ".\n To correct this problem, please run one of ";
print "the following commands as\n root depending on ";
print "the system you have:\n";
if ($model eq "Ultra-60") {
print " eeprom banner-name='Sun Ultra 60 UPA/PCI'\n";
print " eeprom banner-name='Sun Enterprise 220R'\n";
print "Note: Netra t1120/1125 systems may also use the 'Sun Ultra 60 UPA/PCI' banner\n";
}
if ($model eq "Ultra-80") {
print " eeprom banner-name='Sun Ultra 80 UPA/PCI'\n";
print " eeprom banner-name='Sun Enterprise 420R'\n";
print " eeprom banner-name='Netra t 1400/1405'\n";
print "Note: Netra t1400/1405 systems may also use the 'Sun Ultra 80 UPA/PCI' banner\n";
}
if ($ultra eq "Sun Blade 1000" || $ultra eq "Sun Blade 2000" || $ultra eq "Sun Fire 280R" || $ultra eq "Netra 20") {
print " eeprom banner-name='Sun-Blade-1000'\n";
print " eeprom banner-name='Sun Fire 280R'\n";
print " eeprom banner-name='Netra 20'\n";
print "Note: Netra 20 systems may also use the 'Sun-Blade-1000' banner\n";
}
$exitstatus=1;
}
#
# Check for possible memory detection errors by this program
#
if ($prtdiag_failed == 2) {
&found_nonglobal_zone;
$prtdiag_has_mem=0;
}
# prtdiag only available on SunOS
$prtdiag_has_mem=0 if ($os ne "SunOS");
if (! $boardfound_mem && $prtdiag_has_mem) {
print "WARNING: Memory should have been reported in the output from";
if ($prtdiag_cmd) {
print "\n $prtdiag_cmd";
} else {
if (-d '/usr/platform') {
print " prtdiag,\n which was not found in /usr/platform/$machine/sbin";
} else {
print " prtdiag.";
}
}
print "\nERROR: prtdiag failed!" if ($prtdiag_failed);
print "\n This system may be misconfigured, or may be";
print " missing software packages\n like SUNWpiclr,";
print " SUNWpiclu and SUNWpiclx, or may need the latest\n";
print " recommended Sun patches installed from";
print " http://sunsolve.sun.com/\n";
if ($ultra eq "Sun Fire V880") {
print " This may be corrected by installing ";
print "Sun patch 112186-19 or 119231-01 or later.\n";
}
print " Check my website at $URL\n";
print " to get the latest version of memconf.\n";
$exitstatus=1;
}
if ($recognized == 0) {
print "ERROR: Layout of memory ${sockettype}s not completely ";
print "recognized on this system.\n";
$exitstatus=1;
}
if ($recognized < 0 && $os eq "SunOS") {
if ($have_prtfru_details && $recognized == -3) {
print "ERROR: Memory manufacturer not recognized.\n";
print " This is a bug in the Sun OBP or prtfru";
print " command, not a bug in memconf.\n";
} else {
print "WARNING: Layout of memory ${sockettype}s not";
print " completely recognized on this system.\n";
}
if ($model eq "Ultra-80" || $ultra eq 80 || $ultra eq "420R" || $ultra eq "Netra t140x") {
if ($recognized == -1) {
print " The memory configuration displayed is a guess which may be incorrect.\n";
if ($totmem eq 1024) {
print " The 1GB of memory installed may be 4 256MB DIMMs populating bank 0,\n";
print " or 16 64MB DIMMs populating all 4 banks.\n";
}
}
print " This is a known bug due to Sun's 'prtconf', 'prtdiag' and 'prtfru'\n";
print " commands not providing enough detail for the memory layout of this\n";
print " SunOS $osrel $platform system to be accurately determined.\n";
print " This is a bug in Sun's OBP, not a bug in memconf. The latest OBP\n";
print " release (OBP 3.33.0 2003/10/07 from patch 109082-06) ";
print (($totmem eq 1024) ? "still has this bug" : "should fix this");
print ".\n This system is using $romver\n";
$exitstatus=1;
}
if ($ultra eq "Sun Blade 1000" || $ultra eq "Sun Blade 2000" || $ultra eq "Sun Fire 280R" || $ultra eq "Netra 20") {
# Do this if memory was not in the output of prtdiag
if ($recognized == -2) {
# Hack: If Sun Blade 1000 has 8GB of memory (maximum
# allowed), then memory line was rewritten to show
# memory stuffing.
print " The memory configuration displayed should be";
print " correct though since this\n";
print " is a fully stuffed system.\n";
} else {
print " The memory configuration displayed is a guess which may be incorrect.\n";
}
}
if ($ultra eq "T2000" || $ultra eq "T1000") {
# Do this if memory was not in the output of prtdiag
# Hack: If Sun Fire T2000 has 8GB or 16GB of memory or
# if Sun Fire T1000 has 4GB or 8GB of memory, then it
# may be 1 rank of DIMMs instead of default 2 ranks.
print " The memory configuration displayed is a guess which may be incorrect.\n";
print " Base Sun configurations ship with two ranks of modules installed.\n";
print " This system may have one rank of " . $simmsizesfound[0]*2 . "MB DIMMs installed instead\n";
print " of two ranks of " . $simmsizesfound[0] . "MB DIMMs as shown.\n";
print " This is a known bug due to Sun's 'prtconf', 'prtdiag' and 'prtfru'\n";
print " commands not providing enough detail for the memory layout of this\n";
print " SunOS $osrel $platform system to be accurately determined.\n";
print " This is a Sun bug, not a bug in memconf.\n";
$exitstatus=1;
}
}
if ($banner =~ /Netra t1\b/ || $ultra eq "Netra t1" || $model eq "Netra t1") {
if ($totmem eq 1024) {
print "WARNING: Cannot distinguish between four";
print " 370-4155 256MB mezzanine boards and\n";
print " two 512MB mezzanine boards.\n";
}
if ($totmem eq 768) {
print "WARNING: Cannot distinguish between three";
print " 370-4155 256MB mezzanine boards and\n";
print " one 512MB and one 256MB mezzanine boards.\n";
}
}
if ($installed_memory) {
if ($installed_memory != $totmem) {
print "ERROR: Total memory installed (${installed_memory}MB) ";
print "does not match total memory found.\n";
$recognized=0;
$exitstatus=1;
}
}
if ($failed_memory) {
print "ERROR: Failed memory (${failed_memory}MB) was detected.\n";
print " You should consider replacing the failed memory.\n";
$exitstatus=1;
}
if ($spare_memory) {
print "NOTICE: Spare memory (${spare_memory}MB) was detected.\n";
print " You can configure the spare memory using the 'cfgadm' command.\n";
}
&show_errors;
if ($failed_fru) {
print "ERROR: $failed_fru";
print " You should consider replacing the failed FRUs.\n";
$exitstatus=1;
}
&show_unrecognized if ($recognized == 0);
if (! &is_virtualmachine) {
if ($smbios_memory && &roundup_memory($smbios_memory) != $installed_memory) {
print "ERROR: Memory found by smbios (${smbios_memory}MB) does not match memory found in $config_command (${installed_memory}MB).\n";
print " This may be corrected by installing a Sun BIOS patch on this system.\n";
$exitstatus=1;
}
if ($ipmi_memory && $ipmi_memory != $installed_memory) {
print "ERROR: Memory found by ipmitool (${ipmi_memory}MB) does not match memory found in $config_command (${installed_memory}MB).\n";
print " This may be corrected by installing a Sun BIOS patch on this system.\n";
$exitstatus=1;
}
}
# Tested on SunOS 4.X - 5.11 (Solaris 1.0 through Solaris 11)
# Flag Future/Beta SunOS releases as untested
if ($osrel =~ /^5.1[2-9]|^[6-9]/) {
$untested=1;
$untested_type="OS" if (! $untested_type);
}
# Flag untested CPU types:
# US-IIIi+ (Serrano)
if ($cputype =~ /UltraSPARC-IIIi\+/) {
$untested=1;
$untested_type="CPU" if (! $untested_type);
}
# SPARC-T4+, SPARC-T6 or newer
if ($cputype =~ /SPARC-T([4-9]\+|[6-9])/) {
$untested=1;
$untested_type="CPU" if (! $untested_type);
}
# SPARC-M5, SPARC-M6 or other SPARC-M*
if ($cputype =~ /SPARC.M\d\+/) {
$untested=1;
$untested_type="CPU" if (! $untested_type);
}
# SPARC-S* excluding SPARC-S7
if ($cputype =~ /SPARC.S\d\+/ && $cputype !~ /SPARC.S7\b/) {
$untested=1;
$untested_type="CPU" if (! $untested_type);
}
# SPARC64-VII++ or newer other than SPARC64-X
if ($cputype =~ /SPARC64-(VII\+\+|VIII|IX|X)/ && $cputype !~ /SPARC64-X\b/) {
$untested=1;
$untested_type="CPU" if (! $untested_type);
}
# Dual-Core, Triple-Core, Quad-Core, Six-Core, Eight-Core, Ten-Core,
# Twelve-Core, Fourteen-Core, Sixteen-Core, Eighteen-Core x86 CPUs
# have been tested. Don't flag as untested CPU as of V3.14.
# if ($isX86 && $corecnt !~ /^(1|2|3|4|6|8|10|12|14|16|18)$/) {
# $untested=1;
# $untested_type="CPU" if (! $untested_type);
# }
&show_untested if ($untested);
&mailmaintainer if ($verbose == 3);
&pdebug("exit $exitstatus");
exit $exitstatus;
}
sub createfile {
$s=shift;
push(@filelist, "$s");
open(OUTFILE, ">/tmp/$s") || die "can't open /tmp/$s: $!";
$tmp=0;
foreach $line (@_) {
print OUTFILE "$line";
print OUTFILE "\n" if ($line !~ /\n$/);
$tmp++;
}
close(OUTFILE);
print STDERR time . " created $tmp lines in $s\n" if ($debug);
}
sub b64encodefile {
local($file)=@_;
local($res)="";
local($chunk)="";
$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZ' .
'abcdefghijklmnopqrstuvwxyz' .
'0123456789+/';
$uuencode_alphabet=q|`!"#$%&'()*+,-./0123456789:;<=>?| .
'@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_';
# Build some strings for use in tr/// commands.
# Some uuencodes use " " and some use "`", so we handle both.
# We also need to protect backslashes and other special characters.
$tr_uuencode=" " . $uuencode_alphabet;
$tr_uuencode=~s/(\W)/\\$1/g;
$tr_base64="A" . $base64_alphabet;
$tr_base64=~s/(\W)/\\$1/g;
$base64_pad='=';
if (open(INFILE, "<$file")) {
# break into chunks of 45 input chars, use perl's builtin
# uuencoder to convert each chunk to uuencode format,
# then kill the leading "M", translate to the base64 alphabet,
# and finally append a newline.
while (read(INFILE, $_, 45)) {
if (length($_) == 45) {
$chunk=substr(pack("u", $_), $[+1, 60);
eval qq{
\$chunk =~ tr|$tr_uuencode|$tr_base64|;
};
} else {
# any leftover chars go onto a shorter line with
# uuencode padding converted to base64 padding
$chunk=substr(pack("u", $_), $[+1, int((length($_)+2)/3)*4 - (45-length($_))%3);
eval qq{
\$chunk =~ tr|$tr_uuencode|$tr_base64|;
};
$res .= $chunk . ($base64_pad x ((60 - length($chunk)) % 4));
}
$res .= $chunk . "\n";
}
close(INFILE);
return($res);
} else {
return("");
}
}
sub mailmaintainer {
# E-mail information of system to maintainer. Use system call to
# sendmail instead of Mail::Send module so that this works for perl4
if (-x '/usr/sbin/sendmail') {
$sendmail='/usr/sbin/sendmail';
} elsif (-x '/usr/lib/sendmail') {
$sendmail='/usr/lib/sendmail';
} else {
$sendmail="";
}
if ($sendmail) {
print "\nSending E-mail to memconf maintainer tschmidt\@micron.com";
print " with output of:\n memconf -d (seen above)\n";
&show_helpers(" ");
print "\nIf this system cannot send E-mail to the internet, then please E-mail the\n";
print "following file to tschmidt\@micron.com as an attachment from a system that can:\n";
} else {
print "\nPlease E-mail the following file as an attachment to tschmidt\@micron.com\n";
}
# Rewrite fully-qualified hostnames so that attachment filename has
# only one extension.
$newhostname=$hostname;
$newhostname=~s/\./_/g;
$outfile="memconf_$newhostname";
print (" /tmp/${outfile}.tar\n");
if ($filename) {
$mail_subj=($SUNWexplo) ? "Sun/Oracle Explorer directory $filename" : "filename $filename";
} else {
$mail_subj="$hostname";
}
$mail_subject="memconf output from $mail_subj";
close(STDOUT);
rename("/tmp/memconf.output","/tmp/${outfile}.txt");
push(@filelist, "${outfile}.txt");
if ($config_cmd) {
@config=&run("$config_cmd") if (! $config[0]);
&createfile("${outfile}_${config_command}.txt",@config);
}
if ($os eq "SunOS") {
&createfile("${outfile}_prtdiag.txt",@prtdiag) if ($prtdiag_exec);
&createfile("${outfile}_prtfru.txt",@prtfru) if ($prtfru_cmd);
&createfile("${outfile}_prtpicl.txt",@prtpicl) if ($prtpicl_cmd);
&createfile("${outfile}_psrinfo.txt",@psrinfo) if ($psrinfo_cmd);
&createfile("${outfile}_virtinfo.txt",@virtinfo) if ($virtinfo_cmd);
&createfile("${outfile}_cfgadm.txt",@cfgadm) if ($cfgadm_cmd);
&createfile("${outfile}_smbios.txt",@smbios) if ($smbios_cmd);
&createfile("${outfile}_kstat.txt",@kstat) if ($kstat_cmd);
&createfile("${outfile}_ldm.txt",@ldm) if ($ldm_cmd);
}
&createfile("${outfile}_cpuinfo.txt",@cpuinfo) if (-r '/proc/cpuinfo');
&createfile("${outfile}_meminfo.txt",@meminfo) if (-r '/proc/meminfo');
&createfile("${outfile}_free.txt",@free) if ($free_cmd);
&createfile("${outfile}_xm_info.txt",@xm_info) if ($xm_info_cmd);
if (-x '/usr/bin/xenstore-ls') {
$domid=&mychomp(`/usr/bin/xenstore-read domid 2>/dev/null`);
if ($domid) {
@xenstore=`/usr/bin/xenstore-ls /local/domain/$domid 2>/dev/null`;
&createfile("${outfile}_xenstore-ls.txt",@xenstore);
}
}
&createfile("${outfile}_decodedimms.txt",@decodedimms) if ($decodedimms_cmd);
&createfile("${outfile}_ipmitool.txt",@ipmitool) if ($ipmitool_cmd);
if ($os eq "HP-UX") {
&createfile("${outfile}_machinfo.txt",@machinfo) if (-x '/usr/contrib/bin/machinfo');
}
`cd /tmp; tar cf /tmp/${outfile}.tar @filelist 2>/dev/null`;
if ($sendmail) {
# Make MIME attachment using sendmail
open(MAIL, "|$sendmail -t");
print MAIL "To: tschmidt\@micron.com\n";
print MAIL "Subject: $mail_subject\n";
print MAIL "MIME-Version: 1.0\n";
print MAIL "Content-Type: multipart/mixed; boundary=\"memconf_UNIQUE_LINE\"\n";
print MAIL "\n";
print MAIL "This is a multi-part message in MIME format.\n";
print MAIL "--memconf_UNIQUE_LINE\n";
print MAIL "Content-Type: text/plain; charset=\"ISO-8859-1\"; format=flowed\n";
print MAIL "\n";
print MAIL "Attached is output and regression test files from memconf $version $version_date from $mail_subj\n\n";
open(FILE, "/tmp/${outfile}.txt");
@tmp=;
close(FILE);
print MAIL @tmp;
print MAIL "\n--memconf_UNIQUE_LINE\n";
print MAIL "Content-Type: application/octet-stream; name=\"${outfile}.tar\"\n";
print MAIL "Content-Transfer-Encoding: base64\n";
print MAIL "Content-Disposition: attachment; filename=\"${outfile}.tar\"\n";
print MAIL "\n";
print MAIL &b64encodefile("/tmp/${outfile}.tar");
print MAIL "--memconf_UNIQUE_LINE--\n";
close(MAIL);
}
foreach $tmp (@filelist) {
unlink "/tmp/$tmp";
}
}
UnixAgent-2.4.2/ocsinventory-agent 0000775 0000000 0000000 00000022162 13327377321 0017220 0 ustar 00root root 0000000 0000000 #!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
#Copyright (C) 2006-2016 OCS Inventory Developers
#
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; either version 2
#of the License, or (at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
#USA.
#
use strict;
use warnings;
my $devlib;
foreach (@ARGV) {
if (/^--devlib$/) {
print "[info] --devlib are found, Developer mode enabled\n";
eval "use lib 'lib';";
}
}
eval "use Ocsinventory::Agent;";
if ($@) {
print "Failed to load Ocsinventory::Agent, $@\n";
print "you can run the agent directly for its source directory ";
print "with --devlib\n";
exit 1;
}
eval "Ocsinventory::Agent::run();";
print $@;
__END__
=head1 NAME
ocsinventory-agent - Unified client for OCS-Inventory
=head1 SYNOPSIS
B S<[ B<-fhilpruw> ]> S<[ I<--server server> | I<--local /tmp> ]>...
=head1 EXAMPLES
% ocsinventory-agent --server localhost
# send an inventory to the OCS server
% ocsinventory-agent --server http://localhost/ocsinventory2
# send an inventory over http to a server with a non standard
# virtual directory
% ocsinventory-agent --server https://localhost/ocsinventory
# send an inventory over https to the OCS server
% ocsinventory-agent --local /tmp
# write an inventory in the /tmp directory
% ocsinventory-agent --server localhost --user=toto --password=pw --realm="Restricted Area"
# send a report to a server protected by a basic authentication
% ocsinventory-agent --lazy
# send an inventory only if the a random delay between 0 and PROLOG_FREQ had been run over.
% ocsinventory-agent --delaytime 60 -d
# If NO PROLOG_FREQ has been preset, pick a time between execution and --delaytime for the agent to contact the server [default is 3600 seconds]
=head1 DESCRIPTION
F creates inventory and send or write them. This agent is the
successor of the former linux_agent which was released with OCS 1.01 and prior. It also
replaces the Solaris/AIX/BSD unofficial agents. The detailed list of supported
Operating System is available in the Wiki.
=over 4
=item F
=item F
=item F
=item F
=item F
=item F
=item F
=item F
=back
=head1 OPTIONS
Most of the options are available in a I form and a I form. For
example, the two lines below are all equivalent:
% ocsinventory-agent -s localhost
% ocsinventory-agent --server localhost
=over 4
=item B<--backend-collect-timeout=SECONDS_BEFORE_KILL>
Time before OCS kills modules processing which don't end before the timeout.
=item B<--basevardir>=I
Indicate the place where the agent should store its files.
=item B<-d>, B<--daemon>
Launch ocsinventory-agent in background. Proc::Daemon is needed.
=item B<--debug>
Turn the debug mode on.
=item B<--devlib>
This option is designed for backend module developer. With it enabled, ocsinventry-agent won't try to load the Backend module installed on the system. Instead it will scan the ./lib directory.
=item B<--delaytime=SECONDS_TO_WAIT>
This option defaults to waiting a random() time between 0 and 3600 before initially contacting the server assuming NO PROLOG_FREQ has been set. Once PROLOG_FREQ has been set, it uses that number at the top end of it's random setting. Useful for pre-setting a deployed agent's initial start time (so you don't jam the server all at once, but don't have to wait an hour to make sure the deployment worked).
=item B<-f>, B<--force>
The agent will first contact the server during the PROLOG period. If the server doesn't know the machine or has outdated information, it will ask for an inventory.
With this option, the agent doesn't run the PROLOG with the server first but directly sends an inventory.
=item B<-i>, B<--info>
Turn the verbose mode on. The flag is ignored if B<--debug> is enable.
=item B<--lazy>
Do not contact the server more than one time during the PROLOG_FREQ and do
an exit if there is nothing to do. Useful if you want to start the agent
script regulary from the crontab but don't want to overload the server.
=item B<-l>, B<--local>=I
Write an inventory in the I directory. A new file will be created if needed.
=item B<--logfile>=I
Log message in I and turn off STDERR
=item B<-p>, B<--password>=I
Use I for an HTTP identification with the server.
=item B<-P>, B<--proxy>=I
Use I to specify a proxy HTTP server. By default, the agent uses HTTP_PROXY environment variable.
=item B<-r>, B<--realm>=I
Use I for an HTTP identification with the server. For example, the value can be 'Restricted Area'. You can find it in the login popup of your Internet browser.
=item B<-s>, B<--server>=I
The uri of the server. If I doesn't start with http:// or https://, the assume the parameter is a hostname and rewrite it like that:
% http://servername/ocsinventory
If you want to use https or another virtual directory you need to enter the full path.
B<--server> is ignored if B<--local> is in use.
=item B<--stdout>
Print the inventory on stdout.
% ocsinventory-agent --stdout > /tmp/report.xml
# prepare an inventory and write it in the /tmp/report.xml file.
# A file will be created.
=item B<--scan-homedirs>
Authorized OCS to scan home directories to increase the Virtual Machine inventory.
WARNING: beware with user privacy by using this option because it may encounter private data scans (even if it's not designed for !).
=item B<--ssl>=I<0|1>
Check SSL communications using a certificate.
Set to 0 if you want to disable certificate check or 1 to enable (needs CA certificate path in this case) . Default is set to 1.
=item B<--ca>=I
Path to CA certificate chain file in PEM format, for server SSL certificate validation.
Set to /cacert.pem by default.
=item B<--tag>=I
Mark the machine with the I tag. Once the initial inventory is accepted by the server this value is ignored and you've to change the information directly on the server. The server do so in order to centralize the administration of the machine.
=item B<-u> I, B<--user>=I
Use I for the server authentication.
=item B<--version>=I
Print the version and exit.
=item B<-w> I, B<--wait>=I
Wait before initializing the connexion with the server. If I equal I the agent will use the PROLOG_FREQ of the server to determine the duration of this periode. Exactly like it would had done if it was in --daemon mode.
Else if duration is a numerical value, it will be used directly.
% ocsinventory-agent --wait 5 --server localhost
=item B<--nosoftware>
Do not inventory the software installed on the machine. B<--nosoft> also
works but is deperecated.
=item B<--nolocal>
Deactivate local mode even if it is set in config file or command line
=back
=head1 CONFIG FILE
The agent try to initialize the settings from the B
config file.
It looks for the file in these directories:
=over
=item /etc/ocsinventory
=item /usr/local/etc/ocsinventory
=item /etc/ocsinventory-agent
=back
=head1 AUTHORS
The maintainer is Guillaume PROTET
Please read the AUTHORS, Changes and THANKS files to see who is behind OCS
Inventory Agent.
=head1 SEE ALSO
=over 4
=item OCS-Inventory website,
http://www.ocsinventory-ng.org/
=item LaunchPad project page,
http://launchpad.net/ocsinventory-unix-agent
=item forum,
http://forums.ocsinventory-ng.org/
=item and wiki
http://wiki.ocsinventory-ng.org/
=back
=head1 BUGS
Please, use the forum as much as possible. You can open your own bug tickets.
Patches are welcome. You can also use LaunchPad bugtracker or
push your Bazaar branch on LaunchPad and do a merge request.
=head1 COPYRIGHT
Copyright (C) 2006-2016 OCS Inventory contributors
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
=cut
UnixAgent-2.4.2/postinst.pl 0000775 0000000 0000000 00000044123 13327377321 0015660 0 ustar 00root root 0000000 0000000 #!/usr/bin/perl -w
use strict;
use lib 'lib';
use Cwd;
use Ocsinventory::Agent::Config;
my $old_unix_agent_dir = "/etc/ocsinventory-client";
my $config;
my @cacert;
my $binpath;
my $randomtime;
my $crontab;
my $cron_line;
my $option;
my $nowizard;
my $configdir;
my $remove_old_unix;
my $old_unix_config;
my $nossl;
my $download;
my $snmp;
my $now;
for $option (@ARGV){
if ($option=~/--nowizard$/){
$nowizard = 1;
} elsif($option=~/--server=(\S*)$/){
$config->{server} = $1;
} elsif($option=~/--basevardir=(\S*)$/){
$config->{basevardir} = $1;
} elsif($option=~/--configdir=(\S*)$/){
$configdir = $1;
} elsif($option=~/--user=(\S*)$/){
$config->{user} = $1;
} elsif($option=~/--password=(\S*)$/){
$config->{password} = $1;
} elsif($option=~/--realm=(\S*)$/){
$config->{realm} = $1;
} elsif($option=~/--tag=(\S*)$/){
$config->{tag} = $1;
} elsif($option=~/--crontab$/){
$crontab = 1;
} elsif($option=~/--get-old-unix-agent-config$/){
$old_unix_config = 1;
} elsif($option=~/--remove-old-unix-agent$/){
$remove_old_unix = 1;
} elsif($option=~/--debug$/){
$config->{debug} = 1;
} elsif($option=~/--logfile=(\S*)$/){
$config->{logfile} = $1;
} elsif($option=~/--nossl$/){
$nossl = 1;
} elsif($option=~/--ca=(\S*)$/){
$config->{ca} = $1;
} elsif($option=~/--download$/){
$download = 1;
} elsif($option=~/--snmp$/){
$snmp = 1;
} elsif($option=~/--now$/){
$now = 1;
} elsif($option=~/--help/ || $option=~/-h/) {
print STDERR <{basevardir}) {
if ($^O =~ /solaris/) {
$config->{basevardir} = '/var/opt/ocsinventory-agent';
} elsif ($^O =~ /bsd/) {
$config->{basevardir} = '/var/db/ocsinventory-agent';
} else {
$config->{basevardir} = '/var/lib/ocsinventory-agent'
}
}
############ Asking for questions ##############
unless ($nowizard) {
if (!ask_yn("Do you want to configure the agent", 'y')) {
exit 0;
}
unless ($configdir) {
$configdir = getConfigDir (@default_configdirs);
#If not found
unless (-d $configdir) {
$configdir = askConfigDir (@default_configdirs);
unless (-d $configdir) {
unless (ask_yn ("Do you want to create the directory ".$configdir."?", 'y')) {
die("Please create ".$configdir." directory first.\n");
}
}
}
}
#Old unix agent
if (ask_yn("Should the old unix_agent settings be imported ?", 'y')) {
$old_unix_config=1;
}
#Getting agent configuration if exists
if (-f $configdir."/ocsinventory-agent.cfg") {
open (CONFIG, "<".$configdir."/ocsinventory-agent.cfg") or
die "Can't open ".$configdir."/ocsinventory-agent.cfg: ".$!;
foreach () {
s/#.+//;
if (/(\w+)\s*=\s*(.+)/) {
my $key = $1;
my $val = $2;
# Remove the quotes
$val =~ s/\s+$//;
$val =~ s/^'(.*)'$/$1/;
$val =~ s/^"(.*)"$/$1/;
$config->{$key} = $val unless $config->{$key};
}
}
close CONFIG;
}
#Getting server name
print "[info] The config file will be written in $configdir/ocsinventory-agent.cfg,\n";
$config->{server} = promptUser('What is the address of your ocs server',$config->{server});
#$config->{server} = promptUser('What is the address of your ocs server', exists ($config->{server})?$config->{server}:'ocsinventory-ng');
#Getting credentials if needed
if (ask_yn ("Do you need credential for the server? (You probably don't)", 'n')) {
$config->{user} = promptUser("user", $config->{user});
$config->{password} = promptUser("password");
print "[info] The realm can be found in the login popup of your Internet browser.\n[info] In general, it's something like 'Restricted Area'.\n";
$config->{realm} = promptUser("realm");
}
#Getting tag
unless ($config->{tag}){
if (ask_yn('Do you want to apply an administrative tag on this machine', 'y')) {
$config->{tag} = promptUser("tag", $config->{tag});
}
}
#Getting crontab
if ($^O =~ /solaris/ || $^O =~ /bsd/) {
if (ask_yn("Do yo want to install the cron task in current user crontab ?", 'y')) {
$crontab = 1;
}
} elsif (-d "/etc/cron.d") {
if (ask_yn("Do yo want to install the cron task in /etc/cron.d", 'y')) {
$crontab = 1;
}
}
#Getting basevardir
$config->{basevardir} = promptUser('Where do you want the agent to store its files? (You probably don\'t need to change it)', $config->{basevardir}, '^\/\w+', 'The location must begin with /');
unless (-d $config->{basevardir}) {
unless (ask_yn ("Do you want to create the ".$config->{basevardir}." directory?\n", 'y')) {
die("Please create the ".$config->{basevardir}." directory manually and relaunch postinst.pl script\n");
}
}
#Remove old unix agent ?
$remove_old_unix = ask_yn ("Should I remove the old unix_agent", 'n') unless $remove_old_unix;
#Enable debug option ?
$config->{debug} = ask_yn("Do you want to activate debug configuration option ?", 'y') unless $config->{debug};
#Enable log file ?
unless ($config->{logfile}) {
if (ask_yn("Do you want to use OCS Inventory NG UNix Unified agent log file ?", 'y')){
$config->{logfile} = promptUser('Specify log file path you want to use', $config->{logfile}, '^\/\w+', 'The location must begin with /');
}
}
#Disable SSL option ?
unless ($nossl) {
$nossl = ask_yn("Do you want disable SSL CA verification configuration option (not recommended) ?", 'n');
}
#Set CA certificate path ?
unless ($config->{ca}) {
if (ask_yn("Do you want to set CA certificate chain file path ?", 'y')){
$config->{ca} = promptUser('Specify CA certificate chain file path', $config->{ca}, '^\/\w+', 'The location must begin with /');
}
}
#Enable download feature ?
$download = ask_yn("Do you want to use OCS-Inventory software deployment feature?", 'y') unless $download;
#Enable SNMP feature ?
$snmp = ask_yn("Do you want to use OCS-Inventory SNMP scans feature?", 'y') unless $snmp;
#Run agent after configuration ?
$now = ask_yn("Do you want to send an inventory of this machine?", 'y') unless $now;
}
################ Here we go... ##############
#Old unix agent
if (-f $old_unix_agent_dir.'/ocsinv.conf' && $old_unix_config) {
print STDERR "Getting old OCS Inventory NG Unix agent configuration...\n";
my $ocsinv = XMLin($old_unix_agent_dir.'/ocsinv.conf');
$config->{server} = mkFullServerUrl($ocsinv->{'OCSFSERVER'});
if (-f $old_unix_agent_dir.'/cacert.pem') {
open CACERT, $old_unix_agent_dir.'/cacert.pem' or die "Can't import the CA certificate: ".$!;
@cacert = ;
close CACERT;
}
my $admcontent = '';
if (-f "$old_unix_agent_dir/ocsinv.adm") {
if (!open(ADM, "<:encoding(iso-8859-1)", "$old_unix_agent_dir/ocsinv.adm")) {
warn "Can't open $old_unix_agent_dir/ocsinv.adm";
} else {
$admcontent .= $_ foreach ();
close ADM;
my $admdata = XMLin($admcontent) or die;
if (ref ($admdata->{ACCOUNTINFO}) eq 'ARRAY') {
foreach (@{$admdata->{ACCOUNTINFO}}) {
$config->{tag} = $_->{KEYVALUE} if $_->{KEYNAME} =~ /^TAG$/;
}
} elsif (
exists($admdata->{ACCOUNTINFO}->{KEYNAME}) &&
exists($admdata->{ACCOUNTINFO}->{KEYVALUE}) &&
$admdata->{ACCOUNTINFO}->{KEYNAME} eq 'TAG'
){
print $admdata->{ACCOUNTINFO}->{KEYVALUE}."\n";
$config->{tag} = $admdata->{ACCOUNTINFO}->{KEYVALUE};
}
}
}
}
#Setting server uri
print STDERR "Setting OCS Inventory NG server address...\n";
$config->{server}="ocsinventory-ng" unless $config->{server};
$config->{server} = mkFullServerUrl($config->{server});
if (!$config->{server}) {
print "Server is empty. Leaving...\n";
exit 1;
}
my $uri;
if ($config->{server} =~ /^http(|s):\/\//) {
$uri = $config->{server};
} else { # just the hostname
$uri = "http://".$config->{server}."/ocsinventory"
}
#Is OCS agent well installed ?
print STDERR "Looking for OCS Invetory NG Unix Unified agent installation...\n";
chomp($binpath = `which ocsinventory-agent 2>/dev/null`);
if (! -x $binpath) {
# Packaged version with perl and agent ?
$binpath = $^X;
$binpath =~ s/perl/ocsinventory-agent/;
}
if (! -x $binpath) {
print "sorry, can't find ocsinventory-agent in \$PATH\n";
exit 1;
} else {
print "ocsinventory agent presents: $binpath\n";
}
#Setting crontab
$randomtime = int(rand(60)).' '.int(rand(24));
$cron_line = $randomtime." * * * root $binpath --lazy > /dev/null 2>&1\n";
if ($crontab) {
print STDERR "Setting crontab...\n";
if ($^O =~ /solaris/ || $^O =~ /bsd/) {
my $cron = `crontab -l`;
# Let's suppress Unix cron/anacron user column
$cron_line =~ s/ root / /;
$cron .= $cron_line;
open CRONP, "| crontab" || die "Can't run crontab: $!";
print CRONP $crontab;
close(CRONP);
} elsif (-d "/etc/cron.d") {
open DEST, '>/etc/cron.d/ocsinventory-agent' or die $!;
# Save the root PATH
print DEST "PATH=".$ENV{PATH}."\n";
print DEST $randomtime." * * * root $binpath --lazy > /dev/null 2>&1\n";
close DEST;
}
}
#Creating basevardir
if (!-d $config->{basevardir}) {
print STDERR "Creating $config->{basevardir} directory...\n";
mkdir $config->{basevardir} or die $!;
}
#Disabling SSL verification if asked
$config->{ssl} = 0 if $nossl;
#Creating configuration directory
$configdir = "/etc/ocsinventory-agent" unless $configdir; #If not set in command line
if (grep (/$configdir/,@default_configdirs)) {
$configdir = '/etc/ocsinventory-agent' unless $configdir;
print STDERR "Creating $configdir directory...\n";
unless (-d $configdir) {
unless (mkdir $configdir) {
die("Failed to create ".$configdir.". Are you root?\n");
}
}
print STDERR "Writing OCS Inventory NG Unix Unified agent configuration\n";
open CONFIG, ">$configdir/ocsinventory-agent.cfg" or die "Can't write the config file in $configdir: ".$!;
print CONFIG $_."=".$config->{$_}."\n" foreach (keys %$config);
close CONFIG;
chmod 0600, "$configdir/ocsinventory-agent.cfg";
} else {
die("Wrong configuration directory...please choose a directory supported by OCS Inventory NG agent !!!\n");
}
#Removing old unix agent if needed
if ($remove_old_unix) {
print STDERR "Removing old OCS Inventory Unix agent...\n";
foreach (qw#
/etc/ocsinventory-client
/etc/logrotate.d/ocsinventory-client
/usr/sbin/ocsinventory-client.pl
/etc/cron.d/ocsinventory-client
/bin/ocsinv
#) {
print $_."\n";
next;
rmdir if -d;
unlink if -f || -l;
}
print "done\n"
}
# Creating vardirectory for this server
my $dir = $config->{server};
$dir =~ s/\//_/g;
my $vardir = $config->{basevardir}."/".$dir;
print STDERR "Creating $vardir directory...\n";
recMkdir($vardir) or die "Can't create $vardir!";
if (@cacert) { # we need to migrate the certificate
print STDERR "Copying cacert.pem in $vardir...\n";
open CACERT, ">".$vardir."/cacert.pem" or die "Can't open ".$vardir.'/cacert.pem: '.$!;
print CACERT foreach (@cacert);
close CACERT;
print "Certificate copied in ".$vardir."/cacert.pem\n";
}
#We copy custom XML for SNMP MIBs from sources
my $workdir = getcwd();
my $source_snmpdir = "$workdir/snmp";
my $snmpdir = "$vardir/snmp";
if ( -d $source_snmpdir && -d $vardir) {
unless (-d $snmpdir) {
print STDERR "Creating $snmpdir directory...\n";
recMkdir($snmpdir) or die "Can't create $snmpdir!";
}
print STDERR "Copying SNMP MIBs XML files...\n";
system("cp -r $source_snmpdir/* $snmpdir");
}
print STDERR "Activating modules if needed...\n";
open MODULE, ">$configdir/modules.conf" or die "Can't write modules.conf in $configdir: ".$!;
print MODULE "# this list of module will be load by the at run time\n";
print MODULE "# to check its syntax do:\n";
print MODULE "# #perl modules.conf\n";
print MODULE "# You must have NO error. Else the content will be ignored\n";
print MODULE "# This mechanism goal is to launch agent extension modules\n";
print MODULE "\n";
print MODULE ($download?'':'#');
print MODULE "use Ocsinventory::Agent::Modules::Download;\n";
print MODULE ($snmp?'':'#');
print MODULE "use Ocsinventory::Agent::Modules::Snmp;\n";
print MODULE "\n";
print MODULE "# DO NOT REMOVE THE 1;\n";
print MODULE "1;\n";
close MODULE;
#Prevent security risks by removing existing snmp_com.txt file which is no longer used
my $snmp_com_file = "$snmpdir/snmp_com.txt";
if ( -f $snmp_com_file ) {
print STDERR "$snmp_com_file seems to exists...removing it to prevent security risks !\n";
unlink $snmp_com_file;
}
# Launch agent if asked
if ($now) {
print STDERR "Launching OCS Inventory NG Unix Unified agent...\n";
system("$binpath --force");
if (($? >> 8)==0) {
print " -> Success!\n";
} else {
print " -> Failed!\n";
print "You may want to launch the agent with the --verbose or --debug flag.\n";
}
}
#End
print "New settings written! Thank you for using OCS Inventory\n";
######## Subroutines ################
sub loadModules {
my @modules = @_;
foreach (@modules) {
eval "use $_;";
if ($@) {
print STDERR "Failed to load $_. Please install it and restart the postinst.pl script ( ./postinst.pl ).\n";
exit 1;
}
}
}
sub ask_yn {
my $promptUser = shift;
my $default = shift;
die unless $default =~ /^(y|n)$/;
my $cpt = 5;
while (1) {
my $line = prompt("$promptUser\nPlease enter 'y' or 'n'?>", $default);
return 1 if $line =~ /^y$/;
return if $line =~ /^n$/;
if ($cpt-- < 0) {
print STDERR "to much user input, exit...\n";
exit(0);
}
}
}
sub promptUser {
my ($promptUser, $default, $regex, $notice) = @_;
my $string = $promptUser;
$string .= "?>";
my $line;
my $cpt = 5;
while (1) {
$line = prompt($string, $default);
if ($regex && $line !~ /$regex/) {
print STDERR $notice."\n";
} else {
last;
}
if ($cpt-- < 0) {
print STDERR "to much user input, exit...\n";
exit(0);
}
}
return $line;
}
sub getConfigDir {
my @choices = @_;
foreach (@choices) {
my $t = $_.'/ocsinventory-agent.cfg';
if (-f $t) {
print "Config file found are $t! Reusing it.\n";
return $_;
}
}
}
sub askConfigDir {
my @choices = @_;
print STDERR "Where do you want to write the configuration file?\n";
foreach (0..$#choices) {
print STDERR " ".$_." -> ".$choices[$_]."\n";
}
my $input = -1;
my $configdir;
while (1) {
$input = prompt("?>");
if ($input =~ /^\d+$/ && $input >= 0 && $input <= $#choices) {
last;
} else {
print STDERR "Value must be between 0 and ".$#choices."\n";
}
}
return $choices[$input];
}
sub recMkdir {
my $dir = shift;
my @t = split /\//, $dir;
shift @t;
return unless @t;
my $t;
foreach (@t) {
$t .= '/'.$_;
if ((!-d $t) && (!mkdir $t)) {
return;
}
}
1;
}
sub mkFullServerUrl {
my $server = shift;
my $ret = 'http://' unless $server =~ /^http(s|):\/\//;
$ret .= $server;
if ($server !~ /http(|s):\/\/\S+\/\S+/) {
$ret .= '/ocsinventory';
}
return $ret;
}
UnixAgent-2.4.2/resources/ 0000775 0000000 0000000 00000000000 13327377321 0015443 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/resources/cpuinfo/ 0000775 0000000 0000000 00000000000 13327377321 0017106 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/resources/cpuinfo/cpuinfo-vmware-esx 0000664 0000000 0000000 00000000000 13327377321 0022556 0 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/resources/cpuinfo/linux-686-1 0000664 0000000 0000000 00000001134 13327377321 0020646 0 ustar 00root root 0000000 0000000 processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 13
model name : Intel(R) Pentium(R) M processor 1.73GHz
stepping : 8
cpu MHz : 1729.038
cache size : 2048 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx bts est tm2
bogomips : 3462.27
clflush size : 64
power management:
UnixAgent-2.4.2/resources/cpuinfo/linux-alpha-1 0000664 0000000 0000000 00000001550 13327377321 0021412 0 ustar 00root root 0000000 0000000 cpu : Alpha
cpu model : EV68CB
cpu variation : 7
cpu revision : 0
cpu serial number : JA30502089
system type : Titan
system variation : Privateer
system revision : 0
system serial number : AY31001636
cycle frequency [Hz] : 1250000000
timer frequency [Hz] : 1024.00
page size [bytes] : 8192
phys. address bits : 44
max. addr. space # : 255
BogoMIPS : 2484.04
kernel unaligned acc : 0 (pc=0,va=0)
user unaligned acc : 0 (pc=0,va=0)
platform string : AlphaServer ES45 Model 3B
cpus detected : 3
cpus active : 3
cpu active mask : 0000000000000007
L1 Icache : 64K, 2-way, 64b line
L1 Dcache : 64K, 2-way, 64b line
L2 cache : n/a
L3 cache : n/a
UnixAgent-2.4.2/resources/cpuinfo/linux-armel-1 0000664 0000000 0000000 00000001130 13327377321 0021417 0 ustar 00root root 0000000 0000000 Processor : XScale-80219 rev 0 (v5l)
BogoMIPS : 593.10
Features : swp half fastmult edsp
CPU implementer : 0x69
CPU architecture: 5TE
CPU variant : 0x0
CPU part : 0x2e3
CPU revision : 0
Cache type : undefined 5
Cache clean : undefined 5
Cache lockdown : undefined 5
Cache format : Harvard
I size : 32768
I assoc : 32
I line length : 32
I sets : 32
D size : 32768
D assoc : 32
D line length : 32
D sets : 32
Hardware : Thecus N2100
Revision : 0000
Serial : 0000000000000000
UnixAgent-2.4.2/resources/cpuinfo/linux-ia64-1 0000664 0000000 0000000 00000001033 13327377321 0021064 0 ustar 00root root 0000000 0000000 processor : 0
vendor : GenuineIntel
arch : IA-64
family : Itanium 2
model : 2
revision : 1
archrev : 0
features : branchlong
cpu number : 0
cpu regs : 4
cpu MHz : 1600.000009
itc MHz : 1600.009464
BogoMIPS : 2392.06
siblings : 1
processor : 1
vendor : GenuineIntel
arch : IA-64
family : Itanium 2
model : 2
revision : 1
archrev : 0
features : branchlong
cpu number : 0
cpu regs : 4
cpu MHz : 1600.000009
itc MHz : 1600.009464
BogoMIPS : 2392.06
siblings : 1
UnixAgent-2.4.2/resources/cpuinfo/linux-mips-1 0000664 0000000 0000000 00000000644 13327377321 0021300 0 ustar 00root root 0000000 0000000 system type : SGI Indigo2
processor : 0
cpu model : R4400SC V5.0 FPU V0.0
BogoMIPS : 74.75
wait instruction : no
microsecond timers : yes
tlb_entries : 48
extra interrupt vector : no
hardware watchpoint : yes
ASEs implemented :
shadow register sets : 1
VCED exceptions : 640580539
VCEI exceptions : 9972559
UnixAgent-2.4.2/resources/cpuinfo/linux-ppc-1 0000664 0000000 0000000 00000000406 13327377321 0021106 0 ustar 00root root 0000000 0000000 processor : 0
cpu : 604r
clock : ???
revision : 49.2 (pvr 0009 3102)
bogomips : 299.00
machine : PReP Utah (Powerstack II Pro4000)
l2 cache : 512KiB, parity disabled SRAM:synchronous, pipelined, no parity
UnixAgent-2.4.2/resources/cpuinfo/linux-ppc-2 0000664 0000000 0000000 00000000427 13327377321 0021112 0 ustar 00root root 0000000 0000000 processor : 0
cpu : POWER4+ (gq)
clock : 1452.000000MHz
revision : 2.1
processor : 1
cpu : POWER4+ (gq)
clock : 1452.000000MHz
revision : 2.1
timebase : 181495202
machine : CHRP IBM,7029-6C3
UnixAgent-2.4.2/resources/cpuinfo/linux-sparc-1 0000664 0000000 0000000 00000000615 13327377321 0021436 0 ustar 00root root 0000000 0000000 cpu : TI UltraSparc IIIi (Jalapeno)
fpu : UltraSparc IIIi integrated FPU
prom : OBP 4.13.2 2004/03/29 10:11
type : sun4u
ncpus probed : 2
ncpus active : 2
D$ parity tl1 : 0
I$ parity tl1 : 0
Cpu0ClkTck : 000000003bb94e80
Cpu1ClkTck : 000000003bb94e80
MMU Type : Cheetah+
State:
CPU0: online
CPU1: online
UnixAgent-2.4.2/resources/dmidecode-freebsd-6.2 0000664 0000000 0000000 00000014471 13327377321 0021225 0 ustar 00root root 0000000 0000000 # dmidecode 2.8
SMBIOS 2.3 present.
25 structures occupying 643 bytes.
Table at 0x000F0800.
Handle 0x0000, DMI type 1, 25 bytes
System Information
Manufacturer:
Product Name:
Version:
Serial Number:
UUID: Not Present
Wake-up Type: Power Switch
Handle 0x0001, DMI type 2, 8 bytes
Base Board Information
Manufacturer:
Product Name: CN700-8237R
Version:
Serial Number:
Handle 0x0002, DMI type 3, 17 bytes
Chassis Information
Manufacturer:
Type: Desktop
Lock: Not Present
Version:
Serial Number:
Asset Tag:
Boot-up State: Unknown
Power Supply State: Unknown
Thermal State: Unknown
Security Status: Unknown
OEM Information: 0x00000000
Handle 0x0003, DMI type 4, 35 bytes
Processor Information
Socket Designation: NanoBGA2
Type: Central Processor
Family: Other
Manufacturer: VIA
ID: A9 06 00 00 FF BB C9 A7
Version: VIA C7
Voltage: 1.1 V
External Clock: 100 MHz
Max Speed: 2000 MHz
Current Speed: 2000 MHz
Status: Populated, Enabled
Upgrade: None
L1 Cache Handle: 0x0006
L2 Cache Handle: 0x0007
L3 Cache Handle: Not Provided
Serial Number:
Asset Tag:
Part Number:
Handle 0x0004, DMI type 5, 18 bytes
Memory Controller Information
Error Detecting Method: None
Error Correcting Capabilities:
None
Supported Interleave: Eight-way Interleave
Current Interleave: Four-way Interleave
Maximum Memory Module Size: 1024 MB
Maximum Total Memory Size: 1024 MB
Supported Speeds:
70 ns
60 ns
Supported Memory Types:
DIMM
SDRAM
Memory Module Voltage: 2.9 V
Associated Memory Slots: 1
0x0005
Enabled Error Correcting Capabilities: None
Handle 0x0005, DMI type 6, 12 bytes
Memory Module Information
Socket Designation: A0
Bank Connections: 0
Current Speed: 37 ns
Type: Other
Installed Size: 512 MB (Single-bank Connection)
Enabled Size: 512 MB (Single-bank Connection)
Error Status: OK
Handle 0x0006, DMI type 7, 19 bytes
Cache Information
Socket Designation: Internal Cache
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Back
Location: Internal
Installed Size: 32 KB
Maximum Size: 32 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Speed: Unknown
Error Correction Type: Unknown
System Type: Unknown
Associativity: 4-way Set-associative
Handle 0x0007, DMI type 7, 19 bytes
Cache Information
Socket Designation: Internal Cache
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Write Back
Location: External
Installed Size: 0 KB
Maximum Size: 0 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Speed: Unknown
Error Correction Type: Unknown
System Type: Unknown
Associativity: Unknown
Handle 0x0008, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: PRIMARY IDE
Internal Connector Type: On Board IDE
External Reference Designator: Not Specified
External Connector Type: None
Port Type: Other
Handle 0x0009, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: SECONDARY IDE
Internal Connector Type: On Board IDE
External Reference Designator: Not Specified
External Connector Type: None
Port Type: Other
Handle 0x000A, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: FDD
Internal Connector Type: On Board Floppy
External Reference Designator: Not Specified
External Connector Type: None
Port Type: 8251 FIFO Compatible
Handle 0x000B, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: COM1
Internal Connector Type: 9 Pin Dual Inline (pin 10 cut)
External Reference Designator:
External Connector Type: DB-9 male
Port Type: Serial Port 16450 Compatible
Handle 0x000C, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: COM2
Internal Connector Type: 9 Pin Dual Inline (pin 10 cut)
External Reference Designator:
External Connector Type: DB-9 male
Port Type: Serial Port 16450 Compatible
Handle 0x000D, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: LPT1
Internal Connector Type: DB-25 female
External Reference Designator:
External Connector Type: DB-25 female
Port Type: Parallel Port ECP/EPP
Handle 0x000E, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: Keyboard
Internal Connector Type: PS/2
External Reference Designator:
External Connector Type: PS/2
Port Type: Keyboard Port
Handle 0x000F, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: PS/2 Mouse
Internal Connector Type: PS/2
External Reference Designator:
External Connector Type: PS/2
Port Type: Mouse Port
Handle 0x0010, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: USB0
External Connector Type: Other
Port Type: USB
Handle 0x0011, DMI type 9, 13 bytes
System Slot Information
Designation: PCI0
Type: 32-bit PCI
Current Usage: Available
Length: Long
ID: 1
Characteristics:
5.0 V is provided
PME signal is supported
Handle 0x0012, DMI type 13, 22 bytes
BIOS Language Information
Installable Languages: 3
n|US|iso8859-1
r|CA|iso8859-1
a|JP|unicode
Currently Installed Language: n|US|iso8859-1
Handle 0x0013, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: None
Maximum Capacity: 512 MB
Error Information Handle: Not Provided
Number Of Devices: 1
Handle 0x0014, DMI type 17, 27 bytes
Memory Device
Array Handle: 0x0013
Error Information Handle: Not Provided
Total Width: Unknown
Data Width: Unknown
Size: 512 MB
Form Factor: DIMM
Set: None
Locator: A0
Bank Locator: Bank0/1
Type: Unknown
Type Detail: None
Speed: Unknown
Manufacturer: None
Serial Number: None
Asset Tag: None
Part Number: None
Handle 0x0015, DMI type 19, 15 bytes
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0001FFFFFFF
Range Size: 512 MB
Physical Array Handle: 0x0013
Partition Width: 0
Handle 0x0016, DMI type 20, 19 bytes
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0001FFFFFFF
Range Size: 512 MB
Physical Device Handle: 0x0014
Memory Array Mapped Address Handle: 0x0015
Partition Row Position: 1
Handle 0x0017, DMI type 32, 11 bytes
System Boot Information
Status: No errors detected
Handle 0x0018, DMI type 127, 4 bytes
End Of Table
UnixAgent-2.4.2/resources/dmidecode-linux-2.6 0000664 0000000 0000000 00000032757 13327377321 0020761 0 ustar 00root root 0000000 0000000 # dmidecode 2.8
SMBIOS 2.3 present.
60 structures occupying 2446 bytes.
Table at 0x000F7860.
Handle 0xDA00, DMI type 218, 125 bytes
OEM-specific Type
Header and Data:
DA 7D 00 DA B2 00 0D 5F 0F 37 40 7D 00 00 00 00
00 7E 00 02 00 00 00 40 00 04 00 01 00 41 00 04
00 00 00 90 00 05 00 00 00 91 00 05 00 01 00 92
00 05 00 02 00 45 01 45 01 01 00 44 01 44 01 00
00 00 80 00 80 01 00 00 A0 00 A0 01 00 05 80 05
80 01 00 76 01 76 01 01 00 75 01 75 01 01 00 01
F0 01 F0 00 00 02 F0 02 F0 00 00 03 F0 03 F0 00
00 04 F0 04 F0 00 00 FF FF 00 00 00 00
Handle 0x0000, DMI type 0, 20 bytes
BIOS Information
Vendor: Dell Inc.
Version: A06
Release Date: 10/02/2005
Address: 0xF0000
Runtime Size: 64 kB
ROM Size: 576 kB
Characteristics:
ISA is supported
PCI is supported
PC Card (PCMCIA) is supported
PNP is supported
BIOS is upgradeable
BIOS shadowing is allowed
Boot from CD is supported
Selectable boot is supported
3.5"/720 KB floppy services are supported (int 13h)
Print screen service is supported (int 5h)
8042 keyboard services are supported (int 9h)
Serial services are supported (int 14h)
Printer services are supported (int 17h)
CGA/mono video services are supported (int 10h)
ACPI is supported
USB legacy is supported
AGP is supported
Smart battery is supported
BIOS boot specification is supported
Function key-initiated network boot is supported
Handle 0x0100, DMI type 1, 25 bytes
System Information
Manufacturer: Dell Inc.
Product Name: Latitude D610
Version: Not Specified
Serial Number: D8XD62J
UUID: 44454C4C-3800-1058-8044-C4C04F36324A
Wake-up Type: Power Switch
Handle 0x0200, DMI type 2, 9 bytes
Base Board Information
Manufacturer: Dell Inc.
Product Name: 0XD762
Version:
Serial Number: .D8XD62J.CN4864363E7491.
Handle 0x0300, DMI type 3, 13 bytes
Chassis Information
Manufacturer: Dell Inc.
Type: Portable
Lock: Not Present
Version: Not Specified
Serial Number: D8XD62J
Asset Tag: Not Specified
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: None
Handle 0x0301, DMI type 126, 13 bytes
Inactive
Handle 0x0400, DMI type 4, 32 bytes
Processor Information
Socket Designation: Microprocessor
Type: Central Processor
Family: Pentium M
Manufacturer: Intel
ID: D8 06 00 00 FF FB E9 AF
Signature: Type 0, Family 6, Model 13, Stepping 8
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (Fast floating-point save and restore)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
TM (Thermal monitor supported)
PBE (Pending break enabled)
Version: Not Specified
Voltage: 3.3 V
External Clock: 133 MHz
Max Speed: 1800 MHz
Current Speed: 1733 MHz
Status: Populated, Enabled
Upgrade: None
L1 Cache Handle: 0x0700
L2 Cache Handle: 0x0701
L3 Cache Handle: Not Provided
Handle 0x0700, DMI type 7, 19 bytes
Cache Information
Socket Designation: Not Specified
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Back
Location: Internal
Installed Size: 8 KB
Maximum Size: 8 KB
Supported SRAM Types:
Unknown
Installed SRAM Type: Unknown
Speed: Unknown
Error Correction Type: None
System Type: Data
Associativity: 4-way Set-associative
Handle 0x0701, DMI type 7, 19 bytes
Cache Information
Socket Designation: Not Specified
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Varies With Memory Address
Location: Internal
Installed Size: 2048 KB
Maximum Size: 2048 KB
Supported SRAM Types:
Pipeline Burst
Installed SRAM Type: Pipeline Burst
Speed: 15 ns
Error Correction Type: None
System Type: Unified
Associativity: Other
Handle 0x0800, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: PARALLEL
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: DB-25 female
Port Type: Parallel Port PS/2
Handle 0x0801, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: SERIAL1
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: DB-9 male
Port Type: Serial Port 16550A Compatible
Handle 0x0803, DMI type 126, 9 bytes
Inactive
Handle 0x0804, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: USB
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0805, DMI type 126, 9 bytes
Inactive
Handle 0x0806, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: MONITOR
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: DB-15 female
Port Type: Video Port
Handle 0x0808, DMI type 126, 9 bytes
Inactive
Handle 0x0809, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: IrDA
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Infrared
Port Type: Other
Handle 0x080A, DMI type 126, 9 bytes
Inactive
Handle 0x080C, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: Modem
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: RJ-11
Port Type: Modem Port
Handle 0x080D, DMI type 8, 9 bytes
Port Connector Information
Internal Reference Designator: Ethernet
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: RJ-45
Port Type: Network Port
Handle 0x0900, DMI type 9, 13 bytes
System Slot Information
Designation: PCMCIA 0
Type: 32-bit PC Card (PCMCIA)
Current Usage: Available
Length: Other
ID: Adapter 0, Socket 0
Characteristics:
5.0 V is provided
3.3 V is provided
PC Card-16 is supported
Cardbus is supported
Zoom Video is supported
Modem ring resume is supported
Handle 0x0902, DMI type 126, 13 bytes
Inactive
Handle 0x0904, DMI type 9, 13 bytes
System Slot Information
Designation: MiniPCI
Type: 32-bit Other
Current Usage: Available
Length: Other
Characteristics:
5.0 V is provided
3.3 V is provided
PME signal is supported
Handle 0x0A00, DMI type 10, 6 bytes
On Board Device Information
Type: Video
Status: Enabled
Description: Intel 915GM Graphics
Handle 0x0A01, DMI type 10, 6 bytes
On Board Device Information
Type: Sound
Status: Enabled
Description: Sigmatel 9751
Handle 0x0B00, DMI type 11, 5 bytes
OEM Strings
String 1: Dell System
String 2: 5[0003]
String 3: 13[PP11L]
Handle 0x0D00, DMI type 13, 22 bytes
BIOS Language Information
Installable Languages: 1
en|US|iso8859-1
Currently Installed Language: en|US|iso8859-1
Handle 0x1000, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: None
Maximum Capacity: 4 GB
Error Information Handle: Not Provided
Number Of Devices: 2
Handle 0x1100, DMI type 17, 27 bytes
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: DIMM
Set: None
Locator: DIMM_A
Bank Locator: Not Specified
Type: DDR
Type Detail: Synchronous
Speed: 533 MHz (1.9 ns)
Manufacturer: C100000000000000
Serial Number: 02132010
Asset Tag: Not Specified
Part Number: Not Specified
Handle 0x1101, DMI type 17, 27 bytes
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor: DIMM
Set: None
Locator: DIMM_B
Bank Locator: Not Specified
Type: DDR
Type Detail: Synchronous
Speed: 533 MHz (1.9 ns)
Manufacturer: C100000000000000
Serial Number: 02132216
Asset Tag: Not Specified
Part Number: Not Specified
Handle 0x1300, DMI type 19, 15 bytes
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0000009FFFF
Range Size: 640 kB
Physical Array Handle: 0x1000
Partition Width: 0
Handle 0x1301, DMI type 19, 15 bytes
Memory Array Mapped Address
Starting Address: 0x00000100000
Ending Address: 0x0007FFFFFFF
Range Size: 2047 MB
Physical Array Handle: 0x1000
Partition Width: 0
Handle 0x1400, DMI type 20, 19 bytes
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0000009FFFF
Range Size: 640 kB
Physical Device Handle: 0x1100
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Handle 0x1401, DMI type 20, 19 bytes
Memory Device Mapped Address
Starting Address: 0x00000100000
Ending Address: 0x0003FFFFFFF
Range Size: 1023 MB
Physical Device Handle: 0x1100
Memory Array Mapped Address Handle: 0x1301
Partition Row Position: 1
Handle 0x1402, DMI type 20, 19 bytes
Memory Device Mapped Address
Starting Address: 0x00040000000
Ending Address: 0x0007FFFFFFF
Range Size: 1 GB
Physical Device Handle: 0x1101
Memory Array Mapped Address Handle: 0x1301
Partition Row Position: 1
Handle 0x1500, DMI type 21, 7 bytes
Built-in Pointing Device
Type: Touch Pad
Interface: Bus Mouse
Buttons: 2
Handle 0x1600, DMI type 22, 26 bytes
Portable Battery
Location: Sys. Battery Bay
Manufacturer: Samsung SDI
Name: DELL C129563
Design Capacity: 48000 mWh
Design Voltage: 11100 mV
SBDS Version: 1.0
Maximum Error: 3%
SBDS Serial Number: 7734
SBDS Manufacture Date: 2006-03-11
SBDS Chemistry: LION
OEM-specific Information: 0x00000001
Handle 0x1601, DMI type 126, 26 bytes
Inactive
Handle 0x1602, DMI type 126, 26 bytes
Inactive
Handle 0x1B00, DMI type 27, 12 bytes
Cooling Device
Type: Fan
Status: OK
OEM-specific Information: 0x0000DD00
Handle 0x1C00, DMI type 28, 20 bytes
Temperature Probe
Description: CPU Internal Temperature
Location: Processor
Status: OK
Maximum Value: 127.0 deg C
Minimum Value 0.0 deg C
Resolution: 1.000 deg C
Tolerance: 0.5 deg C
Accuracy: Unknown
OEM-specific Information: 0x0000DC00
Handle 0x2000, DMI type 32, 11 bytes
System Boot Information
Status: No errors detected
Handle 0xB000, DMI type 176, 5 bytes
OEM-specific Type
Header and Data:
B0 05 00 B0 00
Handle 0xB100, DMI type 177, 12 bytes
OEM-specific Type
Header and Data:
B1 0C 00 B1 01 00 00 00 00 00 00 00
Handle 0xD000, DMI type 208, 10 bytes
OEM-specific Type
Header and Data:
D0 0A 00 D0 01 04 FE 00 82 01
Handle 0xD100, DMI type 209, 12 bytes
OEM-specific Type
Header and Data:
D1 0C 00 D1 00 00 00 03 04 07 80 05
Handle 0xD200, DMI type 210, 12 bytes
OEM-specific Type
Header and Data:
D2 0C 00 D2 F8 03 04 03 06 80 04 05
Handle 0xD300, DMI type 211, 13 bytes
OEM-specific Type
Header and Data:
D3 0D 00 D3 01 04 02 01 00 00 00 00 02
Strings:
Back of System
Handle 0xD800, DMI type 216, 9 bytes
OEM-specific Type
Header and Data:
D8 09 00 D8 01 03 01 F0 03
Strings:
Intel Corp.
1219
Handle 0xD900, DMI type 217, 8 bytes
OEM-specific Type
Header and Data:
D9 08 00 D9 01 02 01 03
Strings:
US-101
Proprietary
Handle 0xDB00, DMI type 219, 9 bytes
OEM-specific Type
Header and Data:
DB 09 00 DB 03 01 02 03 FF
Strings:
System Device Bay
Floppy, Battery, CD-ROM, CD-RW, DVD, DVD+RW, DVD+/-RW, Hard Disk
CDRW+DVD
Handle 0xDB80, DMI type 126, 9 bytes
Inactive
Handle 0xDB81, DMI type 126, 9 bytes
Inactive
Handle 0x8100, DMI type 129, 8 bytes
OEM-specific Type
Header and Data:
81 08 00 81 01 01 02 01
Strings:
Intel_ASF
Dell_ASF_001
Handle 0xDC00, DMI type 220, 22 bytes
OEM-specific Type
Header and Data:
DC 16 00 DC 01 F0 00 00 02 F0 00 00 00 00 03 F0
04 F0 00 00 00 00
Handle 0xDD00, DMI type 221, 19 bytes
OEM-specific Type
Header and Data:
DD 13 00 DD 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
Handle 0xD400, DMI type 212, 237 bytes
OEM-specific Type
Header and Data:
D4 ED 00 D4 70 00 71 00 00 10 2D 2E 5C 00 78 BF
40 5D 00 78 BF 00 65 00 21 F7 00 66 00 21 F7 08
5E 00 23 FE 01 5F 00 23 FE 00 F1 00 21 FC 00 F2
00 21 FC 01 F3 00 21 FC 02 0F 00 26 F8 00 11 00
26 F8 01 05 00 26 F8 02 12 00 26 F8 03 06 00 26
F8 04 31 00 26 8F 00 32 00 26 8F 10 33 00 26 8F
20 34 00 26 8F 30 35 00 26 8F 40 07 00 25 F8 00
0B 00 25 F8 01 0C 00 25 F8 02 0D 00 25 F8 03 28
00 23 F3 00 29 00 23 F3 04 2A 00 23 F3 08 2B 00
58 00 00 2C 00 59 00 00 E7 00 1D F3 04 E6 00 1D
F3 00 0E 01 23 FD 02 0F 01 23 FD 00 9B 00 23 EF
10 9C 00 23 EF 00 87 00 11 FD 02 88 00 11 FD 00
E8 00 23 DF 20 E9 00 23 DF 00 51 01 22 F7 00 50
01 22 F7 08 12 01 34 FB 04 13 01 34 FB 00 08 00
1D DF 00 03 00 1D DF 00 FF FF 00 00 00
Handle 0xD401, DMI type 212, 127 bytes
OEM-specific Type
Header and Data:
D4 7F 01 D4 70 00 71 00 03 40 49 4A 42 00 48 7F
80 43 00 48 7F 00 55 00 47 BF 00 6D 00 47 BF 40
0C 01 46 FB 04 0D 01 46 FB 00 14 01 46 E7 00 15
01 46 E7 08 16 01 46 E7 10 0A 01 48 EF 10 0B 01
48 EF 00 2D 00 48 DF 20 2E 00 48 DF 00 11 01 48
BF 00 10 01 48 BF 40 F0 00 46 DF 20 ED 00 46 DF
00 41 01 46 FE 01 40 01 46 FE 00 EA 00 67 F3 00
EB 00 67 F3 04 EC 00 67 F3 08 FF FF 00 00 00
Handle 0xDE00, DMI type 222, 13 bytes
OEM-specific Type
Header and Data:
DE 0D 00 DE 01 02 FF FF 00 00 00 00 00
Handle 0x7F00, DMI type 127, 4 bytes
End Of Table
UnixAgent-2.4.2/resources/dmidecode-openbsd-3.7 0000664 0000000 0000000 00000040102 13327377321 0021235 0 ustar 00root root 0000000 0000000 # dmidecode 2.6
Legacy DMI 2.0 present.
41 structures occupying 1014 bytes.
Table at 0x000F0800.
Handle 0x0000
DMI type 0, 18 bytes.
BIOS Information
Vendor: Award Software International, Inc.
Version: 4.51 PG
Release Date: 02/11/99
Address: 0xE0000
Runtime Size: 128 kB
ROM Size: 256 kB
Characteristics:
ISA is supported
PCI is supported
PNP is supported
APM is supported
BIOS is upgradeable
BIOS shadowing is allowed
ESCD support is available
Boot from CD is supported
Selectable boot is supported
BIOS ROM is socketed
EDD is supported
5.25"/360 KB floppy services are supported (int 13h)
5.25"/1.2 MB floppy services are supported (int 13h)
3.5"/720 KB floppy services are supported (int 13h)
3.5"/2.88 MB floppy services are supported (int 13h)
Print screen service is supported (int 5h)
8042 keyboard services are supported (int 9h)
Serial services are supported (int 14h)
Printer services are supported (int 17h)
CGA/mono video services are supported (int 10h)
Handle 0x0001
DMI type 1, 8 bytes.
System Information
Manufacturer: VIA Technologies, Inc.
Product Name: VT82C691
Version:
Serial Number:
Handle 0x0002
DMI type 2, 8 bytes.
Base Board Information
Manufacturer: Tekram Technology Co., Ltd.
Product Name: P6PROA5
Version: Rev. 1.0
Serial Number:
Handle 0x0003
DMI type 3, 9 bytes.
Chassis Information
Manufacturer:
Type: Unknown
Lock: Not Present
Version:
Serial Number:
Asset Tag:
Handle 0x0004
DMI type 4, 26 bytes.
Processor Information
Socket Designation: SLOT 1
Type: Central Processor
Family: Pentium II
Manufacturer: Intel
ID: 52 06 00 00 FF F9 83 01
Signature: Type 0, Family 6, Model 5, Stepping 2
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
MMX (MMX technology supported)
FXSR (Fast floating-point save and restore)
Version: Pentium II
Voltage: 3.3 V
External Clock: 100 MHz
Max Speed: 500 MHz
Current Speed: 400 MHz
Status: Populated, Enabled
Upgrade: Slot 1
Handle 0x0005
DMI type 5, 31 bytes.
Memory Controller Information
Error Detecting Method: 64-bit ECC
Error Correcting Capabilities:
Single-bit Error Correcting
Supported Interleave: Four-way Interleave
Current Interleave: One-way Interleave
Maximum Memory Module Size: 256 MB
Maximum Total Memory Size: 2048 MB
Supported Speeds:
70 ns
60 ns
Supported Memory Types:
Other
Unknown
Standard
FPM
EDO
Parity
ECC
SIMM
DIMM
SDRAM
Memory Module Voltage: 5.0 V 3.3 V
Associated Memory Slots: 8
0x0006
0x0007
0x0008
0x0009
0x000A
0x000B
0x000C
0x000D
Handle 0x0007
DMI type 6, 12 bytes.
Memory Module Information
Socket Designation: BANK_1
Bank Connections: 2
Current Speed: 70 ns
Type: Unknown
Installed Size: Not Installed
Enabled Size: Not Installed
Error Status: OK
Handle 0x0008
DMI type 6, 12 bytes.
Memory Module Information
Socket Designation: BANK_2
Bank Connections: 3
Current Speed: 70 ns
Type: DIMM SDRAM
Installed Size: 64 MB (Single-bank Connection)
Enabled Size: 64 MB (Single-bank Connection)
Error Status: OK
Handle 0x0009
DMI type 6, 12 bytes.
Memory Module Information
Socket Designation: BANK_3
Bank Connections: 4
Current Speed: 70 ns
Type: Unknown
Installed Size: Not Installed
Enabled Size: Not Installed
Error Status: OK
Handle 0x000A
DMI type 6, 12 bytes.
Memory Module Information
Socket Designation: BANK_4
Bank Connections: 5
Current Speed: 70 ns
Type: DIMM SDRAM
Installed Size: 64 MB (Single-bank Connection)
Enabled Size: 64 MB (Single-bank Connection)
Error Status: OK
Handle 0x000B
DMI type 6, 12 bytes.
Memory Module Information
Socket Designation: BANK_5
Bank Connections: 6
Current Speed: 70 ns
Type: DIMM SDRAM
Installed Size: 64 MB (Single-bank Connection)
Enabled Size: 64 MB (Single-bank Connection)
Error Status: OK
Handle 0x000C
DMI type 6, 12 bytes.
Memory Module Information
Socket Designation: BANK_6
Bank Connections: 7
Current Speed: 70 ns
Type: Unknown
Installed Size: Not Installed
Enabled Size: Not Installed
Error Status: OK
Handle 0x000D
DMI type 6, 12 bytes.
Memory Module Information
Socket Designation: BANK_7
Bank Connections: 8
Current Speed: 70 ns
Type: Unknown
Installed Size: Not Installed
Enabled Size: Not Installed
Error Status: OK
Handle 0x000E
DMI type 7, 15 bytes.
Cache Information
Socket Designation: Internal Cache
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Back
Location: Internal
Installed Size: 32 KB
Maximum Size: 32 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Handle 0x000F
DMI type 7, 15 bytes.
Cache Information
Socket Designation: External Cache
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Write Back
Location: External
Installed Size: 512 KB
Maximum Size: 2048 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Handle 0x0010
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: PRIMARY IDE
Internal Connector Type: On Board IDE
External Reference Designator:
External Connector Type: None
Port Type: Other
Handle 0x0011
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: SECONDARY IDE
Internal Connector Type: On Board IDE
External Reference Designator:
External Connector Type: None
Port Type: Other
Handle 0x0012
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: FLOPPY
Internal Connector Type: On Board Floppy
External Reference Designator:
External Connector Type: None
Port Type: Other
Handle 0x0013
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: COM1
Internal Connector Type: 9 Pin Dual Inline (pin 10 cut)
External Reference Designator:
External Connector Type: DB-9 male
Port Type: Serial Port 16550 Compatible
Handle 0x0014
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: COM2
Internal Connector Type: 9 Pin Dual Inline (pin 10 cut)
External Reference Designator:
External Connector Type: DB-9 male
Port Type: Serial Port 16550 Compatible
Handle 0x0015
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: LPT1
Internal Connector Type: DB-25 female
External Reference Designator:
External Connector Type: DB-25 female
Port Type: Parallel Port ECP/EPP
Handle 0x0016
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Keyboard
Internal Connector Type: Other
External Reference Designator:
External Connector Type: PS/2
Port Type: Keyboard Port
Handle 0x0017
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: PS/2 Mouse
Internal Connector Type: Other
External Reference Designator:
External Connector Type: PS/2
Port Type: Mouse Port
Handle 0x0018
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: IR_CON
Internal Connector Type: Other
External Reference Designator:
External Connector Type: Infrared
Port Type: Other
Handle 0x0019
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: IR_CON2
Internal Connector Type: Other
External Reference Designator:
External Connector Type: Infrared
Port Type: Other
Handle 0x001A
DMI type 9, 12 bytes.
System Slot Information
Designation: AGP
Type: 32-bit PCI
Current Usage: In Use
Length: Long
ID: 32
Characteristics:
5.0 V is provided
Handle 0x001B
DMI type 9, 12 bytes.
System Slot Information
Designation: PCI1
Type: 32-bit PCI
Current Usage: Available
Length: Long
ID: 12
Characteristics:
5.0 V is provided
Handle 0x001C
DMI type 9, 12 bytes.
System Slot Information
Designation: PCI2
Type: 32-bit PCI
Current Usage: Available
Length: Long
ID: 11
Characteristics:
5.0 V is provided
Handle 0x001D
DMI type 9, 12 bytes.
System Slot Information
Designation: PCI3
Type: 32-bit PCI
Current Usage: In Use
Length: Long
ID: 10
Characteristics:
5.0 V is provided
Handle 0x001E
DMI type 9, 12 bytes.
System Slot Information
Designation: PCI4
Type: 32-bit PCI
Current Usage: Available
Length: Long
ID: 9
Characteristics:
5.0 V is provided
Handle 0x001F
DMI type 9, 12 bytes.
System Slot Information
Designation: PCI5
Type: 32-bit PCI
Current Usage: Available
Length: Long
ID: 8
Characteristics:
5.0 V is provided
Handle 0x0020
DMI type 9, 12 bytes.
System Slot Information
Designation: ISA
Type: 16-bit ISA
Current Usage: Unknown
Length: Long
Characteristics:
5.0 V is provided
Handle 0x0021
DMI type 9, 12 bytes.
System Slot Information
Designation: ISA
Type: 16-bit ISA
Current Usage: Unknown
Length: Long
Characteristics:
5.0 V is provided
Handle 0x0022
DMI type 9, 12 bytes.
System Slot Information
Designation: PCIx
Type: 32-bit PCI
Current Usage: Unknown
Length: Long
ID: 0
Characteristics:
5.0 V is provided
Handle 0x0023
DMI type 9, 12 bytes.
System Slot Information
Designation: PCIx
Type: 32-bit PCI
Current Usage: Unknown
Length: Long
ID: 0
Characteristics:
5.0 V is provided
Handle 0x0024
DMI type 9, 12 bytes.
System Slot Information
Designation: PCIx
Type: 32-bit PCI
Current Usage: Unknown
Length: Long
ID: 0
Characteristics:
5.0 V is provided
Handle 0x0025
DMI type 9, 12 bytes.
System Slot Information
Designation: PCIx
Type: 32-bit PCI
Current Usage: Unknown
Length: Long
ID: 0
Characteristics:
5.0 V is provided
Handle 0x0026
DMI type 9, 12 bytes.
System Slot Information
Designation: PCIx
Type: 32-bit PCI
Current Usage: Unknown
Length: Long
ID: 0
Characteristics:
5.0 V is provided
Handle 0x0027
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: USB
Internal Connector Type: Other
External Reference Designator:
External Connector Type: Other
Port Type: USB
Handle 0x0028
DMI type 13, 22 bytes.
BIOS Language Information
Installable Languages: 3
en|US|iso8859-1
fr|CA|iso8859-1
ja|JP|unicode
Currently Installed Language: en|US|iso8859-1
Wrong DMI structures count: 41 announced, only 40 decoded.
UnixAgent-2.4.2/resources/dmidecode-openbsd-3.8 0000664 0000000 0000000 00000067563 13327377321 0021262 0 ustar 00root root 0000000 0000000 dmidecode 2.6
SMBIOS 2.3 present.
82 structures occupying 3043 bytes.
Table at 0x000FA4C0.
Handle 0xDA00
DMI type 218, 11 bytes.
OEM-specific Type
Header and Data:
DA 0B 00 DA B2 00 17 00 0E 20 00
Handle 0x0000
DMI type 0, 20 bytes.
BIOS Information
Vendor: Dell Computer Corporation
Version: A05
Release Date: 09/21/2005
Address: 0xF0000
Runtime Size: 64 kB
ROM Size: 1024 kB
Characteristics:
ISA is supported
PCI is supported
PNP is supported
BIOS is upgradeable
BIOS shadowing is allowed
ESCD support is available
Boot from CD is supported
Selectable boot is supported
EDD is supported
Japanese floppy for Toshiba 1.2 MB is supported (int 13h)
5.25"/360 KB floppy services are supported (int 13h)
5.25"/1.2 MB floppy services are supported (int 13h)
3.5"/720 KB floppy services are supported (int 13h)
Print screen service is supported (int 5h)
8042 keyboard services are supported (int 9h)
Serial services are supported (int 14h)
Printer services are supported (int 17h)
CGA/mono video services are supported (int 10h)
ACPI is supported
USB legacy is supported
LS-120 boot is supported
BIOS boot specification is supported
Function key-initiated network boot is supported
Handle 0x0100
DMI type 1, 25 bytes.
System Information
Manufacturer: Dell Computer Corporation
Product Name: PowerEdge 1800
Version: Not Specified
Serial Number: 2K1012J
UUID: 44454C4C-4B00-1031-8030-B2C04F31324A
Wake-up Type: Power Switch
Handle 0x0200
DMI type 2, 9 bytes.
Base Board Information
Manufacturer: Dell Computer Corporation
Product Name: 0P8611
Version: A04
Serial Number: ..CN717035A80217.
Handle 0x0300
DMI type 3, 17 bytes.
Chassis Information
Manufacturer: Dell Computer Corporation
Type: Main Server Chassis
Lock: Present
Version: Not Specified
Serial Number: 2K1012J
Asset Tag: Not Specified
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: Unknown
OEM Information: 0x00000000
Handle 0x0400
DMI type 4, 35 bytes.
Processor Information
Socket Designation: PROC_1
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: 43 0F 00 00 FF FB EB BF
Signature: Type 0, Family 15, Model 4, Stepping 3
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (Fast floating-point save and restore)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Hyper-threading technology)
TM (Thermal monitor supported)
PBE (Pending break enabled)
Version: Not Specified
Voltage: 1.4 V
External Clock: 800 MHz
Max Speed: 3600 MHz
Current Speed: 3000 MHz
Status: Populated, Enabled
Upgrade: ZIF Socket
L1 Cache Handle: 0x0700
L2 Cache Handle: 0x0701
L3 Cache Handle: 0x0702
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Handle 0x0401
DMI type 4, 35 bytes.
Processor Information
Socket Designation: PROC_2
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: 00 00 00 00 00 00 00 00
Signature: Type 0, Family 0, Model 0, Stepping 0
Flags: None
Version: Not Specified
Voltage: 1.4 V
External Clock: Unknown
Max Speed: 3600 MHz
Current Speed: Unknown
Status: Unpopulated
Upgrade: ZIF Socket
L1 Cache Handle: 0x0703
L2 Cache Handle: 0x0704
L3 Cache Handle: 0x0705
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Handle 0x0700
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Not Specified
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Through
Location: Internal
Installed Size: 16 KB
Maximum Size: 16 KB
Supported SRAM Types:
Unknown
Installed SRAM Type: Unknown
Speed: Unknown
Error Correction Type: Parity
System Type: Data
Associativity: 8-way Set-associative
Handle 0x0701
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Not Specified
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Write Back
Location: Internal
Installed Size: 2048 KB
Maximum Size: 2048 KB
Supported SRAM Types:
Unknown
Installed SRAM Type: Unknown
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unified
Associativity: 8-way Set-associative
Handle 0x0702
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Not Specified
Configuration: Enabled, Not Socketed, Level 3
Operational Mode: Write Back
Location: Internal
Installed Size: 0 KB
Maximum Size: 0 KB
Supported SRAM Types:
Unknown
Installed SRAM Type: Unknown
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unified
Associativity: 2-way Set-associative
Handle 0x0703
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Not Specified
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Through
Location: Internal
Installed Size: 0 KB
Maximum Size: 16 KB
Supported SRAM Types:
Unknown
Installed SRAM Type: Unknown
Speed: Unknown
Error Correction Type: Parity
System Type: Data
Associativity: 8-way Set-associative
Handle 0x0704
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Not Specified
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Write Back
Location: Internal
Installed Size: 0 KB
Maximum Size: 2048 KB
Supported SRAM Types:
Unknown
Installed SRAM Type: Unknown
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unified
Associativity: 8-way Set-associative
Handle 0x0705
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Not Specified
Configuration: Enabled, Not Socketed, Level 3
Operational Mode: Write Back
Location: Internal
Installed Size: 0 KB
Maximum Size: 0 KB
Supported SRAM Types:
Unknown
Installed SRAM Type: Unknown
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unified
Associativity: 2-way Set-associative
Handle 0x0800
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: SCSI
Internal Connector Type: 68 Pin Dual Inline
External Reference Designator: Not Specified
External Connector Type: None
Port Type: SCSI Wide
Handle 0x0801
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: DB-15 female
Port Type: Video Port
Handle 0x0802
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0803
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0804
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0805
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0806
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: DB-25 female
Port Type: Parallel Port PS/2
Handle 0x0807
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: RJ-45
Port Type: Network Port
Handle 0x0808
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: DB-9 male
Port Type: Serial Port 16550A Compatible
Handle 0x0809
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: PS/2
Port Type: Keyboard Port
Handle 0x080A
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: Not Specified
External Connector Type: PS/2
Port Type: Mouse Port
Handle 0x0900
DMI type 9, 13 bytes.
System Slot Information
Designation: SLOT1
Type: 64-bit PCI
Current Usage: Available
Length: Long
ID: 1
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0901
DMI type 9, 13 bytes.
System Slot Information
Designation: SLOT2
Type:
Current Usage: Available
Length: Long
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0902
DMI type 9, 13 bytes.
System Slot Information
Designation: SLOT3
Type:
Current Usage: Available
Length: Long
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0903
DMI type 9, 13 bytes.
System Slot Information
Designation: SLOT4
Type: 32-bit PCI
Current Usage: Available
Length: Long
ID: 4
Characteristics:
5.0 V is provided
PME signal is supported
Handle 0x0904
DMI type 9, 13 bytes.
System Slot Information
Designation: SLOT5
Type: 64-bit PCI-X
Current Usage: In Use
Length: Long
ID: 5
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0905
DMI type 9, 13 bytes.
System Slot Information
Designation: SLOT6
Type: 64-bit PCI-X
Current Usage: Available
Length: Long
ID: 6
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0A00
DMI type 10, 10 bytes.
On Board Device 1 Information
Type: SCSI Controller
Status: Enabled
Description: LSI Logic 53C1020 Ultra 320 SCSI
On Board Device 2 Information
Type: Video
Status: Enabled
Description: ATI RADEON 7000 PCI Video
On Board Device 3 Information
Type: Ethernet
Status: Enabled
Description: Intel 82541GI Gigabit Ethernet
Handle 0x0B00
DMI type 11, 5 bytes.
OEM Strings
String 1: Dell System
String 2: 5[0000]
Handle 0x7E00
DMI type 126, 144 bytes.
Inactive
Handle 0x0C00
DMI type 12, 5 bytes.
System Configuration Options
Option 1: NVRAM_CLR: Clear user settable NVRAM areas and set defaults
Option 2: PASSWD: Close to enable password
Handle 0x0D00
DMI type 13, 22 bytes.
BIOS Language Information
Installable Languages: 1
en|US|iso8859-1
Currently Installed Language: en|US|iso8859-1
Handle 0x1000
DMI type 16, 15 bytes.
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Multi-bit ECC
Maximum Capacity: 12 GB
Error Information Handle: Not Provided
Number Of Devices: 6
Handle 0x1100
DMI type 17, 27 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 512 MB
Form Factor: DIMM
Set: 1
Locator: DIMM1_A
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: 400 MHz (2.5 ns)
Manufacturer: CE00000000000000
Serial Number: 50075483
Asset Tag: 010552
Part Number: M3 93T6450FZ0-CCC
Handle 0x1101
DMI type 17, 27 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 512 MB
Form Factor: DIMM
Set: 1
Locator: DIMM1_B
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: 400 MHz (2.5 ns)
Manufacturer: CE00000000000000
Serial Number: 500355A1
Asset Tag: 010552
Part Number: M3 93T6450FZ0-CCC
Handle 0x1102
DMI type 17, 27 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: DIMM
Set: 2
Locator: DIMM2_A
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: 400 MHz (2.5 ns)
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Handle 0x1103
DMI type 17, 27 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: DIMM
Set: 2
Locator: DIMM2_B
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: 400 MHz (2.5 ns)
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Handle 0x1104
DMI type 17, 27 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: DIMM
Set: 3
Locator: DIMM3_A
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: 400 MHz (2.5 ns)
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Handle 0x1105
DMI type 17, 27 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: DIMM
Set: 3
Locator: DIMM3_B
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: 400 MHz (2.5 ns)
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Handle 0x1300
DMI type 19, 15 bytes.
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0003FFFFFFF
Range Size: 1 GB
Physical Array Handle: 0x1000
Partition Width: 0
Handle 0x1301
DMI type 126, 15 bytes.
Inactive
Handle 0x1400
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0003FFFFFFF
Range Size: 1 GB
Physical Device Handle: 0x1100
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Handle 0x1401
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0003FFFFFFF
Range Size: 1 GB
Physical Device Handle: 0x1101
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 2
Handle 0x1402
DMI type 126, 19 bytes.
Inactive
Handle 0x1403
DMI type 126, 19 bytes.
Inactive
Handle 0x1404
DMI type 126, 19 bytes.
Inactive
Handle 0x1405
DMI type 126, 19 bytes.
Inactive
Handle 0x1406
DMI type 126, 19 bytes.
Inactive
Handle 0x1407
DMI type 126, 19 bytes.
Inactive
Handle 0x1408
DMI type 126, 19 bytes.
Inactive
Handle 0x1409
DMI type 126, 19 bytes.
Inactive
Handle 0x140A
DMI type 126, 19 bytes.
Inactive
Handle 0x140B
DMI type 126, 19 bytes.
Inactive
Handle 0x140C
DMI type 126, 19 bytes.
Inactive
Handle 0x140D
DMI type 126, 19 bytes.
Inactive
Handle 0x1420
DMI type 126, 19 bytes.
Inactive
Handle 0x1421
DMI type 126, 19 bytes.
Inactive
Handle 0x1424
DMI type 126, 19 bytes.
Inactive
Handle 0x1425
DMI type 126, 19 bytes.
Inactive
Handle 0x1428
DMI type 126, 19 bytes.
Inactive
Handle 0x1429
DMI type 126, 19 bytes.
Inactive
Handle 0x1430
DMI type 126, 19 bytes.
Inactive
Handle 0x1431
DMI type 126, 19 bytes.
Inactive
Handle 0x1434
DMI type 126, 19 bytes.
Inactive
Handle 0x1435
DMI type 126, 19 bytes.
Inactive
Handle 0x1438
DMI type 126, 19 bytes.
Inactive
Handle 0x1439
DMI type 126, 19 bytes.
Inactive
Handle 0x2000
DMI type 32, 11 bytes.
System Boot Information
Status: No errors detected
Handle 0x2600
DMI type 38, 18 bytes.
IPMI Device Information
Interface Type: KCS (Keyboard Control Style)
Specification Version: 1.5
I2C Slave Address: 0x10
NV Storage Device: Not Present
Base Address: 0x0000000000000CA8 (I/O)
Register Spacing: 32-bit Boundaries
Handle 0xD000
DMI type 208, 10 bytes.
OEM-specific Type
Header and Data:
D0 0A 00 D0 01 05 FE 00 83 01
Handle 0xD100
DMI type 209, 12 bytes.
OEM-specific Type
Header and Data:
D1 0C 00 D1 78 03 07 03 04 0F 80 05
Handle 0xD200
DMI type 210, 12 bytes.
OEM-specific Type
Header and Data:
D2 0C 00 D2 F8 03 04 03 06 80 04 05
Handle 0xD400
DMI type 212, 167 bytes.
OEM-specific Type
Header and Data:
D4 A7 00 D4 70 00 71 00 00 10 2D 2E 03 00 11 7F
80 04 00 11 7F 00 07 00 25 9F 00 08 00 25 9F 20
09 00 25 9F 40 0A 00 25 9F 60 0B 00 25 7F 00 0C
00 25 7F 80 0F 00 25 F8 00 11 00 25 F8 01 12 00
25 F8 02 2E 40 25 F8 03 2F 40 25 F8 04 00 00 25
F8 05 42 00 11 FE 01 43 00 11 FE 00 44 00 11 9F
20 45 00 11 9F 00 31 40 11 FB 00 32 40 11 FB 04
9D 00 11 FD 02 9E 00 11 FD 00 9F 00 26 FE 01 A0
00 26 FE 00 51 00 26 3F 00 52 00 26 3F 40 53 00
26 3F 80 54 00 26 3F C0 28 40 26 DF 20 29 40 26
DF 00 FF FF 00 00 00
Handle 0xD401
DMI type 212, 202 bytes.
OEM-specific Type
Header and Data:
D4 CA 01 D4 70 00 71 00 03 40 59 6D 6B 00 78 7F
80 6C 00 78 7F 00 58 00 78 FA 05 59 00 78 FA 00
5C 00 78 BF 40 5D 00 78 BF 00 04 80 78 FD 02 01
A0 78 FD 00 08 40 51 FE 01 09 40 51 FE 00 0A 40
51 FD 02 0B 40 51 FD 00 19 00 55 E7 00 1A 00 55
E7 08 1B 00 55 E7 10 FF 00 55 9F 40 FE 00 55 9F
20 FD 00 55 9F 00 1E 00 55 FD 00 50 00 55 FD 02
8A 00 55 FE 01 8B 00 55 FE 00 BF 00 53 FE 00 C0
00 53 FE 01 33 40 53 E7 00 34 40 53 E7 08 35 40
53 E7 10 36 40 53 E7 18 1A 40 53 FD 02 1B 40 53
FD 00 1C 40 53 FB 04 1D 40 53 FB 00 6E 00 58 FC
01 2D 00 58 FC 02 2E 00 58 FC 00 22 40 58 EF 10
23 40 58 EF 00 FF FF 00 00 00
Handle 0xD402
DMI type 212, 47 bytes.
OEM-specific Type
Header and Data:
D4 2F 02 D4 70 00 71 00 03 40 59 6D D8 00 55 7F
80 D9 00 55 7F 00 00 C0 5C 00 0A 03 C0 67 00 05
83 00 76 00 00 84 00 77 00 00 FF FF 00 00 00
Handle 0xD403
DMI type 212, 177 bytes.
OEM-specific Type
Header and Data:
D4 B1 03 D4 72 00 73 00 00 40 5D 5E 28 01 4A FC
00 29 01 4A FC 01 2A 01 4A FC 02 02 40 4A F7 00
01 40 4A F7 08 D1 00 7E FE 00 D2 00 7E FE 01 2A
40 7E FB 00 2B 40 7E FB 04 D3 00 00 00 02 D4 00
06 00 02 00 90 2C 00 00 01 90 2D 00 00 17 01 4B
FE 00 18 01 4B FE 01 19 01 4B FD 00 1A 01 4B FD
02 35 01 4C FC 00 37 01 4C FC 01 39 01 4C FC 02
3B 01 4C F3 04 3D 01 4C F3 08 DE 00 76 FE 01 26
40 42 FE 01 27 40 42 FE 00 37 40 42 FB 00 38 40
42 FB 04 00 00 47 FE 01 00 00 47 FE 00 A1 00 48
FC 02 A3 00 48 FC 01 A2 00 48 FC 00 FF FF 00 00
00
Handle 0xD800
DMI type 216, 9 bytes.
OEM-specific Type
Header and Data:
D8 09 00 D8 01 02 01 00 00
Strings:
ATI
RADEON 7000 V6.11
Handle 0xDE00
DMI type 222, 15 bytes.
OEM-specific Type
Header and Data:
DE 0F 00 DE 01 04 FF FF 00 00 00 00 00 00 00
Handle 0x7F00
DMI type 127, 4 bytes.
End Of Table
UnixAgent-2.4.2/resources/dmidecode.rhel.2.1 0000664 0000000 0000000 00000013425 13327377321 0020540 0 ustar 00root root 0000000 0000000 PNP BIOS present.
PNP BIOS present.
SYSID present.
SMBIOS 2.3 present.
DMI 2.3 present.
40 structures occupying 1146 bytes.
DMI table at 0x000FAC20.
Handle 0x0000
DMI type 0, 20 bytes.
BIOS Information Block
Vendor: IBM
Version: -[JPE130AUS-1.30]-
Release: 12/11/2002
BIOS base: 0xF0000
ROM size: 448K
Capabilities:
Flags: 0x000000007FFBDE90
Handle 0x0100
DMI type 1, 25 bytes.
System Information Block
Vendor: IBM
Product: -[84803AX]-
Version: IBM CORPORATION
Serial Number: KBKGW40
Handle 0x0200
DMI type 2, 8 bytes.
Board Information Block
Vendor: IBM
Product: -[M51G]-
Version: -1
Serial Number: NA60B7Y0S3Q
Handle 0x0300
DMI type 3, 17 bytes.
Chassis Information Block
Vendor: IBM
Chassis Type: Mini Tower
Lock present
Version: N/A
Serial Number: N/A
Asset Tag: N/A
Handle 0x0400
DMI type 4, 32 bytes.
Processor
Socket Designation: CPU1
Processor Type: Central Processor
Processor Family:
Processor Manufacturer: Intel
Processor Version: Pentium 4
Handle 0x0500
DMI type 5, 20 bytes.
Memory Controller
Handle 0x0600
DMI type 6, 12 bytes.
Memory Bank
Socket: DIMM1
Banks: 0
Type: ECC DIMM SDRAM
Installed Size: 256Mbyte
Enabled Size: 256Mbyte
Handle 0x0601
DMI type 6, 12 bytes.
Memory Bank
Socket: DIMM2
Type: UNKNOWN
Installed Size: Not Installed
Enabled Size: Not Installed
Handle 0x0700
DMI type 7, 19 bytes.
Cache
Socket: CPU1
L1 socketed Internal Cache: write-back
L1 Cache Size: 32K
L1 Cache Maximum: 20K
L1 Cache Type: Unknown
Handle 0x0701
DMI type 7, 19 bytes.
Cache
Socket: CPU1
L2 socketed Internal Cache: write-back
L2 Cache Size: 512K
L2 Cache Maximum: 512K
L2 Cache Type: Pipeline burst
Handle 0x0800
DMI type 8, 9 bytes.
Port Connector
Internal Designator:
Internal Connector Type: None
External Designator: SERIAL1
External Connector Type: DB-9 pin male
Port Type: Serial Port 16650A Compatible
Handle 0x0801
DMI type 8, 9 bytes.
Port Connector
Internal Designator:
Internal Connector Type: None
External Designator: SERIAL2
External Connector Type: DB-9 pin male
Port Type: Serial Port 16650A Compatible
Handle 0x0802
DMI type 8, 9 bytes.
Port Connector
Internal Designator:
Internal Connector Type: None
External Designator: PRINTER
External Connector Type: DB-25 pin female
Port Type: Parallel Port ECP/EPP
Handle 0x0803
DMI type 8, 9 bytes.
Port Connector
Internal Designator:
Internal Connector Type: None
External Designator: KEYBOARD
External Connector Type: PS/2
Port Type: Keyboard Port
Handle 0x0804
DMI type 8, 9 bytes.
Port Connector
Internal Designator:
Internal Connector Type: None
External Designator: MOUSE
External Connector Type: PS/2
Port Type: Mouse Port
Handle 0x0805
DMI type 8, 9 bytes.
Port Connector
Internal Designator:
Internal Connector Type: None
External Designator: USB1
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0806
DMI type 8, 9 bytes.
Port Connector
Internal Designator:
Internal Connector Type: None
External Designator: USB2
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0807
DMI type 8, 9 bytes.
Port Connector
Internal Designator: IDE1
Internal Connector Type: On Board IDE
External Designator:
External Connector Type: None
Port Type: Other
Handle 0x0808
DMI type 8, 9 bytes.
Port Connector
Internal Designator: IDE2
Internal Connector Type: On Board IDE
External Designator:
External Connector Type: None
Port Type: Other
Handle 0x0809
DMI type 8, 9 bytes.
Port Connector
Internal Designator: FDD
Internal Connector Type: On Board Floppy
External Designator:
External Connector Type: None
Port Type: Other
Handle 0x080A
DMI type 8, 9 bytes.
Port Connector
Internal Designator: SCSI1
Internal Connector Type: SSA SCSI
External Designator:
External Connector Type: None
Port Type: SCSI II
Handle 0x0900
DMI type 9, 12 bytes.
Card Slot
Slot: AGP
Type:
Slot Features: 5v
Handle 0x0901
DMI type 9, 12 bytes.
Card Slot
Slot: PCI1
Type: 32bit PCI
Status: Available.
Slot Features: 5v
Handle 0x0902
DMI type 9, 13 bytes.
Card Slot
Slot: PCI2
Type: 32bit PCI
Status: In use.
Slot Features: 5v
Handle 0x0903
DMI type 9, 13 bytes.
Card Slot
Slot: PCI3
Type: 32bit PCI
Status: Available.
Slot Features: 5v
Handle 0x0904
DMI type 9, 13 bytes.
Card Slot
Slot: PCI4
Type: 32bit PCI
Status: Available.
Slot Features: 5v
Handle 0x0905
DMI type 9, 13 bytes.
Card Slot
Slot: PCI5
Type: 32bit PCI
Status: Available.
Slot Features: 5v
Handle 0x0A00
DMI type 10, 14 bytes.
On Board Devices Information
Description: ATI RAGE XL : Enabled
Type:
Description: Adaptec 7892 SCSI : Enabled
Type:
Description: Broadcom 5702 : Enabled
Type:
Description: AC 97 : Enabled
Type:
Description: IBM Automatic Server Restart - Machine Type 8480 : Enabled
Type:
Handle 0x0D00
DMI type 13, 22 bytes.
BIOS Language Information
Handle 0x0F00
DMI type 15, 39 bytes.
Event Log
Log Area: 511 bytes.
Log Header At: 0.
Log Data At: 16.
Log Type: 3.
Log Valid: Yes.
Handle 0x1000
DMI type 16, 15 bytes.
Physical Memory Array
Handle 0x1100
DMI type 17, 23 bytes.
Memory Device
Handle 0x1101
DMI type 17, 23 bytes.
Memory Device
Handle 0x1300
DMI type 19, 15 bytes.
Memory Array Mapped Address
Handle 0x1400
DMI type 20, 19 bytes.
Memory Device Mapped Address
Handle 0x1401
DMI type 20, 19 bytes.
Memory Device Mapped Address
Handle 0x2000
DMI type 32, 12 bytes.
System Boot Information
Handle 0x2200
DMI type 34, 11 bytes.
01 06 5a 00 00 00 05 ..Z....
Handle 0x8900
DMI type 137, 10 bytes.
01 02 03 04 05 06 ......
Handle 0x7F00
DMI type 127, 4 bytes.
End-of-Table
UnixAgent-2.4.2/resources/dmidecode.rhel.3.4 0000664 0000000 0000000 00000030001 13327377321 0020531 0 ustar 00root root 0000000 0000000 # dmidecode 2.2
SMBIOS 2.33 present.
59 structures occupying 2374 bytes.
Table at 0x7FF77000.
Handle 0x0000
DMI type 0, 20 bytes.
BIOS Information
Vendor: IBM
Version: IBM BIOS Version 1.57-[PME157AUS-1.57]-
Release Date: 08/25/2005
Address: 0xE03F0
Runtime Size: 130064 bytes
ROM Size: 1024 kB
Characteristics:
PCI is supported
PNP is supported
BIOS is upgradeable
BIOS shadowing is allowed
ESCD support is available
Boot from CD is supported
Selectable boot is supported
BIOS ROM is socketed
Print screen service is supported (int 5h)
Serial services are supported (int 14h)
ACPI is supported
USB legacy is supported
BIOS boot specification is supported
Handle 0x0001
DMI type 1, 25 bytes.
System Information
Manufacturer: IBM
Product Name: IBM eServer x226-[8488PCR]-
Version: Not Applicable
Serial Number: KDXPC16
UUID: A8346631-8E88-3AE3-898C-F3AC9F61C316
Wake-up Type: Power Switch
Handle 0x0002
DMI type 2, 8 bytes.
Base Board Information
Manufacturer: IBM
Product Name: MSI-9151 Boards
Version: Not Applicable
Serial Number: #A123456789
Handle 0x0003
DMI type 3, 17 bytes.
Chassis Information
Manufacturer: IBM
Type: Tower
Lock: Not Present
Version: N/A
Serial Number: N/A
Asset Tag: 12345678901234567890123456789012
Boot-up State: Safe
Power Supply State: Safe
Thermal State: Safe
Security Status: None
OEM Information: 0x00001234
Handle 0x0004
DMI type 4, 35 bytes.
Processor Information
Socket Designation: CPU#1
Type: Central Processor
Family: Xeon MP
Manufacturer: Intel Corporation
ID: 41 0F 00 00 FF FB EB BF
Signature: Type 0, Family F, Model 4, Stepping 1
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (Fast floating-point save and restore)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Hyper-threading technology)
TM (Thermal monitor supported)
SBF (Signal break on FERR)
Version: Intel(R) Xeon(TM) CPU 2.80GHz
Voltage: 1.3 V
External Clock: 200 MHz
Max Speed: 3600 MHz
Current Speed: 2800 MHz
Status: Populated, Enabled
Upgrade: ZIF Socket
L1 Cache Handle: 0x0006
L2 Cache Handle: 0x0007
L3 Cache Handle: Not Provided
Serial Number:
Asset Tag:
Part Number:
Handle 0x0005
DMI type 4, 35 bytes.
Processor Information
Socket Designation: CPU#2
Type: Central Processor
Family: Xeon MP
Manufacturer: Intel Corporation
ID: 41 0F 00 00 FF FB EB BF
Signature: Type 0, Family F, Model 4, Stepping 1
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (Fast floating-point save and restore)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Hyper-threading technology)
TM (Thermal monitor supported)
SBF (Signal break on FERR)
Version: Intel(R) Xeon(TM) CPU 2.80GHz
Voltage: 1.3 V
External Clock: 200 MHz
Max Speed: 3600 MHz
Current Speed: 2800 MHz
Status: Populated, Enabled
Upgrade: ZIF Socket
L1 Cache Handle: 0x0009
L2 Cache Handle: 0x000A
L3 Cache Handle: Not Provided
Serial Number:
Asset Tag:
Part Number:
Handle 0x0006
DMI type 7, 19 bytes.
Cache Information
Socket Designation: L1 Cache for CPU#1
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Back
Location: Internal
Installed Size: 16 KB
Maximum Size: 16 KB
Supported SRAM Types:
Burst
Pipeline Burst
Installed SRAM Type: Burst Pipeline Burst
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Data
Associativity: 4-way Set-associative
Handle 0x0007
DMI type 7, 19 bytes.
Cache Information
Socket Designation: L2 Cache for CPU#1
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Write Back
Location: Internal
Installed Size: 1024 KB
Maximum Size: 2048 KB
Supported SRAM Types:
Burst
Pipeline Burst
Installed SRAM Type: Burst
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unified
Associativity: 4-way Set-associative
Handle 0x0008
DMI type 126, 19 bytes.
Inactive
Handle 0x0009
DMI type 7, 19 bytes.
Cache Information
Socket Designation: L1 Cache for CPU#2
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Back
Location: Internal
Installed Size: 16 KB
Maximum Size: 16 KB
Supported SRAM Types:
Burst
Pipeline Burst
Installed SRAM Type: Burst Pipeline Burst
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Data
Associativity: 4-way Set-associative
Handle 0x000A
DMI type 7, 19 bytes.
Cache Information
Socket Designation: L2 Cache for CPU#2
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Write Back
Location: Internal
Installed Size: 1024 KB
Maximum Size: 2048 KB
Supported SRAM Types:
Burst
Pipeline Burst
Installed SRAM Type: Burst
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unified
Associativity: 4-way Set-associative
Handle 0x000B
DMI type 126, 19 bytes.
Inactive
Handle 0x000C
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: J2A1
Internal Connector Type: 9 Pin Dual Inline (pin 10 cut)
External Reference Designator: COM 1
External Connector Type: DB-9 male
Port Type: Serial Port 16550A Compatible
Handle 0x000D
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: J2A2
Internal Connector Type: 9 Pin Dual Inline (pin 10 cut)
External Reference Designator: COM 2
External Connector Type: DB-9 male
Port Type: Serial Port 16550A Compatible
Handle 0x000E
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: J3A1
Internal Connector Type: 25 Pin Dual Inline (pin 26 cut)
External Reference Designator: Parallel
External Connector Type: DB-25 female
Port Type: Parallel Port ECP/EPP
Handle 0x000F
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: J1A1
Internal Connector Type: None
External Reference Designator: Keyboard
External Connector Type: Circular DIN-8 male
Port Type: Keyboard Port
Handle 0x0010
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: J1A1
Internal Connector Type: None
External Reference Designator: PS/2 Mouse
External Connector Type: Circular DIN-8 male
Port Type: Keyboard Port
Handle 0x0011
DMI type 9, 13 bytes.
System Slot Information
Designation: PCIE Slot #1
Type: PCI
Current Usage: Available
Length: Other
ID: 1
Characteristics:
PME signal is supported
Handle 0x0012
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI/33 Slot #2
Type: 32-bit PCI
Current Usage: Available
Length: Short
ID: 2
Characteristics:
5.0 V is provided
3.3 V is provided
PME signal is supported
Handle 0x0013
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI/33 Slot #3
Type: 32-bit PCI
Current Usage: Available
Length: Short
ID: 3
Characteristics:
5.0 V is provided
3.3 V is provided
PME signal is supported
Handle 0x0014
DMI type 9, 13 bytes.
System Slot Information
Designation: PCIX 133 Slot #4
Type: 64-bit PCI-X
Current Usage: Available
Length: Long
ID: 4
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0015
DMI type 9, 13 bytes.
System Slot Information
Designation: PCIX100(ZCR) Slot #5
Type: 64-bit PCI-X
Current Usage: Available
Length: Long
ID: 5
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0016
DMI type 9, 13 bytes.
System Slot Information
Designation: PCIX100 Slot #6
Type: 64-bit PCI-X
Current Usage: Available
Length: Long
ID: 6
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0017
DMI type 10, 6 bytes.
On Board Device Information
Type: Other
Status: Enabled
Description: IBM Automatic Server Restart - Machine Type 8648
Handle 0x0018
DMI type 10, 6 bytes.
On Board Device Information
Type: Video
Status: Enabled
Description: ATI Rage 7000
Handle 0x0019
DMI type 10, 6 bytes.
On Board Device Information
Type: SCSI Controller
Status: Enabled
Description: Adaptec AIC 7902
Handle 0x001A
DMI type 10, 6 bytes.
On Board Device Information
Type: Ethernet
Status: Enabled
Description: BoardCom BCM5721
Handle 0x001D
DMI type 11, 5 bytes.
OEM Strings
String 1: IBM Remote Supervisor Adapter -[GRET15AUS]-
Handle 0x001E
DMI type 12, 5 bytes.
System Configuration Options
Option 1: JCMOS1: 1-2 Keep CMOS Data(Default), 2-3 Clear CMOS Data (make sure the AC power cord(s) is(are) removed from the system)
Handle 0x001F
DMI type 12, 5 bytes.
System Configuration Options
Option 1: JCON1: 1-2 Normal(Default), 2-3 Configuration, No Jumper - BIOS Crisis Recovery
Handle 0x0020
DMI type 13, 22 bytes.
BIOS Language Information
Installable Languages: 1
en|US|iso8859-1
Currently Installed Language: en|US|iso8859-1
Handle 0x0021
DMI type 15, 29 bytes.
System Event Log
Area Length: 320 bytes
Header Start Offset: 0x0000
Header Length: 16 bytes
Data Start Offset: 0x0010
Access Method: General-pupose non-volatile data functions
Access Address: 0x0000
Status: Valid, Not Full
Change Token: 0x00000013
Header Format: Type 1
Supported Log Type Descriptors: 3
Descriptor 1: POST error
Data Format 1: POST results bitmap
Descriptor 2: Single-bit ECC memory error
Data Format 2: Multiple-event
Descriptor 3: Multi-bit ECC memory error
Data Format 3: Multiple-event
Handle 0x0022
DMI type 16, 15 bytes.
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Single-bit ECC
Maximum Capacity: 16 GB
Error Information Handle: No Error
Number Of Devices: 6
Handle 0x0023
DMI type 17, 27 bytes.
Memory Device
Array Handle: 0x0022
Error Information Handle: No Error
Total Width: 72 bits
Data Width: 64 bits
Size: 512 MB
Form Factor: DIMM
Set: 1
Locator: DIMM 1
Bank Locator: BANK 1
Type: DDR
Type Detail: Synchronous
Speed: 400 MHz (2.5 ns)
Manufacturer:
Serial Number: 460360BB
Asset Tag: 3342
Part Number: M3 93T6553BZ3-CCC
Handle 0x0024
DMI type 17, 27 bytes.
Memory Device
Array Handle: 0x0022
Error Information Handle: No Error
Total Width: 72 bits
Data Width: 64 bits
Size: 512 MB
Form Factor: DIMM
Set: 1
Locator: DIMM 2
Bank Locator: BANK 1
Type: DDR
Type Detail: Synchronous
Speed: 400 MHz (2.5 ns)
Manufacturer:
Serial Number: 460360E8
Asset Tag: 3342
Part Number: M3 93T6553BZ3-CCC
Handle 0x0025
DMI type 17, 27 bytes.
Memory Device
Array Handle: 0x0022
Error Information Handle: No Error
Total Width: 72 bits
Data Width: 64 bits
Size: 512 MB
Form Factor: DIMM
Set: 2
Locator: DIMM 3
Bank Locator: BANK 2
Type: DDR
Type Detail: Synchronous
Speed: 400 MHz (2.5 ns)
Manufacturer:
UnixAgent-2.4.2/resources/dmidecode.rhel.4.3 0000664 0000000 0000000 00000044015 13327377321 0020543 0 ustar 00root root 0000000 0000000 # dmidecode 2.2
SMBIOS 2.2 present.
57 structures occupying 1719 bytes.
Table at 0x000F0000.
Handle 0x0000
DMI type 0, 19 bytes.
BIOS Information
Vendor: IBM
Version: -[OQE115A]-
Release Date: 03/14/2006
Address: 0xE0000
Runtime Size: 128 kB
ROM Size: 1024 kB
Characteristics:
PCI is supported
PNP is supported
APM is supported
BIOS is upgradeable
BIOS shadowing is allowed
Boot from CD is supported
Selectable boot is supported
BIOS ROM is socketed
EDD is supported
5.25"/360 KB floppy services are supported (int 13h)
5.25"/1.2 MB floppy services are supported (int 13h)
3.5"/720 KB floppy services are supported (int 13h)
3.5"/2.88 MB floppy services are supported (int 13h)
Print screen service is supported (int 5h)
8042 keyboard services are supported (int 9h)
Serial services are supported (int 14h)
Printer services are supported (int 17h)
CGA/mono video services are supported (int 10h)
ACPI is supported
USB legacy is supported
AGP is supported
LS-120 boot is supported
ATAPI Zip drive boot is supported
Handle 0x0001
DMI type 1, 25 bytes.
System Information
Manufacturer: IBM
Product Name: -[86494jg]-
Version: 2.0
Serial Number: KDMAH1Y
UUID: 0339D4C3-44C0-9D11-A20E-85CDC42DE79C
Wake-up Type: Other
Handle 0x0002
DMI type 2, 8 bytes.
Base Board Information
Manufacturer: IBM
Product Name: MS-9121
Version: 2.0
Serial Number: 48Z1LX
Handle 0x0003
DMI type 3, 13 bytes.
Chassis Information
Manufacturer: IBM
Type: Tower
Lock: Present
Version:
Serial Number:
Asset Tag:
Boot-up State: Unknown
Power Supply State: Unknown
Thermal State: Unknown
Security Status: Unknown
Handle 0x0004
DMI type 4, 32 bytes.
Processor Information
Socket Designation: CPU1
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: 29 0F 00 00 FF FB EB BF
Signature: Type 0, Family F, Model 2, Stepping 9
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (Fast floating-point save and restore)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Hyper-threading technology)
TM (Thermal monitor supported)
SBF (Signal break on FERR)
Version: Intel Xeon(tm)
Voltage: 1.4 V
External Clock: 133 MHz
Max Speed: 3200 MHz
Current Speed: 2666 MHz
Status: Populated, Enabled
Upgrade: ZIF Socket
L1 Cache Handle: 0x000B
L2 Cache Handle: 0x000D
L3 Cache Handle: 0x000F
Handle 0x0005
DMI type 4, 32 bytes.
Processor Information
Socket Designation: CPU2
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: 29 0F 00 00 FF FB EB BF
Signature: Type 0, Family F, Model 2, Stepping 9
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (Fast floating-point save and restore)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Hyper-threading technology)
TM (Thermal monitor supported)
SBF (Signal break on FERR)
Version: Intel Xeon(tm)
Voltage: 1.4 V
External Clock: 133 MHz
Max Speed: 3200 MHz
Current Speed: 2666 MHz
Status: Populated, Enabled
Upgrade: ZIF Socket
L1 Cache Handle: 0x000C
L2 Cache Handle: 0x000E
L3 Cache Handle: 0x0010
Handle 0x0006
DMI type 5, 24 bytes.
Memory Controller Information
Error Detecting Method: 8-bit Parity
Error Correcting Capabilities:
Single-bit Error Correcting
Double-bit Error Correcting
Error Scrubbing
Supported Interleave: One-way Interleave
Current Interleave: One-way Interleave
Maximum Memory Module Size: 2048 MB
Maximum Total Memory Size: 8192 MB
Supported Speeds:
Other
Supported Memory Types:
Other
ECC
DIMM
Memory Module Voltage: 3.3 V
Associated Memory Slots: 4
0x0007
0x0008
0x0009
0x000A
Enabled Error Correcting Capabilities:
Single-bit Error Correcting
Double-bit Error Correcting
Error Scrubbing
Handle 0x0007
DMI type 6, 12 bytes.
Memory Module Information
Socket Designation: DIMM1
Bank Connections: 0
Current Speed: Unknown
Type: Other DIMM
Installed Size: 512 MB (Single-bank Connection)
Enabled Size: 512 MB (Single-bank Connection)
Error Status: OK
Handle 0x0008
DMI type 6, 12 bytes.
Memory Module Information
Socket Designation: DIMM2
Bank Connections: 2
Current Speed: Unknown
Type: Other DIMM
Installed Size: 512 MB (Single-bank Connection)
Enabled Size: 512 MB (Single-bank Connection)
Error Status: OK
Handle 0x0009
DMI type 6, 12 bytes.
Memory Module Information
Socket Designation: DIMM3
Bank Connections: 4
Current Speed: Unknown
Type: Other DIMM
Installed Size: 512 MB (Single-bank Connection)
Enabled Size: 512 MB (Single-bank Connection)
Error Status: OK
Handle 0x000A
DMI type 6, 12 bytes.
Memory Module Information
Socket Designation: DIMM4
Bank Connections: 6
Current Speed: Unknown
Type: Other DIMM
Installed Size: 512 MB (Single-bank Connection)
Enabled Size: 512 MB (Single-bank Connection)
Error Status: OK
Handle 0x000B
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Level 1 Cache
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Back
Location: Internal
Installed Size: 20 KB
Maximum Size: 20 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Speed: Unknown
Error Correction Type: Unknown
System Type: Unknown
Associativity: Unknown
Handle 0x000C
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Level 1 Cache
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Back
Location: Internal
Installed Size: 20 KB
Maximum Size: 20 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Speed: Unknown
Error Correction Type: Unknown
System Type: Unknown
Associativity: Unknown
Handle 0x000D
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Level 2 Cache
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Write Back
Location: Internal
Installed Size: 512 KB
Maximum Size: 512 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Speed: Unknown
Error Correction Type: Unknown
System Type: Unknown
Associativity: Unknown
Handle 0x000E
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Level 2 Cache
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Write Back
Location: Internal
Installed Size: 512 KB
Maximum Size: 512 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Speed: Unknown
Error Correction Type: Unknown
System Type: Unknown
Associativity: Unknown
Handle 0x000F
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Tertiary (Level 3) Cache
Configuration: Disabled, Not Socketed, Level 3
Operational Mode: Write Back
Location: Internal
Installed Size: 0 KB
Maximum Size: 0 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Speed: Unknown
Error Correction Type: Unknown
System Type: Unknown
Associativity: Unknown
Handle 0x0010
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Tertiary (Level 3) Cache
Configuration: Disabled, Not Socketed, Level 3
Operational Mode: Write Back
Location: Internal
Installed Size: 0 KB
Maximum Size: 0 KB
Supported SRAM Types:
Synchronous
Installed SRAM Type: Synchronous
Speed: Unknown
Error Correction Type: Unknown
System Type: Unknown
Associativity: Unknown
Handle 0x0011
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: IDE1
Internal Connector Type: On Board IDE
External Reference Designator: Not Specified
External Connector Type: None
Port Type: Other
Handle 0x0012
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: IDE2
Internal Connector Type: On Board IDE
External Reference Designator: Not Specified
External Connector Type: None
Port Type: Other
Handle 0x0013
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: FDD
Internal Connector Type: On Board Floppy
External Reference Designator: Not Specified
External Connector Type: None
Port Type: 8251 FIFO Compatible
Handle 0x0014
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: COM1
Internal Connector Type: 9 Pin Dual Inline (pin 10 cut)
External Reference Designator:
External Connector Type: DB-9 male
Port Type: Serial Port 16450 Compatible
Handle 0x0015
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: COM2
Internal Connector Type: 9 Pin Dual Inline (pin 10 cut)
External Reference Designator:
External Connector Type: DB-9 male
Port Type: Serial Port 16450 Compatible
Handle 0x0016
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: LPT1
Internal Connector Type: DB-25 female
External Reference Designator:
External Connector Type: DB-25 female
Port Type: Parallel Port ECP/EPP
Handle 0x0017
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Keyboard
Internal Connector Type: PS/2
External Reference Designator:
External Connector Type: PS/2
Port Type: Keyboard Port
Handle 0x0018
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: PS/2 Mouse
Internal Connector Type: PS/2
External Reference Designator:
External Connector Type: PS/2
Port Type: Mouse Port
Handle 0x0019
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: JUSB1
External Connector Type: Other
Port Type: USB
Handle 0x001A
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: JUSB2
External Connector Type: Other
Port Type: USB
Handle 0x001B
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: AUD1
External Connector Type: None
Port Type: Audio Port
Handle 0x001C
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: JLAN1
External Connector Type: RJ-45
Port Type: Network Port
Handle 0x001D
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: SCSI1
External Connector Type: None
Port Type: SCSI Wide
Handle 0x001E
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: Not Specified
Internal Connector Type: None
External Reference Designator: SCSI2
External Connector Type: None
Port Type: SCSI Wide
Handle 0x001F
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI1
Type: 32-bit PCI
Current Usage: Available
Length: Other
ID: 1
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0020
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI6
Type: 32-bit PCI
Current Usage: In Use
Length: Other
ID: 2
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0021
DMI type 10, 14 bytes.
On Board Device Information
Type: Other
Status: Enabled
Description: IBM Automatic Server Restart - Machine Type 8480
On Board Device Information
Type: SCSI Controller
Status: Enabled
Description: LSI Logic 1030 Ultra320 SCSI Adapter - SCSI1
On Board Device Information
Type: SCSI Controller
Status: Enabled
Description: LSI Logic 1030 Ultra320 SCSI Adapter - SCSI2
On Board Device Information
Type: Ethernet
Status: Enabled
Description: Broadcom BCM5703 NetXtreme Gigabit Ethernet - JLAN1
On Board Device Information
Type: Sound
Status: Enabled
Description: SoundMax Integrated Digital Audio - AUD1
Handle 0x0022
DMI type 9, 13 bytes.
System Slot Information
Designation: AGP
Type: 32-bit AGP
Current Usage: Available
Length: Long
ID: 8
Characteristics:
5.0 V is provided
Handle 0x0023
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI2
Type: 64-bit PCI-X
Current Usage: Available
Length: Long
ID: 2
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0024
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI3
Type: 64-bit PCI-X
Current Usage: Available
Length: Long
ID: 3
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0025
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI4
Type: 64-bit PCI-X
Current Usage: In Use
Length: Long
ID: 1
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0026
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI5
Type: 64-bit PCI-X
Current Usage: Available
Length: Long
ID: 2
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0027
DMI type 13, 22 bytes.
BIOS Language Information
Installable Languages: 3
n|US|iso8859-1
n|US|iso8859-1
r|CA|iso8859-1
Currently Installed Language: n|US|iso8859-1
Handle 0x0028
DMI type 16, 15 bytes.
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Multi-bit ECC
Maximum Capacity: 8 GB
Error Information Handle: No Error
Number Of Devices: 4
Handle 0x0029
DMI type 17, 21 bytes.
Memory Device
Array Handle: 0x0028
Error Information Handle: 0x002D
Total Width: 257 bits
Data Width: 256 bits
Size: 512 MB
Form Factor: DIMM
Set: 1
Locator: DIMM1
Bank Locator: Bank0
Type: DDR
Type Detail: None
Handle 0x002A
DMI type 17, 21 bytes.
Memory Device
Array Handle: 0x0028
Error Information Handle: 0x002E
Total Width: 257 bits
Data Width: 256 bits
Size: 512 MB
Form Factor: DIMM
Set: 1
Locator: DIMM2
Bank Locator: Bank1
Type: DDR
Type Detail: None
Handle 0x002B
DMI type 17, 21 bytes.
Memory Device
Array Handle: 0x0028
Error Information Handle: 0x002F
Total Width: 257 bits
Data Width: 256 bits
Size: 512 MB
Form Factor: DIMM
Set: 2
Locator: DIMM3
Bank Locator: Bank2
Type: DDR
Type Detail: None
Handle 0x002C
DMI type 17, 21 bytes.
Memory Device
Array Handle: 0x0028
Error Information Handle: 0x0030
Total Width: 257 bits
Data Width: 256 bits
Size: 512 MB
Form Factor: DIMM
Set: 2
Locator: DIMM4
Bank Locator: Bank3
Type: DDR
Type Detail: None
Handle 0x002D
DMI type 18, 23 bytes.
32-bit Memory Error Information
Type: Other
Granularity: Other
Operation: Other
Vendor Syndrome: Unknown
Memory Array Address: Unknown
Device Address: Unknown
Resolution: Unknown
Handle 0x002E
DMI type 18, 23 bytes.
32-bit Memory Error Information
Type: Other
Granularity: Other
Operation: Other
Vendor Syndrome: Unknown
Memory Array Address: Unknown
Device Address: Unknown
Resolution: Unknown
Handle 0x002F
DMI type 18, 23 bytes.
32-bit Memory Error Information
Type: Other
Granularity: Other
Operation: Other
Vendor Syndrome: Unknown
Memory Array Address: Unknown
Device Address: Unknown
Resolution: Unknown
Handle 0x0030
DMI type 18, 23 bytes.
32-bit Memory Error Information
Type: Other
Granularity: Other
Operation: Other
Vendor Syndrome: Unknown
Memory Array Address: Unknown
Device Address: Unknown
Resolution: Unknown
Handle 0x0031
DMI type 19, 15 bytes.
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0007FFFFFFF
Range Size: 2 GB
Physical Array Handle: 0x0028
Partition Width: 0
Handle 0x0032
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0001FFFFFFF
Range Size: 512 MB
Physical Device Handle: 0x0029
Memory Array Mapped Address Handle: 0x0031
Partition Row Position: 1
Handle 0x0033
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00020000000
Ending Address: 0x0003FFFFFFF
Range Size: 512 MB
Physical Device Handle: 0x002A
Memory Array Mapped Address Handle: 0x0031
Partition Row Position: 1
Handle 0x0034
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00040000000
Ending Address: 0x0005FFFFFFF
Range Size: 512 MB
Physical Device Handle: 0x002B
Memory Array Mapped Address Handle: 0x0031
Partition Row Position: 1
Handle 0x0035
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00060000000
Ending Address: 0x0007FFFFFFF
Range Size: 512 MB
Physical Device Handle: 0x002C
Memory Array Mapped Address Handle: 0x0031
Partition Row Position: 1
Handle 0x0036
DMI type 32, 11 bytes.
System Boot Information
Status: No errors detected
Handle 0x0037
DMI type 129, 8 bytes.
OEM-specific Type
Header And Data:
81 08 37 00 01 01 02 01
Strings:
Alert Standard Format
IBM 0053
Handle 0x0038
DMI type 127, 4 bytes.
End Of Table
UnixAgent-2.4.2/resources/dmidecode.rhel.4.6 0000664 0000000 0000000 00000045616 13327377321 0020556 0 ustar 00root root 0000000 0000000 # dmidecode 2.2
SMBIOS 2.4 present.
74 structures occupying 2059 bytes.
Table at 0x000EE000.
Handle 0x0000
DMI type 0, 24 bytes.
BIOS Information
Vendor: HP
Version: D21
Release Date: 01/24/2008
Address: 0xF0000
Runtime Size: 64 kB
ROM Size: 4096 kB
Characteristics:
PCI is supported
PNP is supported
BIOS is upgradeable
BIOS shadowing is allowed
ESCD support is available
Boot from CD is supported
Selectable boot is supported
EDD is supported
5.25"/360 KB floppy services are supported (int 13h)
5.25"/1.2 MB floppy services are supported (int 13h)
3.5"/720 KB floppy services are supported (int 13h)
Print screen service is supported (int 5h)
8042 keyboard services are supported (int 9h)
Serial services are supported (int 14h)
Printer services are supported (int 17h)
CGA/mono video services are supported (int 10h)
ACPI is supported
USB legacy is supported
BIOS boot specification is supported
Function key-initiated network boot is supported
Handle 0x0100
DMI type 1, 27 bytes.
System Information
Manufacturer: HP
Product Name: ProLiant ML350 G5
Version: Not Specified
Serial Number: GB8814HE7S
UUID: 34313236-3435-4742-3838-313448453753
Wake-up Type: Power Switch
Handle 0x0300
DMI type 3, 17 bytes.
Chassis Information
Manufacturer: HP
Type: Tower
Lock: Not Present
Version: Not Specified
Serial Number: GB8814HE7S
Asset Tag:
Boot-up State: Unknown
Power Supply State: Unknown
Thermal State: Unknown
Security Status: Unknown
OEM Information: 0x00000000
Handle 0x0400
DMI type 4, 40 bytes.
Processor Information
Socket Designation: Proc 1
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: 76 06 01 00 FF FB EB BF
Signature: Type 0, Family 6, Model 17, Stepping 6
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (Fast floating-point save and restore)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Hyper-threading technology)
TM (Thermal monitor supported)
SBF (Signal break on FERR)
Version: Not Specified
Voltage: 1.4 V
External Clock: 1333 MHz
Max Speed: 4800 MHz
Current Speed: 2333 MHz
Status: Populated, Enabled
Upgrade: ZIF Socket
L1 Cache Handle: 0x0710
L2 Cache Handle: 0x0720
L3 Cache Handle: 0x0730
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Handle 0x0406
DMI type 4, 40 bytes.
Processor Information
Socket Designation: Proc 2
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: 00 00 00 00 00 00 00 00
Signature: Type 0, Family 0, Model 0, Stepping 0
Flags: None
Version: Not Specified
Voltage: 1.4 V
External Clock: 200 MHz
Max Speed: 4800 MHz
Current Speed: Unknown
Status: Unpopulated
Upgrade: ZIF Socket
L1 Cache Handle: 0x0716
L2 Cache Handle: 0x0726
L3 Cache Handle: 0x0736
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Handle 0x0710
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Processor 1 Internal L1 Cache
Configuration: Enabled, Not Socketed, Level 1
Operational Mode: Write Back
Location: Internal
Installed Size: 128 KB
Maximum Size: 128 KB
Supported SRAM Types:
Burst
Installed SRAM Type: Burst
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Data
Associativity: 8-way Set-associative
Handle 0x0716
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Processor 2 Internal L1 Cache
Configuration: Disabled, Not Socketed, Level 1
Operational Mode: Unknown
Location: Internal
Installed Size: 0 KB
Maximum Size: 128 KB
Supported SRAM Types:
Burst
Installed SRAM Type: Burst
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Data
Associativity: 8-way Set-associative
Handle 0x0720
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Processor 1 Internal L2 Cache
Configuration: Enabled, Not Socketed, Level 2
Operational Mode: Write Back
Location: Internal
Installed Size: 12288 KB
Maximum Size: 16384 KB
Supported SRAM Types:
Burst
Installed SRAM Type: Burst
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unknown
Associativity: 8-way Set-associative
Handle 0x0726
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Processor 2 Internal L2 Cache
Configuration: Disabled, Not Socketed, Level 2
Operational Mode: Unknown
Location: Internal
Installed Size: 0 KB
Maximum Size: 16384 KB
Supported SRAM Types:
Burst
Installed SRAM Type: Burst
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unknown
Associativity: 8-way Set-associative
Handle 0x0730
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Processor 1 Internal L3 Cache
Configuration: Disabled, Not Socketed, Level 3
Operational Mode: Unknown
Location: Internal
Installed Size: 0 KB
Maximum Size: 8192 KB
Supported SRAM Types:
Burst
Installed SRAM Type: Burst
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unknown
Associativity: Other
Handle 0x0736
DMI type 7, 19 bytes.
Cache Information
Socket Designation: Processor 2 Internal L3 Cache
Configuration: Disabled, Not Socketed, Level 3
Operational Mode: Unknown
Location: Internal
Installed Size: 0 KB
Maximum Size: 8192 KB
Supported SRAM Types:
Burst
Installed SRAM Type: Burst
Speed: Unknown
Error Correction Type: Single-bit ECC
System Type: Unknown
Associativity: Other
Handle 0x0801
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: J16
Internal Connector Type: Access Bus (USB)
External Reference Designator: USB Port 1
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0802
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: J19
Internal Connector Type: Access Bus (USB)
External Reference Designator: USB Port 2
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0803
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: J69
Internal Connector Type: Access Bus (USB)
External Reference Designator: USB Port 3
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0804
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: J69
Internal Connector Type: Access Bus (USB)
External Reference Designator: USB Port 4
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0805
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: J02
Internal Connector Type: Access Bus (USB)
External Reference Designator: USB Port 5
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0806
DMI type 8, 9 bytes.
Port Connector Information
Internal Reference Designator: J03
Internal Connector Type: Access Bus (USB)
External Reference Designator: USB Port 6
External Connector Type: Access Bus (USB)
Port Type: USB
Handle 0x0901
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI Slot 1
Type: 64-bit PCI-X
Current Usage: Available
Length: Long
ID: 1
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0902
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI Slot 2
Type: 64-bit PCI-X
Current Usage: Available
Length: Long
ID: 2
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0903
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI Slot 3
Type: 64-bit PCI-X
Current Usage: Available
Length: Long
ID: 3
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0904
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI-E Slot 4
Type:
Current Usage: Available
Length: Long
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0905
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI-E Slot 5
Type:
Current Usage: Available
Length: Long
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0906
DMI type 9, 13 bytes.
System Slot Information
Designation: PCI-E Slot 6
Type:
Current Usage: Available
Length: Long
Characteristics:
3.3 V is provided
PME signal is supported
Handle 0x0B00
DMI type 11, 5 bytes.
OEM Strings
String 1: Product ID: 412645-B21
Handle 0x1000
DMI type 16, 15 bytes.
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Single-bit ECC
Maximum Capacity: 32 GB
Error Information Handle: Not Provided
Number Of Devices: 8
Handle 0x1100
DMI type 17, 23 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 512 MB
Form Factor:
Set: 1
Locator: DIMM 1A
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: 667 MHz (1.5 ns)
Handle 0x1101
DMI type 17, 23 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor:
Set: 2
Locator: DIMM 2B
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: 667 MHz (1.5 ns)
Handle 0x1102
DMI type 17, 23 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor:
Set: 3
Locator: DIMM 3C
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: 667 MHz (1.5 ns)
Handle 0x1103
DMI type 17, 23 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor:
Set: 4
Locator: DIMM 4D
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: Unknown
Handle 0x1104
DMI type 17, 23 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 512 MB
Form Factor:
Set: 1
Locator: DIMM 5A
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: 667 MHz (1.5 ns)
Handle 0x1105
DMI type 17, 23 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor:
Set: 2
Locator: DIMM 6B
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: 667 MHz (1.5 ns)
Handle 0x1106
DMI type 17, 23 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 1024 MB
Form Factor:
Set: 3
Locator: DIMM 7C
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: 667 MHz (1.5 ns)
Handle 0x1107
DMI type 17, 23 bytes.
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor:
Set: 4
Locator: DIMM 8D
Bank Locator: Not Specified
Type:
Type Detail: Synchronous
Speed: Unknown
Handle 0x1300
DMI type 19, 15 bytes.
Memory Array Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0015FFFFFFF
Range Size: 5632 MB
Physical Array Handle: 0x1000
Partition Width: 0
Handle 0x1400
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0015FFFFFFF
Range Size: 5632 MB
Physical Device Handle: 0x1100
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Interleave Position: 1
Interleaved Data Depth: Unknown
Handle 0x1401
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0015FFFFFFF
Range Size: 5632 MB
Physical Device Handle: 0x1101
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Interleave Position: 1
Interleaved Data Depth: Unknown
Handle 0x1402
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0015FFFFFFF
Range Size: 5632 MB
Physical Device Handle: 0x1102
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Interleave Position: 1
Interleaved Data Depth: Unknown
Handle 0x1403
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x000000003FF
Range Size: 1 kB
Physical Device Handle: 0x1103
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Interleave Position: 1
Interleaved Data Depth: Unknown
Handle 0x1404
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0015FFFFFFF
Range Size: 5632 MB
Physical Device Handle: 0x1104
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Interleave Position: 2
Interleaved Data Depth: Unknown
Handle 0x1405
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0015FFFFFFF
Range Size: 5632 MB
Physical Device Handle: 0x1105
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Interleave Position: 2
Interleaved Data Depth: Unknown
Handle 0x1406
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x0015FFFFFFF
Range Size: 5632 MB
Physical Device Handle: 0x1106
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Interleave Position: 2
Interleaved Data Depth: Unknown
Handle 0x1407
DMI type 20, 19 bytes.
Memory Device Mapped Address
Starting Address: 0x00000000000
Ending Address: 0x000000003FF
Range Size: 1 kB
Physical Device Handle: 0x1107
Memory Array Mapped Address Handle: 0x1300
Partition Row Position: 1
Interleave Position: 2
Interleaved Data Depth: Unknown
Handle 0x2000
DMI type 32, 11 bytes.
System Boot Information
Status: No errors detected
Handle 0x2600
DMI type 38, 18 bytes.
IPMI Device Information
Interface Type: KCS (Keyboard Control Style)
Specification Version: 2.0
I2C Slave Address: 0x10
NV Storage Device: Not Present
Base Address: 0x0000000000000CA2 (I/O)
Register Spacing: Successive Byte Boundaries
Handle 0xC100
DMI type 193, 7 bytes.
OEM-specific Type
Header And Data:
C1 07 00 C1 01 01 02
Strings:
11/13/2007
11/13/2007
Handle 0xC200
DMI type 194, 5 bytes.
OEM-specific Type
Header And Data:
C2 05 00 C2 01
Handle 0xC300
DMI type 195, 5 bytes.
OEM-specific Type
Header And Data:
C3 05 00 C3 01
Strings:
$0E110764
Handle 0xC400
DMI type 196, 5 bytes.
OEM-specific Type
Header And Data:
C4 05 00 C4 00
Handle 0xC500
DMI type 197, 10 bytes.
OEM-specific Type
Header And Data:
C5 0A 00 C5 00 04 00 01 FF 01
Handle 0xDF00
DMI type 223, 7 bytes.
OEM-specific Type
Header And Data:
DF 07 00 DF 66 46 70
Handle 0xC506
DMI type 197, 10 bytes.
OEM-specific Type
Header And Data:
C5 0A 06 C5 06 04 00 00 FF 02
Handle 0xD300
DMI type 211, 7 bytes.
OEM-specific Type
Header And Data:
D3 07 00 D3 00 04 4E
Handle 0xD306
DMI type 211, 7 bytes.
OEM-specific Type
Header And Data:
D3 07 06 D3 06 04 00
Handle 0xC600
DMI type 198, 11 bytes.
OEM-specific Type
Header And Data:
C6 0B 00 C6 17 00 00 01 3C 00 01
Handle 0xC700
DMI type 199, 112 bytes.
OEM-specific Type
Header And Data:
C7 70 00 C7 0B 06 00 00 08 20 19 01 76 06 01 00
0B 06 00 00 08 20 19 01 76 06 01 00 04 04 00 00
07 20 08 06 74 06 01 00 04 04 00 00 07 20 08 06
74 06 01 00 B4 00 00 00 07 20 14 03 FB 06 00 00
B4 00 00 00 07 20 14 03 FB 06 00 00 67 00 00 00
07 20 26 03 F7 06 00 00 C9 00 00 00 07 20 26 03
F6 06 00 00 02 00 00 00 05 20 15 12 64 0F 00 00
Handle 0xCD00
DMI type 205, 22 bytes.
OEM-specific Type
Header And Data:
CD 16 00 CD 01 01 46 41 54 78 00 00 E0 FF 00 00
00 00 00 00 0D 00
Handle 0xCA00
DMI type 202, 8 bytes.
OEM-specific Type
Header And Data:
CA 08 00 CA 00 11 FF 01
Handle 0xCA01
DMI type 202, 8 bytes.
OEM-specific Type
Header And Data:
CA 08 01 CA 01 11 FF 02
Handle 0xCA02
DMI type 202, 8 bytes.
OEM-specific Type
Header And Data:
CA 08 02 CA 02 11 FF 03
Handle 0xCA03
DMI type 202, 8 bytes.
OEM-specific Type
Header And Data:
CA 08 03 CA 03 11 FF 04
Handle 0xCA04
DMI type 202, 8 bytes.
OEM-specific Type
Header And Data:
CA 08 04 CA 04 11 FF 05
Handle 0xCA05
DMI type 202, 8 bytes.
OEM-specific Type
Header And Data:
CA 08 05 CA 05 11 FF 06
Handle 0xCA06
DMI type 202, 8 bytes.
OEM-specific Type
Header And Data:
CA 08 06 CA 06 11 FF 07
Handle 0xCA07
DMI type 202, 8 bytes.
OEM-specific Type
Header And Data:
CA 08 07 CA 07 11 FF 08
Handle 0xD100
DMI type 209, 12 bytes.
OEM-specific Type
Header And Data:
D1 0C 00 D1 00 03 00 1F 29 62 C4 A4
Handle 0xD400
DMI type 212, 24 bytes.
OEM-specific Type
Header And Data:
D4 18 00 D4 24 43 52 55 00 F8 F6 FF 00 00 00 00
00 40 00 00 00 00 00 00
Handle 0xD500
DMI type 213, 28 bytes.
OEM-specific Type
Header And Data:
D5 1C 00 D5 00 00 36 00 00 00 BF 1F 00 00 46 00
00 00 00 00 00 00 00 00 00 00 00 00
Handle 0xD600
DMI type 214, 44 bytes.
OEM-specific Type
Header And Data:
D6 2C 00 D6 31 31 00 02 0E 20 00 00 13 20 00 00
00 60 00 00 00 20 00 00 02 20 00 00 04 20 00 00
06 20 00 00 0C 20 00 00 08 20 00 00
Handle 0xD700
DMI type 215, 6 bytes.
OEM-specific Type
Header And Data:
D7 06 00 D7 00 05
Handle 0xDB00
DMI type 219, 8 bytes.
OEM-specific Type
Header And Data:
DB 08 00 DB FF 00 00 00
Handle 0xDC00
DMI type 218, 45 bytes.
OEM-specific Type
Header And Data:
DA 2D 00 DC 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00
Handle 0xDC01
DMI type 220, 45 bytes.
OEM-specific Type
Header And Data:
DC 2D 01 DC 08 00 00 C5 00 FF 01 00 C5 01 FF 02
00 C5 02 FF 03 00 C5 03 FF 04 06 C5 02 FF 05 06
C5 03 FF 06 06 C5 00 FF 07 06 C5 01 FF
Handle 0xDD00
DMI type 221, 12 bytes.
OEM-specific Type
Header And Data:
DD 0C 00 DD 00 03 00 1F 29 62 C4 A5
Handle 0x7F00
DMI type 127, 4 bytes.
End Of Table
UnixAgent-2.4.2/resources/ipdiscover/ 0000775 0000000 0000000 00000000000 13327377321 0017612 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/resources/ipdiscover/ipdiscover.c 0000664 0000000 0000000 00000015474 13327377321 0022140 0 ustar 00root root 0000000 0000000 /*
###############################################################################
##OCSInventory Version NG Beta
##Copyleft Pascal DANEK 2006
##Web : http://ocsinventory.sourceforge.net
##
##This code is open source and may be copied and modified as long as the source
##code is always made freely available.
##Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################
*/
#include "ipdiscover.h"
/* We get IP address, netmask, index number and mac address of the adapter */
void get_iface_infos( packet *ppacket, int *index, char *iface, struct sockaddr_in *ipaddr, struct sockaddr_in *netmask){
int tmpsock;
struct ifreq ifr;
if( ( tmpsock = socket( AF_INET, SOCK_STREAM, 0 ) ) < 0 ){
perror("Socket creation problem");
exit(1);
}
/* Initialize */
memset( &ifr, 0x0, sizeof(struct ifreq));
/* We put into the ifreq struct the name of adapter */
strncpy(ifr.ifr_name, iface, IF_NAMESIZE-1);
/* IP */
if(ioctl(tmpsock, SIOCGIFADDR, &ifr)< 0){
close(tmpsock);
perror("Cannot get the ip address");
exit(1);
}
memcpy( &ipaddr->sin_addr, &( (struct sockaddr_in *) &ifr.ifr_addr )->sin_addr, 4 );
memcpy( ppacket->arphdr.ar_sip, &( (struct sockaddr_in *) &ifr.ifr_addr )->sin_addr, 4 );
/*******************/
/* SNM */
if(ioctl(tmpsock, SIOCGIFNETMASK, &ifr)< 0){
close(tmpsock);
perror("Cannot get the net submask");
exit(1);
}
memcpy(&netmask->sin_addr, &((struct sockaddr_in *) &ifr.ifr_netmask)->sin_addr, 4);
/*******************/
/* MAC */
if(ioctl(tmpsock, SIOCGIFHWADDR, &ifr)< 0){
close(tmpsock);
perror("Cannot get the mac address");
exit(1);
}
memcpy( ppacket->ethhdr.h_source, (unsigned char *)&ifr.ifr_hwaddr.sa_data, ETH_ALEN );
memcpy( ppacket->arphdr.ar_sha, (unsigned char *)&ifr.ifr_hwaddr.sa_data, ETH_ALEN );
/*******************/
/* INDEX */
if(ioctl(tmpsock, SIOCGIFINDEX, &ifr)< 0){
close(tmpsock);
perror("Cannot get the interface index");
exit(1);
}
*index = ifr.ifr_ifindex;
/*******************/
close(tmpsock);
}
void data_init( struct sockaddr_in *ipaddr, struct sockaddr_in *netmask, packet **ppacket, struct sockaddr_ll *sll, int index ){
memset(ipaddr, 0x00, sizeof(struct sockaddr_in));
memset(netmask, 0x00, sizeof(struct sockaddr_in));
/* Arp structure */
*ppacket = malloc( sizeof( packet ) );
/* Tie to adapter */
sll->sll_family = AF_PACKET;
sll->sll_protocol = htons(ETH_P_ARP);
/* Building the packet */
memset( (*ppacket)->ethhdr.h_dest, 0xFF, 6 );
(*ppacket)->ethhdr.h_proto = htons(0x806);
/* arp header */
(*ppacket)->arphdr.arp_hrdad = htons(ARPHRD_ETHER);
(*ppacket)->arphdr.arp_prot = htons(ETH_P_IP);
(*ppacket)->arphdr.arp_halen = ETH_ALEN;
(*ppacket)->arphdr.arp_prlen = 4;
(*ppacket)->arphdr.arp_opcode = htons(ARPOP_REQUEST);
memset( (*ppacket)->arphdr.ar_tha, 0x0,ETH_ALEN );
}
void print_xml(struct in_addr *ipsrc, packet *ppacket_r, struct hostent* name){
printf("%s %02x:%02x:%02x:%02x:%02x:%02x %s \n",inet_ntoa(*ipsrc), *ppacket_r->arphdr.ar_sha,ppacket_r->arphdr.ar_sha[1],ppacket_r->arphdr.ar_sha[2],
ppacket_r->arphdr.ar_sha[3],ppacket_r->arphdr.ar_sha[4],ppacket_r->arphdr.ar_sha[5], name?name->h_name:"-");
}
void create_socket(int *sd, struct sockaddr_ll *sll, int index){
/* Socket creation */
*sd = socket( PF_PACKET, SOCK_RAW, htons( ETH_P_ARP ) );
/* Put the iface index in sockaddr_ll structure to bind */
sll->sll_ifindex = index;
if( *sd < 0 ){
perror("Socket creation problem");
exit(1);
}
if( fcntl( *sd, F_SETFL, O_NONBLOCK ) == -1 ){
perror("Cannot set socket mode to O_NONBLOCK");
exit(1);
}
/* Bind */
if( bind( *sd, (struct sockaddr*)sll, sizeof(*sll) ) == -1 ){
perror("Bind error");
exit(1);
}
}
void validate_iface( struct sockaddr_in *ipaddr, struct sockaddr_in *netmask, packet *ppacket ){
char error_str[100];
if( ntohl(netmask->sin_addr.s_addr) < 0xFFFF0000){
snprintf(error_str, 100, "Invalid netmask -> too large (%s). Stop\n", inet_ntoa(netmask->sin_addr));
perror( error_str );
exit(1);
}
}
void scan_init( unsigned long *unet, unsigned long *uhost, struct sockaddr_in *ipaddr, struct sockaddr_in *netmask, struct in_addr *ipsrc, packet **ppacket_r ){
/* Netid */
*unet = ntohl(ipaddr->sin_addr.s_addr) & ntohl(netmask->sin_addr.s_addr);
/* Supposed number of hosts */
*uhost = ~( ntohl(netmask->sin_addr.s_addr) );
memset(ipsrc, 0, sizeof(struct in_addr));
*ppacket_r = malloc( sizeof( packet ) );
}
int main(int argc, char ** argv){
/* Declarations */
/* full packet (tx and rx) */
packet *ppacket, *ppacket_r;
/* Socket descriptor, nic index */
int sd = 0;
int flag = 0;
int index = 0;
/* ip data */
unsigned long unet,uhost,ipdst,tip;
/* The name of the interface is given in parameter to the binary */
char * iface;
/* detected device's FQDN */
struct hostent* name;
/* ip level sockaddr */
struct sockaddr_in ipaddr, netmask;
/* Lowlevel sockaddr */
struct sockaddr_ll sll = {0x0};
/* source ip to put in packet */
struct in_addr ipsrc;
int request_latency = REQUEST_LATENCY_DEFAULT;
int p=0;
/* Take at least one argument */
if(argc<2){
printf("IPDISCOVER binary ver. %d \nUsage : ipdiscover [iface name] [latency in ms]\n", VERSION);
exit(0);
}else{
iface = argv[1];
if( argc==3 )
request_latency = atoi( argv[2] );
}
/* Initialize data */
data_init( &ipaddr, &netmask, &ppacket, &sll, index );
/* Reading nic parameters */
get_iface_infos( ppacket, &index, iface, &ipaddr, &netmask );
/* Check iface settings */
validate_iface( &ipaddr, &netmask, ppacket );
/* Creating socket */
create_socket( &sd, &sll, index );
/* Initialize packet target ip, potential hosts number... */
scan_init( &unet, &uhost, &ipaddr, &netmask, &ipsrc, &ppacket_r );
/* We are looking for all the possible connected host */
for(ipdst=1;ipdstarphdr.ar_tip, &tip, 4 );
/* Sending the packet */
if( write( sd, ppacket, sizeof(packet) ) < 0 ){
perror("Transmission error");
exit(1);
}
flag = 0;
usleep( request_latency * 1000 );
while( flag>=0 ){
memset( ppacket_r, 0, sizeof( packet ) );
flag = read( sd, ppacket_r, sizeof( packet ) );
if( flag>0 )
memcpy(&ipsrc, ppacket_r->arphdr.ar_sip, sizeof(struct in_addr));
if(ntohs(ppacket_r->arphdr.arp_opcode) == 2){
char * c;
if(p==0)
printf("\n");
p++;
name = gethostbyaddr(&ipsrc, sizeof(struct in_addr), AF_INET);
if(name){
while((c=strchr(name->h_name,'<')) || (c=strchr(name->h_name,'>'))){
strncpy(c,"x",sizeof(c));
}
}
usleep( NAME_RES_LATENCY );
print_xml( &ipsrc, ppacket_r, name );
}
}
}
if(p)
printf(" \n");
/* That's all */
exit(0);
}
UnixAgent-2.4.2/resources/ipdiscover/ipdiscover.h 0000664 0000000 0000000 00000003000 13327377321 0022123 0 ustar 00root root 0000000 0000000 /*
###############################################################################
##OCSInventory Version NG Beta
##Copyleft Pascal DANEK 2006
##Web : http://ocsinventory.sourceforge.net
##
##This code is open source and may be copied and modified as long as the source
##code is always made freely available.
##Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifndef ARPHRD_ETHER
#define ARPHRD_ETHER 1
#endif
#ifndef ARPOP_REQUEST
#define ARPOP_REQUEST 1
#endif
#ifndef ARPOP_REPLY
#define ARPOP_REPLY 2
#endif
#define VERSION 5
#define NAME_RES_LATENCY 1000000
#define REQUEST_LATENCY_DEFAULT 100 /* ms */
/* Trame ARP */
struct arphdr{
unsigned short arp_hrdad;
unsigned short arp_prot;
unsigned char arp_halen;
unsigned char arp_prlen;
unsigned short arp_opcode;
unsigned char ar_sha[ETH_ALEN];
unsigned char ar_sip[4];
unsigned char ar_tha[ETH_ALEN];
unsigned char ar_tip[4];
};
/* Ethernet header*/
struct Packet{
struct ethhdr ethhdr;
struct arphdr arphdr;
};
typedef struct Packet packet;
UnixAgent-2.4.2/snmp/ 0000775 0000000 0000000 00000000000 13327377321 0014406 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/snmp/mibs/ 0000775 0000000 0000000 00000000000 13327377321 0015340 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/snmp/mibs/local/ 0000775 0000000 0000000 00000000000 13327377321 0016432 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/snmp/mibs/local/1588.xml 0000664 0000000 0000000 00000007707 13327377321 0017574 0 ustar 00root root 0000000 0000000
1
1
Brocade
Host_Resources_Mib
If_Mib
Entity_Mib
San
1.3.6.1.4.1.1588.2.1.1.1.1.10.0
Brocade
1.3.6.1.4.1.1588.2.1.1.1.1.6.0
1.3.6.1.4.1.1588.2.1.1.1.2.1.0
1.3.6.1.4.1.1588.2.1.1.1.2.2.0
1.3.6.1.4.1.1588.2.1.1.1.6.2.1.1
1.3.6.1.4.1.1588.2.1.1.1.6.2.1.1.(\S+)
IDX
1.3.6.1.4.1.1588.2.1.1.1.6.2.1.37.IDX
1.3.6.1.4.1.1588.2.1.1.1.6.2.1.3.IDX
1
No Card
2
No Gbic
3
Laser Fault
4
No Light
5
No Sync
6
In Sync
7
Port Fault
8
Diagnostics Fault
9
Lock Reference Signal
1.3.6.1.4.1.1588.2.1.1.1.6.2.1.4.IDX
0
Unknown
1
Online
2
Offline
3
testing
4
Faulty
1.3.6.1.4.1.1588.2.1.1.1.6.2.1.5.IDX
1
Online
2
Offline
3
Testing
4
Faulty
1.3.6.1.4.1.1588.2.1.1.1.6.2.1.7.IDX
1
unknown
2
long wave laser (lw)
3
short wave laser (sw)
4
long wave LED (ld)
5
copper (CU)
1.3.6.1.4.1.1588.2.1.1.1.6.2.1.35.IDX
1
1 GB
2
2 GB
3
auto
4
4 GB
5
8 GB
6
10 GB
1.3.6.1.4.1.1588.2.1.1.1.6.2.1.34.IDX
UnixAgent-2.4.2/snmp/mibs/local/18552.xml 0000664 0000000 0000000 00000000273 13327377321 0017642 0 ustar 00root root 0000000 0000000
1
1
xxx
8072
UnixAgent-2.4.2/snmp/mibs/local/24681.xml 0000664 0000000 0000000 00000002137 13327377321 0017643 0 ustar 00root root 0000000 0000000
1
1
Nas
San
1.3.6.1.4.1.24681.1.4
1.3.6.1.4.1.24681.1.2
1.3.6.1.4.1.24681.1.9.1.2
1.3.6.1.4.1.24681.1.9.1.(\S+)
IDX
1.3.6.1.4.1.24681.1.9.1.2.IDX
1.3.6.1.4.1.24681.1.11.1.2
1.3.6.1.4.1.24681.1.11.1.(\S+)
IDX
1.3.6.1.4.1.24681.1.11.5.IDX
1.3.6.1.4.1.24681.1.11.6.IDX
1.3.6.1.4.1.24681.1.11.2.IDX
UnixAgent-2.4.2/snmp/mibs/local/6876.xml 0000664 0000000 0000000 00000006042 13327377321 0017570 0 ustar 00root root 0000000 0000000
1
1
Vmware
Host_Resources_Mib
If_Mib
1.3.6.1.4.1.6876.1.1.0
Virtual Server
1.3.6.1.4.1.6876.1.1.0
VmWare
1.3.6.1.4.1.6876.1.2.0
1.3.6.1.4.1.6876.1.4.0
1.3.6.1.4.1.6876.2.1.1.2
1.3.6.1.4.1.6876.2.1.1.2.(\S+)
VM
1.3.6.1.4.1.6876.2.1.1.2.VM
1.3.6.1.4.1.6876.2.1.1.3.VM
1.3.6.1.4.1.6876.2.1.1.4.VM
1.3.6.1.4.1.6876.2.1.1.5.VM
1.3.6.1.4.1.6876.2.1.1.6.VM
1.3.6.1.4.1.6876.2.1.1.9.VM
1.3.6.1.4.1.6876.2.1.1.10.VM
1.3.6.1.4.1.6876.2.3.1.3.VM
1.3.6.1.4.1.6876.2.3.1.3.VM.(\S+)
DISK
1.3.6.1.4.1.6876.2.3.1.3.VM.DISK
1.3.6.1.4.1.6876.2.4.1.3.VM
1.3.6.1.4.1.6876.2.4.1.3.VM.(\S+)
NET
1.3.6.1.4.1.6876.2.4.1.3.VM.NET
1.3.6.1.4.1.6876.2.4.1.4.VM.NET
1.3.6.1.4.1.6876.2.4.1.7.VM.NET
1.3.6.1.4.1.6876.2.4.1.6.VM.NET
true
Up
false
Down
UnixAgent-2.4.2/snmp/mibs/local/7244.xml 0000664 0000000 0000000 00000031042 13327377321 0017554 0 ustar 00root root 0000000 0000000
1
1
Blade
1.3.6.1.4.1.7244.1.1.1.3.2.4.1.1
1.3.6.1.4.1.7244.1.1.1.3.2.4.1.1.(\S+)
POWER
1.3.6.1.4.1.7244.1.1.1.3.2.4.1.2.POWER
1
Unknown
2
Ok
3
Not present
4
Error
5
Critical
6
Off
7
dummy
1.3.6.1.4.1.7244.1.1.1.3.2.4.1.3.POWER
1.3.6.1.4.1.7244.1.1.1.3.2.4.1.4.POWER
1.3.6.1.4.1.7244.1.1.1.3.2.5.1.5.POWER
1.3.6.1.4.1.7244.1.1.1.3.2.4.1.6.POWER
1.3.6.1.4.1.7244.1.1.1.3.2.4.1.7.POWER
1.3.6.1.4.1.7244.1.1.1.4.1.1.1.1
1.3.6.1.4.1.7244.1.1.1.4.1.1.1.1.(\S+)
LAME
1.3.6.1.4.1.7244.1.1.1.4.1.1.1.5.LAME
1
Unknown
2
On
3
Off
4
Power-cycle
5
Reset
6
Nmi
7
Force Off
1.3.6.1.4.1.7244.1.1.1.4.1.1.1.1.LAME
1.3.6.1.4.1.7244.1.1.1.4.2.1.1.2.LAME
1
Unknown
2
Ok
3
Not Present
4
Error
5
Critical
6
Standby
1.3.6.1.4.1.7244.1.1.1.4.2.1.1.3.LAME
FSC
Fujitsu Siemens Computers
1.3.6.1.4.1.7244.1.1.1.4.2.1.1.5.LAME
1.3.6.1.4.1.7244.1.1.1.4.2.1.1.6.LAME
1.3.6.1.4.1.7244.1.1.1.4.2.1.1.8.LAME
1.3.6.1.4.1.7244.1.1.1.4.2.1.1.9.LAME
1.3.6.1.4.1.7244.1.1.1.4.2.1.1.10.LAME
1.3.6.1.4.1.7244.1.1.1.4.2.1.1.10.LAME
1.3.6.1.4.1.7244.1.1.1.4.2.1.1.11.LAME
1.3.6.1.4.1.7244.1.1.1.4.2.1.1.12.LAME
1.3.6.1.4.1.7244.1.1.1.4.2.1.1.22.LAME
1.3.6.1.4.1.7244.1.1.1.4.3.1.1.1.LAME
1.3.6.1.4.1.7244.1.1.1.4.3.1.1.1.LAME.(\S+)
CPU
1.3.6.1.4.1.7244.1.1.1.4.3.1.1.3.LAME.CPU
12
Xeon
11
Pentium M
10
Pentium IV
9
M Un
8
Pentium III
7
Pentium II Xeon
6
Celeron
5
Pentium MMX
4
Pentium II
3
Pentium Pro
2
Pentium
1
Unknown
1.3.6.1.4.1.7244.1.1.1.4.3.1.1.4.LAME.CPU
1.3.6.1.4.1.7244.1.1.1.4.3.1.1.6.LAME.CPU
1
Unknown
2
OK
3
Not Present
4
Error
5
Critical
6
Missing termination
7
Disabled
1.3.6.1.4.1.7244.1.1.1.4.3.1.1.9.LAME.CPU
1.3.6.1.4.1.7244.1.1.1.4.4.1.1.2.LAME
1.3.6.1.4.1.7244.1.1.1.4.4.2.1.1.LAME
1.3.6.1.4.1.7244.1.1.1.4.4.2.1.1.LAME.(\S+)
SLOT
1.3.6.1.4.1.7244.1.1.1.4.4.2.1.2.LAME.SLOT
1.3.6.1.4.1.7244.1.1.1.4.4.2.1.3.LAME.SLOT
1
Unknown
2
Disable
3
Ok
4
Not Present
5
Critical
6
Prefailure Warning
3
1.3.6.1.4.1.7244.1.1.1.4.4.2.1.4.LAME.SLOT
1.3.6.1.4.1.7244.1.1.1.4.4.2.1.6.LAME.SLOT
1.3.6.1.4.1.7244.1.1.1.4.4.2.1.7.LAME.SLOT
1.3.6.1.4.1.7244.1.1.1.3.3.1.1.2
1.3.6.1.4.1.7244.1.1.1.3.3.1.1.2.(\S+)
FAN
1.3.6.1.4.1.7244.1.1.1.3.3.1.1.2.FAN
1
Unknown
2
Disable
3
Ok
4
Fail
5
Prefailure predicted
6
Redundant fan failed
7
Not manageable
8
Not present
9
Not available
1.3.6.1.4.1.7244.1.1.1.3.3.1.1.3.FAN
1.3.6.1.4.1.7244.1.1.1.2.1.1.3
1.3.6.1.4.1.7244.1.1.1.2.1.1.3.(\S+)
BLADE
1.3.6.1.4.1.7244.1.1.1.2.1.1.2.BLADE
1
Unknown
2
Ok
3
Not present
4
Error
5
Critical
6
Standby
1.3.6.1.4.1.7244.1.1.1.2.1.1.3.BLADE
FSC
Fujitsu Siemens Computers
1.3.6.1.4.1.7244.1.1.1.2.1.1.5.BLADE
1.3.6.1.4.1.7244.1.1.1.2.1.1.6.BLADE
1.3.6.1.4.1.7244.1.1.1.2.1.1.7.BLADE
1.3.6.1.4.1.7244.1.1.1.2.1.1.8.BLADE
1.3.6.1.4.1.7244.1.1.1.2.1.1.9.BLADE
UnixAgent-2.4.2/tools/ 0000775 0000000 0000000 00000000000 13327377321 0014571 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/tools/build-perl-tree.sh 0000775 0000000 0000000 00000004635 13327377321 0020134 0 ustar 00root root 0000000 0000000 #!/bin/sh
# A script to prepare a installation of Perl + OCSInventory-agent for
# Unix/Linux
# This in order to be able to provide an installation for system without
# Perl > 5.6
set -e
MAKE="make"
TMP="/home2/goneri/tmp"
PREFIX="$TMP/build/opt/ocsinventory-agent"
ETCDIR="$PREFIX/etc"
BASEDIR="$PREFIX/var/ocsinventory-agent"
LOGDIR="$PREFIX/log/ocsinventory-agent"
PIDFILE="$PREFIX/var/run"
PERLVERSION="5.10.0"
if [ ! -d $TMP ]; then
echo "tmp $TMP dir is missing"
fi
cd $TMP
if [ ! -f perl-$PERLVERSION.tar.gz ]; then
wget -O perl-$PERLVERSION.tar.gz.part http://cpan.perl.org/src/perl-$PERLVERSION.tar.gz
mv perl-$PERLVERSION.tar.gz.part perl-$PERLVERSION.tar.gz
fi
gunzip < perl-$PERLVERSION.tar.gz | tar xvf -
cd perl-$PERLVERSION
# AIX
#./Configure -Dusenm -des -Dinstallprefix=$PREFIX -Dsiteprefix=$PREFIX -Dprefix=$PREFIX
#./Configure -Dcc="gcc" -des -Dinstallprefix=$PREFIX -Dsiteprefix=$PREFIX -Dprefix=$PREFIX
./Configure -des -Dinstallprefix=$PREFIX -Dsiteprefix=$PREFIX -Dprefix=$PREFIX
$MAKE
$MAKE install
PATH=$PREFIX/bin:$PATH
export PATH
cpanp 's conf prereqs 1; i XML::SAX'
cpanp 's conf prereqs 1; i XML::Simple'
cpanp 's conf prereqs 1; i LWP'
cpanp 's conf prereqs 1; i Proc::Daemon'
cpanp 's conf prereqs 1; i HTML::Parser' # For what?
# Report error about IPv6 on Solaris 10
cpanp 's conf prereqs 1; i --force Net::IP'
cpanp 's conf prereqs 1; i --force PAR::Packer'
cpanp 's conf prereqs 1; i --force Net::SSLeay'
exit;
if [ ! openssl-0.9.8j.tar.gz ]; then
wget -O openssl-0.9.8j.tar.gz.part http://www.openssl.org/source/openssl-0.9.8j.tar.gz
mv openssl-0.9.8j.tar.gz.part openssl-0.9.8j.tar.gz
fi
gunzip < openssl-0.9.8j.tar.gz | tar xvf -
cd openssl-0.9.8j
./config --prefix=/home2/goneri/tmp/openssl
make
make install
ln -s apps bin
#for i in `ls ../tarballs/*.gz`; do
# gunzip < $i | tar xvf -
#done
#cd ../expat-2.0.0/
#./configure --prefix=$PREFIX
#$MAKE
#cd ../Ocsinventory-Agent-0.0.2/
#$PERL Makefile.PL PREFIX=$PREFIX
#$MAKE PREFIX=$PREFIX
#$MAKE install PREFIX=$PREFIX
#:$PATH#perl -i -pe "s!/etc/ocsinventory-agent!$ETCDIR!" $PREFIX/bin/ocsinventory-agent
#perl -i -pe "s!/var/lib/ocsinventory-agent!$BASEDIR!" $PREFIX/bin/ocsinventory-agent
#perl -i -pe "s!/var/log/ocsinventory-agent!$LOGDIR!" $PREFIX/bin/ocsinventory-agent
#perl -i -pe "s!/var/run/ocsinventory-agent.pid!$PIDFILE!" $PREFIX/bin/ocsinventory-agent
#mkdir -p $ETCDIR
#mkdir -p $BASEDIR
#mkdir -p $LOGDIR
#mkdir -p $PIDFILE
UnixAgent-2.4.2/tools/macosx/ 0000775 0000000 0000000 00000000000 13327377321 0016063 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/tools/macosx/README 0000664 0000000 0000000 00000004320 13327377321 0016742 0 ustar 00root root 0000000 0000000 DESCRIPTION
OS X [darwin] Readme
This README will help you roll your own native OSX, OCSNG.app client for enterprise deployment.
PREREQUISITES
- XCode 6.4
- Darwin Perl dependencies [A tarball with all the PerlDep's you'll need for this to run in darwin-land, see create....cpan.pl script]
- OCSNG.pmproj [Apple PackageMaker binrary settings file]
- Iceberg [http://s.sudre.free.fr/Software/Iceberg.html]
BUILDING/INSTALLING
- Run the tools/macosx/scripts/create-darwin-perl-lib_fromCPAN.pl script which will create the ~/darwin-perl-lib directory. This directory will stash a built version of all the perl libraries needed to run this client (ie: no running CPAN on the hosts you're deploying this on)
- READ THE SCRIPT BEFORE RUNNING, some CPAN configurations are needed prior to running
- You'll need CPAN, Perl (the development libraries for perl), so Xcode Tools (just about a full install).
- Open the tools/macosx/ocsng_app-xcode/OCSNG.xcodeproj project using Xcode 6.4 and build it (Choose menu "Product\Archive")
- Export the created archive to folder tools/macosx/installer_gui/iceberg/
- OPen tools/macosx/installer_gui/iceberg/iceberg_project.packproj file using Iceberg and build it to create the final graphic installer
COPYRIGHT
See AUTHORS file. Ocsinventory-Agent is released under GNU GPL 2 licence. Portions of the Xcode project may fall under other, open licences (individual files will elaborate). Some of the Xcode project files are not core pieces of OCSNG and are to be treated as a supplement tool for building the agent for OSX deployment.
NOTES
- macosx tools was created by claimid.com/wesyoung and modified by OCS NG team for the 2.0 version.
- Once installed, the agent should contact the server and upload an initial inventory, then go back to sleep.
- OCS MacOSX agent is launched using LaunchD but you can click on /Applications/OCSNG.app to launch OCS agent manually.
- You can take a look to OCS MacOSX logs in /var/logs/ocsng.log file (by default)
- To uninstall the .app, use the uninstaller.sh script in /Application/OCSNG/Contents/Resources directory. This will kill the service, remove all the files (no restart required).
- This package works on MacOSX 10.9+ on i386, ppc and x86_64 architectures.
UnixAgent-2.4.2/tools/macosx/installer_gui/ 0000775 0000000 0000000 00000000000 13327377321 0020724 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/tools/macosx/installer_gui/iceberg/ 0000775 0000000 0000000 00000000000 13327377321 0022324 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/tools/macosx/installer_gui/iceberg/iceberg_project.packproj 0000664 0000000 0000000 00000035421 13327377321 0027212 0 ustar 00root root 0000000 0000000
Hierarchy
Attributes
Documents
Background Image
IFPkgFlagBackgroundAlignment
0
IFPkgFlagBackgroundScaling
2
Mode
1
Path
logos/OCS_logo.jpg
Path Type
2
License
English
Keywords
Mode
1
Path
license/gpl-2.0.txt
Path Type
2
Template
APSL License
French
Keywords
Mode
1
Path
license/gpl-2.0.txt
Path Type
2
Template
CeCILL 2 License
International
Mode
1
Path
license/gpl-2.0.txt
Path Type
2
ReadMe
International
Mode
0
Path
Path Type
1
Welcome
International
Mode
0
Path
Path Type
1
Files
Compress
Hierarchy
Children
Children
Children
GID
80
Path
OCSNG.app
Path Type
2
Privileges
493
Type
3
UID
0
Children
GID
80
Path
Utilities
Path Type
1
Privileges
509
Type
1
UID
0
GID
80
Path
Applications
Path Type
1
Privileges
509
Type
1
UID
0
Children
Children
GID
80
Path
Application Support
Path Type
1
Privileges
509
Type
1
UID
0
Children
GID
80
Path
Documentation
Path Type
1
Privileges
509
Type
1
UID
0
Children
GID
80
Path
Filesystems
Path Type
1
Privileges
509
Type
1
UID
0
Children
GID
80
Path
Frameworks
Path Type
1
Privileges
509
Type
1
UID
0
Children
GID
80
Path
Internet Plug-Ins
Path Type
1
Privileges
509
Type
1
UID
0
Children
GID
80
Path
PreferencePanes
Path Type
1
Privileges
509
Type
1
UID
0
Children
GID
80
Path
Preferences
Path Type
1
Privileges
509
Type
1
UID
0
Children
GID
80
Path
Printers
Path Type
1
Privileges
509
Type
1
UID
0
Children
GID
80
Path
QuickTime
Path Type
1
Privileges
509
Type
1
UID
0
Children
GID
80
Path
Scripts
Path Type
1
Privileges
509
Type
1
UID
0
GID
80
Path
Library
Path Type
1
Privileges
1021
Type
1
UID
0
Children
Children
Children
GID
0
Path
Extensions
Path Type
1
Privileges
493
Type
1
UID
0
GID
0
Path
Library
Path Type
1
Privileges
493
Type
1
UID
0
GID
0
Path
System
Path Type
1
Privileges
493
Type
1
UID
0
GID
80
Path
/
Path Type
1
Privileges
1021
Type
1
UID
0
IFPkgFlagDefaultLocation
/Applications
Imported Package
Package Path
Split Forks
Plugins
PluginsList
Path
Introduction
Type
0
Path
ReadMe
Type
0
Path
License
Type
0
Path
plugins/ocs_agent_config.bundle
Path Type
2
Status
Type
1
Path
plugins/ocs_agent_daemon_options.bundle
Path Type
2
Status
Type
1
Path
Target
Type
0
Path
PackageSelection
Type
0
Path
Install
Type
0
Path
FinishUp
Type
0
Scripts
Additional Resources
International
Installation Scripts
IFInstallationScriptsPostflight
Path
Status
IFInstallationScriptsPostinstall
Path
scripts/postinstall
Path Type
2
Status
IFInstallationScriptsPostupgrade
Path
scripts/postinstall
Path Type
2
Status
IFInstallationScriptsPreflight
Path
Status
IFInstallationScriptsPreinstall
Path
Status
IFInstallationScriptsPreupgrade
Path
Status
Requirements
Settings
Description
International
IFPkgDescriptionDeleteWarning
IFPkgDescriptionDescription
IFPkgDescriptionTitle
Ocsinventory Agent MacOSX
IFPkgDescriptionVersion
2.3
Display Information
CFBundleGetInfoString
Ocsinventory Agent MacOSX
CFBundleIconFile
CFBundleIconFile Path Type
1
CFBundleIdentifier
org.ocsinventory-ng.agent.macosx
CFBundleName
Ocsinventory Agent MacOSX
CFBundleShortVersionString
2.3
Options
IFPkgFlagAllowBackRev
IFPkgFlagAuthorizationAction
1
IFPkgFlagFollowLinks
IFPkgFlagIsRequired
IFPkgFlagOverwritePermissions
IFPkgFlagRelocatable
IFPkgFlagRestartAction
0
IFPkgFlagRootVolumeOnly
IFPkgFlagUpdateInstalledLanguages
Version
IFMajorVersion
2
IFMinorVersion
0
IFPkgFlagPackageSelection
0
Name
Ocsinventory_Agent_MacOSX
Status
1
Type
1
Name
Project
Settings
10.1 Compatibility
Build Path
build
Build Path Type
2
Comment
Remove .DS_Store
Remove .pbdevelopment
Remove CVS
UnixAgent-2.4.2/tools/macosx/installer_gui/iceberg/license/ 0000775 0000000 0000000 00000000000 13327377321 0023746 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/tools/macosx/installer_gui/iceberg/license/gpl-2.0.txt 0000664 0000000 0000000 00000043254 13327377321 0025576 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
UnixAgent-2.4.2/tools/macosx/installer_gui/iceberg/logos/ 0000775 0000000 0000000 00000000000 13327377321 0023447 5 ustar 00root root 0000000 0000000 UnixAgent-2.4.2/tools/macosx/installer_gui/iceberg/logos/OCS_logo.jpg 0000775 0000000 0000000 00000024567 13327377321 0025636 0 ustar 00root root 0000000 0000000 PNG
IHDR , r F pHYs .# .#x?v
OiCCPPhotoshop ICC profile xڝSgTS=BKKoR RB&*! J!QEEȠQ,
!{kּ>H3Q5B.@
$p d!s# ~<<+" x M0B\t8K @zB @F&S