May 18, 2008, 2:45 AM
Post #1 of 2
Hi Guys these are the requirements:
SNMP Data Retrieval (Pretty Easy!)
Its a very simple script for perl programmers. I have provided a lot of detail.
This assignment consists of 5 parts – use a small perl program to:
1.retrieve and calculate the system load of a remote machine via snmp
2.read the current swapspace from the remote machine via snmp and calculate the percentage in use
3.snmpd.conf lines to "expose" only the data needed to satisfy the above tasks
4.a crontab line that can be inserted into a machine to run the perl script once every 15 minutes at an appropriate time
5.a crontab line to email the results to the local system administrator before the start of the business day (~8.30am)
Parts 1 and 2:Produce a single Perl script that is to be run once every 15 minutes, retrieving the requisite values and logging them to a local file. Just before the start of the business day (8.30am), send the file to the system administrator
The output is intended to be parsed by script working on the log file or correlated in a spreadsheet. Use a csv format (you will have to research "what" is a csv format! - use one line in this format per record), including the run-time, hostname, 1m load, 5m load, 15m load, swapspace in use (as a percentage of the total available). The order, and fine details of these entries are up to you – think about what you would want if you were writing the parser to process this file.
The Perl program should read the hosts to parse from a simple list in a separate configuration file – the format of which is up to you. Make sure you describe the format if this file in your perl script (as comments) – no need to supply the file. Remember that hostnames, snmp ports and whether access is tcp/udp will need to be stored for each server to be accessed.
The administrator account resides on the local machine, so a simple cron job will suffice
*NOTE: use cron, no external mail program should be used!
Part 3: snmp is inherently insecure as it potentially exposes a huge amount of sensitive information about a host. As the above will be the only data required, a new snmpd.conf file (for Fedora 7) is required that exposes ONLY the minimum details to provide the requested data. Targets will use snmp v2c.
Part 4: cron is ideal for running the script every hour, and emailing the results to the system administrator. You are required to produce the relevant crontab entries to enable the script to run every 15 minutes, and email the contents of the log file once a day.
1.You are not expected to set up or use an external email program. Use the existing facilities in the FC7 image. If you cant see how to email the results – check the lectures!!!!
2.The target system for this program is Fedora Core 7, however these servers at Murdoch University that can be used for checking, as well as the lab image.
1.troll.murdoch.edu.au, TCP, port 1161
126.96.36.199.94, TCP, port 1161
188.8.131.52.95, TCP, port 1161
3.Do not "walk" the snmp tree and use perl to filter the data – you are expected to retrieve ONLY the needed values from within your program.
one file containing the Perl script, snmpd.conf lines inserted as comments, the crontab line inserted as a comment and the format of the configuration file. Note that descriptive comments about the snmpd.conf, crontab and configuration file information should also be included.
(This post was edited by shanks on May 18, 2008, 2:59 AM)