├── macosx ├── setup_plugins │ ├── .gitkeep │ ├── auth_plugin_installer │ │ └── auth │ │ │ ├── en.lproj │ │ │ ├── InfoPlist.strings │ │ │ ├── Localizable.strings │ │ │ └── AuthInstallerPane.strings │ │ │ ├── AuthInstallerPane.h │ │ │ ├── InstallerSections.plist │ │ │ └── Info.plist │ ├── config_plugin_installer │ │ └── config │ │ │ ├── en.lproj │ │ │ ├── InfoPlist.strings │ │ │ ├── Localizable.strings │ │ │ └── ConfigInstallerPane.strings │ │ │ ├── InstallerSections.plist │ │ │ ├── ConfigInstallerPane.h │ │ │ └── Info.plist │ └── daemonconfig_plugin_install │ │ └── daemonconfig │ │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ ├── Localizable.strings │ │ └── DaemonConfigPane.strings │ │ ├── DaemonConfigPane.h │ │ ├── InstallerSections.plist │ │ └── Info.plist ├── ocsinventory_packages_setup │ ├── .gitignore │ ├── logos │ │ └── OCS_logo.jpg │ ├── auth.bundle │ │ └── Contents │ │ │ ├── MacOS │ │ │ └── auth │ │ │ ├── Resources │ │ │ ├── en.lproj │ │ │ │ ├── InfoPlist.strings │ │ │ │ ├── Localizable.strings │ │ │ │ └── AuthInstallerPane.strings │ │ │ ├── Base.lproj │ │ │ │ └── AuthInstallerPane.nib │ │ │ └── InstallerSections.plist │ │ │ └── Info.plist │ ├── config.bundle │ │ └── Contents │ │ │ ├── MacOS │ │ │ └── config │ │ │ ├── Resources │ │ │ ├── en.lproj │ │ │ │ ├── InfoPlist.strings │ │ │ │ ├── Localizable.strings │ │ │ │ └── ConfigInstallerPane.strings │ │ │ ├── Base.lproj │ │ │ │ └── ConfigInstallerPane.nib │ │ │ └── InstallerSections.plist │ │ │ └── Info.plist │ ├── daemonconfig.bundle │ │ └── Contents │ │ │ ├── MacOS │ │ │ └── daemonconfig │ │ │ ├── Resources │ │ │ ├── en.lproj │ │ │ │ ├── InfoPlist.strings │ │ │ │ ├── Localizable.strings │ │ │ │ └── DaemonConfigPane.strings │ │ │ ├── Base.lproj │ │ │ │ └── DaemonConfigPane.nib │ │ │ └── InstallerSections.plist │ │ │ └── Info.plist │ └── scripts │ │ ├── preinstall │ │ └── postinstall ├── ocsng_app-xcode │ ├── GetPID.h │ ├── icons │ │ └── ocs_logo.icns │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ └── Localizable.strings │ ├── OCSNG_Prefix.pch │ ├── ocscontact.h │ ├── .gitignore │ ├── fr.lproj │ │ └── Localizable.strings │ ├── ocscontact-Info.plist │ ├── Info.plist │ └── ocscontact.m ├── deps │ └── darwin-perl-deps.zip ├── patches │ ├── perl_sonoma.patch │ ├── ocsinventory-agent-darwin.patch │ └── lib-ocsinventory-agent-backend-darwn.patch ├── scripts │ └── uninstaller.sh └── README ├── resources ├── cpuinfo │ ├── cpuinfo-vmware-esx │ ├── linux-ppc-1 │ ├── linux-ppc-2 │ ├── linux-sparc-1 │ ├── linux-mips-1 │ ├── linux-ia64-1 │ ├── linux-686-1 │ ├── linux-armel-1 │ └── linux-alpha-1 └── ipdiscover │ └── ipdiscover.h ├── etc ├── default │ └── ocsinventory-agent ├── ocsinventory-agent │ ├── modules.conf │ └── softwares │ │ └── example.sh ├── cron.d │ └── ocsinventory-agent └── logrotate.d │ └── ocsinventory-agent ├── lib └── Ocsinventory │ ├── Agent │ ├── Backend │ │ ├── OS │ │ │ ├── Generic.pm │ │ │ ├── Generic │ │ │ │ ├── Repository.pm │ │ │ │ ├── Lspci.pm │ │ │ │ ├── Lsusb.pm │ │ │ │ ├── Dmidecode.pm │ │ │ │ ├── Packaging.pm │ │ │ │ ├── Lspci │ │ │ │ │ ├── Sounds.pm │ │ │ │ │ ├── Modems.pm │ │ │ │ │ └── Videos.pm │ │ │ │ ├── Dmidecode │ │ │ │ │ ├── UUID.pm │ │ │ │ │ ├── Psu.pm │ │ │ │ │ ├── Slots.pm │ │ │ │ │ └── Ports.pm │ │ │ │ ├── Packaging │ │ │ │ │ ├── Pacman.pm │ │ │ │ │ ├── AppImage.pm │ │ │ │ │ ├── Flatpak.pm │ │ │ │ │ ├── Snap.pm │ │ │ │ │ ├── BSDpkg.pm │ │ │ │ │ ├── Gentoo.pm │ │ │ │ │ └── RPM.pm │ │ │ │ ├── Hostname.pm │ │ │ │ ├── OS.pm │ │ │ │ ├── Repository │ │ │ │ │ ├── SuSE.pm │ │ │ │ │ └── Debian.pm │ │ │ │ └── Printers │ │ │ │ │ └── Cups.pm │ │ │ ├── Linux │ │ │ │ ├── Distro │ │ │ │ │ ├── NonLSB.pm │ │ │ │ │ ├── NonLSB │ │ │ │ │ │ ├── Fedora.pm │ │ │ │ │ │ ├── Trustix.pm │ │ │ │ │ │ ├── VmWare.pm │ │ │ │ │ │ ├── ArchLinux.pm │ │ │ │ │ │ ├── Gentoo.pm │ │ │ │ │ │ ├── Oracle.pm │ │ │ │ │ │ ├── Mandrake.pm │ │ │ │ │ │ ├── Debian.pm │ │ │ │ │ │ ├── Knoppix.pm │ │ │ │ │ │ ├── Mandriva.pm │ │ │ │ │ │ ├── CentOS.pm │ │ │ │ │ │ ├── Redhat.pm │ │ │ │ │ │ ├── Ubuntu.pm │ │ │ │ │ │ ├── Slackware.pm │ │ │ │ │ │ └── SuSE.pm │ │ │ │ │ └── LSB.pm │ │ │ │ ├── Archs │ │ │ │ │ ├── ARM.pm │ │ │ │ │ ├── m68k.pm │ │ │ │ │ ├── Alpha.pm │ │ │ │ │ ├── MIPS.pm │ │ │ │ │ ├── SPARC.pm │ │ │ │ │ ├── s390x.pm │ │ │ │ │ ├── i386.pm │ │ │ │ │ ├── PowerPC.pm │ │ │ │ │ ├── SPARC │ │ │ │ │ │ └── CPU.pm │ │ │ │ │ ├── MIPS │ │ │ │ │ │ └── CPU.pm │ │ │ │ │ ├── m68k │ │ │ │ │ │ └── CPU.pm │ │ │ │ │ ├── s390x │ │ │ │ │ │ └── CPU.pm │ │ │ │ │ ├── Alpha │ │ │ │ │ │ └── CPU.pm │ │ │ │ │ ├── PowerPC │ │ │ │ │ │ └── CPU.pm │ │ │ │ │ └── ARM │ │ │ │ │ │ ├── CPU.pm │ │ │ │ │ │ └── Bios.pm │ │ │ │ ├── Sys.pm │ │ │ │ ├── Mem.pm │ │ │ │ ├── Domains.pm │ │ │ │ ├── Network │ │ │ │ │ └── IP.pm │ │ │ │ ├── Uptime.pm │ │ │ │ └── Inputs.pm │ │ │ ├── BSD │ │ │ │ ├── Sys.pm │ │ │ │ ├── IPv4.pm │ │ │ │ ├── Mem.pm │ │ │ │ ├── Uptime.pm │ │ │ │ ├── Drives.pm │ │ │ │ ├── Domains.pm │ │ │ │ ├── Archs │ │ │ │ │ ├── I386.pm │ │ │ │ │ └── Alpha.pm │ │ │ │ └── Acpiconf.pm │ │ │ ├── AIX │ │ │ │ ├── UUID.pm │ │ │ │ ├── Users.pm │ │ │ │ ├── Modems.pm │ │ │ │ ├── Videos.pm │ │ │ │ ├── IPv4.pm │ │ │ │ ├── Sounds.pm │ │ │ │ ├── Domains.pm │ │ │ │ ├── Controller.pm │ │ │ │ ├── Software.pm │ │ │ │ ├── Mem.pm │ │ │ │ ├── Slots.pm │ │ │ │ └── Drives.pm │ │ │ ├── Solaris │ │ │ │ ├── Users.pm │ │ │ │ ├── Domains.pm │ │ │ │ ├── Mem.pm │ │ │ │ ├── Controllers.pm │ │ │ │ ├── IPv4.pm │ │ │ │ └── Ports.pm │ │ │ ├── HPUX │ │ │ │ ├── IPv4.pm │ │ │ │ ├── Mem.pm │ │ │ │ ├── Domains.pm │ │ │ │ ├── Software.pm │ │ │ │ ├── Controller.pm │ │ │ │ ├── Slots.pm │ │ │ │ ├── Bios.pm │ │ │ │ ├── Drives.pm │ │ │ │ └── README │ │ │ ├── MacOS │ │ │ │ ├── UUID.pm │ │ │ │ ├── Camera.pm │ │ │ │ ├── Hostname.pm │ │ │ │ ├── IPv4.pm │ │ │ │ ├── Sound.pm │ │ │ │ ├── Domains.pm │ │ │ │ ├── Uptime.pm │ │ │ │ ├── Slots.pm │ │ │ │ ├── Drives.pm │ │ │ │ └── Bios.pm │ │ │ ├── HPUX.pm │ │ │ ├── AIX.pm │ │ │ ├── Linux.pm │ │ │ ├── BSD.pm │ │ │ └── Solaris.pm │ │ ├── Virtualization │ │ │ ├── Xen.pm │ │ │ ├── Docker.pm │ │ │ ├── Libvirt.pm │ │ │ ├── VmWareDesktop.pm │ │ │ ├── VmWareESX.pm │ │ │ ├── XenCitrixServer.pm │ │ │ ├── SolarisLdoms.pm │ │ │ ├── Jails.pm │ │ │ └── VmWareWorkstation.pm │ │ ├── IpDiscover.pm │ │ ├── AccessLog.pm │ │ └── DeviceID.pm │ ├── Encrypt.pm │ └── XML │ │ ├── Response │ │ └── Inventory.pm │ │ ├── Prolog.pm │ │ ├── SimpleMessage.pm │ │ └── Response.pm │ ├── LoggerBackend │ ├── Syslog.pm │ ├── File.pm │ └── Stderr.pm │ └── Compress.pm ├── tools ├── pre-nobundle.sh ├── encryptText.pm ├── makedist.sh └── parseVmware.pl ├── snmp └── mibs │ └── local │ ├── 18552.xml │ └── 24681.xml ├── contrib ├── cron │ ├── ocsinventory-agent.logrotate │ ├── systemd │ │ ├── ocsinventory-agent.service │ │ ├── ocsinventory-agent-onboot.timer │ │ ├── ocsinventory-agent-hourly.timer │ │ └── ocsinventory-agent-daily.timer │ ├── ocsinventory-agent.sysconf │ └── ocsinventory-agent.cron └── Tarballs.pm ├── .travis.yml ├── MANIFEST.SKIP ├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── AUTHORS ├── cpanfile ├── .gitignore ├── inc └── Module │ └── Install │ ├── Include.pm │ ├── Scripts.pm │ ├── Base.pm │ └── WriteAll.pm └── META.yml /macosx/setup_plugins/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/cpuinfo/cpuinfo-vmware-esx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /etc/default/ocsinventory-agent: -------------------------------------------------------------------------------- 1 | SERVER="localhost" 2 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/.gitignore: -------------------------------------------------------------------------------- 1 | *.xcarchive 2 | app/ 3 | build/ 4 | -------------------------------------------------------------------------------- /macosx/ocsng_app-xcode/GetPID.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsng_app-xcode/GetPID.h -------------------------------------------------------------------------------- /macosx/deps/darwin-perl-deps.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/deps/darwin-perl-deps.zip -------------------------------------------------------------------------------- /macosx/setup_plugins/auth_plugin_installer/auth/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | InstallerSectionTitle = "Authentication settings"; 2 | 3 | -------------------------------------------------------------------------------- /macosx/setup_plugins/config_plugin_installer/config/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | InstallerSectionTitle = "Agent configuration"; 2 | 3 | -------------------------------------------------------------------------------- /macosx/ocsng_app-xcode/icons/ocs_logo.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsng_app-xcode/icons/ocs_logo.icns -------------------------------------------------------------------------------- /macosx/setup_plugins/daemonconfig_plugin_install/daemonconfig/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | InstallerSectionTitle = "Daemon configuration"; 2 | 3 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic; 2 | 3 | use strict; 4 | 5 | sub run {} 6 | 7 | 1; 8 | -------------------------------------------------------------------------------- /macosx/ocsng_app-xcode/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsng_app-xcode/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/logos/OCS_logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/logos/OCS_logo.jpg -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Repository.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Repository; 2 | use strict; 3 | 4 | sub run {} 5 | 6 | 1; 7 | -------------------------------------------------------------------------------- /macosx/setup_plugins/auth_plugin_installer/auth/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | "PaneTitle" = "OCS Inventory Agent Config"; 4 | 5 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/auth.bundle/Contents/MacOS/auth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/auth.bundle/Contents/MacOS/auth -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/config.bundle/Contents/MacOS/config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/config.bundle/Contents/MacOS/config -------------------------------------------------------------------------------- /macosx/ocsng_app-xcode/OCSNG_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'OCSNG' target in the 'OCSNG' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /tools/pre-nobundle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | make distclean 4 | rm -f MANIFEST Makefile 5 | sed -i 's/^bundle/#bundle/' Makefile.PL 6 | rm -rf inc/BUNDLES* 7 | perl Makefile.PL 8 | make manifest 9 | 10 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/Virtualization/Xen.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::Virtualization::Xen; 2 | 3 | $runMeIfTheseChecksFailed = ["Ocsinventory::Agent::Backend::Virtualization::Libvirt"]; 4 | 5 | 1; 6 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/daemonconfig.bundle/Contents/MacOS/daemonconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/daemonconfig.bundle/Contents/MacOS/daemonconfig -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB; 2 | 3 | $runMeIfTheseChecksFailed = ["Ocsinventory::Agent::Backend::OS::Linux::Distro::OSRelease"]; 4 | 5 | 1; 6 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Encrypt.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Encrypt; 2 | 3 | use MIME::Base64; 4 | 5 | sub getClearText { 6 | my ($encodedpass) = @_; 7 | 8 | return decode_base64($encodedpass); 9 | } 10 | 11 | 1; -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/auth.bundle/Contents/Resources/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/auth.bundle/Contents/Resources/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/auth.bundle/Contents/Resources/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/auth.bundle/Contents/Resources/en.lproj/Localizable.strings -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/config.bundle/Contents/Resources/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/config.bundle/Contents/Resources/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/config.bundle/Contents/Resources/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/config.bundle/Contents/Resources/en.lproj/Localizable.strings -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/auth.bundle/Contents/Resources/Base.lproj/AuthInstallerPane.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/auth.bundle/Contents/Resources/Base.lproj/AuthInstallerPane.nib -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/daemonconfig.bundle/Contents/Resources/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/daemonconfig.bundle/Contents/Resources/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /snmp/mibs/local/18552.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 1 5 | xxx 6 | 7 | 8072 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/config.bundle/Contents/Resources/Base.lproj/ConfigInstallerPane.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/config.bundle/Contents/Resources/Base.lproj/ConfigInstallerPane.nib -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/daemonconfig.bundle/Contents/Resources/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/daemonconfig.bundle/Contents/Resources/en.lproj/Localizable.strings -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/daemonconfig.bundle/Contents/Resources/Base.lproj/DaemonConfigPane.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OCSInventory-NG/UnixAgent/HEAD/macosx/ocsinventory_packages_setup/daemonconfig.bundle/Contents/Resources/Base.lproj/DaemonConfigPane.nib -------------------------------------------------------------------------------- /contrib/cron/ocsinventory-agent.logrotate: -------------------------------------------------------------------------------- 1 | # Rotate OCS Inventory NG agent logs daily, only if not empty 2 | # Save 7 days old logs under compressed mode 3 | /var/log/ocsinventory-agent/*.log { 4 | daily 5 | rotate 7 6 | compress 7 | notifempty 8 | missingok 9 | } 10 | -------------------------------------------------------------------------------- /contrib/cron/systemd/ocsinventory-agent.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OCS Inventory Agent 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | ExecStart=/usr/libexec/ocsinventory-agent/ocsinventory-agent.cron 8 | 9 | [Install] 10 | WantedBy=multi-user.target 11 | -------------------------------------------------------------------------------- /contrib/cron/systemd/ocsinventory-agent-onboot.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Run OCS Inventory shortly after boot 3 | 4 | [Timer] 5 | OnBootSec=900 6 | Unit=ocsinventory-agent.service 7 | RandomizedDelaySec=10 8 | Persistent=true 9 | 10 | [Install] 11 | WantedBy=timers.target 12 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Lspci.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Lspci; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_run("lspci") 8 | } 9 | 10 | sub run {} 11 | 1; 12 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Lsusb.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Lsusb; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_run("lsusb") 8 | } 9 | 10 | sub run {} 11 | 1; 12 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/ARM.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::ARM; 2 | 3 | use strict; 4 | 5 | use Config; 6 | 7 | sub check { 8 | return 1 if $Config{'archname'} =~ /^arm/; 9 | 0; 10 | }; 11 | 12 | sub run{} 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/m68k.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::m68k; 2 | 3 | use strict; 4 | 5 | use Config; 6 | 7 | sub check { 8 | return 1 if $Config{'archname'} =~ /^m68k/; 9 | 0; 10 | }; 11 | 12 | sub run{} 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /macosx/patches/perl_sonoma.patch: -------------------------------------------------------------------------------- 1 | --- ocsinventory-agent.orig 2024-05-14 17:10:08 2 | +++ ocsinventory-agent 2024-05-14 17:09:16 3 | @@ -1,4 +1,4 @@ 4 | -#!/usr/bin/perl 5 | +#!/usr/bin/perl5.30 6 | 7 | eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' 8 | if 0; # not running under some shell 9 | -------------------------------------------------------------------------------- /contrib/cron/systemd/ocsinventory-agent-hourly.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Run OCS Inventory Hourly (if server permits) 3 | 4 | [Timer] 5 | OnCalendar=hourly 6 | Unit=ocsinventory-agent.service 7 | RandomizedDelaySec=10 8 | Persistent=true 9 | 10 | [Install] 11 | WantedBy=timers.target 12 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/Alpha.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::Alpha; 2 | 3 | use strict; 4 | 5 | use Config; 6 | 7 | sub check { 8 | return 1 if $Config{'archname'} =~ /^alpha/; 9 | 0; 10 | }; 11 | 12 | sub run{} 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/MIPS.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::MIPS; 2 | 3 | use strict; 4 | 5 | use Config; 6 | 7 | sub check { 8 | return 1 if $Config{'archname'} =~ /^mips/; 9 | 0; 10 | }; 11 | 12 | sub run{} 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/SPARC.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::SPARC; 2 | 3 | use strict; 4 | 5 | use Config; 6 | 7 | sub check { 8 | return 1 if $Config{'archname'} =~ /^sparc/; 9 | 0; 10 | }; 11 | 12 | sub run{} 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/s390x.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::s390x; 2 | 3 | use strict; 4 | 5 | use Config; 6 | 7 | sub check { 8 | return 1 if $Config{'archname'} =~ /^s390/; 9 | 0; 10 | }; 11 | 12 | sub run{} 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/i386.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::i386; 2 | 3 | use strict; 4 | 5 | use Config; 6 | 7 | sub check { 8 | return 1 if $Config{'archname'} =~ /^(i\d86|x86_64)/; 9 | 0; 10 | }; 11 | 12 | sub run{} 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/PowerPC.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::PowerPC; 2 | 3 | use strict; 4 | 5 | use Config; 6 | 7 | sub check { 8 | return 1 if $Config{'archname'} =~ /^(ppc|powerpc)/; 9 | 0; 10 | }; 11 | 12 | sub run{} 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /resources/cpuinfo/linux-ppc-1: -------------------------------------------------------------------------------- 1 | processor : 0 2 | cpu : 604r 3 | clock : ??? 4 | revision : 49.2 (pvr 0009 3102) 5 | bogomips : 299.00 6 | machine : PReP Utah (Powerstack II Pro4000) 7 | l2 cache : 512KiB, parity disabled SRAM:synchronous, pipelined, no parity 8 | -------------------------------------------------------------------------------- /contrib/cron/systemd/ocsinventory-agent-daily.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Run OCS Inventory once per day 3 | 4 | [Timer] 5 | OnCalendar=daily 6 | OnUnitInactiveSec=86000 7 | 8 | Unit=ocsinventory-agent.service 9 | RandomizedDelaySec=900 10 | AccuracySec=900 11 | Persistent=true 12 | 13 | [Install] 14 | WantedBy=timers.target 15 | -------------------------------------------------------------------------------- /macosx/setup_plugins/daemonconfig_plugin_install/daemonconfig/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | "PaneTitle" = "OCS agent daemon options"; 3 | 4 | //Peridocity warn 5 | "Periodicity_warn"="Invalid periodicity value"; 6 | 7 | //Periodicity warn comment 8 | "Periodicity_warn_comment"="Please enter a valid number value"; 9 | -------------------------------------------------------------------------------- /resources/cpuinfo/linux-ppc-2: -------------------------------------------------------------------------------- 1 | processor : 0 2 | cpu : POWER4+ (gq) 3 | clock : 1452.000000MHz 4 | revision : 2.1 5 | 6 | processor : 1 7 | cpu : POWER4+ (gq) 8 | clock : 1452.000000MHz 9 | revision : 2.1 10 | 11 | timebase : 181495202 12 | machine : CHRP IBM,7029-6C3 13 | 14 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Dmidecode; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | return unless -r "/dev/mem"; 8 | return unless $common->can_run("dmidecode"); 9 | 1; 10 | } 11 | 12 | sub run {} 13 | 14 | 1; 15 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/BSD/Sys.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::BSD::Sys; 2 | 3 | #$LunchAfter = "Ocsinventory::Agent::Backend::OS::Linux::VirtualFs::Sys"; 4 | 5 | sub check { 6 | foreach (`mount`) { 7 | return 1 if (/type\ sysfs/); 8 | } 9 | return; 10 | } 11 | 12 | sub run { 13 | # Hum? 14 | return ""; 15 | } 16 | 17 | 1 18 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Packaging; 2 | 3 | use strict; 4 | 5 | sub check { 6 | my $params = shift; 7 | 8 | # Do not run an package inventory if there is the --nosoftware parameter 9 | return if ($params->{config}->{nosoftware}); 10 | 1; 11 | } 12 | 13 | sub run{} 14 | 15 | 1; 16 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/IpDiscover.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::IpDiscover; 2 | 3 | use strict; 4 | 5 | sub check { 6 | my $params = shift; 7 | 8 | my $prologresp = $params->{prologresp}; 9 | my $mem = $params->{mem}; 10 | 11 | return unless ($prologresp && $prologresp->getOptionsInfoByName("IPDISCOVER")); 12 | 13 | 1; 14 | } 15 | 16 | 17 | 1; 18 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: perl 2 | perl: 3 | - "5.30" 4 | - "5.28" 5 | - "5.26" 6 | - "5.20" 7 | 8 | before_install: 9 | - sudo apt -y install dmidecode make gcc 10 | - cpanm --quiet --installdeps --notest . 11 | 12 | script: env PERL_AUTOINSTALL=1 perl Makefile.PL && sudo make && sudo make install 13 | 14 | addons: 15 | apt: 16 | update: true 17 | 18 | branches: 19 | only: 20 | - master -------------------------------------------------------------------------------- /MANIFEST.SKIP: -------------------------------------------------------------------------------- 1 | CVS/ 2 | .git 3 | .bzr 4 | ^00 5 | ^.gitignore$ 6 | ^.cvsignore$ 7 | .svn 8 | .merge 9 | 10 | ^blib 11 | ^_build 12 | ^Build$ 13 | ^cover_db 14 | ^nytprof 15 | ^Makefile(\.old)?$ 16 | ^MANIFEST\. 17 | ^MYMETA\. 18 | ^pm_to_blib$ 19 | ^run-postinst 20 | 21 | ~$ 22 | \.bak$ 23 | \.old$ 24 | \.sw[a-z]$ 25 | \.# 26 | \.swp 27 | 28 | 29 | ^Ocsinventory-agent.* 30 | /tarballs/ 31 | ^setup.sh 32 | 33 | .*\.tmp 34 | var/ 35 | 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | *It's hard to solve a problem when important details are missing, that why we added this template, to help you and us.* 2 | 3 | ### General informations 4 | Operating system : 5 | Perl version : 6 | 7 | ### OCS Inventory informations 8 | Unix agent version : 9 | 10 | ### Problem's description 11 | *Describe your problem here* 12 | 13 | ### Inventory log file ( optional ) 14 | *Use github cloud or trusted upload website* 15 | -------------------------------------------------------------------------------- /macosx/setup_plugins/auth_plugin_installer/auth/en.lproj/AuthInstallerPane.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSTextFieldCell"; title = "Password : "; ObjectID = "A3p-tZ-dYM"; */ 3 | "A3p-tZ-dYM.title" = "Password : "; 4 | 5 | /* Class = "NSTextFieldCell"; title = "Username :"; ObjectID = "Mro-sY-ZAf"; */ 6 | "Mro-sY-ZAf.title" = "Username :"; 7 | 8 | /* Class = "NSTextFieldCell"; title = "Realm :"; ObjectID = "m6M-ck-BMP"; */ 9 | "m6M-ck-BMP.title" = "Realm :"; 10 | -------------------------------------------------------------------------------- /etc/ocsinventory-agent/modules.conf: -------------------------------------------------------------------------------- 1 | # This list of modules will be loaded by the agent at run time. 2 | # To check its syntax do: 3 | # $perl modules.conf 4 | # You must have NO error, else the content will be ignored. 5 | 6 | use Ocsinventory::Agent::Modules::Download; 7 | use Ocsinventory::Agent::Modules::SnmpScan; 8 | #use Ocsinventory::Agent::Modules::LocalSnmpScan; 9 | use Ocsinventory::Agent::Modules::SnmpFork; 10 | 11 | # DO NOT REMOVE the 1; 12 | 1; 13 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Sys.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Sys; 2 | 3 | #$LunchAfter = "Ocsinventory::Agent::Backend::OS::Linux::VirtualFs::Sys"; 4 | 5 | sub check { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | 9 | return unless $common->can_run ("mount"); 10 | foreach (`mount`) { 11 | return 1 if (/type\ sysfs/); 12 | } 13 | 0; 14 | } 15 | 16 | sub run {} 17 | 18 | 1; 19 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/auth.bundle/Contents/Resources/en.lproj/AuthInstallerPane.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSTextFieldCell"; title = "Password : "; ObjectID = "A3p-tZ-dYM"; */ 3 | "A3p-tZ-dYM.title" = "Password : "; 4 | 5 | /* Class = "NSTextFieldCell"; title = "Username :"; ObjectID = "Mro-sY-ZAf"; */ 6 | "Mro-sY-ZAf.title" = "Username :"; 7 | 8 | /* Class = "NSTextFieldCell"; title = "Realm :"; ObjectID = "m6M-ck-BMP"; */ 9 | "m6M-ck-BMP.title" = "Realm :"; 10 | -------------------------------------------------------------------------------- /tools/encryptText.pm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | # Requirements 4 | use MIME::Base64; 5 | 6 | # (1) quit unless we have the correct number of command-line args 7 | $num_args = $#ARGV + 1; 8 | if ($num_args != 1) { 9 | print "\nUsage: perl encryptPassword.pm clearTextPassword \n"; 10 | exit; 11 | } 12 | 13 | my $hash = encode_base64($ARGV[0]); 14 | 15 | print "Password's hash is : \n"; 16 | print "$hash \n"; 17 | print "You can now put it in ocsinventory-agent.cfg \n"; 18 | -------------------------------------------------------------------------------- /resources/cpuinfo/linux-sparc-1: -------------------------------------------------------------------------------- 1 | cpu : TI UltraSparc IIIi (Jalapeno) 2 | fpu : UltraSparc IIIi integrated FPU 3 | prom : OBP 4.13.2 2004/03/29 10:11 4 | type : sun4u 5 | ncpus probed : 2 6 | ncpus active : 2 7 | D$ parity tl1 : 0 8 | I$ parity tl1 : 0 9 | Cpu0ClkTck : 000000003bb94e80 10 | Cpu1ClkTck : 000000003bb94e80 11 | MMU Type : Cheetah+ 12 | State: 13 | CPU0: online 14 | CPU1: online 15 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Maintainer: 2 | Frank Bourdeau 3 | 4 | Former maintainers: 5 | Guillaume PROTET 6 | Gonéri LE BOUDER 7 | 8 | Based on the legacy OCS Linux agent (Copyright (C) 2005-2008 Pascal DANEK ) 9 | 10 | Copyright 2006-2020 OCS Inventory contributors 11 | 12 | Website: http://www.ocsinventory-ng.org 13 | 14 | Please read THANKS to get the list of the contributors 15 | -------------------------------------------------------------------------------- /tools/makedist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Hack because of 4 | # http://rt.cpan.org/Public/Bug/Display.html?id=43060 5 | perl Makefile.PL 6 | make manifest 7 | make dist 8 | gunzip < Ocsinventory-Agent-0.0.10beta3.tar.gz | tar xf - 9 | perl -i -pe 's/^exit;//' Ocsinventory-Agent-0.0.10beta3/inc/BUNDLES/libwww-perl-5.823/Makefile.PL 10 | rm Ocsinventory-Agent-0.0.10beta3.tar.gz 11 | tar cf Ocsinventory-Agent-0.0.10beta3.tar Ocsinventory-Agent-0.0.10beta3 12 | gzip Ocsinventory-Agent-0.0.10beta3.tar 13 | 14 | -------------------------------------------------------------------------------- /macosx/setup_plugins/auth_plugin_installer/auth/AuthInstallerPane.h: -------------------------------------------------------------------------------- 1 | // 2 | // AutInstallerPane.h 3 | // auth 4 | // 5 | // Created by Factorfx Factorfx on 08/08/2022. 6 | // 7 | 8 | #import 9 | 10 | @interface AuthInstallerPane : InstallerPane { 11 | IBOutlet NSTextField *authUser; 12 | IBOutlet NSTextField *authPwd; 13 | IBOutlet NSTextField *authRealm; 14 | 15 | NSFileManager *filemgr; 16 | NSString *tmpCfgFilePath; 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /resources/cpuinfo/linux-mips-1: -------------------------------------------------------------------------------- 1 | system type : SGI Indigo2 2 | processor : 0 3 | cpu model : R4400SC V5.0 FPU V0.0 4 | BogoMIPS : 74.75 5 | wait instruction : no 6 | microsecond timers : yes 7 | tlb_entries : 48 8 | extra interrupt vector : no 9 | hardware watchpoint : yes 10 | ASEs implemented : 11 | shadow register sets : 1 12 | VCED exceptions : 640580539 13 | VCEI exceptions : 9972559 14 | 15 | 16 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/AccessLog.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::AccessLog; 2 | 3 | sub run { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | 7 | my ($YEAR, $MONTH , $DAY, $HOUR, $MIN, $SEC) = (localtime (time))[5,4,3,2,1,0]; 8 | my $date=sprintf "%02d-%02d-%02d %02d:%02d:%02d", ($YEAR+1900), ($MONTH+1), $DAY, $HOUR, $MIN, $SEC; 9 | 10 | $common->setAccessLog ({ 11 | USERID => 'N/A', 12 | LOGDATE => $date 13 | }); 14 | } 15 | 16 | 1; 17 | -------------------------------------------------------------------------------- /macosx/ocsng_app-xcode/ocscontact.h: -------------------------------------------------------------------------------- 1 | // 2 | // OCSINVENTORY-NG 3 | // Copyleft Guillaume PROTET 2011 4 | // Web : http://www.ocsinventory-ng.org 5 | // 6 | // This code is open source and may be copied and modified as long as the source 7 | // code is always made freely available. 8 | // Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt 9 | // 10 | // 11 | 12 | #ifdef __OBJC__ 13 | #import 14 | #endif 15 | 16 | @interface ocscontact : NSObject { 17 | 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /cpanfile: -------------------------------------------------------------------------------- 1 | requires 'XML::Simple', '>= 2.12'; 2 | requires 'Compress::Zlib', '>= 1.33'; 3 | requires 'Net::IP', '>= 1.20'; 4 | requires 'Switch', '>= 2.0'; 5 | requires 'Proc::Daemon', '>= 0.20'; 6 | requires 'Proc::PID::File', '>= 1.20'; 7 | requires 'Net::SNMP', '>= 6.0'; 8 | requires 'Net::Netmask', '>= 1.9'; 9 | requires 'LWP::Protocol::https', '>= 6.0'; 10 | requires 'Parse::EDID', '>= 1.0'; 11 | requires 'Data::UUID', '>= 1.2'; 12 | requires 'LWP::UserAgent', '>= 6.4'; -------------------------------------------------------------------------------- /tools/parseVmware.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Data::Dumper; 7 | 8 | my $data = { 9 | cpu => {}, 10 | mem => {}, 11 | }; 12 | 13 | open VMWARECPU,") { 15 | if (/^\s*(\w+)\s+(\w.*)\s*/) { 16 | my $key = $1; 17 | my @data = split(/\s+/,$2); 18 | 19 | print Dumper(\@data); 20 | $data->{cpu}->{$key} = \@data; 21 | #print $1." -> '".$2."'\n"; 22 | } 23 | } 24 | 25 | print Dumper($data); 26 | close VMWARECPU; 27 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Lspci/Sounds.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Lspci::Sounds; 2 | use strict; 3 | 4 | sub run { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | 8 | foreach(`lspci`){ 9 | if (/audio/i && /^\S+\s([^:]+):\s*(.+?)(?:\(([^()]+)\))?$/i){ 10 | $common->addSound({ 11 | 'DESCRIPTION' => $3, 12 | 'MANUFACTURER' => $2, 13 | 'NAME' => $1, 14 | }); 15 | } 16 | } 17 | } 18 | 1; 19 | -------------------------------------------------------------------------------- /etc/ocsinventory-agent/softwares/example.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # This is an example script for the byHand software collect method 3 | # 4 | # You can create your own script to detect the installed software 5 | # and install them in /etc/ocsinventory/softwares 6 | # 7 | #ligne=$(ls --version| head -n 1) 8 | # 9 | #soft=$(echo $ligne | cut -f1 -d'('| sed 's/ //') 10 | #vendor=$(echo $ligne | cut -f2 -d'('| cut -f1 -d')') 11 | #version=$(echo $ligne | cut -f2 -d'('| cut -f2 -d')'|sed 's/ //') 12 | # 13 | #echo "$vendor#$soft#$version#simple test" 14 | # 15 | # 16 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Lspci/Modems.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Lspci::Modems; 2 | use strict; 3 | 4 | sub run { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | 8 | foreach(`lspci`){ 9 | if (/modem/i && /\d+\s(.+):\s*(.+)$/){ 10 | my $name = $1; 11 | my $description = $2; 12 | $common->addModems({ 13 | 'DESCRIPTION' => $description, 14 | 'NAME' => $name, 15 | }); 16 | } 17 | } 18 | } 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX/UUID.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX::UUID; 2 | use strict; 3 | use warnings; 4 | 5 | 6 | sub check { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | return(undef) unless -r '/usr/sbin/lsattr'; 10 | return 1; 11 | } 12 | 13 | sub run { 14 | my $params = shift; 15 | my $common = $params->{common}; 16 | 17 | my $uuid = `/usr/sbin/lsattr -El sys0 -a os_uuid | awk '{print \$2}'`; 18 | chomp $uuid; 19 | 20 | $common->setHardware({ 21 | UUID => $uuid, 22 | }); 23 | } 24 | 25 | 1; -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/DeviceID.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::DeviceID; 2 | 3 | # Initialise the DeviceID. In fact this value is a bit specific since 4 | # it generates in the main script. 5 | sub run { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | my $config = $params->{config}; 9 | 10 | my $UsersLoggedIn = join "/", keys %user; 11 | 12 | if ($config->{old_deviceid}) { 13 | $common->setHardware({ OLD_DEVICEID => $config->{old_deviceid} }); 14 | } 15 | $common->setHardware({ DEVICEID => $config->{deviceid} }); 16 | } 17 | 18 | 1; 19 | -------------------------------------------------------------------------------- /macosx/patches/ocsinventory-agent-darwin.patch: -------------------------------------------------------------------------------- 1 | --- ../unified_unix_agent/ocsinventory-agent 2011-05-08 19:23:10.000000000 +0200 2 | +++ ocsinventory-agent 2011-07-29 00:15:15.000000000 +0200 3 | @@ -18,6 +18,18 @@ 4 | #USA. 5 | # 6 | 7 | +BEGIN { 8 | + use File::Basename; 9 | + use Cwd qw(abs_path); 10 | + 11 | + my $scriptname = basename(__FILE__); 12 | + my $path = abs_path($0); 13 | + $path =~ s/$scriptname//g; 14 | + 15 | + unshift(@INC,$path."lib/"); 16 | + unshift(@INC,$path."lib//darwin-thread-multi-2level/"); 17 | +} 18 | + 19 | + 20 | use strict; 21 | use warnings; 22 | 23 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Solaris/Users.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Solaris::Users; 2 | 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | $common->can_run ("who") 7 | } 8 | 9 | # Initialise the distro entry 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | my %user; 15 | # Logged on users 16 | for (`who`){ 17 | $user{$1} = 1 if /^(\S+)./; 18 | } 19 | my $UsersLoggedIn = join "/", keys %user; 20 | $common->setHardware ({ USERID => $UsersLoggedIn }); 21 | } 22 | 23 | 1; 24 | -------------------------------------------------------------------------------- /macosx/setup_plugins/auth_plugin_installer/auth/InstallerSections.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SectionOrder 6 | 7 | Introduction 8 | ReadMe 9 | License 10 | auth.bundle 11 | Target 12 | PackageSelection 13 | Install 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /macosx/setup_plugins/daemonconfig_plugin_install/daemonconfig/DaemonConfigPane.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyInstallerPane.h 3 | // daemonconfig 4 | // 5 | // Created by OCSInventory on 02/02/2020. 6 | // Copyright © 2020 OCSInventory. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DaemonConfigPane : InstallerPane { 12 | 13 | IBOutlet NSTextField *periodicity; 14 | IBOutlet NSButton *now; 15 | IBOutlet NSButton *startup; 16 | 17 | NSFileManager *filemgr; 18 | NSString *tmpLaunchdFilePath; 19 | NSString *tmpNowFilePath; 20 | 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Mac OS Specific dir 2 | .DS_Store 3 | build/ 4 | *.old 5 | 6 | # Iceberg specific dir 7 | tools/macosx/installer_gui/iceberg/OCSNG.app/ 8 | tools/macosx/installer_gui/iceberg/ocscontact 9 | tools/macosx/installer_gui/iceberg/plugins/ 10 | 11 | # Ignore darwin perl lib if un tar from script repository 12 | tools/macosx/scripts/darwin-perl-lib/ 13 | 14 | # Xcworkspace and user data 15 | project.xcworkspace/ 16 | xcuserdata/ 17 | 18 | # perl Makefile.PL 19 | /MYMETA.json 20 | /MYMETA.yml 21 | /Makefile 22 | /ipdiscover 23 | /run-postinst 24 | 25 | # make 26 | /blib/ 27 | /pm_to_blib 28 | 29 | # make dist 30 | /*.tar.gz 31 | -------------------------------------------------------------------------------- /macosx/setup_plugins/config_plugin_installer/config/InstallerSections.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SectionOrder 6 | 7 | Introduction 8 | ReadMe 9 | License 10 | config.bundle 11 | Target 12 | PackageSelection 13 | Install 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/UUID.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Dmidecode::UUID; 2 | 3 | use strict; 4 | 5 | sub check { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | return $common->can_run('dmidecode') 9 | } 10 | 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | 15 | my $uuid; 16 | 17 | $uuid = `dmidecode -s system-uuid`; 18 | chomp($uuid); 19 | $uuid =~ s/^#+\s+$//g; 20 | $uuid =~ s/Invalid.*$//g; 21 | 22 | $common->setHardware({ 23 | UUID => $uuid, 24 | }); 25 | } 26 | 27 | 1; 28 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/HPUX/IPv4.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::HPUX::IPv4; 2 | 3 | sub check { 4 | `which ifconfig 2>&1`; ($? >> 8)?0:1 5 | } 6 | 7 | # Initialise the distro entry 8 | sub run { 9 | my $params = shift; 10 | my $common = $params->{common}; 11 | my $ip; 12 | my $hostname; 13 | 14 | if ( `hostname` =~ /(\S+)/ ) { 15 | $hostname=$1; 16 | } 17 | 18 | for ( `grep $hostname /etc/hosts ` ) { 19 | if ( /(^\d+\.\d+\.\d+\.\d+)\s+/ ){ 20 | $ip=$1; 21 | $common->setHardware({IPADDR => $ip}); 22 | } 23 | } 24 | } 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/auth.bundle/Contents/Resources/InstallerSections.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SectionOrder 6 | 7 | Introduction 8 | ReadMe 9 | License 10 | auth.bundle 11 | Target 12 | PackageSelection 13 | Install 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/Pacman.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Packaging::Pacman; 2 | 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | $common->can_run("/usr/bin/pacman") 7 | } 8 | sub run { 9 | my $params = shift; 10 | my $common = $params->{common}; 11 | 12 | foreach(`/usr/bin/pacman -Q`){ 13 | /^(\S+)\s+(\S+)/; 14 | my $name = $1; 15 | my $version = $2; 16 | 17 | $common->addSoftware({ 18 | 'NAME' => $name, 19 | 'VERSION' => $version 20 | }); 21 | } 22 | } 23 | 24 | 1; 25 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/config.bundle/Contents/Resources/InstallerSections.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SectionOrder 6 | 7 | Introduction 8 | ReadMe 9 | License 10 | config.bundle 11 | Target 12 | PackageSelection 13 | Install 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /macosx/setup_plugins/daemonconfig_plugin_install/daemonconfig/InstallerSections.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SectionOrder 6 | 7 | Introduction 8 | ReadMe 9 | License 10 | daemonconfig.bundle 11 | Target 12 | PackageSelection 13 | Install 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX/Users.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX::Users; 2 | 3 | sub check { 4 | # Useless check for a posix system i guess 5 | my @who = `who 2>/dev/null`; 6 | return 1 if @who; 7 | return; 8 | } 9 | 10 | # Initialise the distro entry 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | 15 | my %user; 16 | # Logged on users 17 | for (`who`){ 18 | $user{$1} = 1 if /^(\S+)./; 19 | } 20 | 21 | my $UsersLoggedIn = join "/", keys %user; 22 | 23 | $common->setHardware ({ USERID => $UsersLoggedIn }); 24 | 25 | } 26 | 27 | 1; 28 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/daemonconfig.bundle/Contents/Resources/InstallerSections.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SectionOrder 6 | 7 | Introduction 8 | ReadMe 9 | License 10 | daemonconfig.bundle 11 | Target 12 | PackageSelection 13 | Install 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /macosx/ocsng_app-xcode/.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Gcc Patch 26 | /*.gcno 27 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Fedora.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Fedora; 2 | use strict; 3 | 4 | sub check {-f "/etc/fedora-release"} 5 | 6 | ##### 7 | sub findRelease { 8 | my $v; 9 | 10 | open V, "); 12 | close V; 13 | $v; 14 | } 15 | 16 | sub run { 17 | my $params = shift; 18 | my $common = $params->{common}; 19 | 20 | my $OSComment; 21 | chomp($OSComment =`uname -v`); 22 | 23 | $common->setHardware({ 24 | OSNAME => findRelease(), 25 | OSCOMMENTS => "$OSComment" 26 | }); 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Trustix.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Trustix; 2 | use strict; 3 | 4 | sub check {-f "/etc/trustix-release"} 5 | 6 | ##### 7 | sub findRelease { 8 | my $v; 9 | 10 | open V, "); 12 | close V; 13 | $v; 14 | } 15 | 16 | sub run { 17 | my $params = shift; 18 | my $common = $params->{common}; 19 | 20 | my $OSComment; 21 | chomp($OSComment =`uname -v`); 22 | 23 | $common->setHardware({ 24 | OSNAME => findRelease(), 25 | OSCOMMENTS => "$OSComment" 26 | }); 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/VmWare.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::VmWare; 2 | use strict; 3 | 4 | sub check { -f "/etc/vmware-release" } 5 | 6 | #### 7 | sub findRelease { 8 | my $v; 9 | 10 | open V, "); 12 | close V; 13 | $v; 14 | } 15 | 16 | sub run { 17 | my $params = shift; 18 | my $common = $params->{common}; 19 | 20 | my $OSComment; 21 | chomp($OSComment =`uname -v`); 22 | 23 | $common->setHardware({ 24 | OSNAME => findRelease(), 25 | OSCOMMENTS => "$OSComment" 26 | }); 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/AppImage.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Packaging::AppImage; 2 | 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | $common->can_run("updatedb") 7 | } 8 | 9 | sub run { 10 | my $params = shift; 11 | my $common = $params->{common}; 12 | 13 | foreach(`locate -i "*.appimage"`){ 14 | /^(\/)(\S+)(\/)(\S+)/; 15 | 16 | my $name = $4; 17 | my $publisher = "AppImage"; 18 | 19 | $common->addSoftware({ 20 | 'NAME' => $name, 21 | 'PUBLISHER' => $publisher 22 | }); 23 | } 24 | } 25 | 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/ArchLinux.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::ArchLinux; 2 | use strict; 3 | 4 | sub check {-f "/etc/arch-release"} 5 | 6 | ##### 7 | sub findRelease { 8 | my $v; 9 | 10 | open V, "); 12 | close V; 13 | return "ArchLinux $v"; 14 | } 15 | 16 | sub run { 17 | my $params = shift; 18 | my $common = $params->{common}; 19 | 20 | my $OSComment; 21 | chomp($OSComment =`uname -v`); 22 | 23 | $common->setHardware({ 24 | OSNAME => findRelease(), 25 | OSCOMMENTS => "$OSComment" 26 | }); 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Gentoo.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Gentoo; 2 | use strict; 3 | 4 | sub check {-f "/etc/gentoo-release"} 5 | 6 | ##### 7 | sub findRelease { 8 | my $v; 9 | 10 | open V, "); 12 | close V; 13 | return "Gentoo Linux $v"; 14 | } 15 | 16 | sub run { 17 | my $params = shift; 18 | my $common = $params->{common}; 19 | 20 | my $OSComment; 21 | chomp($OSComment =`uname -v`); 22 | 23 | $common->setHardware({ 24 | OSNAME => findRelease(), 25 | OSCOMMENTS => "$OSComment" 26 | }); 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/XML/Response/Inventory.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::XML::Response::Inventory; 2 | 3 | use strict; 4 | use Ocsinventory::Agent::XML::Response; 5 | our @ISA = ('Ocsinventory::Agent::XML::Response'); 6 | 7 | sub new { 8 | my ($class, @params) = @_; 9 | 10 | my $this = $class->SUPER::new(@params); 11 | bless ($this, $class); 12 | 13 | my $parsedContent = $this->getParsedContent(['ACCOUNTINFO']); 14 | if ($parsedContent && exists ($parsedContent->{RESPONSE}) && $parsedContent->{RESPONSE} =~ /^ACCOUNT_UPDATE$/) { 15 | $this->{accountinfo}->writeAccountInfoFile($parsedContent->{ACCOUNTINFO}); 16 | } 17 | return $this; 18 | } 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Oracle.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Oracle; 2 | use strict; 3 | 4 | sub check {-f "/etc/oracle-release"} 5 | 6 | ##### 7 | sub findRelease { 8 | my $v; 9 | 10 | open V, "); 12 | close V; 13 | return $v if $v; 14 | 15 | 0; 16 | } 17 | 18 | sub run { 19 | my $params = shift; 20 | my $common = $params->{common}; 21 | 22 | my $OSComment; 23 | chomp($OSComment =`uname -v`); 24 | 25 | $common->setHardware({ 26 | OSNAME => findRelease(), 27 | OSCOMMENTS => "$OSComment" 28 | }); 29 | } 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Ocsinventory/LoggerBackend/Syslog.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::LoggerBackend::Syslog; 2 | # Not tested yet! 3 | use Sys::Syslog qw( :DEFAULT setlogsock); 4 | 5 | sub new { 6 | my (undef, $params) = @_; 7 | 8 | my $self = {}; 9 | 10 | openlog("ocs-agent",'cons.pid', $params->{config}->{logfacility}); 11 | syslog('debug', 'syslog backend enabled'); 12 | 13 | bless $self; 14 | } 15 | 16 | sub addMsg { 17 | 18 | my (undef, $args) = @_; 19 | 20 | my $level = $args->{level}; 21 | my $message = $args->{message}; 22 | 23 | return if $message =~ /^$/; 24 | 25 | syslog('info', $message); 26 | 27 | } 28 | 29 | sub destroy { 30 | closelog(); 31 | } 32 | 33 | 1; 34 | -------------------------------------------------------------------------------- /macosx/ocsng_app-xcode/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | // 2 | // OCSINVENTORY-NG 3 | // Copyleft Guillaume PROTET 2011 4 | // Web : http://www.ocsinventory-ng.org 5 | // 6 | // This code is open source and may be copied and modified as long as the source 7 | // code is always made freely available. 8 | // Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt 9 | // 10 | // 11 | 12 | 13 | //Yes button 14 | "Yes" = "Yes"; 15 | 16 | //No button 17 | "No" = "No"; 18 | 19 | //First Window question 20 | "Ask_agent_run" = "Do you want to launch OCS Inventory NG agent ?"; 21 | 22 | //First window comment 23 | "Ask_agent_run_comment" = "This will take contact with OCS Inventory NG server"; -------------------------------------------------------------------------------- /macosx/ocsng_app-xcode/fr.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | // 2 | // OCSINVENTORY-NG 3 | // Copyleft Guillaume PROTET 2011 4 | // Web : http://www.ocsinventory-ng.org 5 | // 6 | // This code is open source and may be copied and modified as long as the source 7 | // code is always made freely available. 8 | // Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt 9 | // 10 | // 11 | 12 | 13 | //Yes button 14 | "Yes" = "Oui"; 15 | 16 | //No button 17 | "No" = "Non"; 18 | 19 | //First Window question 20 | "Ask_agent_run" = "Voulez-vous lancer l'agent OCS Inventory NG ?"; 21 | 22 | //First window comment 23 | "Ask_agent_run_comment" = "Ceci prendra contact avec le serveur OCS Inventory NG"; -------------------------------------------------------------------------------- /resources/cpuinfo/linux-ia64-1: -------------------------------------------------------------------------------- 1 | processor : 0 2 | vendor : GenuineIntel 3 | arch : IA-64 4 | family : Itanium 2 5 | model : 2 6 | revision : 1 7 | archrev : 0 8 | features : branchlong 9 | cpu number : 0 10 | cpu regs : 4 11 | cpu MHz : 1600.000009 12 | itc MHz : 1600.009464 13 | BogoMIPS : 2392.06 14 | siblings : 1 15 | 16 | processor : 1 17 | vendor : GenuineIntel 18 | arch : IA-64 19 | family : Itanium 2 20 | model : 2 21 | revision : 1 22 | archrev : 0 23 | features : branchlong 24 | cpu number : 0 25 | cpu regs : 4 26 | cpu MHz : 1600.000009 27 | itc MHz : 1600.009464 28 | BogoMIPS : 2392.06 29 | siblings : 1 30 | 31 | 32 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Mandrake.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Mandrake; 2 | use strict; 3 | 4 | sub check {-f "/etc/mandrake-release" && !-f "/etc/mandriva-release"} 5 | 6 | ##### 7 | sub findRelease { 8 | my $v; 9 | 10 | open V, "); 12 | close V; 13 | $v; 14 | } 15 | 16 | sub run { 17 | my $params = shift; 18 | my $common = $params->{common}; 19 | 20 | my $OSComment; 21 | chomp($OSComment =`uname -v`); 22 | 23 | $common->setHardware({ 24 | OSNAME => findRelease(), 25 | OSCOMMENTS => "$OSComment" 26 | }); 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX/Modems.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX::Modems; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_run("lsdev") 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | for (`lsdev -Cc adapter -F 'name:type:description'`){ 15 | if (/modem/i && /\d+\s(.+):(.+)$/){ 16 | my $name = $1; 17 | my $description = $2; 18 | $common->addModems({ 19 | 'DESCRIPTION' => $description, 20 | 'NAME' => $name, 21 | }); 22 | } 23 | } 24 | } 25 | 26 | 1 27 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX/Videos.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX::Videos; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_run("lsdev"); 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | for (`lsdev -Cc adapter -F 'name:type:description'`){ 15 | if (/graphics|vga|video/i){ 16 | if (/^\S+\s([^:]+):\s*(.+?)(?:\(([^()]+)\))?$/i){ 17 | $common->addVideo({ 18 | 'CHIPSET' => $1, 19 | 'NAME' => $2, 20 | }); 21 | } 22 | } 23 | } 24 | } 25 | 1; 26 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/BSD/IPv4.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::BSD::IPv4; 2 | 3 | sub check { 4 | my @ifconfig = `ifconfig -a 2>/dev/null`; 5 | return 1 if @ifconfig; 6 | return; 7 | } 8 | 9 | # Initialise the distro entry 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | my @ip; 14 | 15 | # Looking for ip addresses with ifconfig, except loopback 16 | # *BSD need -a option 17 | foreach (`ifconfig -a`){ 18 | if (/^\s*inet\s+(\S+)/){ 19 | ($1=~/^127.+/)?next:push @ip, $1 20 | }; 21 | } 22 | 23 | my $ip=join "/", @ip; 24 | 25 | $common->setHardware({IPADDR => $ip}); 26 | } 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/HPUX/Mem.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::HPUX::Mem; 2 | use strict; 3 | 4 | sub check { $^O =~ /hpux/ } 5 | 6 | sub run { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | 10 | my $mem; 11 | my $swap; 12 | 13 | $mem = `grep Physical /var/adm/syslog/syslog.log|tr -s " "|cut -f 7 -d " "` ; 14 | if ( $mem eq "" ) { 15 | $mem = `grep Physical /var/adm/syslog/OLDsyslog.log|tr -s " "|cut -f 7 -d " "` ; 16 | }; 17 | $mem = int ($mem/1024); 18 | 19 | $swap = `swapinfo -mdfq`; 20 | 21 | 22 | $common->setHardware({ 23 | MEMORY => $mem, 24 | SWAP => $swap, 25 | }); 26 | } 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /resources/cpuinfo/linux-686-1: -------------------------------------------------------------------------------- 1 | processor : 0 2 | vendor_id : GenuineIntel 3 | cpu family : 6 4 | model : 13 5 | model name : Intel(R) Pentium(R) M processor 1.73GHz 6 | stepping : 8 7 | cpu MHz : 1729.038 8 | cache size : 2048 KB 9 | fdiv_bug : no 10 | hlt_bug : no 11 | f00f_bug : no 12 | coma_bug : no 13 | fpu : yes 14 | fpu_exception : yes 15 | cpuid level : 2 16 | wp : yes 17 | 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 18 | bogomips : 3462.27 19 | clflush size : 64 20 | power management: 21 | 22 | 23 | -------------------------------------------------------------------------------- /inc/Module/Install/Include.pm: -------------------------------------------------------------------------------- 1 | #line 1 2 | package Module::Install::Include; 3 | 4 | use strict; 5 | use Module::Install::Base (); 6 | 7 | use vars qw{$VERSION @ISA $ISCORE}; 8 | BEGIN { 9 | $VERSION = '1.14'; 10 | @ISA = 'Module::Install::Base'; 11 | $ISCORE = 1; 12 | } 13 | 14 | sub include { 15 | shift()->admin->include(@_); 16 | } 17 | 18 | sub include_deps { 19 | shift()->admin->include_deps(@_); 20 | } 21 | 22 | sub auto_include { 23 | shift()->admin->auto_include(@_); 24 | } 25 | 26 | sub auto_include_deps { 27 | shift()->admin->auto_include_deps(@_); 28 | } 29 | 30 | sub auto_include_dependent_dists { 31 | shift()->admin->auto_include_dependent_dists(@_); 32 | } 33 | 34 | 1; 35 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX/IPv4.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX::IPv4; 2 | 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | $common->can_run("ifconfig") 7 | } 8 | 9 | # Initialise the distro entry 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | my @ip; 14 | 15 | # Looking for ip addresses with ifconfig, except loopback 16 | # AIX need -a option 17 | for (`ifconfig -a`){#ifconfig in the path 18 | # AIX ligne inet 19 | if(/^\s*inet\s+(\S+).*/){($1=~/^127.+/)?next:push @ip, $1}; 20 | } 21 | $ip=join "/", @ip; 22 | $common->setHardware({IPADDR => $ip}); 23 | } 24 | 25 | 1; 26 | -------------------------------------------------------------------------------- /macosx/patches/lib-ocsinventory-agent-backend-darwn.patch: -------------------------------------------------------------------------------- 1 | --- a/lib/Ocsinventory/Agent/Backend.pm 2 | +++ b/lib/Ocsinventory/Agent/Backend.pm 3 | @@ -85,8 +87,11 @@ sub initModList { 4 | } 5 | 6 | if ($config->{devlib}) { 7 | - # devlib enable, I only search for backend module in ./lib 8 | - push (@dirToScan, './lib'); 9 | + eval "use Cwd qw(abs_path);"; 10 | + eval "use File::Basename;"; 11 | + my $path = dirname( abs_path($0) ); 12 | + $logger->debug("devlib mode: Only looking in $path for backend modules."); 13 | + push (@dirToScan, $path . "/lib"); 14 | } else { 15 | # my ($inst) = ExtUtils::Installed->new(); 16 | # eval {@installed_files = 17 | -------------------------------------------------------------------------------- /resources/cpuinfo/linux-armel-1: -------------------------------------------------------------------------------- 1 | Processor : XScale-80219 rev 0 (v5l) 2 | BogoMIPS : 593.10 3 | Features : swp half fastmult edsp 4 | CPU implementer : 0x69 5 | CPU architecture: 5TE 6 | CPU variant : 0x0 7 | CPU part : 0x2e3 8 | CPU revision : 0 9 | Cache type : undefined 5 10 | Cache clean : undefined 5 11 | Cache lockdown : undefined 5 12 | Cache format : Harvard 13 | I size : 32768 14 | I assoc : 32 15 | I line length : 32 16 | I sets : 32 17 | D size : 32768 18 | D assoc : 32 19 | D line length : 32 20 | D sets : 32 21 | 22 | Hardware : Thecus N2100 23 | Revision : 0000 24 | Serial : 0000000000000000 25 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Debian.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Debian; 2 | use strict; 3 | 4 | sub check {-f "/etc/debian_version" && !-f "/etc/ubuntu_version"} 5 | 6 | ##### 7 | sub findRelease { 8 | my $v; 9 | 10 | open V, "); 12 | close V; 13 | return "Debian GNU/Linux $v"; 14 | } 15 | 16 | sub run { 17 | my $params = shift; 18 | my $common = $params->{common}; 19 | 20 | my $OSComment; 21 | chomp($OSComment =`uname -v`); 22 | 23 | $common->setHardware({ 24 | OSNAME => findRelease(), 25 | OSCOMMENTS => "$OSComment" 26 | }); 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Knoppix.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Knoppix; 2 | use strict; 3 | 4 | sub check {-f "/etc/knoppix_version"} 5 | 6 | ##### 7 | sub findRelease { 8 | my $v; 9 | 10 | open V, "); 12 | close V; 13 | print $v."\n"; 14 | return "Knoppix GNU/Linux $v"; 15 | } 16 | 17 | sub run { 18 | my $params = shift; 19 | my $common = $params->{common}; 20 | 21 | my $OSComment; 22 | chomp($OSComment =`uname -v`); 23 | 24 | $common->setHardware({ 25 | OSNAME => findRelease(), 26 | OSCOMMENTS => "$OSComment" 27 | }); 28 | } 29 | 30 | 1; 31 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/MacOS/UUID.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::MacOS::UUID; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | sub check { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | return(undef) unless -r '/usr/sbin/system_profiler'; 10 | return 1; 11 | } 12 | 13 | sub run { 14 | my $params = shift; 15 | my $common = $params->{common}; 16 | 17 | my @sphardware=`system_profiler SPHardwareDataType`; 18 | my $uuid; 19 | 20 | foreach my $line (@sphardware){ 21 | chomp $line; 22 | $uuid = $1 if ($line =~ /Hardware UUID:\s(.*)/i); 23 | } 24 | 25 | $common->setHardware({ 26 | UUID => $uuid, 27 | }); 28 | } 29 | 30 | 1; 31 | -------------------------------------------------------------------------------- /inc/Module/Install/Scripts.pm: -------------------------------------------------------------------------------- 1 | #line 1 2 | package Module::Install::Scripts; 3 | 4 | use strict 'vars'; 5 | use Module::Install::Base (); 6 | 7 | use vars qw{$VERSION @ISA $ISCORE}; 8 | BEGIN { 9 | $VERSION = '1.14'; 10 | @ISA = 'Module::Install::Base'; 11 | $ISCORE = 1; 12 | } 13 | 14 | sub install_script { 15 | my $self = shift; 16 | my $args = $self->makemaker_args; 17 | my $exe = $args->{EXE_FILES} ||= []; 18 | foreach ( @_ ) { 19 | if ( -f $_ ) { 20 | push @$exe, $_; 21 | } elsif ( -d 'script' and -f "script/$_" ) { 22 | push @$exe, "script/$_"; 23 | } else { 24 | die("Cannot find script '$_'"); 25 | } 26 | } 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Mandriva.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Mandriva; 2 | use strict; 3 | 4 | sub check {-f "/etc/mandrake-release" && -f "/etc/mandriva-release"} 5 | 6 | ##### 7 | sub findRelease { 8 | my $v; 9 | 10 | open V, "); 12 | close V; 13 | return $v if $v; 14 | 15 | 0; 16 | } 17 | 18 | sub run { 19 | my $params = shift; 20 | my $common = $params->{common}; 21 | 22 | my $OSComment; 23 | chomp($OSComment =`uname -v`); 24 | 25 | $common->setHardware({ 26 | OSNAME => findRelease(), 27 | OSCOMMENTS => "$OSComment" 28 | }); 29 | } 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/MacOS/Camera.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::MacOS::Camera; 2 | use strict; 3 | 4 | 5 | sub check { 6 | return(undef) unless -r '/usr/sbin/system_profiler'; # check perms 7 | return 1; 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | # create profiler obj, bail if datatype fails 15 | my $data = $common->get_sysprofile_devices_names('SPCameraDataType'); 16 | 17 | return(undef) unless(ref($data) eq 'ARRAY'); 18 | 19 | # add sound cards 20 | foreach my $cam (@$data){ 21 | $common->addCamera({ 22 | 'MODEL' => $cam, 23 | 'UUID' => $cam, 24 | }); 25 | } 26 | } 27 | 1; 28 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX/Sounds.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX::Sounds; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_run("lsdev") 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | for (`lsdev -Cc adapter -F 'name:type:description'`){ 15 | if (/audio/i){ 16 | if (/^\S+\s([^:]+):\s*(.+?)(?:\(([^()]+)\))?$/i){ 17 | $common->addSound({ 18 | 'DESCRIPTION' => $3, 19 | 'MANUFACTURER' => $2, 20 | 'NAME' => $1, 21 | }); 22 | } 23 | } 24 | } 25 | } 26 | 1; 27 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/MacOS/Hostname.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::MacOS::Hostname; 2 | 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | return 1 if $common->can_load ("Mac::SysProfile"); 7 | 0; 8 | } 9 | 10 | # Initialise the distro entry 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | 15 | my $hostname; 16 | 17 | my $profile = Mac::SysProfile->new(); 18 | my $data = $profile->gettype('SPSoftwareDataType'); 19 | 20 | return undef unless(ref($data) eq 'ARRAY'); 21 | 22 | my $h = $data->[0]; 23 | 24 | $hostname = $h->{'local_host_name'}; 25 | 26 | $common->setHardware ({NAME => $hostname}) if $hostname; 27 | } 28 | 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Ocsinventory/LoggerBackend/File.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::LoggerBackend::File; 2 | use strict; 3 | 4 | sub new { 5 | my (undef, $params) = @_; 6 | 7 | my $self = {}; 8 | $self->{config} = $params->{config}; 9 | $self->{logfile} = $self->{config}->{logdir}."/".$self->{config}->{logfile}; 10 | 11 | bless $self; 12 | } 13 | 14 | sub addMsg { 15 | 16 | my ($self, $args) = @_; 17 | 18 | my $level = $args->{level}; 19 | my $message = $args->{message}; 20 | 21 | return if $message =~ /^$/; 22 | 23 | open FILE, ">>".$self->{config}->{logfile} or warn "Can't open ". 24 | "`".$self->{config}->{logfile}."'\n"; 25 | print FILE "[".localtime()."][$level] $message\n"; 26 | close FILE; 27 | 28 | } 29 | 30 | 1; 31 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/MacOS/IPv4.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::MacOS::IPv4; 2 | 3 | # straight up theft from the other modules 4 | 5 | sub check { 6 | my @ifconfig = `ifconfig -a 2>/dev/null`; 7 | return 1 if @ifconfig; 8 | return; 9 | } 10 | 11 | # Initialise the distro entry 12 | sub run { 13 | my $params = shift; 14 | my $common = $params->{common}; 15 | my @ip; 16 | 17 | # Looking for ip addresses with ifconfig, except loopback 18 | # *BSD need -a option 19 | foreach (`ifconfig -a`){ 20 | if(/^\s*inet\s+(\S+)/){ 21 | ($1=~/^127.+/)?next:push @ip, $1 22 | }; 23 | } 24 | 25 | my $ip=join "/", @ip; 26 | 27 | $common->setHardware({IPADDR => $ip}); 28 | } 29 | 30 | 1; 31 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/SPARC/CPU.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::SPARC::CPU; 2 | 3 | use strict; 4 | 5 | sub check { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | $common->can_read ("/proc/cpuinfo") 9 | } 10 | 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | 15 | my @cpu; 16 | my $current = { CPUARCH => 'ARM' }; 17 | my $ncpus = 1; 18 | open CPUINFO, ") { 20 | $current->{TYPE} = $1 if /cpu\s+:\s+(\S.*)/; 21 | $ncpus = $1 if /ncpus probed\s+:\s+(\d+)/ 22 | } 23 | 24 | foreach (1..$ncpus) { 25 | $common->addCPU($current); 26 | } 27 | } 28 | 29 | 1 30 | -------------------------------------------------------------------------------- /lib/Ocsinventory/LoggerBackend/Stderr.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::LoggerBackend::Stderr; 2 | 3 | sub new { 4 | my (undef, $params) = @_; 5 | 6 | my $self = {}; 7 | $self->{config} = $params->{config}; 8 | bless $self; 9 | } 10 | 11 | sub addMsg { 12 | 13 | my ($self, $args) = @_; 14 | 15 | my $level = $args->{level}; 16 | my $message = $args->{message}; 17 | 18 | return if $message =~ /^$/; 19 | 20 | # if STDERR has been hijacked, I take its saved ref 21 | my $stderr; 22 | if (exists ($self->{config}->{savedstderr})) { 23 | $stderr = $self->{config}->{savedstderr}; 24 | } else { 25 | open ($stderr, ">&STDERR"); 26 | } 27 | 28 | print $stderr "[$level] $message\n"; 29 | 30 | } 31 | 32 | 1; 33 | -------------------------------------------------------------------------------- /etc/cron.d/ocsinventory-agent: -------------------------------------------------------------------------------- 1 | # 2 | # File generated by OCS Inventory NG Unified Unix Agent setup 3 | # 4 | ################################################################################ 5 | # 6 | # OCS Inventory NG Unified Unix Agent 7 | # 8 | # Copyleft 2007 Didier LIROULET 9 | # Web: http://www.ocsinventory-ng.org 10 | # 11 | # This code is open source and may be copied and modified as long as the source 12 | # code is always made freely available. 13 | # Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt 14 | ################################################################################ 15 | # 16 | # Launch OCS Inventory NG Agent once a day under root account, at HH:MM 17 | # 18 | MM HH * * * root /usr/bin/ocsinventory-agent > /dev/null 2>&1 19 | 20 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/CentOS.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::CentOS; 2 | use strict; 3 | 4 | sub check { 5 | -f "/etc/centos-release" 6 | && 7 | !readlink ("/etc/centos-release") 8 | && 9 | !-f "/etc/vmware-release" 10 | } 11 | 12 | #### 13 | sub findRelease { 14 | my $v; 15 | 16 | open V, "); 18 | close V; 19 | $v; 20 | } 21 | 22 | sub run { 23 | my $params = shift; 24 | my $common = $params->{common}; 25 | 26 | my $OSComment; 27 | chomp($OSComment =`uname -v`); 28 | 29 | $common->setHardware({ 30 | OSNAME => findRelease(), 31 | OSCOMMENTS => "$OSComment" 32 | }); 33 | } 34 | 35 | 1; 36 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Redhat.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Redhat; 2 | use strict; 3 | 4 | sub check { 5 | -f "/etc/redhat-release" 6 | && 7 | !readlink ("/etc/redhat-release") 8 | && 9 | !-f "/etc/vmware-release" 10 | } 11 | 12 | #### 13 | sub findRelease { 14 | my $v; 15 | 16 | open V, "); 18 | close V; 19 | $v; 20 | } 21 | 22 | sub run { 23 | my $params = shift; 24 | my $common = $params->{common}; 25 | 26 | my $OSComment; 27 | chomp($OSComment =`uname -v`); 28 | 29 | $common->setHardware({ 30 | OSNAME => findRelease(), 31 | OSCOMMENTS => "$OSComment" 32 | }); 33 | } 34 | 35 | 1; 36 | -------------------------------------------------------------------------------- /macosx/setup_plugins/daemonconfig_plugin_install/daemonconfig/en.lproj/DaemonConfigPane.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSTextFieldCell"; title = "Launch OCS agent every"; ObjectID = "CR7-Av-TyG"; */ 3 | "CR7-Av-TyG.title" = "Launch OCS agent every"; 4 | 5 | /* Class = "NSTextFieldCell"; title = "5"; ObjectID = "Kd5-vS-SZ8"; */ 6 | "Kd5-vS-SZ8.title" = "5"; 7 | 8 | /* Class = "NSTextFieldCell"; title = "hour(s)"; ObjectID = "L5X-oH-TrN"; */ 9 | "L5X-oH-TrN.title" = "hour(s)"; 10 | 11 | /* Class = "NSButtonCell"; title = "Launch OCS Agent at daemon start"; ObjectID = "dlF-LS-rTI"; */ 12 | "dlF-LS-rTI.title" = "Launch OCS Agent at daemon start"; 13 | 14 | /* Class = "NSButtonCell"; title = "Launch daemon after install"; ObjectID = "kI2-ox-p1X"; */ 15 | "kI2-ox-p1X.title" = "Launch daemon after install"; 16 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/MacOS/Sound.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::MacOS::Sound; 2 | use strict; 3 | 4 | 5 | sub check { 6 | return(undef) unless -r '/usr/sbin/system_profiler'; # check perms 7 | return 1; 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | # create profiler obj, bail if datatype fails 15 | my $data = $common->get_sysprofile_devices_names('SPAudioDataType'); 16 | 17 | return(undef) unless(ref($data) eq 'ARRAY'); 18 | 19 | # add sound cards 20 | foreach my $sound (@$data){ 21 | $common->addSound({ 22 | 'NAME' => $sound, 23 | 'MANUFACTURER' => $sound, 24 | 'DESCRIPTION' => $sound, 25 | }); 26 | } 27 | } 28 | 1; 29 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/HPUX.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::HPUX; 2 | 3 | use strict; 4 | use vars qw($runAfter); 5 | $runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"]; 6 | 7 | sub check { $^O =~ /hpux/ } 8 | 9 | sub run { 10 | my $params = shift; 11 | my $common = $params->{common}; 12 | my $OSName; 13 | my $OSVersion; 14 | my $OSComment; 15 | #my $uname_path = &_get_path('uname'); 16 | 17 | # Operating systeminformations 18 | 19 | chomp($OSName = `uname -s`); 20 | chomp($OSVersion = `uname -r`); 21 | chomp($OSComment = `uname -l`); 22 | 23 | $common->setHardware({ 24 | OSNAME => $OSName, 25 | OSCOMMENTS => $OSComment, 26 | OSVERSION => $OSVersion, 27 | }); 28 | } 29 | 30 | 1; 31 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Ubuntu.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Ubuntu; 2 | use strict; 3 | 4 | use vars qw($runAfter); 5 | $runAfter = ["Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Debian"]; 6 | 7 | sub check {-f "/etc/ubuntu_version"} 8 | 9 | ##### 10 | sub findRelease { 11 | my $v; 12 | 13 | open V, "); 15 | close V; 16 | return "Ubuntu $v"; 17 | } 18 | 19 | sub run { 20 | my $params = shift; 21 | my $common = $params->{common}; 22 | 23 | my $OSComment; 24 | chomp($OSComment =`uname -v`); 25 | 26 | $common->setHardware({ 27 | OSNAME => findRelease(), 28 | OSCOMMENTS => "$OSComment" 29 | }); 30 | } 31 | 32 | 1; 33 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/daemonconfig.bundle/Contents/Resources/en.lproj/DaemonConfigPane.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSTextFieldCell"; title = "Launch OCS agent every"; ObjectID = "CR7-Av-TyG"; */ 3 | "CR7-Av-TyG.title" = "Launch OCS agent every"; 4 | 5 | /* Class = "NSTextFieldCell"; title = "5"; ObjectID = "Kd5-vS-SZ8"; */ 6 | "Kd5-vS-SZ8.title" = "5"; 7 | 8 | /* Class = "NSTextFieldCell"; title = "hour(s)"; ObjectID = "L5X-oH-TrN"; */ 9 | "L5X-oH-TrN.title" = "hour(s)"; 10 | 11 | /* Class = "NSButtonCell"; title = "Launch OCS Agent at daemon start"; ObjectID = "dlF-LS-rTI"; */ 12 | "dlF-LS-rTI.title" = "Launch OCS Agent at daemon start"; 13 | 14 | /* Class = "NSButtonCell"; title = "Launch daemon after install"; ObjectID = "kI2-ox-p1X"; */ 15 | "kI2-ox-p1X.title" = "Launch daemon after install"; 16 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX/Domains.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX::Domains; 2 | use strict; 3 | 4 | sub run { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | my $domain; 8 | 9 | # Domain name 10 | open RESOLV, "/etc/resolv.conf"; 11 | while(){ 12 | if (/^(domain|search)\s+(.+)/){ 13 | $domain=$2; 14 | chomp($domain); 15 | } 16 | } 17 | # If no domain name and no workgroup name (samba), we send "WORKGROUP" 18 | # TODO:Check if samba is present and get the windows workgroup or NT domain name 19 | unless (defined($domain)){chomp($domain="WORKGROUP");} 20 | $domain=~s/^.\.(.)/$1/; 21 | 22 | $common->setHardware({ 23 | WORKGROUP => $domain 24 | }); 25 | } 26 | 27 | 1; 28 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/Slackware.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::Slackware; 2 | use strict; 3 | 4 | sub check {-f "/etc/slackware-version"} 5 | 6 | ##### 7 | sub findRelease { 8 | my $v; 9 | 10 | open V, "); 12 | foreach (){ 13 | $v=$1 if (/Slackware ([\d.]+)/); 14 | close V; 15 | return $v; 16 | } 17 | } 18 | 19 | sub run { 20 | my $params = shift; 21 | my $common = $params->{common}; 22 | 23 | my $OSComment; 24 | chomp($OSComment =`uname -v`); 25 | 26 | $common->setHardware({ 27 | OSNAME => "Slackware", 28 | OSVERSION => findRelease(), 29 | OSCOMMENTS => "$OSComment" 30 | }); 31 | } 32 | 33 | 1; 34 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Hostname.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Hostname; 2 | 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | return 1 if $common->can_load ("Sys::Hostname"); 7 | return 1 if $common->can_run ("hostname"); 8 | 0; 9 | } 10 | 11 | # Initialise the distro entry 12 | sub run { 13 | my $params = shift; 14 | my $common = $params->{common}; 15 | 16 | my $hostname; 17 | 18 | if ($common->can_load("Sys::Hostname")) { 19 | $hostname = Sys::Hostname::hostname(); 20 | } else { 21 | chomp ( $hostname = `hostname` ); # TODO: This is not generic. 22 | } 23 | $hostname =~ s/\..*//; # keep just the hostname 24 | 25 | $common->setHardware ({NAME => $hostname}); 26 | } 27 | 28 | 1; 29 | -------------------------------------------------------------------------------- /macosx/scripts/uninstaller.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | OSVER=`uname -r` 4 | echo "OSVer is $OSVER" 5 | 6 | PID=`ps ax -e | grep OCSNG | grep -v grep | grep -v $0 | awk '{print $1}'` 7 | if [ "$PID" != "" ]; then 8 | echo "killing process: $PID" 9 | sudo kill $PID 10 | fi 11 | 12 | FILES="/Library/Receipts/OCSNG* /etc/ocsinventory-agent/ /var/lib/ocsinventory-agent/ /Applications/OCSNG.app /var/log/ocsng.log" 13 | 14 | if [ "$OSVER" == "7.9.0" ]; then 15 | FILES="$FILES /Library/StartupItems/OCSInventory" 16 | else 17 | FILES="$FILES /Library/LaunchDaemons/org.ocsng.agent.plist" 18 | 19 | echo 'Stopping and unloading service' 20 | launchctl stop org.ocsng.agent 21 | launchctl unload /Library/LaunchDaemons/org.ocsng.agent.plist 22 | fi 23 | 24 | for FILE in $FILES; do 25 | echo 'removing '.$FILE 26 | rm -f -R $FILE 27 | done 28 | 29 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Mem.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Mem; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_read ("/proc/meminfo") 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | my $unit = 1024; 14 | 15 | my $PhysicalMemory; 16 | my $SwapFileSize; 17 | 18 | # Memory informations 19 | open MEMINFO, "/proc/meminfo"; 20 | while(){ 21 | $PhysicalMemory=$1 if /^memtotal\s*:\s*(\S+)/i; 22 | $SwapFileSize=$1 if /^swaptotal\s*:\s*(\S+)/i; 23 | } 24 | # TODO 25 | $common->setHardware({ 26 | MEMORY => sprintf("%i",$PhysicalMemory/$unit), 27 | SWAP => sprintf("%i", $SwapFileSize/$unit), 28 | }); 29 | } 30 | 31 | 1; 32 | -------------------------------------------------------------------------------- /contrib/cron/ocsinventory-agent.sysconf: -------------------------------------------------------------------------------- 1 | ## 2 | ## OCS Inventory "Unix Unified Agent" Configuration File 3 | ## used by the supplied cron job 4 | ## 5 | 6 | ## Add tools directory if needed (tw_cli, hpacucli, ipssend, ...) 7 | PATH=/sbin:/bin:/usr/sbin:/usr/bin 8 | 9 | ## Mode, change to "cron" to activate 10 | OCSMODE[0]=none 11 | 12 | ## can be used to override the ocsinventory-agent.cfg setup. 13 | # OCSSERVER[0]=your.ocsserver.name 14 | # 15 | ## can be used to disable HTTPS cert check. 16 | # OCSSSL[0]=0 17 | # 18 | ## If you need an HTTP/HTTPS proxy, fill this out 19 | # OCSPROXYSERVER[0]='http://user:pass@proxy:port' 20 | # 21 | ## corresponds with --local=/var/lib/ocsinventory-agent 22 | OCSSERVER[0]=local 23 | 24 | ## Wait before inventory 25 | OCSPAUSE[0]=100 26 | 27 | ## Administrative TAG (optional, must be filed before first inventory) 28 | OCSTAG[0]= 29 | 30 | -------------------------------------------------------------------------------- /etc/logrotate.d/ocsinventory-agent: -------------------------------------------------------------------------------- 1 | # 2 | # File generated by OCS Inventory NG Unified Unix Agent setup 3 | # 4 | ################################################################################ 5 | # 6 | # OCS Inventory NG Unified Unix Agent 7 | # 8 | # Copyleft 2007 Didier LIROULET 9 | # Web: http://www.ocsinventory-ng.org 10 | # 11 | # This code is open source and may be copied and modified as long as the source 12 | # code is always made freely available. 13 | # Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt 14 | ################################################################################ 15 | # 16 | # Rotate OCS Inventory NG agent logs daily, only if not empty 17 | # Save 7 days old logs under compressed mode 18 | PATH_TO_LOG_DIRECTORY/*.log { 19 | daily 20 | rotate 7 21 | compress 22 | notifempty 23 | missingok 24 | } 25 | -------------------------------------------------------------------------------- /macosx/ocsng_app-xcode/ocscontact-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | org.ocsinventory-ng.ocscontact 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 2.6 19 | NSMainNibFile 20 | MainMenu 21 | NSPrincipalClass 22 | NSApplication 23 | 24 | 25 | -------------------------------------------------------------------------------- /macosx/setup_plugins/config_plugin_installer/config/ConfigInstallerPane.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyInstallerPane.h 3 | // config 4 | // 5 | // Created by Gilles Dubois on 02/02/2020. 6 | // Copyright © 2020 Gilles Dubois. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ConfigInstallerPane : InstallerPane { 12 | IBOutlet NSTextField *server; 13 | IBOutlet NSTextField *tag; 14 | IBOutlet NSTextField *logfile; 15 | IBOutlet NSTextField *cacertfile; 16 | IBOutlet NSButton *debugmode; 17 | IBOutlet NSButton *lazymode; 18 | IBOutlet NSButton *download; 19 | IBOutlet NSButton *ssl; 20 | IBOutlet NSPopUpButton *protocolist; 21 | 22 | NSFileManager *filemgr; 23 | NSString *tmpCfgFilePath; 24 | NSString *tmpModulesFilePath; 25 | NSString *tmpServerdirFilePath; 26 | NSString *tmpCacertFilePath; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/MIPS/CPU.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::MIPS::CPU; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_read("/proc/cpuinfo") 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | my @cpu; 15 | my $current; 16 | open CPUINFO, ") { 18 | print; 19 | if (/^system type\s+:\s*:/) { 20 | 21 | if ($current) { 22 | $common->addCPU($current); 23 | } 24 | $current = { 25 | CPUARCH => 'MIPS', 26 | }; 27 | } 28 | $current->{TYPE} = $1 if /cpu model\s+:\s+(\S.*)/; 29 | } 30 | # The last one 31 | $common->addCPU($current); 32 | } 33 | 34 | 1; 35 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/BSD/Mem.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::BSD::Mem; 2 | use strict; 3 | 4 | sub check { 5 | `which sysctl 2>&1`; 6 | return 0 if($? >> 8); 7 | `which swapctl 2>&1`; 8 | return 0 if($? >> 8); 9 | 1; 10 | }; 11 | 12 | sub run { 13 | my $params = shift; 14 | my $common = $params->{common}; 15 | 16 | my $PhysicalMemory; 17 | my $SwapFileSize; 18 | 19 | # Swap 20 | my @bsd_swapctl= `swapctl -sk`; 21 | for (@bsd_swapctl){ 22 | $SwapFileSize=$1 if /total:\s*(\d+)/i; 23 | } 24 | # RAM 25 | chomp($PhysicalMemory=`sysctl -n hw.physmem`); 26 | $PhysicalMemory=$PhysicalMemory/1024; 27 | 28 | # Send it to inventory object 29 | $common->setHardware({ 30 | MEMORY => sprintf("%i",$PhysicalMemory/1024), 31 | SWAP => sprintf("%i", $SwapFileSize/1024), 32 | }); 33 | } 34 | 1; 35 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/NonLSB/SuSE.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB::SuSE; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_read ("/etc/SuSE-release") 8 | } 9 | 10 | sub run { 11 | my $v; 12 | my $version; 13 | my $patchlevel; 14 | 15 | my $params = shift; 16 | my $common = $params->{common}; 17 | 18 | open V, ") { 20 | next if (/^#/); 21 | $version=$1 if (/^VERSION = ([0-9]+)/); 22 | $patchlevel=$1 if (/^PATCHLEVEL = ([0-9]+)/); 23 | } 24 | close V; 25 | 26 | $common->setHardware({ 27 | OSNAME => "SUSE Linux Enterprise Server $version SP$patchlevel", 28 | OSVERSION => $version, 29 | OSCOMMENTS => $patchlevel 30 | }); 31 | } 32 | 33 | 1; 34 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Distro/LSB.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Distro::LSB; 2 | 3 | use vars qw($runMeIfTheseChecksFailed); 4 | $runMeIfTheseChecksFailed = ["Ocsinventory::Agent::Backend::OS::Linux::Distro::NonLSB"]; 5 | 6 | sub check { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | $common->can_run("lsb_release") 10 | } 11 | 12 | sub run { 13 | my $params = shift; 14 | my $common = $params->{common}; 15 | 16 | my $OSname; 17 | chomp($OSname =`lsb_release -is`); 18 | 19 | my $OSversion; 20 | chomp($OSversion =`lsb_release -rs`); 21 | 22 | my $OSComment; 23 | chomp($OSComment =`uname -v`); 24 | 25 | my $release = "$OSname $OSVersion"; 26 | 27 | $common->setHardware({ 28 | OSNAME => $release, 29 | OSVERSION => $OSversion, 30 | OSCOMMENTS => "$OSComment" 31 | }); 32 | } 33 | 34 | 1; 35 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/HPUX/Domains.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::HPUX::Domains; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_run ("domainname") 8 | } 9 | sub run { 10 | my $params = shift; 11 | my $common = $params->{common}; 12 | 13 | my $domain; 14 | 15 | chomp($domain = `domainname`); 16 | 17 | if (!$domain) { 18 | my %domain; 19 | 20 | if (open RESOLV, "/etc/resolv.conf") { 21 | while() { 22 | $domain{$2} = 1 if (/^(domain|search)\s+(.+)/); 23 | } 24 | close RESOLV; 25 | } 26 | $domain = join "/", keys %domain; 27 | } 28 | # If no domain name, we send "WORKGROUP" 29 | $domain = 'WORKGROUP' unless $domain; 30 | 31 | $common->setHardware({ 32 | WORKGROUP => $domain 33 | }); 34 | } 35 | 36 | 1; 37 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/OS.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::OS; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | sub check { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | 10 | if ($common->can_run("stat")) { 11 | return 1; 12 | } else { 13 | return 0; 14 | } 15 | } 16 | 17 | # Initialise the distro entry 18 | sub run { 19 | my $params = shift; 20 | my $common = $params->{common}; 21 | 22 | my $installdate; 23 | my $idate; 24 | if ($^O =~ /linux/) { 25 | $idate=`stat -c %W /`; 26 | } elsif (($^O =~ /bsd/) or ($^O =~ /Darwin/)) { 27 | $idate=`stat -f %m /`; 28 | } 29 | 30 | my ($day,$month,$year)=(localtime($idate))[3,4,5]; 31 | $installdate=sprintf "%02d-%02d-%02d",($year+1900),$month,$day; 32 | 33 | $common->setHardware({ 34 | INSTALLDATE => $installdate 35 | }); 36 | } 37 | 38 | 1; 39 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Solaris/Domains.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Solaris::Domains; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_run ("domainname") 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | my $domain; 15 | 16 | chomp($domain = `domainname`); 17 | 18 | if (!$domain) { 19 | my %domain; 20 | 21 | if (open RESOLV, "/etc/resolv.conf") { 22 | while() { 23 | $domain{$2} = 1 if (/^(domain|search)\s+(.+)/); 24 | } 25 | close RESOLV; 26 | } 27 | $domain = join "/", keys %domain; 28 | } 29 | # If no domain name, we send "WORKGROUP" 30 | $domain = 'WORKGROUP' unless $domain; 31 | $common->setHardware({ 32 | WORKGROUP => $domain 33 | }); 34 | } 35 | 36 | 1; 37 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Solaris/Mem.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Solaris::Mem; 2 | 3 | use strict; 4 | 5 | sub check { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | $common->can_run ("swap") && $common->can_run ("prtconf") 9 | } 10 | 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | #my $unit = 1024; 15 | 16 | my $PhysicalMemory; 17 | my $SwapFileSize=0; 18 | 19 | # Memory informations 20 | foreach(`prtconf`){ 21 | if(/^Memory\ssize:\s+(\S+)/){ 22 | #print "total memoire: $1"; 23 | $PhysicalMemory = $1}; 24 | } 25 | 26 | #Swap Informations 27 | foreach(`swap -l`){ 28 | if(/(\d+)(?!.*\d)/g){$SwapFileSize = $SwapFileSize + $1}; 29 | } 30 | 31 | $common->setHardware({ 32 | MEMORY => $PhysicalMemory, 33 | SWAP => $SwapFileSize 34 | }); 35 | } 36 | 37 | 1 38 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX/Controller.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX::Controller; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | return unless $common->can_run('lsdev'); 8 | my @lsdev = `lsdev -Cc adapter -F 'name:type:description'`; 9 | return 1 if @lsdev; 10 | 0 11 | } 12 | 13 | sub run { 14 | my $params = shift; 15 | my $common = $params->{common}; 16 | 17 | my $name; 18 | my $type; 19 | my $manufacturer; 20 | 21 | for (`lsdev -Cc adapter -F 'name:type:description'`){ 22 | chomp($_); 23 | /^(.+):(.+):(.+)/; 24 | my $name = $1; 25 | my $type = $2; 26 | my $manufacturer = $3; 27 | $common->addController({ 28 | 'NAME' => $name, 29 | 'MANUFACTURER' => $manufacturer, 30 | 'TYPE' => $type, 31 | }); 32 | } 33 | } 34 | 35 | 1; 36 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/MacOS/Domains.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::MacOS::Domains; 2 | use strict; 3 | 4 | # straight up theft from the other modules... 5 | 6 | sub check { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | return unless $common->can_run('dsconfigad'); 10 | my @domain = `dsconfigad -show`; 11 | return 1 if @domain; 12 | 0 13 | } 14 | 15 | sub run { 16 | my $params = shift; 17 | my $common = $params->{common}; 18 | 19 | my $domain; 20 | my $domainInfo; 21 | chomp ($domainInfo = `dsconfigad -show`); 22 | 23 | my @domainInfo = split (/\n/, $domainInfo); 24 | 25 | shift(@domainInfo); 26 | 27 | if($domainInfo[0]) { 28 | @domainInfo = split(/\=/, $domainInfo[0]); 29 | $domain = $domainInfo[1]; 30 | $domain =~ s/^\s+//; 31 | } 32 | 33 | $common->setHardware({ 34 | WORKGROUP => $domain 35 | }); 36 | } 37 | 38 | 1; 39 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/m68k/CPU.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::m68k::CPU; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_read("/proc/cpuinfo") 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | my @cpu; 15 | my $current; 16 | open CPUINFO, ") { 18 | print; 19 | if (/^CPU\s+:\s*:/) { 20 | if ($current) { 21 | $common->addCPU($current); 22 | } 23 | $current = { 24 | CPUARCH => 'm68k', 25 | }; 26 | } else { 27 | $current->{TYPE} = $1 if /CPU:\s+(\S.*)/; 28 | $current->{SPEED} = $1 if /Clocking:\s+:\s+(\S.*)/; 29 | } 30 | } 31 | # The last one 32 | $common->addCPU($current); 33 | } 34 | 35 | 1; 36 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/HPUX/Software.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::HPUX::Software; 2 | 3 | sub check { 4 | my $params = shift; 5 | 6 | # Do not run an package inventory if there is the --nosoftware parameter 7 | return if ($params->{params}->{nosoftware}); 8 | 9 | $^O =~ /hpux/ 10 | } 11 | 12 | sub run { 13 | my $params = shift; 14 | my $common = $params->{common}; 15 | 16 | my @softList; 17 | my $software; 18 | 19 | @softList = `swlist | grep -v '^ PH' | grep -v '^#' |tr -s "\t" " "|tr -s " "` ; 20 | foreach $software (@softList) { 21 | chomp( $software ); 22 | if ( $software =~ /^ (\S+)\s(\S+)\s(.+)/ ) { 23 | $common->addSoftwares({ 24 | 'NAME' => $1 , 25 | 'VERSION' => $2 , 26 | 'COMMENTS' => $3 , 27 | 'PUBLISHER' => "HP" , 28 | }); 29 | } 30 | } 31 | } 32 | 33 | 1; 34 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/Flatpak.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Packaging::Flatpak; 2 | 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | return unless $common->can_run("flatpak"); 7 | } 8 | 9 | sub run { 10 | my $params = shift; 11 | my $common = $params->{common}; 12 | 13 | if ($common->can_run("flatpak list")) { 14 | foreach(`flatpak list`){ 15 | /(\S+)(\/)(\S+)(\/)(\S+)\s+(\S+)/; 16 | 17 | my $name = $1; 18 | my $version = $5; 19 | my $publisher = "Flatpak package"; 20 | my $comments = $6; 21 | 22 | $common->addSoftware({ 23 | 'COMMENTS' => $comments, 24 | 'NAME' => $name, 25 | 'PUBLISHER' => $publisher, 26 | 'VERSION' => $version 27 | }); 28 | } 29 | } 30 | } 31 | 32 | 1; 33 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/XML/Prolog.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::XML::Prolog; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use XML::Simple; 7 | use Digest::MD5 qw(md5_base64); 8 | 9 | sub new { 10 | my (undef, $params) = @_; 11 | 12 | my $self = {}; 13 | $self->{config} = $params->{context}->{config}; 14 | 15 | $self->{logger} = $params->{context}->{logger}; 16 | 17 | die unless ($self->{config}->{deviceid}); #XXX 18 | 19 | $self->{xmlroot}{QUERY} = ['PROLOG']; 20 | $self->{xmlroot}{DEVICEID} = [$self->{config}->{deviceid}]; 21 | 22 | bless $self; 23 | } 24 | 25 | sub dump { 26 | my $self = shift; 27 | eval "use Data::Dumper;"; 28 | print Dumper($self->{xmlroot}); 29 | 30 | } 31 | 32 | sub getContent { 33 | my ($self, $args) = @_; 34 | 35 | my $content=XMLout( $self->{xmlroot}, RootName => 'REQUEST', XMLDecl => '', SuppressEmpty => undef ); 36 | 37 | return $content; 38 | } 39 | 40 | 1; 41 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Repository/SuSE.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Repository::SuSE; 2 | 3 | use strict; 4 | use warnings; 5 | use Data::Dumper; 6 | 7 | sub check { 8 | my $params = shift; 9 | my $common = $params->{common}; 10 | return unless $common->can_run("zypper"); 11 | } 12 | 13 | sub run { 14 | my $params = shift; 15 | my $common = $params->{common}; 16 | 17 | my @repository=`LANG=C zypper lr -Ed 2>/dev/null`; 18 | 19 | for (my $i=0;$i<=$#repository;$i++){ 20 | my $line=$repository[$i]; 21 | next if ($line =~ /^#/); 22 | next if ($line =~ /^-/); 23 | my ($num,$alias,$name,$enabled,$gpg,$refresh,$priority,$type,$url)=split('\|',$line); 24 | $url =~ s/\s+//g; 25 | $name =~ s/^\s+//; 26 | $name =~ s/\s+$//; 27 | $common->addRepo({ 28 | BASEURL => $url, 29 | NAME => $name, 30 | }); 31 | } 32 | } 33 | 34 | 1; 35 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/s390x/CPU.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::s390x::CPU; 2 | 3 | use strict; 4 | 5 | sub check { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | $common->can_read("/proc/cpuinfo") 9 | } 10 | 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | 15 | my $current; 16 | my $cpucores; 17 | open CPUINFO, ") { 19 | print; 20 | if (/^vendor\s*:/) { 21 | if ($current) { 22 | $common->addCPU($current); 23 | } 24 | } elsif (/^processor [0-9]:\s+(\S.*)/) { 25 | $cpucores++; 26 | } 27 | $current->{MANUFACTURER} = $1 if /vendor_id\s*:\s+(\S.*)/; 28 | $current->{SPEED} = $1 if /bogomips per cpu:\s+(\S.*)/; 29 | } 30 | $current->{CORES} = $cpucores; 31 | $common->addCPU($current); 32 | } 33 | 34 | 1; 35 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/HPUX/Controller.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::HPUX::Controller; 2 | use strict; 3 | 4 | sub check { $^O =~ /hpux/ } 5 | 6 | sub run { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | 10 | my $name; 11 | my $interface; 12 | my $info; 13 | my $type; 14 | my @typeScaned=('ext_bus','fc','psi'); 15 | my $scaned; 16 | 17 | for (@typeScaned) { 18 | $scaned=$_; 19 | for ( `ioscan -kFC $scaned| cut -d ':' -f 9,11,17,18` ) { 20 | if ( /(\S+):(\S+):(\S+):(.+)/ ) { 21 | $name=$2; 22 | $interface=$3; 23 | $info=$4; 24 | $type=$1; 25 | $common->addController({ 26 | 'NAME' => $name, 27 | 'MANUFACTURER' => "$interface $info", 28 | 'TYPE' => $type, 29 | }); 30 | }; 31 | }; 32 | }; 33 | } 34 | 35 | 1; 36 | -------------------------------------------------------------------------------- /resources/cpuinfo/linux-alpha-1: -------------------------------------------------------------------------------- 1 | cpu : Alpha 2 | cpu model : EV68CB 3 | cpu variation : 7 4 | cpu revision : 0 5 | cpu serial number : JA30502089 6 | system type : Titan 7 | system variation : Privateer 8 | system revision : 0 9 | system serial number : AY31001636 10 | cycle frequency [Hz] : 1250000000 11 | timer frequency [Hz] : 1024.00 12 | page size [bytes] : 8192 13 | phys. address bits : 44 14 | max. addr. space # : 255 15 | BogoMIPS : 2484.04 16 | kernel unaligned acc : 0 (pc=0,va=0) 17 | user unaligned acc : 0 (pc=0,va=0) 18 | platform string : AlphaServer ES45 Model 3B 19 | cpus detected : 3 20 | cpus active : 3 21 | cpu active mask : 0000000000000007 22 | L1 Icache : 64K, 2-way, 64b line 23 | L1 Dcache : 64K, 2-way, 64b line 24 | L2 cache : n/a 25 | L3 cache : n/a 26 | 27 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX/Software.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX::Software; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | sub check { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | 10 | # Do not run an package inventory if there is the --nosoftware parameter 11 | return if ($params->{config}->{nosoftware}); 12 | 13 | return unless $common->can_run("lslpp"); 14 | 1; 15 | } 16 | 17 | sub run { 18 | my $params = shift; 19 | my $common = $params->{common}; 20 | 21 | my @list; 22 | my $buff; 23 | foreach (`lslpp -c -l`) { 24 | my @entry = split /:/,$_; 25 | next unless (@entry); 26 | next unless ($entry[1]); 27 | next if $entry[1] =~ /^device/; 28 | 29 | $common->addSoftware({ 30 | 'COMMENTS' => $entry[6], 31 | 'FOLDER' => $entry[0], 32 | 'NAME' => $entry[1], 33 | 'VERSION' => $entry[2], 34 | }); 35 | } 36 | } 37 | 38 | 1; 39 | -------------------------------------------------------------------------------- /macosx/ocsng_app-xcode/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | ocs_logo 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | OCNG 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | LSApplicationCategoryType 24 | public.app-category.utilities 25 | LSUIElement 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX; 2 | 3 | use strict; 4 | use vars qw($runAfter); 5 | $runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"]; 6 | 7 | sub check { 8 | my $r; 9 | $r = 1 if $^O =~ /^aix$/; 10 | $r; 11 | } 12 | 13 | sub run { 14 | my $params = shift; 15 | my $common = $params->{common}; 16 | 17 | my @tabOS; 18 | my $OSName; 19 | my $OSComment; 20 | my $OSVersion; 21 | my $OSLevel; 22 | # Operating system informations 23 | chomp($OSName=`uname -s`); 24 | # AIX OSVersion = oslevel, OSComment=oslevel -r affiche niveau de maintenance 25 | chomp($OSVersion=`oslevel`); 26 | chomp($OSLevel=`oslevel -r`); 27 | @tabOS=split(/-/,$OSLevel); 28 | $OSComment="Maintenance Level :".@tabOS[1]; 29 | 30 | $OSVersion =~ s/(.0)*$//; 31 | $common->setHardware({ 32 | OSNAME => "$OSName $OSVersion", 33 | OSCOMMENTS => $OSComment, 34 | OSVERSION => $OSLevel, 35 | }); 36 | } 37 | 1; 38 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/MacOS/Uptime.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::MacOS::Uptime; 2 | use strict; 3 | 4 | sub check { 5 | my $boottime = `sysctl -n kern.boottime 2>/dev/null`; # straight from the BSD module ;-) 6 | return 1 if $boottime; 7 | return; 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | # stolen code from bsd. 15 | chomp (my $boottime = `sysctl -n kern.boottime`); 16 | $boottime = $1 if $boottime =~ /sec\s*=\s*(\d+)/; 17 | chomp (my $currenttime = `date +%s`); 18 | my $uptime = $currenttime - $boottime; 19 | 20 | # Uptime conversion 21 | my ($UYEAR, $UMONTH , $UDAY, $UHOUR, $UMIN, $USEC) = (gmtime ($uptime))[5,4,3,2,1,0]; 22 | 23 | # Write in ISO format 24 | $uptime=sprintf "%02d-%02d-%02d %02d:%02d:%02d", ($UYEAR-70), $UMONTH, ($UDAY-1), $UHOUR, $UMIN, $USEC; 25 | 26 | chomp(my $DeviceType =`uname -m`); 27 | $common->setHardware({ DESCRIPTION => "$DeviceType/$uptime" }); 28 | } 29 | 1; 30 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/HPUX/Slots.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::HPUX::Slots; 2 | use strict; 3 | 4 | sub check { $^O =~ /hpux/ } 5 | 6 | sub run { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | 10 | my $name; 11 | my $interface; 12 | my $info; 13 | my $type; 14 | my @typeScaned=('ioa','ba'); 15 | my $scaned; 16 | 17 | for (@typeScaned ) { 18 | $scaned=$_; 19 | for ( `ioscan -kFC $scaned| cut -d ':' -f 9,11,17,18` ) { 20 | if ( /(\S+):(\S+):(\S+):(.+)/ ) { 21 | $name=$2; 22 | $interface=$3; 23 | $info=$4; 24 | $type=$1; 25 | $common->addSlots({ 26 | DESCRIPTION => "$name", 27 | DESIGNATION => "$interface $info", 28 | NAME => "$type", 29 | STATUS => "OK", 30 | }); 31 | }; 32 | }; 33 | }; 34 | } 35 | 36 | 1; 37 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux; 2 | 3 | use strict; 4 | use vars qw($runAfter); 5 | $runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"]; 6 | 7 | sub check { $^O =~ /^linux$/ } 8 | 9 | sub run { 10 | my $params = shift; 11 | my $common = $params->{common}; 12 | 13 | chomp (my $osversion = `uname -r`); 14 | 15 | my $lastloggeduser; 16 | my $datelastlog; 17 | my @query = $common->runcmd("last -R -n 1"); 18 | 19 | foreach ($query[0]) { 20 | if ( s/^(\S+)\s+\S+\s+(\S+\s+\S+\s+\S+\s+\S+)\s+.*// ) { 21 | $lastloggeduser = $1; 22 | $datelastlog = $2; 23 | } 24 | } 25 | 26 | # This will probably be overwritten by a Linux::Distro module. 27 | $common->setHardware({ 28 | OSNAME => "Linux", 29 | OSCOMMENTS => "Unknown Linux distribution", 30 | OSVERSION => $osversion, 31 | LASTLOGGEDUSER => $lastloggeduser, 32 | DATELASTLOGGEDUSER => $datelastlog 33 | }); 34 | } 35 | 36 | 1; 37 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/BSD/Uptime.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::BSD::Uptime; 2 | use strict; 3 | 4 | sub check { 5 | my $boottime = `sysctl -n kern.boottime 2>/dev/null`; 6 | return 1 if $boottime; 7 | return; 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | chomp (my $boottime = `sysctl -n kern.boottime`); 15 | $boottime = $1 if $boottime =~ /sec\s*=\s*(\d+)/; 16 | chomp (my $currenttime = `date +%s`); 17 | my $uptime = $currenttime - $boottime; 18 | 19 | # Uptime conversion 20 | my ($UYEAR, $UMONTH , $UDAY, $UHOUR, $UMIN, $USEC) = (gmtime ($uptime))[5,4,3,2,1,0]; 21 | 22 | # Write in ISO format 23 | $uptime=sprintf "%02d-%02d-%02d %02d:%02d:%02d", ($UYEAR-70), $UMONTH, ($UDAY-1), $UHOUR, $UMIN, $USEC; 24 | 25 | chomp(my $DeviceType =`uname -m`); 26 | # TODO$h->{'CONTENT'}{'HARDWARE'}{'DESCRIPTION'} = [ "$DeviceType/$uptime" ]; 27 | $common->setHardware({ DESCRIPTION => "$DeviceType/$uptime" }); 28 | } 29 | 30 | 1; 31 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Solaris/Controllers.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Solaris::Controllers; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_run ("cfgadm") 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | my $name; 15 | my $type; 16 | my $description; 17 | 18 | foreach(`cfgadm -s cols=ap_id:type:info`){ 19 | $name = $type = $description = ""; 20 | next if (/^Ap_Id/); 21 | if (/^(\S+)\s+/){ 22 | $name = $1; 23 | } 24 | if(/^\S+\s+(\S+)/){ 25 | $type = $1; 26 | } 27 | #No manufacturer, but informations about controller 28 | if(/^\S+\s+\S+\s+(.*)/){ 29 | $description = $1; 30 | } 31 | $common->addController({ 32 | 'NAME' => $name, 33 | 'TYPE' => $type, 34 | 'DESCRIPTION' => $description, 35 | }); 36 | } 37 | } 38 | 1; 39 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/Alpha/CPU.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::Alpha::CPU; 2 | 3 | use strict; 4 | 5 | sub check { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | $common->can_read("/proc/cpuinfo") 9 | } 10 | 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | 15 | my @cpu; 16 | my $current; 17 | open CPUINFO, ") { 19 | print; 20 | if (/^cpu\s*:/) { 21 | if ($current) { 22 | $common->addCPU($current); 23 | } 24 | $current = { 25 | CPUARCH => 'Alpha', 26 | }; 27 | } else { 28 | $current->{SERIAL} = $1 if /^cpu serial number\s+:\s+(\S.*)/; 29 | $current->{SPEED} = $1 if /cycle frequency \[Hz\]\s+:\s+(\d+)000000/; 30 | $current->{TYPE} = $1 if /platform string\s+:\s+(\S.*)/; 31 | } 32 | } 33 | # The last one 34 | $common->addCPU($current); 35 | } 36 | 37 | 1; 38 | -------------------------------------------------------------------------------- /META.yml: -------------------------------------------------------------------------------- 1 | --- 2 | abstract: 'Ocs-Inventory unified Agent for UNIX, Linux and MacOSX' 3 | author: 4 | - 'OCS Inventory Team' 5 | build_requires: 6 | ExtUtils::MakeMaker: 6.59 7 | configure_requires: 8 | ExtUtils::MakeMaker: 6.59 9 | distribution_type: module 10 | dynamic_config: 1 11 | generated_by: 'Module::Install version 1.19' 12 | license: gpl 13 | meta-spec: 14 | url: http://module-build.sourceforge.net/META-spec-v1.4.html 15 | version: 1.4 16 | name: Ocsinventory-Unix-Agent 17 | no_index: 18 | directory: 19 | - inc 20 | recommends: 21 | Compress::Zlib: 0 22 | Net::IP: 0 23 | Nvidia::ml: 0 24 | Proc::Daemon: 0 25 | Proc::PID::File: 0 26 | requires: 27 | Digest::MD5: 0 28 | File::Temp: 0 29 | LWP: 0 30 | XML::Simple: 0 31 | perl: 5.6.0 32 | resources: 33 | homepage: http://www.ocsinventory-ng.org 34 | bugtracker: https://github.com/OCSInventory-NG/UnixAgent/issues 35 | repository: https://github.com/OCSInventory-NG/UnixAgent 36 | irc: irc://irc.freenode.net/#ocsinventory-ng 37 | license: http://opensource.org/licenses/gpl-license.php 38 | version: 2.4.2 39 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/Snap.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Packaging::Snap; 2 | 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | return unless $common->can_run("snap"); 7 | } 8 | 9 | sub run { 10 | my $params = shift; 11 | my $common = $params->{common}; 12 | 13 | if ($common->can_run("snap list")) { 14 | my $i = 0; 15 | foreach(`snap list`){ 16 | /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/; 17 | if($i >= 1) { 18 | my $name = $1; 19 | my $version = $2; 20 | my $publisher = $5; 21 | my $comments = "Snap package"; 22 | 23 | $common->addSoftware({ 24 | 'COMMENTS' => $comments, 25 | 'NAME' => $name, 26 | 'PUBLISHER' => $publisher, 27 | 'VERSION' => $version 28 | }); 29 | } 30 | $i++; 31 | } 32 | } 33 | } 34 | 35 | 1; -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/BSD/Drives.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::BSD::Drives; 2 | 3 | use strict; 4 | 5 | sub run { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | 9 | my $free; 10 | my $filesystem; 11 | my $total; 12 | my $type; 13 | my $volumn; 14 | 15 | 16 | for my $t ("ffs","ufs","zfs") { 17 | # OpenBSD has no -m option so use -k to obtain results in kilobytes 18 | for (`df -P -t $t -k`){ 19 | if (/^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\n/){ 20 | $volumn = $1; 21 | $filesystem = $t; 22 | $total = sprintf("%i",$2/1024); 23 | $free = sprintf("%i",$4/1024); 24 | $type = $6; 25 | 26 | $common->addDrive({ 27 | FREE => $free, 28 | FILESYSTEM => $filesystem, 29 | TOTAL => $total, 30 | TYPE => $type, 31 | VOLUMN => $volumn 32 | }); 33 | } 34 | } 35 | } 36 | } 37 | 1; 38 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Repository/Debian.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Repository::Debian; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | sub check{ 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | return unless $common->can_run("apt-cache"); 10 | } 11 | 12 | sub run{ 13 | my $params = shift; 14 | my $common = $params->{common}; 15 | 16 | my ($repo_name, $repo_baseurl); 17 | 18 | my @repository=`apt-cache policy | grep -i http | awk {'print \$2 " " \$3'} | sort -u`; 19 | push @repository, "\n"; 20 | 21 | for (my $i=0;$i<$#repository;$i++){ 22 | my $line=$repository[$i]; 23 | 24 | $repo_name=$1 if ($line =~ /\/([^\/]*)\n$/); 25 | $repo_baseurl=$1 if ($line =~ /^(\S*)\h/); 26 | 27 | if ($line =~ /(^.*$)/ && $repo_name && $repo_baseurl){ 28 | $common->addRepo({ 29 | NAME => $repo_name, 30 | BASEURL => $repo_baseurl, 31 | }); 32 | $repo_name = $repo_baseurl = undef; 33 | } 34 | #$repo_name=$1 if ($line =~ /.*\s(\w-?\/\w)/); 35 | } 36 | } 37 | 38 | 1; 39 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX/Mem.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX::Mem; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | return unless $common->can_run("lsdev"); 8 | return unless $common->can_run("which"); 9 | return unless $common->can_run("lsattr"); 10 | } 11 | 12 | sub run { 13 | my $params = shift; 14 | my $common = $params->{common}; 15 | 16 | my $memory; 17 | my $swap; 18 | 19 | # Memory informations 20 | # lsdev -Cc memory -F 'name' -t totmem 21 | # lsattr -EOlmem0 22 | my (@lsdev, @lsattr, @grep); 23 | $memory=0; 24 | @lsdev=`lsdev -Cc memory -F 'name' -t totmem`; 25 | for (@lsdev){ 26 | $memory += `lsattr -a size -F value -El$_`; 27 | } 28 | 29 | 30 | # Paging Space 31 | @grep=`lsps -s`; 32 | for (@grep){ 33 | if ( ! /^Total/){ 34 | /^\s*(\d+)\w*\s+\d+.+/; 35 | $swap=$1; 36 | } 37 | } 38 | 39 | $common->setHardware({ 40 | MEMORY => $memory, 41 | SWAP => $swap 42 | }); 43 | } 44 | 45 | 1; 46 | -------------------------------------------------------------------------------- /contrib/cron/ocsinventory-agent.cron: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | NAME=ocsinventory-agent 3 | 4 | exec >>/var/log/$NAME/$NAME.log 2>&1 5 | 6 | [ -f /etc/sysconfig/$NAME ] || exit 0 7 | source /etc/sysconfig/$NAME 8 | export PATH 9 | 10 | i=0 11 | while [ $i -lt ${#OCSMODE[*]} ] 12 | do 13 | if [ ${OCSMODE[$i]:-none} == cron ]; then 14 | OPTS= 15 | if [ ! -z "${OCSPAUSE[$i]}" ]; then 16 | OPTS="--wait ${OCSPAUSE[$i]}" 17 | fi 18 | 19 | if [ ! -z "${OCSTAG[$i]}" ]; then 20 | OPTS="$OPTS --tag=${OCSTAG[$i]}" 21 | fi 22 | 23 | if [ "z${OCSSERVER[$i]}" = 'zlocal' ]; then 24 | # Local inventory 25 | OPTS="$OPTS --local=/var/lib/$NAME" 26 | 27 | elif [ ! -z "${OCSSERVER[$i]}" ]; then 28 | # Remote inventory 29 | OPTS="$OPTS --lazy --nolocal --server=${OCSSERVER[$i]}" 30 | if [ ! -z "${OCSPROXYSERVER[$i]}" ]; then 31 | OPTS="$OPTS --proxy=${OCSPROXYSERVER[$i]}" 32 | fi 33 | fi 34 | 35 | if [ ! -z "${OCSSSL[$i]}" ]; then 36 | OPTS="$OPTS --ssl=${OCSSSL[$i]}" 37 | fi 38 | 39 | echo "[$(date '+%c')] Running $NAME $OPTS" 40 | /usr/sbin/$NAME $OPTS 41 | fi 42 | ((i++)) 43 | done 44 | echo "[$(date '+%c')] End of cron job ($PATH)" 45 | -------------------------------------------------------------------------------- /macosx/setup_plugins/auth_plugin_installer/auth/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | InstallerSectionTitle 22 | auth 23 | NSHumanReadableCopyright 24 | Copyright © 2020 OCS Inventory. All rights reserved. 25 | NSMainNibFile 26 | AuthInstallerPane 27 | NSPrincipalClass 28 | InstallerSection 29 | 30 | 31 | -------------------------------------------------------------------------------- /macosx/setup_plugins/config_plugin_installer/config/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | InstallerSectionTitle 22 | config 23 | NSHumanReadableCopyright 24 | Copyright © 2020 OCS Inventory. All rights reserved. 25 | NSMainNibFile 26 | ConfigInstallerPane 27 | NSPrincipalClass 28 | InstallerSection 29 | 30 | 31 | -------------------------------------------------------------------------------- /macosx/setup_plugins/daemonconfig_plugin_install/daemonconfig/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | InstallerSectionTitle 22 | daemonconfig 23 | NSHumanReadableCopyright 24 | Copyright © 2020 OCS Inventory. All rights reserved. 25 | NSMainNibFile 26 | DaemonConfigPane 27 | NSPrincipalClass 28 | InstallerSection 29 | 30 | 31 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/MacOS/Slots.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::MacOS::Slots; 2 | 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | return(undef) unless -r '/usr/sbin/system_profiler'; # check perms 7 | return (undef) unless $common->can_load("Mac::SysProfile"); 8 | return 1; 9 | } 10 | 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | my ($name, $description, $status); 15 | 16 | # create the profile object and return undef unless we get something back 17 | my $pro = Mac::SysProfile->new(); 18 | my $data = $pro->gettype('SPPCIDataType'); 19 | return(undef) unless(ref($data) eq 'ARRAY'); 20 | 21 | foreach my $slot (@$data) { 22 | 23 | 24 | $name = $slot->{'_name'}; 25 | $description = $slot->{'sppci_link-width'}." ".$slot->{'sppci_bus'}." ".$slot->{'sppci_slot_name'}; 26 | 27 | $common->addSlot({ 28 | NAME => $name, 29 | DESCRIPTION => $description, 30 | }); 31 | 32 | $name = $description = $status = undef; 33 | } 34 | 35 | } 36 | 37 | 1; 38 | -------------------------------------------------------------------------------- /macosx/setup_plugins/config_plugin_installer/config/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | "PaneTitle" = "OCSInventory Agent Config"; 4 | 5 | //Yes button 6 | "Yes" = "Yes"; 7 | 8 | //No button 9 | "No" = "No"; 10 | 11 | //Warning about already existing cofiguration file 12 | "Already_conf_warn" = "OCS agent configuration file seems to already exists. Do you want to launch OCS Inventory NG agent configuration?"; 13 | 14 | //Warning about already existing cofiguration file comment 15 | "Already_conf_warn_comment" = "The previous /etc/ocsinventory-agent/ocsinventory-agent.cfg file will be erased"; 16 | 17 | //Warning about missing certificate file 18 | "Missing_cert_warn" = "You have enabled Download feature and SSL certicate check but you don't specify a certificate file"; 19 | 20 | //Warning about missing certificate file comment 21 | "Missing_cert_warn_comment" = "If you don't specifiy a certificate file, Download feature won't work"; 22 | 23 | //Warning about invalid server address 24 | "Invalid_srv_addr" = "Invalid OCS server address"; 25 | 26 | //Warning about invalid server address comment 27 | "Invalid_srv_addr_comment" = "Please check and re-enter your OCS server address"; 28 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Lspci/Videos.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Lspci::Videos; 2 | use strict; 3 | 4 | my $memory; 5 | my $chipset; 6 | my $name; 7 | 8 | sub run { 9 | my $params = shift; 10 | my $common = $params->{common}; 11 | 12 | foreach(`lspci`){ 13 | if(/graphics|vga|video|display/i && /^([0-9a-f][0-9a-f]:[0-9a-f][0-9a-f].[0-9a-f])\s([^:]+):\s*(.+?)(?:\(([^()]+)\))?$/i){ 14 | my $slot = $1; 15 | $chipset = $2; 16 | $name = $3; 17 | if (defined $slot) { 18 | my @detail = `lspci -v -s $slot 2>/dev/null`; 19 | $memory = 0; 20 | foreach my $m (@detail) { 21 | if ($m =~ /.*Memory.*\s+\(.*-bit,\sprefetchable\)\s\[size=(\d*)M\]/) { 22 | $memory += $1; 23 | } 24 | } 25 | # Don't record zero memory 26 | $memory = undef if $memory == 0; 27 | } 28 | $common->addVideo({ 29 | 'CHIPSET' => $chipset, 30 | 'NAME' => $name, 31 | 'MEMORY' => $memory, 32 | }); 33 | } 34 | } 35 | } 36 | 37 | 1; 38 | -------------------------------------------------------------------------------- /macosx/ocsng_app-xcode/ocscontact.m: -------------------------------------------------------------------------------- 1 | // 2 | // OCSINVENTORY-NG 3 | // Copyleft Guillaume PROTET 2011 4 | // Web : http://www.ocsinventory-ng.org 5 | // 6 | // This code is open source and may be copied and modified as long as the source 7 | // code is always made freely available. 8 | // Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt 9 | // 10 | // 11 | 12 | 13 | //ocscontact is the helper tool to run OCS agent using Authorization Services. 14 | //ocscontact executable MUST be owned by root and have 700 permissions 15 | 16 | #import "ocscontact.h" 17 | 18 | @implementation ocscontact 19 | 20 | int main( int argc, char *argv[], char *envp[]) { 21 | 22 | NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; 23 | NSLog(@"Running ocscontact"); 24 | setuid(0); //To be able to run OCS agent as root 25 | 26 | NSTask *Task = [[NSTask alloc] init]; 27 | 28 | //We get the path of ocsinventory-agent executable 29 | NSString *ocsinventoryAgentPath = [[NSBundle mainBundle] pathForResource:@"ocsinventory-agent"ofType:nil]; 30 | 31 | [Task setLaunchPath:ocsinventoryAgentPath]; 32 | [Task launch]; 33 | 34 | [autoreleasepool release]; 35 | return 0; 36 | } 37 | 38 | 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Must read before submitting 2 | Please, take a look to our contributing guidelines before submitting your pull request. 3 | There's some simple rules that will help us to speed up the review process and avoid any misunderstanding 4 | 5 | [Contributors GuideLines](https://github.com/OCSInventory-NG/OCSInventory-ocsreports/blob/master/.github/Contributing.md) 6 | 7 | ## Status 8 | **READY/IN DEVELOPMENT/HOLD** 9 | 10 | ## Description 11 | A few sentences describing the overall goals of the pull request's commits. 12 | 13 | ## Related Issues 14 | Put here all the related issues link 15 | 16 | ## Todos 17 | - [ ] Tests 18 | - [ ] Documentation 19 | 20 | ## Test environment 21 | If some tests has been already made, please give us your test environment' specs 22 | 23 | #### General informations 24 | Operating system : 25 | Perl version : 26 | 27 | #### OCS Inventory informations 28 | Unix agent version : 29 | 30 | 31 | ## Deploy Notes 32 | Notes regarding deployment the contained body of work. These should note any dependencies changes, 33 | logical changes, etc. 34 | 35 | 1. 36 | 37 | ## Impacted Areas in Application 38 | List general components of the application that this PR will affect: 39 | 40 | * 41 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/XML/SimpleMessage.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::XML::SimpleMessage; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use Data::Dumper; # XXX Debug 7 | use XML::Simple; 8 | use Digest::MD5 qw(md5_base64); 9 | 10 | use Ocsinventory::Agent::XML::Prolog; 11 | 12 | sub new { 13 | my (undef, $params) = @_; 14 | 15 | my $self = {}; 16 | $self->{config} = $params->{config}; 17 | $self->{accountinfo} = $params->{accountinfo}; 18 | 19 | die unless ($self->{config}->{deviceid}); #XXX 20 | 21 | $self->{xmlroot}{QUERY} = ['PROLOG']; 22 | $self->{xmlroot}{DEVICEID} = [$self->{config}->{deviceid}]; 23 | 24 | bless $self; 25 | } 26 | 27 | sub dump { 28 | my $self = shift; 29 | print Dumper($self->{xmlroot}); 30 | 31 | } 32 | 33 | sub set { 34 | my ($self, $args) = @_; 35 | 36 | foreach (keys %$args) { 37 | $self->{xmlroot}{$_} = [$args->{$_}]; 38 | } 39 | } 40 | 41 | sub getContent { 42 | my ($self, $args) = @_; 43 | 44 | $self->{accountinfo}->setAccountInfo($self); 45 | my $content=XMLout( $self->{xmlroot}, RootName => 'REQUEST', XMLDecl => '', SuppressEmpty => undef ); 46 | 47 | return $content; 48 | } 49 | 50 | 1; 51 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Domains.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Domains; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | return unless $common->can_run ("hostname"); 8 | my @domain = `hostname -d`; 9 | return 1 if @domain || $common->can_read ("/etc/resolv.conf"); 10 | 0; 11 | } 12 | sub run { 13 | my $params = shift; 14 | my $common = $params->{common}; 15 | 16 | my $domain; 17 | my %domain; 18 | my @dns_list; 19 | my $dns; 20 | chomp($domain = `hostname -d`); 21 | 22 | open RESOLV, "/etc/resolv.conf" or warn; 23 | while (){ 24 | if (/^nameserver\s+(\S+)/i) { 25 | push(@dns_list,$1); 26 | } elsif (!$domain) { 27 | $domain{$2} = 1 if (/^(domain|search)\s+(.+)/); 28 | } 29 | } 30 | close RESOLV; 31 | 32 | if (!$domain) { 33 | $domain = join "/", keys %domain; 34 | } 35 | 36 | $dns=join("/",@dns_list); 37 | # If no domain name, we send "WORKGROUP" 38 | $domain = 'WORKGROUP' unless $domain; 39 | 40 | $common->setHardware({ 41 | WORKGROUP => $domain, 42 | DNS => $dns 43 | }); 44 | 45 | } 46 | 47 | 1; 48 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX/Slots.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX::Slots; 2 | use strict; 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | $common->can_run("lsdev") 7 | } 8 | 9 | sub run { 10 | my $params = shift; 11 | my $common = $params->{common}; 12 | 13 | my $description; 14 | my $designation; 15 | my $name; 16 | my $status; 17 | my @slot; 18 | my $flag=0; 19 | 20 | @slot=`lsdev -Cc bus -F 'name:description'`; 21 | for (@slot){ 22 | /^(.+):(.+)/; 23 | $name = $1; 24 | $status = 'available'; 25 | $designation = $2; 26 | $flag=0; 27 | my @lsvpd = `lsvpd`; 28 | s/^\*// for (@lsvpd); 29 | for (@lsvpd){ 30 | if ((/^AX $name/) ) {$flag=1} 31 | if ((/^YL (.+)/) && ($flag)){ 32 | $description = $2; 33 | } 34 | if ((/^FC .+/) && $flag) {$flag=0;last} 35 | } 36 | $common->addSlot({ 37 | DESCRIPTION => $description, 38 | DESIGNATION => $designation, 39 | NAME => $name, 40 | STATUS => $status, 41 | }); 42 | } 43 | } 44 | 45 | 1; 46 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/Psu.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Dmidecode::Psu; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | sub run { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | 10 | my $infos=$common->getDmidecodeInfos(); 11 | my $psu; 12 | 13 | foreach my $info (@{$infos->{39}}) { 14 | next if $info->{'Type'} && $info->{'Type'} eq 'Battery'; 15 | 16 | $psu->{NAME}=$1 if ($info =~ /Name:\s*(.*)/i); 17 | $psu->{LOCATION}=$1 if ($info =~ /Location:\s*(.*)/i); 18 | $psu->{STATUS}=$1 if ($info =~ /Status:\s*(.*)/i); 19 | $psu->{SERIALNUMBER}=$1 if ($info =~ /Serial Number:\s*(.*)/i); 20 | $psu->{PLUGGED}=$1 if ($info =~ /Plugged:\s*(.*)/i); 21 | $psu->{HOTREPLACEABLE}=$1 if ($info =~ /Hot Replaceable:\s*(.*)/i); 22 | $psu->{POWERMAX}=$1 if ($info =~ /Max Power Capacity:\s*(.*)/i); 23 | $psu->{MANUFACTURER}=$1 if ($info =~ /Manufacturer:\s*(.*)/i); 24 | $psu->{PARTNUMBER}=$1 if ($info =~ /Model Part Number:\s*(.*)/i); 25 | 26 | next unless ($psu); 27 | next unless ($psu->{'NAME'} || $psu->{'SERIALNUMBER'} || $psu->{'PARTNUMBER'}); 28 | 29 | $common->addPSU($psu); 30 | } 31 | 32 | } 33 | 34 | 1; 35 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/BSD.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::BSD; 2 | 3 | use strict; 4 | 5 | use vars qw($runAfter); 6 | $runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"]; 7 | 8 | sub check { $^O =~ /freebsd|openbsd|netbsd|gnukfreebsd|gnuknetbsd/ } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | my $OSName; 15 | my $OSComment; 16 | my $OSVersion; 17 | my $OSLevel; 18 | my $OSArchi; 19 | 20 | # Operating system informations 21 | chomp($OSName=`uname -s`); 22 | chomp($OSVersion=`uname -r`); 23 | chomp($OSArchi=`uname -p`); 24 | 25 | # Retrieve the origin of the kernel configuration file 26 | my ($date, $origin, $kernconf); 27 | for (`sysctl -n kern.version`) { 28 | $date = $1 if /^\S.*\#\d+:\s*(.*)/; 29 | ($origin,$kernconf) = ($1,$2) if /^\s+(.+):(.+)$/; 30 | } 31 | $kernconf =~ s/\/.*\///; # remove the path 32 | $OSComment = $kernconf." (".$date.")\n".$origin; 33 | # if there is a problem use uname -v 34 | chomp($OSComment=`uname -v`) unless $OSComment; 35 | 36 | $common->setHardware({ 37 | OSNAME => $OSName." ".$OSArchi, 38 | OSCOMMENTS => $OSComment, 39 | OSVERSION => $OSVersion, 40 | }); 41 | } 42 | 1; 43 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/BSDpkg.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Packaging::BSDpkg; 2 | 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | return if ( `uname -rs` =~ /SunOS 5.11/ ); 7 | $common->can_run("pkg") || $common->can_run("pkg_info") 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | if ($common->can_run("pkg")) { 15 | foreach(`pkg info`){ 16 | /^(\S+)-(\d+\S*)\s+(.*)/; 17 | my $name = $1; 18 | my $version = $2; 19 | my $comments = $3; 20 | 21 | $common->addSoftware({ 22 | 'COMMENTS' => $comments, 23 | 'NAME' => $name, 24 | 'VERSION' => $version 25 | }); 26 | } 27 | } elsif ($common->can_run("pkg_info")) { 28 | foreach(`pkg_info`){ 29 | /^(\S+)-(\d+\S*)\s+(.*)/; 30 | my $name = $1; 31 | my $version = $2; 32 | my $comments = $3; 33 | 34 | $common->addSoftware({ 35 | 'COMMENTS' => $comments, 36 | 'NAME' => $name, 37 | 'VERSION' => $version 38 | }); 39 | } 40 | } 41 | } 42 | 43 | 1; 44 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/MacOS/Drives.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::MacOS::Drives; 2 | 3 | use strict; 4 | 5 | # yea BSD theft!!!! 6 | # would have used Mac::SysProfile, but the xml isn't quite fully supported 7 | # 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) 8 | 9 | sub check {1} 10 | 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | 15 | my $free; 16 | my $filesystem; 17 | my $total; 18 | my $type; 19 | my $volumn; 20 | 21 | 22 | for my $t ("apfs", "ffs","ufs", "hfs") { 23 | # OpenBSD has no -m option so use -k to obtain results in kilobytes 24 | for(`df -P -k -t $t`){ # darwin needs the -t to be last 25 | if(/^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\n/){ 26 | $type = $1; 27 | $filesystem = $t; 28 | $total = sprintf("%i",$2/1024); 29 | $free = sprintf("%i",$4/1024); 30 | $volumn = $6; 31 | 32 | $common->addDrive({ 33 | FREE => $free, 34 | FILESYSTEM => $filesystem, 35 | TOTAL => $total, 36 | TYPE => $type, 37 | VOLUMN => $volumn 38 | }) 39 | } 40 | } 41 | } 42 | } 43 | 1; 44 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/AIX/Drives.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::AIX::Drives; 2 | 3 | use strict; 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | return unless $common->can_run("df"); 8 | 1; 9 | } 10 | 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | 15 | my $free; 16 | my $filesystem; 17 | my $total; 18 | my $type; 19 | my $volumn; 20 | 21 | my @fs; 22 | my @fstype; 23 | #Looking for mount points and disk space 24 | # Aix option -kP 25 | for (`df -kP`) { 26 | next if /^Filesystem\s*1024-blocks.*/; 27 | if (/^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\n/) { 28 | $volumn = $1; 29 | @fs=`lsfs -c $6`; 30 | @fstype = split /:/,$fs[1]; 31 | $filesystem = $fstype[2]; 32 | $total = sprintf("%i",($2/1024)); 33 | $free = sprintf("%i",($4/1024)); 34 | $type = $6; 35 | } 36 | next if $filesystem =~ /procfs/; 37 | 38 | $common->addDrive({ 39 | FREE => $free, 40 | FILESYSTEM => $filesystem, 41 | TOTAL => $total, 42 | TYPE => $type, 43 | VOLUMN => $volumn 44 | }); 45 | } 46 | } 47 | 48 | 1; 49 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/XML/Response.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::XML::Response; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use XML::Simple; 7 | use Data::Dumper; 8 | 9 | sub new { 10 | my (undef, $params) = @_; 11 | 12 | my $self = {}; 13 | 14 | $self->{accountconfig} = $params->{accountconfig}; 15 | $self->{accountinfo} = $params->{accountinfo}; 16 | $self->{content} = $params->{content}; 17 | $self->{config} = $params->{config}; 18 | $self->{common} = $params->{common}; 19 | my $logger = $self->{logger} = $params->{logger}; 20 | $self->{origmsg} = $params->{origmsg}; 21 | 22 | $logger->debug("=BEGIN=SERVER RET======"); 23 | $logger->debug(Dumper($self->{content})); 24 | $logger->debug("=END=SERVER RET======"); 25 | 26 | $self->{parsedcontent} = undef; 27 | 28 | bless $self; 29 | } 30 | 31 | sub getRawXML { 32 | my $self = shift; 33 | 34 | return $self->{content}; 35 | } 36 | 37 | sub getParsedContent { 38 | my ($self,$forcearray) = @_; 39 | 40 | if (!$self->{parsedcontent}) { 41 | $self->{parsedcontent} = $self->{common}->readXml($self->{content},$forcearray); 42 | } 43 | 44 | return $self->{parsedcontent}; 45 | } 46 | 47 | sub origMsgType { 48 | my ($self, $package) = @_; 49 | 50 | return ref($package); 51 | } 52 | 53 | 1; 54 | -------------------------------------------------------------------------------- /snmp/mibs/local/24681.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 1 5 | Nas 6 | 7 | 8 | 9 | 10 | San 11 | 12 | 13 | 1.3.6.1.4.1.24681.1.4 14 | 15 | 16 | 17 | 18 | 1.3.6.1.4.1.24681.1.2 19 | 20 | 21 | 22 | 23 | 1.3.6.1.4.1.24681.1.9.1.2 24 | 1.3.6.1.4.1.24681.1.9.1.(\S+) 25 | IDX 26 | 27 | 28 | 29 | 1.3.6.1.4.1.24681.1.9.1.2.IDX 30 | 31 | 32 | 33 | 34 | 35 | 1.3.6.1.4.1.24681.1.11.1.2 36 | 1.3.6.1.4.1.24681.1.11.1.(\S+) 37 | IDX 38 | 39 | 40 | 1.3.6.1.4.1.24681.1.11.5.IDX 41 | 42 | 43 | 1.3.6.1.4.1.24681.1.11.6.IDX 44 | 45 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/BSD/Domains.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::BSD::Domains; 2 | use strict; 3 | 4 | sub check { 5 | my $hostname; 6 | chomp ($hostname = `hostname`); 7 | my @domain = split (/\./, $hostname); 8 | shift (@domain); 9 | return 1 if @domain; 10 | -f "/etc/resolv.conf" 11 | } 12 | sub run { 13 | my $params = shift; 14 | my $common = $params->{common}; 15 | 16 | my $domain; 17 | my %domain; 18 | my @dns_list; 19 | my $dns; 20 | my $hostname; 21 | chomp ($hostname = `hostname`); 22 | my @domain = split (/\./, $hostname); 23 | shift (@domain); 24 | $domain = join ('.',@domain); 25 | 26 | open RESOLV, "/etc/resolv.conf" or warn; 27 | 28 | while(){ 29 | if (/^nameserver\s+(\S+)/i) { 30 | push(@dns_list,$1); 31 | } elsif (!$domain) { 32 | $domain{$2} = 1 if (/^(domain|search)\s+(.+)/); 33 | } 34 | } 35 | close RESOLV; 36 | 37 | if (!$domain) { 38 | $domain = join "/", keys %domain; 39 | } 40 | 41 | $dns=join("/",@dns_list); 42 | 43 | # If no domain name, we send "WORKGROUP" 44 | $domain = 'WORKGROUP' unless $domain; 45 | 46 | $common->setHardware({ 47 | WORKGROUP => $domain, 48 | DNS => $dns 49 | }); 50 | } 51 | 52 | 1; 53 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/scripts/preinstall: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #Setting path to package resources directory 4 | BASERESOURCES=$(dirname "$1") 5 | RESOURCES="$BASERESOURCES/../Resources" 6 | 7 | 8 | 9 | #Setting temp directory 10 | if [ $3 ] #If run from NetInstall 11 | then 12 | TMP_DIR=$3/tmp/ocs_installer 13 | else 14 | TMP_DIR=/tmp/ocs_installer 15 | fi 16 | 17 | #Files we want to copy 18 | AGENT_CFG_PATH="ocsinventory-agent.cfg" 19 | MODULES_CFG_PATH="modules.conf" 20 | LAUNCHD_CFG_PATH="org.ocsng.agent.plist" 21 | SERVERDIR_CFG_PATH="serverdir" 22 | NOW_PATH="now" 23 | CACERT_PATH="cacert.pem" 24 | 25 | 26 | #Create temporary dir neeeded by postinstall script 27 | mkdir -p $TMP_DIR 28 | 29 | if [ -f "$RESOURCES/$AGENT_CFG_PATH" ] 30 | then 31 | cp $RESOURCES/$AGENT_CFG_PATH $TMP_DIR 32 | fi 33 | 34 | if [ -f "$RESOURCES/$MODULES_CFG_PATH" ] 35 | then 36 | cp $RESOURCES/$MODULES_CFG_PATH $TMP_DIR 37 | fi 38 | 39 | if [ -f "$RESOURCES/$LAUNCHD_CFG_PATH" ] 40 | then 41 | cp $RESOURCES/$LAUNCHD_CFG_PATH $TMP_DIR 42 | fi 43 | 44 | if [ -f "$RESOURCES/$SERVERDIR_CFG_PATH" ] 45 | then 46 | cp $RESOURCES/$SERVERDIR_CFG_PATH $TMP_DIR 47 | fi 48 | 49 | if [ -f "$RESOURCES/$NOW_PATH" ] 50 | then 51 | cp $RESOURCES/$NOW_PATH $TMP_DIR 52 | fi 53 | 54 | if [ -f "$RESOURCES/$CACERT_PATH" ] 55 | then 56 | cp $RESOURCES/$CACERT_PATH $TMP_DIR 57 | fi 58 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Solaris.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Solaris; 2 | 3 | use strict; 4 | use vars qw($runAfter); 5 | $runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"]; 6 | 7 | sub check {$^O =~ /^solaris$/} 8 | 9 | sub run { 10 | my $params = shift; 11 | my $common = $params->{common}; 12 | 13 | my $OSName; 14 | my $OSComment; 15 | my $OSVersion; 16 | my $OSLevel; 17 | my $HWDescription; 18 | my ( $karch, $hostid, $proct, $platform); 19 | 20 | #Operating system informations 21 | chomp($OSName=`uname -s`); 22 | chomp($OSLevel=`uname -r`); 23 | chomp($OSComment=`uname -v`); 24 | 25 | open(FH, "< /etc/release") and do { 26 | chomp($OSVersion = readline (FH)); 27 | $OSVersion =~ s/^\s+//; 28 | close FH; 29 | }; 30 | 31 | chomp($OSVersion=`uname -v`) unless $OSVersion; 32 | chomp($OSVersion); 33 | $OSVersion=~s/^\s*//; 34 | $OSVersion=~s/\s*$//; 35 | 36 | # Hardware informations 37 | chomp($karch=`arch -k`); 38 | chomp($hostid=`hostid`); 39 | chomp($proct=`uname -p`); 40 | chomp($platform=`uname -i`); 41 | $HWDescription = "$platform($karch)/$proct HostID=$hostid"; 42 | 43 | $common->setHardware({ 44 | OSNAME => "$OSName $OSLevel", 45 | OSCOMMENTS => $OSComment, 46 | OSVERSION => $OSVersion, 47 | DESCRIPTION => $HWDescription 48 | }); 49 | } 50 | 51 | 52 | 1; 53 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Solaris/IPv4.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Solaris::IPv4; 2 | 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | $common->can_run ("ifconfig") 7 | } 8 | 9 | # Initialise the distro entry 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | my %ip; 14 | my $ip; 15 | my $hostn; 16 | 17 | #Looking for ip addresses with ifconfig, except loopback 18 | # Solaris need -a option 19 | for (`ifconfig -a`){#ifconfig in the path 20 | #Solarisligne inet 21 | if (/^\s*inet\s+(\S+).*/){($1=~/^127.+/)?next:($ip{$1}=1)}; 22 | } 23 | 24 | # Ok. Now, we have the list of IP addresses configured 25 | # We could have too many addresses to list them in HW 26 | # (details will be sent in Networks instead) 27 | # 28 | # How could we choose ? 29 | # 30 | # Let's try to resolve the name of our server 31 | # 32 | 33 | chomp( $hostn = `uname -n` ); 34 | if ($hostn) { 35 | my $aip; 36 | foreach (`ping -s $hostn 10 1`) { 37 | unless ( $ip ) { 38 | if( /^.*\((\d+\.\d+\.\d+\.\d+)\):.*/ ) { 39 | $aip = $1; 40 | $ip = $aip if( exists($ip{$aip}) ); 41 | } 42 | } 43 | } 44 | } 45 | $common->setHardware({IPADDR => $ip}); 46 | } 47 | 48 | 1; 49 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Network/IP.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Network::IP; 2 | 3 | sub check { 4 | my $params = shift; 5 | my $common = $params->{common}; 6 | return unless $common->can_run ("ip") || $common->can_run("ifconfig"); 7 | 1; 8 | } 9 | 10 | # Initialise the distro entry 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | my @ip; 15 | my @ip6; 16 | 17 | if ($common->can_run("ip")){ 18 | foreach (`ip a`){ 19 | if (/inet (\S+)\/\d{1,2}/){ 20 | ($1=~/^127.+/)?next:push @ip,$1; 21 | } elsif (/inet6 (\S+)\d{2}/){ 22 | ($1=~/::1\/128/)?next:push @ip6, $1; 23 | } 24 | } 25 | } elsif ($common->can_run("ifconfig")){ 26 | foreach (`ifconfig`){ 27 | #if(/^\s*inet\s*(\S+)\s*netmask/){ 28 | if (/^\s*inet add?r\s*:\s*(\S+)/ || /^\s*inet\s+(\S+)/){ 29 | ($1=~/^127.+/)?next:push @ip, $1; 30 | } elsif (/^\s*inet6\s+(\S+)/){ 31 | ($1=~/::1/)?next:push @ip6, $1; 32 | } 33 | } 34 | } 35 | 36 | my $ip=join "/", @ip; 37 | my $ip6=join "/", @ip6; 38 | if (defined $ip) { 39 | $common->setHardware({IPADDR => $ip}); 40 | } else { 41 | $common->setHardware({IPADDR => $ip6}); 42 | 43 | } 44 | } 45 | 46 | 1; 47 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/Gentoo.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Packaging::Gentoo; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | sub check { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | $common->can_run("equery") 10 | } 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | 15 | # TODO: This had been rewrite from the Linux agent _WITHOUT_ being checked! 16 | # New format for listing softwares with equery command (equery 0.3.0.5) 17 | # Older version don't run with these options 18 | 19 | my $equery_vers = `equery --version ` =~ /.*\((.*)\).*/; 20 | $equery_vers = $1; 21 | my ($major,$minor)=$equery_vers=~/(\d+)\.(\d+)\.\d+/; 22 | 23 | if ($minor ge 3) { 24 | foreach (`equery list --format='\$cp \$fullversion' '*'`){ 25 | if (/^(.*) (.*)/) { 26 | $common->addSoftware({ 27 | 'NAME' => $1, 28 | 'VERSION' => $2, 29 | }); 30 | } 31 | } 32 | } else { 33 | # Old version of Gentoo 34 | foreach (`equery list -i`){ 35 | if (/^([a-z]\w+-\w+\/\.*)-([0-9]+.*)/) { 36 | $common->addSoftware({ 37 | 'NAME' => $1, 38 | 'VERSION' => $2, 39 | }); 40 | } 41 | } 42 | } 43 | } 44 | 45 | 1; 46 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/MacOS/Bios.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::MacOS::Bios; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | return $common->can_load("Mac::SysProfile") 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | # use Mac::SysProfile to get the respected datatype 15 | my $profile = Mac::SysProfile->new(); 16 | my $data = $profile->gettype('SPHardwareDataType'); 17 | 18 | # unless we get a real hash value, return with nothing 19 | return(undef) unless($data && ref($data) eq 'ARRAY'); 20 | 21 | my $h = $data->[0]; 22 | 23 | # set the bios information from the apple system profiler 24 | $common->setBios({ 25 | SMANUFACTURER => 'Apple Inc', # duh 26 | SMODEL => $h->{'model_identifier'} || $h->{'machine_model'}, 27 | TYPE => $h->{'machine_name'}, 28 | BMANUFACTURER => 'Apple Inc', 29 | MMANUFACTURER => 'Apple Inc', 30 | # SSN => $h->{'Serial Number'} 31 | # New method to get the SSN, because of MacOS 10.5.7 update 32 | # system_profiler gives 'Serial Number (system): XXXXX' where 10.5.6 33 | # and lower give 'Serial Number: XXXXX' 34 | SSN => $h->{'serial_number'}, 35 | BVERSION => $h->{'boot_rom_version'}, 36 | }); 37 | } 38 | 39 | 1; 40 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Uptime.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Uptime; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | $common->can_read("/proc/uptime") 8 | } 9 | 10 | sub run { 11 | my $params = shift; 12 | my $common = $params->{common}; 13 | 14 | # Uptime 15 | open UPTIME, "/proc/uptime"; 16 | my $uptime = ; 17 | $uptime =~ s/^(.+)\s+.+/$1/; 18 | close UPTIME; 19 | 20 | # Convert uptime 21 | my $uptime_converted = uptime_conversion($uptime); 22 | 23 | chomp(my $DeviceType =`uname -m`); 24 | # TODO$h->{'CONTENT'}{'HARDWARE'}{'DESCRIPTION'} = [ "$DeviceType/$uptime" ]; 25 | $common->setHardware({ DESCRIPTION => "$DeviceType/$uptime_converted" }); 26 | 27 | } 28 | 29 | sub uptime_conversion { 30 | my ($uptime) = @_; 31 | 32 | # Calculate current time 33 | my $current_time = time(); 34 | 35 | # Calculate the time when the system was booted 36 | my $boot_time = $current_time - $uptime; 37 | 38 | # Convert boot time to human-readable format 39 | my ($sec, $min, $hour, $mday, $mon, $year) = localtime($boot_time); 40 | $year += 1900; 41 | $mon += 1; 42 | $sec += 1; 43 | 44 | # Format the date and time 45 | my $uptime_formated = sprintf("%02d-%02d-%04d %02d:%02d:%02d", $mday, $mon, $year, $hour, $min, $sec); 46 | 47 | return $uptime_formated; 48 | } 49 | 50 | 1 51 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Compress.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Compress; 2 | use strict; 3 | 4 | use File::Temp qw/ tempdir tempfile /; 5 | 6 | sub new { 7 | my (undef, $params) = @_; 8 | 9 | my $self = {}; 10 | 11 | my $logger = $self->{logger} = $params->{logger}; 12 | 13 | 14 | eval{require Compress::Zlib;}; 15 | $self->{mode} = 'natif' unless $@; 16 | 17 | if ($self->{mode} eq 'natif') { 18 | $logger->debug ('Compress::Zlib is available.'); 19 | } else { 20 | $self->{mode} = 'deflated'; 21 | $logger->debug ('I need the Compress::Zlib library'. 22 | ' to compress the data - The data will be sent uncompressed 23 | but won\'t be accepted by server prior 1.02'); 24 | } 25 | 26 | bless $self; 27 | } 28 | 29 | sub compress { 30 | my ($self, $content) = @_; 31 | my $logger = $self->{logger}; 32 | 33 | # native mode (zlib) 34 | if ($self->{mode} eq 'natif') { 35 | return Compress::Zlib::compress($content); 36 | } elsif($self->{mode} eq 'deflated'){ 37 | # No compression available 38 | return $content; 39 | } 40 | } 41 | 42 | sub uncompress { 43 | my ($self,$data) = @_; 44 | my $logger = $self->{logger}; 45 | # Native mode 46 | if ($self->{mode} eq 'natif') { 47 | return Compress::Zlib::uncompress($data); 48 | } elsif($self->{mode} eq 'deflated'){ 49 | # No compression available 50 | return $data; 51 | } 52 | } 53 | 1; 54 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/Slots.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Dmidecode::Slots; 2 | 3 | use strict; 4 | 5 | sub run { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | 9 | my $dmidecode = `dmidecode`; 10 | # some versions of dmidecode do not separate items with new lines 11 | # so add a new line before each handle 12 | $dmidecode =~ s/\nHandle/\n\nHandle/g; 13 | my @dmidecode = split (/\n/, $dmidecode); 14 | # add a new line at the end 15 | push @dmidecode, "\n"; 16 | 17 | s/^\s+// for (@dmidecode); 18 | 19 | my $flag; 20 | 21 | my $description; 22 | my $designation; 23 | my $name; 24 | my $status; 25 | 26 | 27 | foreach (@dmidecode) { 28 | if (/dmi type 9,/i) { 29 | $flag=1; 30 | } elsif ($flag && /^$/) { 31 | $flag=0; 32 | $common->addSlot({ 33 | DESCRIPTION => $description, 34 | DESIGNATION => $designation, 35 | NAME => $name, 36 | STATUS => $status, 37 | }); 38 | $description = $designation = $name = $status = undef; 39 | } elsif ($flag) { 40 | $description = $1 if /^type\s*:\s*(.+)/i; 41 | $designation = $1 if /^id\s*:\s*(.+)/i; 42 | $name = $1 if /^designation\s*:\s*(.+)/i; 43 | $status = $1 if /^current usage\s*:\s*(.+)/i; 44 | }; 45 | } 46 | } 47 | 48 | 1; 49 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Printers/Cups.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Printers::Cups; 2 | use strict; 3 | 4 | sub check { 5 | my $params = shift; 6 | my $common = $params->{common}; 7 | # If we are on a MAC, Mac::SysProfile will do the job 8 | return if -r '/usr/sbin/system_profiler'; 9 | return unless $common->can_load("Net::CUPS") && $Net::CUPS::VERSION >= 0.60; 10 | return 1; 11 | } 12 | 13 | sub run { 14 | 15 | my $params = shift; 16 | my $common = $params->{common}; 17 | 18 | my $cups = Net::CUPS->new(); 19 | my @destinations = $cups->getDestinations(); 20 | my $printer; 21 | my $description; 22 | my $port; 23 | my $driver; 24 | 25 | 26 | foreach (@destinations) { 27 | $printer = $_->getName() unless $printer; 28 | $description = $_->getDescription() unless $description; 29 | $port = $_->getUri() unless $port; 30 | $driver = $_->getOptionValue("printer-make-and-model") unless $driver; 31 | 32 | # Just grab the default printer, if I use getDestinations, CUPS 33 | # returns all the printer of the local subnet (if it can) 34 | # TODO There is room for improvement here 35 | 36 | $common->addPrinter({ 37 | NAME => $printer, 38 | DESCRIPTION => $description, 39 | PORT => $port, 40 | DRIVER => $driver 41 | }); 42 | $printer = $description = $port = $driver = undef; 43 | } 44 | } 45 | 46 | 1; 47 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/Ports.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Dmidecode::Ports; 2 | 3 | use strict; 4 | 5 | sub run { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | 9 | my $dmidecode = `dmidecode`; # TODO retrieve error 10 | # some versions of dmidecode do not separate items with new lines 11 | # so add a new line before each handle 12 | $dmidecode =~ s/\nHandle/\n\nHandle/g; 13 | my @dmidecode = split (/\n/, $dmidecode); 14 | # add a new line at the end 15 | push @dmidecode, "\n"; 16 | 17 | s/^\s+// for (@dmidecode); 18 | 19 | my $flag; 20 | 21 | my $caption; 22 | my $description; 23 | my $name; 24 | my $type; 25 | 26 | foreach (@dmidecode) { 27 | if (/dmi type 8,/i) { 28 | $flag = 1; 29 | } elsif ($flag && /^$/){ # end of section 30 | $flag = 0; 31 | $common->addPorts({ 32 | CAPTION => $caption, 33 | DESCRIPTION => $description, 34 | NAME => $name, 35 | TYPE => $type, 36 | }); 37 | $caption = $description = $name = $type = undef; 38 | } elsif ($flag) { 39 | $caption = $1 if /^external connector type\s*:\s*(.+)/i; 40 | $description = $1 if /^internal connector type\s*:\s*(.+)/i; 41 | $name = $1 if /^internal reference designator\s*:\s*(.+)/i; 42 | $type = $1 if /^port type\s*:\s*(.+)/i; 43 | } 44 | } 45 | } 46 | 47 | 1; 48 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/HPUX/Bios.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::HPUX::Bios; 2 | use strict; 3 | 4 | ### 5 | # Version 1.1 6 | # Correction of Bug n 522774 7 | # 8 | # thanks to Marty Riedling for this correction 9 | # 10 | ### 11 | 12 | sub check { $^O =~ /hpux/ } 13 | 14 | sub run { 15 | my $params = shift; 16 | my $common = $params->{common}; 17 | 18 | my $BiosVersion; 19 | my $BiosDate; 20 | my $SystemModel; 21 | my $SystemSerial; 22 | 23 | 24 | $SystemModel=`model`; 25 | if ($common->can_run ("machinfo")) { 26 | foreach (`machinfo`) { 27 | if (/Firmware\s+revision\s?[:=]\s+(\S+)/) { 28 | $BiosVersion=$1; 29 | } 30 | if (/achine\s+serial\s+number\s?[:=]\s+(\S+)/) { 31 | $SystemSerial=$1; 32 | } 33 | } 34 | } else { 35 | for (`echo 'sc product cpu;il' | /usr/sbin/cstm | grep "PDC Firmware"`) { 36 | if (/Revision:\s+(\S+)/){ 37 | $BiosVersion="PDC $1"; 38 | } 39 | } 40 | for (`echo 'sc product system;il' | /usr/sbin/cstm | grep "System Serial Number"`) { 41 | if (/:\s+(\w+)/) { 42 | $SystemSerial=$1; 43 | } 44 | } 45 | } 46 | 47 | $common->setBios ({ 48 | BVERSION => $BiosVersion, 49 | BDATE => $BiosDate, 50 | BMANUFACTURER => "HP", 51 | SMANUFACTURER => "HP", 52 | SMODEL => $SystemModel, 53 | SSN => $SystemSerial, 54 | }); 55 | } 56 | 57 | 1; 58 | -------------------------------------------------------------------------------- /inc/Module/Install/Base.pm: -------------------------------------------------------------------------------- 1 | #line 1 2 | package Module::Install::Base; 3 | 4 | use strict 'vars'; 5 | use vars qw{$VERSION}; 6 | BEGIN { 7 | $VERSION = '1.14'; 8 | } 9 | 10 | # Suspend handler for "redefined" warnings 11 | BEGIN { 12 | my $w = $SIG{__WARN__}; 13 | $SIG{__WARN__} = sub { $w }; 14 | } 15 | 16 | #line 42 17 | 18 | sub new { 19 | my $class = shift; 20 | unless ( defined &{"${class}::call"} ) { 21 | *{"${class}::call"} = sub { shift->_top->call(@_) }; 22 | } 23 | unless ( defined &{"${class}::load"} ) { 24 | *{"${class}::load"} = sub { shift->_top->load(@_) }; 25 | } 26 | bless { @_ }, $class; 27 | } 28 | 29 | #line 61 30 | 31 | sub AUTOLOAD { 32 | local $@; 33 | my $func = eval { shift->_top->autoload } or return; 34 | goto &$func; 35 | } 36 | 37 | #line 75 38 | 39 | sub _top { 40 | $_[0]->{_top}; 41 | } 42 | 43 | #line 90 44 | 45 | sub admin { 46 | $_[0]->_top->{admin} 47 | or 48 | Module::Install::Base::FakeAdmin->new; 49 | } 50 | 51 | #line 106 52 | 53 | sub is_admin { 54 | ! $_[0]->admin->isa('Module::Install::Base::FakeAdmin'); 55 | } 56 | 57 | sub DESTROY {} 58 | 59 | package Module::Install::Base::FakeAdmin; 60 | 61 | use vars qw{$VERSION}; 62 | BEGIN { 63 | $VERSION = $Module::Install::Base::VERSION; 64 | } 65 | 66 | my $fake; 67 | 68 | sub new { 69 | $fake ||= bless(\@_, $_[0]); 70 | } 71 | 72 | sub AUTOLOAD {} 73 | 74 | sub DESTROY {} 75 | 76 | # Restore warning handler 77 | BEGIN { 78 | $SIG{__WARN__} = $SIG{__WARN__}->(); 79 | } 80 | 81 | 1; 82 | 83 | #line 159 84 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/PowerPC/CPU.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::PowerPC::CPU; 2 | 3 | use strict; 4 | 5 | #processor : 0 6 | #cpu : POWER4+ (gq) 7 | #clock : 1452.000000MHz 8 | #revision : 2.1 9 | # 10 | #processor : 1 11 | #cpu : POWER4+ (gq) 12 | #clock : 1452.000000MHz 13 | #revision : 2.1 14 | # 15 | #timebase : 181495202 16 | #machine : CHRP IBM,7029-6C3 17 | # 18 | # 19 | 20 | sub check { 21 | my $params = shift; 22 | my $common = $params->{common}; 23 | $common->can_read ("/proc/cpuinfo") 24 | } 25 | 26 | sub run { 27 | my $params = shift; 28 | my $common = $params->{common}; 29 | 30 | my @cpus; 31 | my $current; 32 | my $isIBM; 33 | open CPUINFO, ") { 35 | $isIBM = 1 if /^machine\s*:.*IBM/; 36 | $current->{TYPE} = $1 if /cpu\s+:\s+(\S.*)/; 37 | $current->{SPEED} = $1 if /clock\s+:\s+(\S.*)/; 38 | $current->{SPEED} =~ s/\.[0-9]+MHz//; 39 | 40 | if (/^\s*$/) { 41 | if ($current->{TYPE}) { 42 | push @cpus, $current; 43 | } 44 | $current = {}; 45 | } 46 | } 47 | 48 | if (/^\s*$/) { 49 | if ($current->{TYPE}) { 50 | push @cpus, $current; 51 | } 52 | $current = {}; 53 | } 54 | 55 | foreach my $cpu (@cpus) { 56 | $cpu->{MANUFACTURER} = 'IBM' if $isIBM; 57 | $cpu->{CPUARCH} = 'PowerPC'; 58 | $common->addCPU($cpu); 59 | } 60 | } 61 | 62 | 1; 63 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/Virtualization/Docker.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::Virtualization::Docker; 2 | 3 | use strict; 4 | 5 | sub check { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | 9 | return unless $common->can_run("docker"); 10 | } 11 | 12 | my @image; 13 | 14 | sub run { 15 | my $params = shift; 16 | my $common = $params->{common}; 17 | 18 | foreach my $cont (`docker ps 2>/dev/null`) { 19 | next if ($cont =~ /^CONTAINER ID/); 20 | my $container_id=$1 if ($cont =~ /^(\w+)/i); 21 | push @image, $container_id; 22 | } 23 | 24 | foreach my $c (@image) { 25 | my $tab=`docker inspect $c`; 26 | my $memory=$1 if ($tab =~ /\s+"Memory":\s(\d+),/); 27 | my $name=$1 if ($tab =~ /\s+"Hostname":\s"(\w+)",/); 28 | my $status=$1 if ($tab =~ /\s+"Status":\s"(\w+)",/); 29 | my $vcpu=$1 if ($tab =~ /\s+"CpuShares":\s(\d+),/); 30 | my $vmid=$1 if ($tab =~ /\s+"Id":\s"(\w+)",/); 31 | my $ipaddr=$1 if ($tab =~ /\s+"IPAddress":\s"(.*)"/); 32 | my $macaddr=$1 if ($tab =~ /\s+"MacAddress":\s"(.*)"/); 33 | my $gateway=$1 if ($tab =~ /\s+"Gateway":\s"(.*)"/); 34 | $common->addVirtualMachine({ 35 | CPUSHARES => $vcpu, 36 | GATEWAY => $gateway, 37 | IPADDR => $ipaddr, 38 | MACADDR => $macaddr, 39 | MEMORY => $memory, 40 | NAME => $name, 41 | STATUS => $status, 42 | SUBSYSTEM => "Docker Container", 43 | VMID => $vmid, 44 | VTYPE => "Docker", 45 | }); 46 | } 47 | } 48 | 49 | 1; 50 | -------------------------------------------------------------------------------- /contrib/Tarballs.pm: -------------------------------------------------------------------------------- 1 | # Write by Simon CLARA 2010-01-25 2 | # 3 | # The complete name of the package 4 | # the path MUST be valid or the package won't be loaded 5 | package Ocsinventory::Agent::Backend::OS::Generic::Tarballs; 6 | use strict; 7 | # I need to declare $runAfter because of the strict mode 8 | use vars qw($runAfter); 9 | # The package must be run after OS::Generic 10 | $runAfter = ["Ocsinventory::Agent::Backend::OS::Generic"]; 11 | 12 | # This is the check function. The agent runs it just once the module is loaded. 13 | # If the function return false, the module and its children are not executed 14 | # eg: OS::Linux and OS::Linux::* won't executed if this run() function return 15 | # false 16 | 17 | # Check if we are on a linux server 18 | sub check { $^O =~ /^linux$/ } 19 | # uncomment this if you want check for FreeBSD server 20 | # sub check {can_run("pkg_info")} 21 | 22 | # its the main function of the script, it's called during the hardware inventory 23 | sub run { 24 | my $params = shift; 25 | # I need to get the inventory object to update it 26 | my $inventory = $params->{inventory}; 27 | 28 | # our software are in /usr/local/src/ 29 | foreach (`ls /usr/local/src/*.{bz2,tar.gz}`){ 30 | /^(\/.*\/)(\S+)-(\d+\S*)(\.tar.gz|\.bz2)$/i; 31 | my $name = $2; 32 | my $version = $3; 33 | my $comments = "Software in /usr/local/src/ \n".`$2 --version`; 34 | # and I updated the information collected 35 | $inventory->addSoftwares({ 36 | COMMENTS => $comments, 37 | NAME => $name, 38 | VERSION => $version 39 | }); 40 | } 41 | } 42 | 43 | 1; 44 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/HPUX/Drives.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::HPUX::Drives; 2 | 3 | sub check { $^O =~ /hpux/ } 4 | 5 | sub run { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | 9 | my $type; 10 | my $fs; 11 | my $lv; 12 | my $total; 13 | my $free; 14 | 15 | for ( `fstyp -l | grep -v nfs` ) { 16 | if ( /^\s*$/ ) { #Blank line 17 | next; 18 | } 19 | 20 | $type=$_; 21 | for ( `bdf -t $type `) { 22 | if ( /Filesystem/ ) { ; } ; 23 | if ( /^(\S+)\s(\d+)\s+(\d+)\s+(\d+)\s+(\d+%)\s+(\S+)/ ) { 24 | $lv=$1; 25 | $total=$2; 26 | $free=$3; 27 | $fs=$6; 28 | $common->addDrives({ 29 | FREE => $free, 30 | FILESYSTEM => $fs, 31 | TOTAL => $total, 32 | TYPE => $type, 33 | VOLUMN => $lv, 34 | }); 35 | }; 36 | if ( /^(\S+)\s/) { 37 | $lv=$1; 38 | }; 39 | if ( /(\d+)\s+(\d+)\s+(\d+)\s+(\d+%)\s+(\S+)/) { 40 | $total=$1; 41 | $free=$3; 42 | $fs=$5; 43 | # print "fs $fs lv $lv total $total free $free type $type\n"; 44 | $common->addDrives({ 45 | FREE => $free, 46 | FILESYSTEM => $fs, 47 | TOTAL => $total, 48 | TYPE => $type, 49 | VOLUMN => $lv, 50 | }); 51 | }; 52 | }; 53 | }; 54 | } 55 | 56 | 1; 57 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/Virtualization/Libvirt.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::Virtualization::Libvirt; 2 | 3 | use strict; 4 | 5 | use XML::Simple; 6 | 7 | sub check { 8 | my $params = shift; 9 | my $common = $params->{common}; 10 | $common->can_run('virsh') 11 | } 12 | 13 | sub run { 14 | my $params = shift; 15 | my $common = $params->{common}; 16 | 17 | foreach (`virsh --readonly list --all`) { 18 | if (/^\s*(\d+|\s+\-)\s+(\S+)\s+(\S.+)/){ 19 | my $memory; 20 | my $vcpu; 21 | my $name = $2; 22 | my $status = $3; 23 | 24 | $status =~ s/^shut off/off/; 25 | my $xml = `virsh --readonly dumpxml $name`; 26 | my $data = XMLin($xml); 27 | 28 | my $vcpu = $data->{vcpu}; 29 | my $uuid = $data->{uuid}; 30 | my $vmtype = $data->{type}; 31 | 32 | if ($data->{currentMemory}->{unit}) { 33 | $memory = $1 if $data->{currentMemory}->{content} =~ /(\d+)\d{3}$/; 34 | $vcpu = $data->{vcpu}->{content}; 35 | } else { 36 | $memory = $1 if $data->{currentMemory} =~ /(\d+)\d{3}$/; 37 | $vcpu = $data->{vcpu}; 38 | } 39 | 40 | my %machine = ( 41 | MEMORY => $memory, 42 | NAME => $name, 43 | UUID => $uuid, 44 | STATUS => $status, 45 | SUBSYSTEM => "Libvirt", 46 | VMTYPE => $vmtype, 47 | VCPU => $vcpu, 48 | ); 49 | 50 | $common->addVirtualMachine(\%machine); 51 | 52 | } 53 | } 54 | } 55 | 56 | 1; 57 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/scripts/postinstall: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #Setting temp directory 4 | if [ $3 ] #If run from NetInstall 5 | then 6 | TMP_DIR=$3/tmp/ocs_installer 7 | else 8 | TMP_DIR=/tmp/ocs_installer 9 | fi 10 | 11 | INSTALL_PATH="/Applications/OCSNG.app" 12 | 13 | #We set rights to install directory 14 | chown -R root:wheel $INSTALL_PATH 15 | chmod -R 755 $INSTALL_PATH 16 | 17 | #We set rights to ocscontact binary 18 | chown root:wheel $INSTALL_PATH/Contents/Resources/ocscontact 19 | chmod 700 $INSTALL_PATH/Contents/Resources/ocscontact 20 | 21 | #We set rights to uninstall script in install path 22 | chmod 700 $INSTALL_PATH/Contents/Resources/uninstaller.sh 23 | 24 | #We set etc configuration path 25 | ETCPATH="/etc/ocsinventory-agent" 26 | mkdir $ETCPATH/ 27 | cp $TMP_DIR/ocsinventory-agent.cfg $ETCPATH/ 28 | cp $TMP_DIR/modules.conf $ETCPATH/ 29 | 30 | #We set var directory 31 | VARPATH="/var/lib/ocsinventory-agent" 32 | mkdir -p $VARPATH 33 | chown -R root:wheel $VARPATH 34 | 35 | if [ -e $TMP_DIR/serverdir ] && [ -e $TMP_DIR/cacert.pem ]; then 36 | SERVERDIR=`cat $TMP_DIR/serverdir` 37 | mkdir $SERVERDIR 38 | cp $TMP_DIR/cacert.pem $SERVERDIR/ 39 | fi 40 | 41 | #We set LaunchDaemons plist files 42 | LAUNCHDPATH="/Library/LaunchDaemons/" 43 | cp $TMP_DIR/org.ocsng.agent.plist $LAUNCHDPATH 44 | chown root:wheel $LAUNCHDPATH/org.ocsng.agent.plist 45 | chmod 644 $LAUNCHDPATH/org.ocsng.agent.plist 46 | 47 | if [ -f $TMP_DIR/now ]; then 48 | echo 'Loading Service' 49 | launchctl load $LAUNCHDPATH/org.ocsng.agent.plist 50 | 51 | echo 'Starting Service' 52 | launchctl start org.ocsng.agent 53 | fi 54 | 55 | #We remove temporary directory 56 | rm -Rf $TMP_DIR 57 | 58 | exit 0 59 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/Virtualization/VmWareDesktop.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::Virtualization::VmWareDesktop; 2 | # 3 | # initial version: Walid Nouh 4 | # 5 | 6 | use strict; 7 | 8 | sub check { 9 | my $params = shift; 10 | my $common = $params->{common}; 11 | return $common->can_run('/Library/Application\ Support/VMware\ Fusion/vmrun') 12 | } 13 | 14 | sub run { 15 | my $params = shift; 16 | my $common = $params->{common}; 17 | my $logger = $params->{logger}; 18 | 19 | my $uuid; 20 | my $mem; 21 | my $status; 22 | my $name; 23 | my $i = 0; 24 | 25 | my $commande = "/Library/Application\\ Support/VMware\\ Fusion\/vmrun list"; 26 | foreach my $vmxpath ( `$commande` ) { 27 | next unless $i++ > 0; # Ignore the first line 28 | if (!open TMP, "<$vmxpath") { 29 | $logger->debug("Can't open $vmxpath\n"); 30 | next; 31 | } 32 | my @vminfos = ; 33 | close TMP; 34 | 35 | foreach my $line (@vminfos) { 36 | if ($line =~ m/^displayName =\s\"+(.*)\"/) { 37 | $name = $1; 38 | } elsif ($line =~ m/^memsize =\s\"+(.*)\"/) { 39 | $mem = $1; 40 | } elsif ($line =~ m/^uuid.bios =\s\"+(.*)\"/) { 41 | $uuid = $1; 42 | } 43 | } 44 | 45 | $common->addVirtualMachine ({ 46 | NAME => $name, 47 | VCPU => 1, 48 | UUID => $uuid, 49 | MEMORY => $mem, 50 | STATUS => "running", 51 | SUBSYSTEM => "VmWare Fusion", 52 | VMTYPE => "VmWare", 53 | }); 54 | } 55 | } 56 | 57 | 1; 58 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/Virtualization/VmWareESX.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::Virtualization::VmWareESX; 2 | 3 | use strict; 4 | 5 | 6 | sub check { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | $common->can_run('vmware-cmd') 10 | } 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | 15 | 16 | foreach my $vmx (`vmware-cmd -l`) { 17 | chomp $vmx; 18 | next unless -f $vmx; 19 | 20 | my %machineInfo; 21 | 22 | open VMX, "<$vmx" or warn; 23 | foreach () { 24 | if (/^(\S+)\s*=\s*(\S+.*)/) { 25 | my $key = $1; 26 | my $value = $2; 27 | $value =~ s/(^"|"$)//g; 28 | $machineInfo{$key} = $value; 29 | } 30 | } 31 | close VMX; 32 | 33 | my $status = 'unknow'; 34 | if ( `vmware-cmd "$vmx" getstate` =~ /=\ (\w+)/ ) { 35 | # off 36 | $status = $1; 37 | } 38 | 39 | my $memory = $machineInfo{'memsize'}; 40 | my $name = $machineInfo{'displayName'}; 41 | my $uuid = $machineInfo{'uuid.bios'}; 42 | 43 | # correct uuid format 44 | $uuid =~ s/\s+//g;# delete space 45 | $uuid =~ s!^(........)(....)(....)-(....)(.+)$!\1-\2-\3-\4-\5!; # add dashs 46 | 47 | my $machine = { 48 | MEMORY => $memory, 49 | NAME => $name, 50 | UUID => $uuid, 51 | STATUS => $status, 52 | SUBSYSTEM => "VmWareESX", 53 | VMTYPE => "VmWare", 54 | }; 55 | 56 | $common->addVirtualMachine($machine); 57 | 58 | } 59 | } 60 | 61 | 1; 62 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/Virtualization/XenCitrixServer.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::Virtualization::XenCitrixServer; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | sub check { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | $common->can_run('xe') 10 | } 11 | 12 | sub run { 13 | 14 | my $params = shift; 15 | my $common = $params->{common}; 16 | my $hostname = `hostname`; 17 | my $residenton; 18 | 19 | foreach (`xe host-list params=uuid hostname=$hostname`) { 20 | $residenton = $1 if /:\s+(.+)/; 21 | } 22 | 23 | foreach (`xe vm-list params=uuid resident-on=$residenton`) { 24 | if (/:\s+(.+)/) { 25 | my $uuid = $1 if /:\s+(.+)/; 26 | my $fname = `xe vm-list params=name-label uuid=$uuid`; 27 | my $name = $1 if $fname =~ /:\s+(.+)/; 28 | my $fstatus = `xe vm-list params=power-state uuid=$uuid`; 29 | my $status = $1 if $fstatus =~ /:\s+(.+)/; 30 | my $fvcpu = `xe vm-list params=VCPUs-max uuid=$uuid`; 31 | my $vcpu = $1 if $fvcpu =~ /:\s+(.+)/; 32 | my $fmemory = `xe vm-list params=memory-actual uuid=$uuid`; 33 | my $tmemory = $1 if $fmemory =~ /:\s+(.+)/; 34 | my $memory = $1 if $tmemory =~ /(\d+)\d{6}$/; 35 | 36 | my $machine = { 37 | MEMORY => $memory, 38 | NAME => $name, 39 | UUID => $uuid, 40 | STATUS => $status, 41 | SUBSYSTEM => "xe", 42 | VMTYPE => "XEN", 43 | VCPU => $vcpu, 44 | }; 45 | $common->addVirtualMachine($machine); 46 | } 47 | } 48 | } 49 | 50 | 1; 51 | -------------------------------------------------------------------------------- /macosx/setup_plugins/config_plugin_installer/config/en.lproj/ConfigInstallerPane.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSButtonCell"; title = "SSL check"; ObjectID = "0JY-Jz-90N"; */ 3 | "0JY-Jz-90N.title" = "SSL check"; 4 | 5 | /* Class = "NSTextFieldCell"; title = "ocsinventory-ng"; ObjectID = "0Sw-Bb-gYo"; */ 6 | "0Sw-Bb-gYo.title" = "ocsinventory-ng"; 7 | 8 | /* Class = "NSButtonCell"; title = "Debug mode"; ObjectID = "31X-X1-h1b"; */ 9 | "31X-X1-h1b.title" = "Debug mode"; 10 | 11 | /* Class = "NSMenuItem"; title = "http://"; ObjectID = "3w5-Xc-SgN"; */ 12 | "3w5-Xc-SgN.title" = "http://"; 13 | 14 | /* Class = "NSTextFieldCell"; title = "Log File path :"; ObjectID = "Bqz-yE-1gz"; */ 15 | "Bqz-yE-1gz.title" = "Log File path :"; 16 | 17 | /* Class = "NSTextFieldCell"; title = "TAG Value (optional) :"; ObjectID = "CJY-Du-ySH"; */ 18 | "CJY-Du-ySH.title" = "TAG Value (optional) :"; 19 | 20 | /* Class = "NSTextFieldCell"; title = "/ocsinventory"; ObjectID = "DIf-zY-Upa"; */ 21 | "DIf-zY-Upa.title" = "/ocsinventory"; 22 | 23 | /* Class = "NSButtonCell"; title = "Deployment feature"; ObjectID = "Fz6-ny-C1b"; */ 24 | "Fz6-ny-C1b.title" = "Deployment feature"; 25 | 26 | /* Class = "NSButtonCell"; title = "Browse"; ObjectID = "MAB-ch-ni8"; */ 27 | "MAB-ch-ni8.title" = "Browse"; 28 | 29 | /* Class = "NSTextFieldCell"; title = "Certificate File (needed by 'Deployment feature')"; ObjectID = "UvL-Ff-Y6G"; */ 30 | "UvL-Ff-Y6G.title" = "Certificate File (needed by 'Deployment feature')"; 31 | 32 | /* Class = "NSButtonCell"; title = "Lazy mode"; ObjectID = "gFK-QK-e24"; */ 33 | "gFK-QK-e24.title" = "Lazy mode"; 34 | 35 | /* Class = "NSTextFieldCell"; title = "OCS Server URL"; ObjectID = "w48-wL-2Wx"; */ 36 | "w48-wL-2Wx.title" = "OCS Server URL";∂ 37 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Inputs.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Inputs; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | 7 | sub run { 8 | 9 | my $params = shift; 10 | my $common = $params->{common}; 11 | my $logger = $params->{logger}; 12 | 13 | my $in; 14 | my $vendor; 15 | my $phys; 16 | my $name; 17 | my $type; 18 | 19 | if (open INPUTS, ") { 21 | if (/^I: Bus=.*Vendor=(.*) Prod/){ 22 | $in=1; 23 | $vendor=$1; 24 | } elsif ($_ =~ /^$/) { 25 | $in=0; 26 | if ($phys && $phys =~ "input"){ 27 | $common->addInput({ 28 | DESCRIPTION=>$name, 29 | CAPTION=>$name, 30 | TYPE=>$type 31 | }); 32 | } 33 | } elsif ($in) { 34 | if (/^P: Phys=.*(button).*/i) { 35 | $phys="nodev"; 36 | } elsif (/^P: Phys=.*(input).*/i) { 37 | $phys="input"; 38 | } 39 | if (/^N: Name=\"(.*)\"/i){ 40 | $name=$1; 41 | } 42 | if (/^H: Handlers=(\w+)/i) { 43 | if ($1 =~ ".*kbd.*") { 44 | $type="Keyboard"; 45 | } elsif ($1 =~ ".*mouse.*") { 46 | $type="Pointing"; 47 | } else { 48 | $type=$1; 49 | } 50 | } 51 | } 52 | } 53 | close INPUTS; 54 | } 55 | } 56 | 57 | 1; 58 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/config.bundle/Contents/Resources/en.lproj/ConfigInstallerPane.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSButtonCell"; title = "SSL check"; ObjectID = "0JY-Jz-90N"; */ 3 | "0JY-Jz-90N.title" = "SSL check"; 4 | 5 | /* Class = "NSTextFieldCell"; title = "ocsinventory-ng"; ObjectID = "0Sw-Bb-gYo"; */ 6 | "0Sw-Bb-gYo.title" = "ocsinventory-ng"; 7 | 8 | /* Class = "NSButtonCell"; title = "Debug mode"; ObjectID = "31X-X1-h1b"; */ 9 | "31X-X1-h1b.title" = "Debug mode"; 10 | 11 | /* Class = "NSMenuItem"; title = "http://"; ObjectID = "3w5-Xc-SgN"; */ 12 | "3w5-Xc-SgN.title" = "http://"; 13 | 14 | /* Class = "NSTextFieldCell"; title = "Log File path :"; ObjectID = "Bqz-yE-1gz"; */ 15 | "Bqz-yE-1gz.title" = "Log File path :"; 16 | 17 | /* Class = "NSTextFieldCell"; title = "TAG Value (optional) :"; ObjectID = "CJY-Du-ySH"; */ 18 | "CJY-Du-ySH.title" = "TAG Value (optional) :"; 19 | 20 | /* Class = "NSTextFieldCell"; title = "/ocsinventory"; ObjectID = "DIf-zY-Upa"; */ 21 | "DIf-zY-Upa.title" = "/ocsinventory"; 22 | 23 | /* Class = "NSButtonCell"; title = "Deployment feature"; ObjectID = "Fz6-ny-C1b"; */ 24 | "Fz6-ny-C1b.title" = "Deployment feature"; 25 | 26 | /* Class = "NSButtonCell"; title = "Browse"; ObjectID = "MAB-ch-ni8"; */ 27 | "MAB-ch-ni8.title" = "Browse"; 28 | 29 | /* Class = "NSTextFieldCell"; title = "Certificate File (needed by 'Deployment feature')"; ObjectID = "UvL-Ff-Y6G"; */ 30 | "UvL-Ff-Y6G.title" = "Certificate File (needed by 'Deployment feature')"; 31 | 32 | /* Class = "NSButtonCell"; title = "Lazy mode"; ObjectID = "gFK-QK-e24"; */ 33 | "gFK-QK-e24.title" = "Lazy mode"; 34 | 35 | /* Class = "NSTextFieldCell"; title = "OCS Server URL"; ObjectID = "w48-wL-2Wx"; */ 36 | "w48-wL-2Wx.title" = "OCS Server URL";∂ 37 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/Virtualization/SolarisLdoms.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::Virtualization::SolarisLdoms; 2 | 3 | use strict; 4 | 5 | sub check { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | return unless $common->can_run('ldm'); 9 | } 10 | 11 | sub run { 12 | my @ldoms; 13 | my $ldom; 14 | my @ldomdetails; 15 | my $ldomdetail; 16 | my $ldomname; 17 | my $ldomstatus; 18 | my $ldommem; 19 | my $ldomncpu; 20 | my $ldomuuid; 21 | my $ldomsoftstate; 22 | my $params = shift; 23 | my $common = $params->{common}; 24 | my $logger = $params->{logger}; 25 | 26 | @ldoms = `/usr/sbin/ldm list-domain -p`; 27 | 28 | foreach $ldom (@ldoms) { 29 | if($ldom =~ /^DOMAIN\|name=(\S+)\|state=(\S+)\|flags=\S+\|cons=\S+\|ncpu=(\d+)\|mem=(\d+)\|.*/) { 30 | $ldomname=$1; 31 | $ldomstatus=$2; 32 | $ldomncpu=$3; 33 | $ldommem=$4/1024/1024; 34 | $ldomsoftstate=""; 35 | 36 | @ldomdetails = `/usr/sbin/ldm list-domain -o domain -p $ldomname`; 37 | 38 | foreach $ldomdetail (@ldomdetails) { 39 | if($ldomdetail =~ /^DOMAIN\|.*\|softstate=(.*)$/) { 40 | $ldomsoftstate=$1; 41 | } elsif($ldomdetail =~ /^UUID\|uuid=(.*)$/) { 42 | $ldomuuid=$1; 43 | } 44 | } 45 | 46 | my $machine = { 47 | 48 | MEMORY => $ldommem, 49 | NAME => $ldomname, 50 | UUID => $ldomuuid, 51 | STATUS => $ldomstatus, 52 | SUBSYSTEM => $ldomsoftstate, 53 | VMTYPE => "Solaris Ldom", 54 | VCPU => $ldomncpu, 55 | 56 | }; 57 | 58 | $common->addVirtualMachine($machine); 59 | 60 | } 61 | } 62 | } 63 | 64 | 1; 65 | -------------------------------------------------------------------------------- /inc/Module/Install/WriteAll.pm: -------------------------------------------------------------------------------- 1 | #line 1 2 | package Module::Install::WriteAll; 3 | 4 | use strict; 5 | use Module::Install::Base (); 6 | 7 | use vars qw{$VERSION @ISA $ISCORE}; 8 | BEGIN { 9 | $VERSION = '1.14'; 10 | @ISA = qw{Module::Install::Base}; 11 | $ISCORE = 1; 12 | } 13 | 14 | sub WriteAll { 15 | my $self = shift; 16 | my %args = ( 17 | meta => 1, 18 | sign => 0, 19 | inline => 0, 20 | check_nmake => 1, 21 | @_, 22 | ); 23 | 24 | $self->sign(1) if $args{sign}; 25 | $self->admin->WriteAll(%args) if $self->is_admin; 26 | 27 | $self->check_nmake if $args{check_nmake}; 28 | unless ( $self->makemaker_args->{PL_FILES} ) { 29 | # XXX: This still may be a bit over-defensive... 30 | unless ($self->makemaker(6.25)) { 31 | $self->makemaker_args( PL_FILES => {} ) if -f 'Build.PL'; 32 | } 33 | } 34 | 35 | # Until ExtUtils::MakeMaker support MYMETA.yml, make sure 36 | # we clean it up properly ourself. 37 | $self->realclean_files('MYMETA.yml'); 38 | 39 | if ( $args{inline} ) { 40 | $self->Inline->write; 41 | } else { 42 | $self->Makefile->write; 43 | } 44 | 45 | # The Makefile write process adds a couple of dependencies, 46 | # so write the META.yml files after the Makefile. 47 | if ( $args{meta} ) { 48 | $self->Meta->write; 49 | } 50 | 51 | # Experimental support for MYMETA 52 | if ( $ENV{X_MYMETA} ) { 53 | if ( $ENV{X_MYMETA} eq 'JSON' ) { 54 | $self->Meta->write_mymeta_json; 55 | } else { 56 | $self->Meta->write_mymeta_yaml; 57 | } 58 | } 59 | 60 | return 1; 61 | } 62 | 63 | 1; 64 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Solaris/Ports.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Solaris::Ports; 2 | 3 | use strict; 4 | 5 | sub run { 6 | my $params = shift; 7 | my $common = $params->{common}; 8 | 9 | my $zone; 10 | my $SystemModel; 11 | my $aarch; 12 | 13 | my $flag; 14 | my $caption; 15 | my $description; 16 | my $name; 17 | my $type; 18 | 19 | if ( !$common->can_run("zonename") || `zonename` =~ /global/ ) { 20 | # Ether pre Sol10 or in Sol10/Sol11 global zone 21 | $zone = "global"; 22 | } else { 23 | $zone = ""; 24 | } 25 | 26 | if ($zone) { 27 | chomp($SystemModel = `uname -m`); 28 | chomp($aarch = `uname -p`); 29 | if( $aarch eq "i386" ){ 30 | # 31 | # For a Intel/AMD arch, we're using smbios 32 | # 33 | foreach(`/usr/sbin/smbios -t SMB_TYPE_PORT`) { 34 | if(/\s+Internal Reference Designator:\s*(.+)/i ) { 35 | $flag = 1; 36 | $name = $1; 37 | } 38 | elsif ($flag && /^$/) { # end of section 39 | $flag = 0; 40 | 41 | $common->addPorts({ 42 | CAPTION => $caption, 43 | DESCRIPTION => $description, 44 | NAME => $name, 45 | TYPE => $type, 46 | }); 47 | 48 | $caption = $description = $name = $type = undef; 49 | } 50 | elsif ($flag) { 51 | $caption = $1 if /\s+External Connector Type:.*\((.+)\)/i; 52 | $description = $1 if /\s+External Reference Designator:\s*(.+)/i; 53 | $type = $1 if /\s+Port Type:.*\((.+)\)/i; 54 | } 55 | 56 | } 57 | } 58 | elsif( $aarch eq "sparc" ) { 59 | # 60 | # For a Sparc arch, we're done 61 | # 62 | } 63 | 64 | } 65 | } 66 | 67 | 1; 68 | 69 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/auth.bundle/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 21G72 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | auth 11 | CFBundleIdentifier 12 | org.ocsinventory.agent.auth 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | auth 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSupportedPlatforms 22 | 23 | MacOSX 24 | 25 | CFBundleVersion 26 | 1 27 | DTCompiler 28 | com.apple.compilers.llvm.clang.1_0 29 | DTPlatformBuild 30 | 13F100 31 | DTPlatformName 32 | macosx 33 | DTPlatformVersion 34 | 12.3 35 | DTSDKBuild 36 | 21E226 37 | DTSDKName 38 | macosx12.3 39 | DTXcode 40 | 1341 41 | DTXcodeBuild 42 | 13F100 43 | InstallerSectionTitle 44 | auth 45 | LSMinimumSystemVersion 46 | 10.15 47 | NSHumanReadableCopyright 48 | 49 | NSMainNibFile 50 | AuthInstallerPane 51 | NSPrincipalClass 52 | InstallerSection 53 | 54 | 55 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/Virtualization/Jails.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::Virtualization::Jails; 2 | 3 | use strict; 4 | 5 | sub check { 6 | return(undef) unless -r '/usr/sbin/jls'; 7 | return 1; 8 | } 9 | 10 | my @jail; 11 | 12 | sub run { 13 | my $params = shift; 14 | my $common = $params->{common}; 15 | 16 | foreach my $line (`jls -h 2>/dev/null | sed -e "1d"`) { 17 | push @jail, $line; 18 | } 19 | 20 | foreach my $j (@jail) { 21 | my @jparam=split('\s',$j); 22 | my $vmid=$jparam[6]; 23 | my $name=$jparam[7]; 24 | my $subsystem=$jparam[9]; 25 | my $status="running"; 26 | my @ip; 27 | my $ipv4=$jparam[39]; 28 | if ($ipv4 ne '-') { 29 | my @ipv4=split(",",$ipv4); 30 | foreach my $i (@ipv4) { 31 | push @ip, $i; 32 | } 33 | } 34 | my $ipv6=$jparam[41]; 35 | if ($ipv6 ne '-') { 36 | my @ipv6=split(",",$ipv6); 37 | foreach my $i (@ipv6) { 38 | push @ip, $i; 39 | } 40 | } 41 | 42 | my $ip=join "/", @ip; 43 | if (defined $ip) { 44 | $common->addVirtualMachine({ 45 | IPADDR => $ip, 46 | NAME => $name, 47 | STATUS => $status, 48 | SUBSYSTEM => "FreeBSD $subsystem", 49 | VMID => $vmid, 50 | VTYPE => "Jail", 51 | }); 52 | } else { 53 | $common->addVirtualMachine({ 54 | NAME => $name, 55 | STATUS => $status, 56 | SUBSYSTEM => "FreeBSD $subsystem", 57 | VMID => $vmid, 58 | VTYPE => "Jail", 59 | }); 60 | } 61 | } 62 | } 63 | 64 | 1; -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/ARM/CPU.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::ARM::CPU; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | sub check { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | $common->can_run("lscpu"); 10 | $common->can_run("vcgencmd"); 11 | } 12 | 13 | sub run { 14 | my $params = shift; 15 | my $common = $params->{common}; 16 | 17 | my @cpuinfos=`LANG=C lscpu 2>/dev/null`; 18 | my $cpu; 19 | my $nbcpus; 20 | my $freq; 21 | 22 | foreach my $info (@cpuinfos){ 23 | chomp $info; 24 | $cpu->{CPUARCH}=$1 if ($info =~ /Architecture:\s*(.*)/i); 25 | $cpu->{NBCPUS}=$1 if ($info =~ /^CPU\(s\):\s*(\d+)/i); 26 | $cpu->{THREADS}=$1 if ($info =~ /Thread\(s\)\sper\score:\s*(\d+)/i); 27 | $cpu->{CORES}=$1 if ($info =~ /Core\(s\)\sper\ssocket:\s*(\d+)/i); 28 | $cpu->{NBSOCKET}=$1 if ($info =~ /Socket\(s\):\s*(\d+)/i); 29 | $cpu->{TYPE}=$1 if ($info =~ /Model\sname:\s*(.*)/i); 30 | $cpu->{MANUFACTURER}=$1 if ($info =~ /Vendor ID:\s*(.+)/i); 31 | $cpu->{SPEED}=$1 if ($info =~ /CPU max MHZ:\s*(.*)/i); 32 | if ($cpu->{CPUARCH} && $cpu->{CPUARCH} =~ /(armv[1-7])/){ 33 | $cpu->{DATA_WIDTH}='32'; 34 | } else { 35 | $cpu->{DATA_WIDTH}='64'; 36 | } 37 | } 38 | # Frequency 39 | $cpu->{CURRENT_SPEED}=`vcgencmd get_config arm_freq | cut -d"=" -f 2`; 40 | 41 | # Total Threads = number of cores x number of threads per core 42 | $cpu->{THREADS}=$cpu->{CORES}*$cpu->{THREADS}; 43 | 44 | # Set LOGICAL_CPUS with THREADS value 45 | $cpu->{LOGICAL_CPUS}=$cpu->{THREADS}; 46 | 47 | for (my $i=0;$i<$cpu->{NBSOCKET};$i++) { 48 | $common->addCPU($cpu); 49 | } 50 | 51 | } 52 | 53 | 1; 54 | -------------------------------------------------------------------------------- /resources/ipdiscover/ipdiscover.h: -------------------------------------------------------------------------------- 1 | /* 2 | ############################################################################### 3 | ##OCSInventory Version NG Beta 4 | ##Copyleft Pascal DANEK 2006 5 | ##Web : http://ocsinventory.sourceforge.net 6 | ## 7 | ##This code is open source and may be copied and modified as long as the source 8 | ##code is always made freely available. 9 | ##Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt 10 | ################################################################################ 11 | */ 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #ifndef ARPHRD_ETHER 33 | #define ARPHRD_ETHER 1 34 | #endif 35 | #ifndef ARPOP_REQUEST 36 | #define ARPOP_REQUEST 1 37 | #endif 38 | #ifndef ARPOP_REPLY 39 | #define ARPOP_REPLY 2 40 | #endif 41 | 42 | #define VERSION 5 43 | #define NAME_RES_LATENCY 1000000 44 | #define REQUEST_LATENCY_DEFAULT 100 /* ms */ 45 | 46 | /* Trame ARP */ 47 | struct arphdr{ 48 | unsigned short arp_hrdad; 49 | unsigned short arp_prot; 50 | unsigned char arp_halen; 51 | unsigned char arp_prlen; 52 | unsigned short arp_opcode; 53 | 54 | unsigned char ar_sha[ETH_ALEN]; 55 | unsigned char ar_sip[4]; 56 | unsigned char ar_tha[ETH_ALEN]; 57 | unsigned char ar_tip[4]; 58 | }; 59 | 60 | /* Ethernet header*/ 61 | struct Packet{ 62 | struct ethhdr ethhdr; 63 | struct arphdr arphdr; 64 | }; 65 | typedef struct Packet packet; 66 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/BSD/Archs/I386.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::BSD::Archs::I386; 2 | # for i386 in case dmidecode is not available 3 | use strict; 4 | 5 | sub check{ 6 | my $arch; 7 | chomp($arch=`sysctl -n hw.machine`); 8 | return if (($arch ne "i386") && ($arch ne "amd64")); 9 | # dmidecode must not be present 10 | `dmidecode 2>&1`; 11 | return if ($? >> 8)==0; 12 | 1; 13 | } 14 | 15 | sub run { 16 | my $params = shift; 17 | my $common = $params->{common}; 18 | 19 | my ($SystemSerial , $SystemModel, $SystemManufacturer, $BiosManufacturer, $BiosVersion, $BiosDate); 20 | my ($processort , $processorn , $processors); 21 | 22 | # use hw.machine for the system model 23 | # TODO see if we can do better 24 | chomp($SystemModel=`sysctl -n hw.machine`); 25 | 26 | # number of procs with sysctl (hw.ncpu) 27 | chomp($processorn=`sysctl -n hw.ncpu`); 28 | # proc type with sysctl (hw.model) 29 | chomp($processort=`sysctl -n hw.model`); 30 | # XXX quick and dirty _attempt_ to get proc speed through dmesg 31 | for (`dmesg`){ 32 | my $tmp; 33 | if (/^cpu\S*\s.*\D[\s|\(]([\d|\.]+)[\s|-]mhz/i) { # XXX unsure 34 | $tmp = $1; 35 | $tmp =~ s/\..*//; 36 | $processors=$tmp; 37 | last 38 | } 39 | } 40 | 41 | # Writing data 42 | $common->setBios ({ 43 | SMANUFACTURER => $SystemManufacturer, 44 | SMODEL => $SystemModel, 45 | SSN => $SystemSerial, 46 | BMANUFACTURER => $BiosManufacturer, 47 | BVERSION => $BiosVersion, 48 | BDATE => $BiosDate, 49 | }); 50 | 51 | $common->setHardware({ 52 | PROCESSORT => $processort, 53 | PROCESSORN => $processorn, 54 | PROCESSORS => $processors 55 | }); 56 | } 57 | 58 | 1; 59 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/config.bundle/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 19H2 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | config 11 | CFBundleIdentifier 12 | org.ocsinventory.agent.config 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | config 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSupportedPlatforms 22 | 23 | MacOSX 24 | 25 | CFBundleVersion 26 | 1 27 | DTCompiler 28 | com.apple.compilers.llvm.clang.1_0 29 | DTPlatformBuild 30 | 12A7300 31 | DTPlatformName 32 | macosx 33 | DTPlatformVersion 34 | 10.15.6 35 | DTSDKBuild 36 | 19G68 37 | DTSDKName 38 | macosx10.15 39 | DTXcode 40 | 1201 41 | DTXcodeBuild 42 | 12A7300 43 | InstallerSectionTitle 44 | config 45 | LSMinimumSystemVersion 46 | 10.15 47 | NSHumanReadableCopyright 48 | Copyright © 2020 OCS Inventory. All rights reserved. 49 | NSMainNibFile 50 | ConfigInstallerPane 51 | NSPrincipalClass 52 | InstallerSection 53 | 54 | 55 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/RPM.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Generic::Packaging::RPM; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | sub check { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | return unless $common->can_run("rpm"); 10 | 11 | # Some time rpm is a wrapper or an alias for another 12 | `rpm --version 2>&1`; 13 | return if ($? >> 8)!=0; 14 | 1; 15 | } 16 | 17 | sub run { 18 | my $params = shift; 19 | my $common = $params->{common}; 20 | my $logger = $params->{logger}; 21 | 22 | my @date; 23 | my @list; 24 | my $buff; 25 | foreach (`rpm -qa --queryformat "%{NAME} --%{ARCH}-- %{VERSION}-%{RELEASE} --%{INSTALLTIME}-- --%{SIZE}-- --%{VENDOR}-- %{SUMMARY}\n--\n" 2>/dev/null`) { 26 | if (! /^--/) { 27 | chomp; 28 | $buff .= $_; 29 | } elsif ($buff =~ s/^(.*)\s+--(.*)--\s+(\S+)\s+--(.*)--\s+--(.*)--\s+--(.*)--\s+(.*)//) { 30 | my ($name,$arch,$version,$installdate,$filesize,$vendor,$comments) = ( $1,$2,$3,$4,$5,$6,$7 ); 31 | @date = localtime($installdate); 32 | $installdate = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $date[5] + 1900, $date[4] + 1, $date[3], $date[2], $date[1], $date[0]); 33 | 34 | $common->addSoftware({ 35 | 'NAME' => $name, 36 | 'ARCHITECTURE' => $arch, 37 | 'VERSION' => $version, 38 | 'INSTALLDATE' => $installdate, 39 | 'FILESIZE' => $filesize, 40 | 'COMMENTS' => $comments, 41 | 'PUBLISHER' => $vendor, 42 | 'FROM' => 'rpm' 43 | }); 44 | } else { 45 | $logger->debug("Should never go here!"); 46 | $buff = ''; 47 | } 48 | } 49 | } 50 | 51 | 1; 52 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/Linux/Archs/ARM/Bios.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::Linux::Archs::ARM::Bios; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | sub check { 7 | my $params = shift; 8 | my $common = $params->{common}; 9 | $common->can_read("/proc/cpuinfo"); 10 | $common->can_run("vcgencmd"); 11 | } 12 | 13 | sub run { 14 | my $params = shift; 15 | my $common = $params->{common}; 16 | my $current; 17 | my @infos; 18 | 19 | # processor : 0 20 | # model name : ARMv6-compatible processor rev 7 (v6l) 21 | # BogoMIPS : 697.95 22 | # Features : half thumb fastmult vfp edsp java tls 23 | # CPU implementer : 0x41 24 | # CPU architecture : 7 25 | # CPU variant : 0x0 26 | # CPU part : 0xb76 27 | # CPU revision : 7 28 | # 29 | # Hardware : BCM2835 30 | # Revision : 0002 31 | # Serial : 0000000081355bf5 32 | # Model : Raspberry Pi Model B Rev 1 33 | open INFO, ") { 35 | $current->{SSN} = $1 if /Serial\s+:\s+(\S.*)/; 36 | $current->{BVERSION} = $1 if /Revision\s+:\s+(.*)/; 37 | $current->{TYPE} = $1 if /Model\s+:\s+(.*)/; 38 | push @infos, $current; 39 | } 40 | close(INFO); 41 | 42 | # vcgencmd version 43 | my $bd=`vcgencmd version | head -1`; 44 | $bd =~ s/^(#.*\n)//g; 45 | $bd =~ s/Invalid.*$//g; 46 | chomp($bd); 47 | 48 | # Writing data 49 | foreach my $info (@infos) { 50 | $info->{ASSETTAG}='N/A'; 51 | $info->{SMANUFACTURER}='Raspberry'; 52 | $info->{SMODEL}='Raspberry'; 53 | $info->{BMANUFACTURER}='N/A'; 54 | $info->{BDATE}=$bd; 55 | $info->{MMANUFACTURER}='N/A'; 56 | $common->setBios($info); 57 | } 58 | } 59 | 60 | 1; 61 | -------------------------------------------------------------------------------- /macosx/ocsinventory_packages_setup/daemonconfig.bundle/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 19H2 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | daemonconfig 11 | CFBundleIdentifier 12 | org.ocsinventory.agent.daemonconfig 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | daemonconfig 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSupportedPlatforms 22 | 23 | MacOSX 24 | 25 | CFBundleVersion 26 | 1 27 | DTCompiler 28 | com.apple.compilers.llvm.clang.1_0 29 | DTPlatformBuild 30 | 12A7300 31 | DTPlatformName 32 | macosx 33 | DTPlatformVersion 34 | 10.15.6 35 | DTSDKBuild 36 | 19G68 37 | DTSDKName 38 | macosx10.15 39 | DTXcode 40 | 1201 41 | DTXcodeBuild 42 | 12A7300 43 | InstallerSectionTitle 44 | daemonconfig 45 | LSMinimumSystemVersion 46 | 10.15 47 | NSHumanReadableCopyright 48 | Copyright © 2020 OCS Inventory. All rights reserved. 49 | NSMainNibFile 50 | DaemonConfigPane 51 | NSPrincipalClass 52 | InstallerSection 53 | 54 | 55 | -------------------------------------------------------------------------------- /macosx/README: -------------------------------------------------------------------------------- 1 | DESCRIPTION 2 | OS X [darwin] Readme 3 | 4 | This README will help you roll your own native OSX, OCSNG.app client for enterprise deployment. 5 | 6 | PREREQUISITES 7 | 8 | - Latest XCode 9 | - Cpanm 10 | - Packages (Iceberg's successor) 11 | 12 | BUILDING/INSTALLING 13 | 14 | - Run `cpanm --install-deps .` in UnixAgent base directory 15 | - You might need to configure cpanm if that the first configuration 16 | - We recommend to install perl and cpanm using brew 17 | - Move generated dependencies inside the lib directory of the OCS Inventory agent root directory 18 | - Apply patches from macosx/patches directory 19 | - Open the macosx/ocsng_app-xcode/OCSNG.xcodeproj and build OCSNG.app and ocscontact 20 | - Before building check that all the external resources are available otherwise the agent won't work 21 | 22 | 23 | 24 | COPYRIGHT 25 | 26 | 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. 27 | 28 | NOTES 29 | 30 | - macosx tools was created by claimid.com/wesyoung and modified by OCS NG team for the 2.8 version. 31 | 32 | - Once installed, the agent should contact the server and upload an initial inventory, then go back to sleep. 33 | 34 | - OCS MacOSX agent is launched using LaunchD but you can click on /Applications/OCSNG.app to launch OCS agent manually. 35 | 36 | - You can take a look to OCS MacOSX logs in /var/logs/ocsng.log file (by default) 37 | 38 | - 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). 39 | 40 | - This package works on MacOSX 10.11+ on x86_64 architectures only. 41 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/Virtualization/VmWareWorkstation.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::Virtualization::VmWareWorkstation; 2 | # 3 | # initial version: Walid Nouh 4 | # 5 | 6 | use strict; 7 | 8 | sub check { 9 | my $params = shift; 10 | my $common = $params->{common}; 11 | return $common->can_run('/bin/vmrun') 12 | } 13 | 14 | sub run { 15 | my $params = shift; 16 | my $common = $params->{common}; 17 | my $logger = $params->{logger}; 18 | 19 | my $cpu; 20 | my $cores; 21 | my $uuid; 22 | my $mem; 23 | my $status; 24 | my $name; 25 | my $i = 0; 26 | 27 | my $commande = "/bin/vmrun list"; 28 | foreach my $vmxpath ( `$commande` ) { 29 | next unless $i++ > 0; # Ignore the first line 30 | if (!open TMP, "<$vmxpath") { 31 | $logger->debug("Can't open $vmxpath\n"); 32 | next; 33 | } 34 | my @vminfos = ; 35 | close TMP; 36 | 37 | foreach my $line (@vminfos) { 38 | if ($line =~ m/^displayName =\s\"+(.*)\"/) { 39 | $name = $1; 40 | } elsif ($line =~ m/^numvcpus =\s\"+(.*)\"/){ 41 | $cpu = $1; 42 | } elsif ($line =~ m/^cpuid.coresPerSocket =\s\"+(.*)\" /){ 43 | $cores = $1; 44 | } elsif ($line =~ m/^memsize =\s\"+(.*)\"/) { 45 | $mem = $1; 46 | } elsif ($line =~ m/^uuid.bios =\s\"+(.*)\"/) { 47 | $uuid = $1; 48 | } 49 | } 50 | 51 | $common->addVirtualMachine ({ 52 | NAME => $name, 53 | VCPU => $cpu, 54 | CORES => $cores, 55 | UUID => $uuid, 56 | MEMORY => $mem, 57 | STATUS => "running", 58 | SUBSYSTEM => "VmWare Workstation", 59 | VMTYPE => "VmWare", 60 | }); 61 | } 62 | } 63 | 64 | 1; 65 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/HPUX/README: -------------------------------------------------------------------------------- 1 | ##################################################### 2 | # 17/12/2009 3 | # Auteur: dwizz.donowin@yahoo.fr 4 | # 5 | # This code is open source and may be copied and modified as long as the source 6 | # code is always made freely available. 7 | # Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt 8 | # 9 | ################################################################################ 10 | 11 | Version Francaise 12 | ----------------- 13 | (for english version see below) 14 | 15 | Ces fichiers sont generes pour etre utilisis avec 16 | l'agent Unix OCS-NG 1.02 17 | 18 | Installation: 19 | 20 | Installer le client OCS-NG 1.02 avec ces prerequis 21 | extraire les fichiers dans le repertoire 22 | 23 | Ocsinventory/Agent/Backend/OS 24 | 25 | Ils seront automatiquement pris en compte par le client OCS 26 | 27 | Je n'ai pu tester ces fichiers que sur N4000 actuellement en version HP-UX 11.0 28 | J'ai commence sur un rp3440 mais je n'ai pas encore toutes les informations 29 | car le format des certaines donnees change. 30 | 31 | N'hesitez pas a m'aider a le faire evoluer. 32 | 33 | 34 | English version 35 | --------------- 36 | 37 | This files are producted for using with 38 | the OCS-NG 1.02 Unix Agent 39 | 40 | Install: 41 | 42 | Install the OCS-NG 1.02 Agent with the prerequesit 43 | 44 | Extract the files in the 45 | 46 | Ocsinventory/Agent/Backend/OS 47 | 48 | It will be used automatically 49 | 50 | I have test the script on only n4000 system for th moment on HP-Ux 11.0 51 | I try it on rp3440 but some informations are not in the same format 52 | 53 | If you wish to help me, you are welwome. 54 | 55 | the files are 56 | HPUX.pm 57 | 58 | HPUX sub directory 59 | Bios.pm 60 | CPU.pm 61 | Controller.pm 62 | Domains.pm 63 | Drives.pm 64 | IPv4.pm 65 | Mem.pm 66 | Memory.pm 67 | Networks.pm 68 | Slots.pm 69 | Software.pm 70 | Storages.pm 71 | 72 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/BSD/Archs/Alpha.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::BSD::Archs::Alpha; 2 | 3 | use strict; 4 | 5 | sub check{ 6 | my $arch; 7 | chomp($arch=`sysctl -n hw.machine`); 8 | $arch eq "alpha"; 9 | } 10 | 11 | sub run { 12 | my $params = shift; 13 | my $common = $params->{common}; 14 | 15 | my ($SystemSerial, $SystemModel, $SystemManufacturer, $BiosManufacturer, $BiosVersion, $BiosDate); 16 | my ($processort, $processorn, $processors); 17 | 18 | ### Get system model with "sysctl hw.model" 19 | # 20 | # example on *BSD 21 | # hw.model = AlphaStation 255 4/232 22 | 23 | chomp($SystemModel=`sysctl -n hw.model`); 24 | $SystemManufacturer = "DEC"; 25 | 26 | ### Get processor type and speed in dmesg 27 | # 28 | # NetBSD: AlphaStation 255 4/232, 232MHz, s/n 29 | # cpu0 at mainbus0: ID 0 (primary), 21064A-2 30 | # OpenBSD: AlphaStation 255 4/232, 232MHz 31 | # cpu0 at mainbus0: ID 0 (primary), 21064A-2 (pass 1.1) 32 | # FreeBSD: AlphaStation 255 4/232, 232MHz 33 | # CPU: EV45 (21064A) major=6 minor=2 34 | 35 | for (`dmesg`) { 36 | if (/^cpu[^:]*:\s*(.*)$/i) { $processort = $1; } 37 | if (/$SystemModel,\s*(\S+)\s*MHz.*$/) { $processors = $1; } 38 | } 39 | 40 | 41 | # number of procs with sysctl (hw.ncpu) 42 | chomp($processorn=`sysctl -n hw.ncpu`); 43 | 44 | # Writing data 45 | $common->setBios ({ 46 | SMANUFACTURER => $SystemManufacturer, 47 | SMODEL => $SystemModel, 48 | SSN => $SystemSerial, 49 | BMANUFACTURER => $BiosManufacturer, 50 | BVERSION => $BiosVersion, 51 | BDATE => $BiosDate, 52 | }); 53 | 54 | $common->setHardware({ 55 | PROCESSORT => $processort, 56 | PROCESSORN => $processorn, 57 | PROCESSORS => $processors 58 | }); 59 | } 60 | 61 | 1; 62 | -------------------------------------------------------------------------------- /lib/Ocsinventory/Agent/Backend/OS/BSD/Acpiconf.pm: -------------------------------------------------------------------------------- 1 | package Ocsinventory::Agent::Backend::OS::BSD::Acpiconf; 2 | 3 | use POSIX; 4 | use strict; 5 | use warnings; 6 | use Data::Dumper; 7 | use English qw( -no_match_vars ) ; 8 | 9 | sub check { 10 | my $params = shift; 11 | my $common = $params->{common}; 12 | 13 | return unless $common->can_run("acpiconf"); 14 | } 15 | 16 | sub run { 17 | 18 | my $params = shift; 19 | my $common = $params->{common}; 20 | 21 | my $battery; 22 | my $index=0; 23 | 24 | my @bat = `acpiconf -i $index`; 25 | 26 | my $data = {}; 27 | foreach my $line (@bat) { 28 | if ($line =~ /^\s(.*):\s*(\S+(?:\s+\S+)*)$/) { 29 | $data->{$1}=$2; 30 | } 31 | } 32 | 33 | $battery = { 34 | NAME => $data->{'Model number'}, 35 | CHEMISTRY => $data->{'Type'}, 36 | SERIALNUMBER => $data->{'Serial number'}, 37 | }; 38 | 39 | if ($battery->{CHEMISTRY} eq "LION") { 40 | $battery->{CHEMISTRY} = "Lithium-Ion"; 41 | } elsif (($battery->{CHEMISTRY} eq "LiP") || ($battery->{CHEMISTRY} eq "LiPo")) { 42 | $battery->{CHEMISTRY} = "Lithium-ion-Polymer"; 43 | } 44 | 45 | my $cycles = $data->{'Cycle Count'}; 46 | $battery->{CYCLES} = $cycles if $cycles; 47 | 48 | my $voltage = $data->{'Design voltage'}; 49 | $battery->{DESIGNVOLTAGE} = ceil($voltage/1000)." V" if $voltage; 50 | 51 | my $capacity = $data->{'Design capacity'}; 52 | $battery->{DESIGNCAPACITY} = $capacity if $capacity; 53 | 54 | my $state = $data->{'State'}; 55 | $battery->{STATUS} = $state if $state; 56 | 57 | my $estimate = $data->{'Remaining capacity'}; 58 | $battery->{ESTIMATEDCHARGEREMAINING} = $estimate if $estimate; 59 | 60 | my $manufacturer = $data->{'OEM info'}; 61 | $battery->{MANUFACTURER} = $manufacturer if $manufacturer; 62 | 63 | $common->addBatteries($battery); 64 | 65 | } 66 | 67 | 1; 68 | --------------------------------------------------------------------------------