Perl programming

Student name

Institution

Date: 7/6/2017

-height =>100). Identify modules from… adapters. sub Main_Terminate { -1.dll and gdi32. use Win32::GUI(). and can read an ebb and flow SSH configuration. $main->ShowShow (). $main = Win32::GUI::Window->newnew(-width => 100. In a manner of speaking: DBD::mysql is an interface among the perlprogramming language and the MySQLprogramming Programming interface that goes with the MySQL relational database managementsystem"( CPAN. -height => 100. Win32Win32::GUI::Dialog(). The module has worked in support for both mystery key and private key affirmation. 2017). In your analysis. Net::SSH::Perl This module gives aperl interface to the SSH1 and SSH2 Secure shell traditions.n. $main = Win32::GUI::Window->new( -name => 'Main'.dll.d). Basically. -width => 100.Use this module when yourperl application needs to interface with a SSH-guaranteed host. performs customized encryption of all data.DBD::mysql "is theperl 5 database Interface driver for the MySQLdatabase. $main->Add Label(-text => "Scripting with Perl CSS260"). (Win32::GUI. with a challenge oriented perl interface and an event based trade appear". "Win32::GUI is a Win32-arrange native graphical UI tool kit forperl. it's a XS use of most of the limits found in user32. demonstrate how… data center. } #Using win32::GUI output . ).

$user. #DATA SOURCE NAME $dsn = "dbi:mysql:$database:localhost:3306". The driver module handles most of the bits of knowledge about interfacing with and talking with thedatabase. by typing cpanm -f install “Win32::GUI” . DBI requires adatabase driver module to chat with thedatabase.? Installing a newmodule can be as simple astyping perl -MCPAN -e 'install In the terminal. These modules are profitable for keeping up and interfacing with thedatabase.select the module youwant typecapnm ”DBD::mysql”cpanm “Net::SSH”“Win32::GUI” if modules does notwant to install you can force it. making it easier to invigorate and take off changes if require. $password). Describe how you… you have identified. #perl DBI CONNECT $DBIconnect = DBI->connect($dsn.

} close (MYFILE). # Capture memory statistics chomp(my $vmMemoryStats = `vmstat`).txt'). open (MYFILE.Syntax Executessystem commands to retrievesystem metrics like CPU utilization # Global variables to gather system data chomp(my $hostName = `hostname`). chomp(my $kernelName = `uname -s`). chomp(my $hardwarePlatform = `uname -i`). 'data. # Determine memory utilization chomp(my $memoryStats = `free`). chomp(my $operatingSystem = `uname -s`). Reads informationfrom a flat file and then inserts into adatabase #!/usr/local/bin/perl open (MYFILE. print "$_\n". # Determine disk utilization my @diskUtilization = `df -k`.txt'). chomp(my $processorType = `uname -p`). while (<MYFILE>) { chomp. chomp(my $kernelRelease = `uname -r`). 'data. then use the chomp . chomp(my $kernelVersion = `uname -v`). while (<MYFILE>) { Inside the loop. chomp(my $machineHwName = `uname -m`).

my@data. my$ipAddress.chomp. my$serverName. Finally close the filehandle tofinish out theprogram. . my($dbTable) = $_[1]. print "$_\n". my$serverStatus. my$memoryUtilization = 0. #OUTPUT Connects toadatabase and retrieves reporting information #subroutine sub Print_DB_Table1 { my($dbh) = $_[0]. my$cpuUtilization = 0.

\$serverName).. # Print out thetable headers print("Server Name \t IP \t\t Status \t CPU \t Memory \t Free-Disk\n"). # Plan question. $dbh->errstr. then beyond words "execute articulation: " . \$ipAddress). $sth->errstr. $sth->bind_col(3. \$cpuUtilization). then beyond words "get ready proclamation: " .. $sth->bind_col(1. # segments begin at 1...my$diskFree = 0. $sth->execute( ) or. $sth->bind_col(4. \$serverStatus). $sth->bind_col(6. my$sth = $dbh->prepare("SELECT * FROM $dbTable") or. # Perused of the records from the giventable and print them out while (@data = $sth->fetchrow_array( )) { #print("@data"). \$memoryUtilization). $sth->bind_col(2. print("$serverName \t"). \$diskFree). # Execute the question. print("$ipAddress \t"). $sth->bind_col(5. .

\n\n"). } on the off chance that (characterized $diskFree && length $diskFree > 0) { print("$diskFree \t").print("$serverStatus \t"). } print("\n") } on the off chance that ($sth->rows == 0) { print("No columns intable $dbTable. } $sth->finish. . } on the off chance that (characterized $memoryUtilization && length $memoryUtilization > 0) { print("$memoryUtilization \t\t"). on the off chance that (characterized $cpuUtilization && length $cpuUtilization > 0) { print("$cpuUtilization \t"). print("\n").

htm .uk/e- learning/ClientSide01CD/page_22.pm Client-side Scripting Features (2007) http://www.org/~michielb/DBD-mysql- 4.org.about.041/lib/DBD/mysql.cgi About tech (2017) how to read a file and write files in Perl http://perl.sqa.Works Cited CPAN (2017) DBD-mysql http://search.d) Win32::GUI http://perl-win32-gui.com/od/perltutorials/a/readwritefiles.htm WIN32(n.cpan.sourceforge.net/cgi-bin/index.