GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Rex::Commands::Gather(3) User Contributed Perl Documentation Rex::Commands::Gather(3)

Rex::Commands::Gather - Hardware and Information gathering

With this module you can gather hardware and software information.

All these functions will not be reported. These functions don't modify anything.

 operating_system_is("SuSE");

Will return the current operating system name.

 task "get-os", "server01", sub {
   say get_operating_system();
 };

Aliased by operating_system().

Alias for get_operating_system()

Will return a hash of all system information. These Information will be also used by the template function.

Will return the kernel name of the operating system. For example on a linux system it will return Linux.

This function dumps all known system information on stdout.

Will return 1 if the operating system is $string.

 task "is_it_suse", "server01", sub {
   if( operating_system_is("SuSE") ) {
     say "This is a SuSE system.";
   }
 };

Will return the os release number as an integer. For example, it will convert 5.10 to 510, 10.04 to 1004 or 6.0.3 to 603.

 task "prepare", "server01", sub {
   if( operating_system_version() >= 510 ) {
     say "OS Release is higher or equal to 510";
   }
 };

Will return the os release number as is.

Return an HashRef of all the networkinterfaces and their configuration.

 task "get_network_information", "server01", sub {
   my $net_info = network_interfaces();
 };

You can iterate over the devices as follow

 my $net_info = network_interfaces();
 for my $dev ( keys %{ $net_info } ) {
   say "$dev has the ip: " . $net_info->{$dev}->{"ip"} . " and the netmask: " . $net_info->{$dev}->{"netmask"};
 }

Return an HashRef of all memory information.

 task "get_memory_information", "server01", sub {
   my $memory = memory();

   say "Total:  " . $memory->{"total"};
   say "Free:   " . $memory->{"free"};
   say "Used:   " . $memory->{"used"};
   say "Cached:  " . $memory->{"cached"};
   say "Buffers: " . $memory->{"buffers"};
 };

Returns true if the target system is a FreeBSD.

 task "foo", "server1", "server2", sub {
   if(is_freebsd) {
     say "This is a freebsd system...";
   }
   else {
     say "This is not a freebsd system...";
   }
 };

 task "foo", "server1", sub {
   if(is_redhat) {
     # do something on a redhat system (like RHEL, Fedora, CentOS, Scientific Linux
   }
 };

 task "foo", "server1", sub {
   if(is_fedora) {
     # do something on a fedora system
   }
 };

 task "foo", "server1", sub {
   if(is_suse) {
     # do something on a suse system
   }
 };

 task "foo", "server1", sub {
   if(is_mageia) {
     # do something on a mageia system (or other Mandriva followers)
   }
 };

 task "foo", "server1", sub {
   if(is_debian) {
     # do something on a debian system
   }
 };

 task "foo", "server1", sub {
   if(is_alt) {
     # do something on a ALT Linux system
   }
 };

Returns true if the target system is a NetBSD.

 task "foo", "server1", "server2", sub {
   if(is_netbsd) {
     say "This is a netbsd system...";
   }
   else {
     say "This is not a netbsd system...";
   }
 };

Returns true if the target system is an OpenBSD.

 task "foo", "server1", "server2", sub {
   if(is_openbsd) {
     say "This is an openbsd system...";
   }
   else {
     say "This is not an openbsd system...";
   }
 };

Returns true if the target system is a Linux System.

 task "prepare", "server1", "server2", sub {
   if(is_linux) {
    say "This is a linux system...";
   }
   else {
    say "This is not a linux system...";
   }
 };

Returns true if the target system is a BSD System.

 task "prepare", "server1", "server2", sub {
   if(is_bsd) {
    say "This is a BSD system...";
   }
   else {
    say "This is not a BSD system...";
   }
 };

Returns true if the target system is a Solaris System.

 task "prepare", "server1", "server2", sub {
   if(is_solaris) {
    say "This is a Solaris system...";
   }
   else {
    say "This is not a Solaris system...";
   }
 };

Returns true if the target system is a Windows System.

Returns true if the target system is an OpenWrt System.

Returns true if the target system is a Gentoo System.

 task "foo", "server1", sub {
   if(is_arch) {
     # do something on a arch system
   }
 };

Returns true if the target system is a Void Linux system.
2021-07-05 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.