IP Accounting  (ip_account)

Top  Previous  Next

The IP accounting program will collect IP Accounting data from a list of Cisco routers and write the results to files.  The script will cycle through each router issuing the “show ip accounting” command.  A separate data file will be created for each router and the data in the file can be sorted by Packet Count, Byte Count, Source IP Address, or Destination IP Address.  Note, “ip accounting” must be enabled on a router interface in order for data to be available.  Please check the appropriate Cisco documentation for more on Ciscos IP accounting fearture.

 

Program Name: ip_account

 

Script Argument

Description

-ual (1 or 2)

User Access Level.  Tells the script what access-level (1st or 2nd) to log into the router before sending the commands.  By default the script will only go into 1st level access.  (OPTIONAL)

-sort (s|d|p|b)

Sort output results based on one of the following:

s        source IP address

d        destination IP address

p        packet count

b        byte count

 

The default is unsorted and will present the data exactly the way it is presented from the “show ip accounting” command.  (OPTIONAL)

-urfn

Use Route File Name.  Use ip address/name in route file for data file name instead of router hostname.

-dir <directory name>

A sub-directory under the users “net-scripts” directory that the data files will be written to.  By default, the data files will be written to the users “net-sense” directory.  (OPTIONAL)

-clc

Clear the IP accounting counters after retrieving the data.  (OPTIONAL)

-nokey

Dont prompt user for encryption key when using encrypted password file.  (OPTIONAL)

-ssafe

SuperSafe Mode.  Abort Script if there is an error while issuing the “clear ip accounting” command. (OPTIONAL)

-ssh

Use Secure Shell when accessing routers.  Do NOT use with -pw option. (OPTIONAL)

-pw <filename>

Login/Password File.  (OPTIONAL)

-log <filename>

Save detailed trace file to a name other than the default file name.  (OPTIONAL)

-ulog

Unique Log file.  Save detailed trace log file to a Unique filename automatically created by script. Filename will be in format of scriptname_timestamp.log. (OPTIONAL)

 

After the script runs, the IP accounting data will be either be in the users “net-scripts” directory or a sub-directory under the users “net-scripts” directory if the dir option is specified.  It is recommended to use the dir option so your “net-scripts” directory will not be “cluttered” with excessive data files.

 

If you plan on clearing the counters for the IP accounting data, you will most likely need to set the User Access level to 2 with the ual 2 option.  Unless, your using Ciscos AAA and the particular username has privilege to issue that command.

 

Sample Command: The following command will run the ip_account program and save the data files, sorted by byte count (-sort option), into the directory my_company_070103 (-dir option).  The script will also being running in 2nd level privileged mode (-ual 2) and will clear the IP accounting counters (-clc) after collecting the data.  If there are any errors while issuing the “clear ip accounting” command, the script will immediately abort because of the ssafe option.  The script will not prompt the user for passwords because the passwords are being read in from the logins.txt file (-pw option).

 

ip_account -pw logins.txt sort b dir my_company_070103 ual 2 clc -ssafe