Changes

Jump to: navigation, search

OPS435 Assignment 1 A

448 bytes added, 08:55, 15 February 2018
Assignment 1 - Users' Usage Report
[[Category:OPS435-Python]][[Category:rchan]]
<font color='red'>'''DRAFT - Under Construction'''</font>
=Assignment 1 - Users' Usage Report=
'''Weight:''' 20% of the overall grade
==Overview==
Most system administrators would like to know the utilization of their systems by their users. On a Linux system, the userseach user' s login records are normally stored in the binary file /var/log/wtmp. The login records record in this binary file can not be viewed or edited directly using normal Linux text commands like 'less', 'cat', etc. The 'last' command is often used to display the login records stored in this file in a human readable form. The following listing is a sample output of running the 'last' command:
<pre>
$ last -F
</pre>
In this assignment, your task is to create a python program with well designed functions to produce daily, weekly, and monthly usage report reports by user or by remote host based on the information obtained from the 'last' command.
== Instructions ==
=== Program Name and valid command line arguments ===
Name your Python3 program as <code>usage_report.py</code>. The program should accept zero or more "file name" as as its command line parameters. for examples:* python3 usage_report.py, or* python3 usage_report.py <b><code>filename</code></b>, or* python3 usage_report.py <b><code>filename1 filename2 </code></b> etc ... - any number of filenames from 1 to as many as the command-line supports.
If there is no command line argument, your python program should get the login records from the 'last' command with the appropriate flags.
If there is one filename provided at the command line, gets the login records from the contents of the given file. The format of the lines each line in the file should be the same as the output of 'last -F'.
If there is more than one filename provided, merges all the files together with the first one at the top and the last one at the bottom. Read and process the file contents in that order in your program.
Daily Usage Report - by User
============================
List of valid users:user1 user2 user3 user4 ...Display list of valid user
...
r) Return to Daily Usage Report Menu
</source>
When a <b>valid user</b> is selected, display the Daily Usage Report for the selected user.
<b>Valid user</b> is regular user (super user and system users should not be included) who are allowed to login to the system.
When option <b>r</b> is selected, the Daily Usage Report menu should be displayed.
 
When a <b>valid user</b> is selected, the Daily Usage Report for the selected user should be generated. The following is a sample Daily Usage Report for user1:
<pre>
Daily Usage Report for user1 on host.cty.senecacollege.ca
=========================================================
Date Usage in Minutes
2018-02-14 60
2018-02-07 45
2018-02-01 5
---
Total 250
</pre>
<source>
1,760
edits

Navigation menu