Objective Create a program that provides a management and monitoring service. Specifications The program must support the following command line arguments: ./sysman [--sysinfo] [--ps] [--exec ]...

Create a program that provides a management and monitoring service.


Objective Create a program that provides a management and monitoring service. Specifications The program must support the following command line arguments: ./sysman [--sysinfo] [--ps] [--exec ] [--listen ] These options are as follows: · --sysinfo should display the following information about the system: number of users, available memory. · --ps should display a table of the current list of processes, including pid, name of executable, owner of process, physical memory consumed by process (RSS), cumulative CPU time. · --exec should execute the requested command and display the result. The command must be provided as a single quoted string, like this: · ./sysman --exec 'ls -l /home' · --listen should start the program in server mode. It should open a TCP server socket on the specified port and handle incoming connections as described in “Server Mode” below. The options are mutually exclusive: only one will be supplied. I will not test your program with more than one option at a time. Server Mode When a client connects to the port sysman is listening on, sysman should display a one-line greeting of your choice, and then read a line from the client with a command as follows: · SYSINFO · PS · EXEC · QUIT sysman should perform the requested operation and send the resulting output back to the client. · The EXEC command here will be executed without quotes (example): · EXEC ls -l /home · The QUIT command should cause sysman to close the connection. To test server mode, launch sysman with the –listen option, then use the nc command to communicate with it interactively (i.e., don’t use echo piped to nc, as you did in project 1). For example, in one terminal, execute: ./sysman --listen 6000 In another terminal, execute: nc localhost 6000 Welcome to sysman! SYSINFO 2 users, 1023232 bytes available PS ... table here ... EXEC ls -l /home ... output of ls here ... QUIT Part 1 Implement the specifications listed above. · You may write your program in either Python or C. · If you write your program in Python (call it sysman.py), you must provide a bash script named sysman that launches the Python program, passing through any command line arguments · If you write your program in C, provide a Makefile that creates an executable named sysman. · For full credit, the EXEC command must stream the output of the command to the client as it is generated, rather than all at once after the command completes. Design Requirements · Create a class with methods to obtain system information, obtain the list of processes, and execute a command, streaming the result to the supplied output stream. The methods of the class should output information to a stream/file parameter. If you are writing in C, create a library of functions in a separate file. · In your main program, implement the command line processing and the logic for the server. Use the Python class/C library to perform the work requested by the command line arguments and/or remote client. Part 2 In this enhancement, sysman, when running in server mode, will support network monitoring when the --monitor command line argument is supplied: ./sysman [--sysinfo] [--ps] [--exec command] [--listen ] [--monitor ::] For example: ./sysman --listen 6000 --monitor 1.2.3.4:5.6.7.8:7000 will cause sysman to analyze incoming packets. For each incoming packet whose source IP address is 1.2.3.4 (srcipaddr), sysman will send a UDP message to 5.6.7.8 (logipaddr), port 7000 (logport). The format of the UDP message should be as follows:
Apr 28, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here