Rex::Commands::Gather - Online Linux Manual PageSection : 3
Updated : 2021-03-06
Source : perl v5.32.1
Note : User Contributed Perl Documentation

NAMERex::Commands::Gather − Hardware and Information gathering

DESCRIPTIONWith this module you can gather hardware and software information. All these functions will not be reported. These functions don't modify anything.

SYNOPSIS​ operating_system_is("SuSE");

EXPORTED FUNCTIONS

get_operating_systemWill return the current operating system name. ​ task "get−os", "server01", sub { ​ say get_operating_system(); ​ }; Aliased by operating_system().

operating_systemAlias for()

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

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

dump_system_informationThis function dumps all known system information on stdout.

operating_system_is($string)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."; ​ }};

operating_system_version()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"; ​ }};

operating_system_release()Will return the os release number as is.

network_interfacesReturn 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"}; ​ }

memoryReturn 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"}; ​ };

is_freebsdReturns 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..."; ​ }};

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

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

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

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

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

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

is_netbsdReturns 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..."; ​ }};

is_openbsdReturns 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..."; ​ }};

is_linuxReturns 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..."; ​ }};

is_bsdReturns 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..."; ​ }};

is_solarisReturns 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..."; ​ }};

is_windowsReturns true if the target system is a Windows System.

is_openwrtReturns true if the target system is an OpenWrt System.

is_gentooReturns true if the target system is a Gentoo System.

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

is_voidReturns true if the target system is a Void Linux system.
0
Johanes Gumabo
Data Size   :   25,952 byte
man-Rex::Commands::Gather.3pmBuild   :   2024-12-29, 07:25   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 256,073
Visitor ID   :     :  
Visitor IP   :   18.217.242.39   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.29
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|252|Rex::Commands::Gather.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|Rex::Commands::Gather.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|252|Rex::Commands::Gather.3pm|43|br══─}─══|'br══─}─══ )         (htmlprn|149|Rex::Commands::Gather.3pm|43|'br══─}─══ |'br══─}─══ )