Changeset 224 for trunk/klask


Ignore:
Timestamp:
Feb 18, 2017, 10:23:58 PM (7 years ago)
Author:
g7moreau
Message:
  • Add option days-to-alert in bad-vlan-id command
  • More and better doc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r223 r224  
    870870
    871871print <<'END';
    872 klask - ports manager and finder for switch
     872klask - port and search manager for switches, map management
    873873
    874874 klask version
     875 klask help
    875876
    876877 klask updatedb [--verbose|-v] [--verb-description|-d] [--chk-hostname|-h] [--chk-location|-l]
     
    879880 klask cleandb  [--verbose|-v] --day number_of_day --repair-dns
    880881
    881  klask updatesw
     882 klask updatesw [--verbose|-v]
    882883 klask exportsw --format [txt|dot]
    883884
     
    886887 klask search-mac-on-switch switch mac_addr
    887888
    888  klask ip-free --day number_of_day --format [txt|html] [vlan_name]
    889 
    890  klask bad-vlan-id
     889 klask ip-free [--verbose|-v] [--day|-d days-to-death] --format [txt|html] [vlan_name]
     890
     891 klask bad-vlan-id [--day|-d days_before_alert]
    891892
    892893 klask enable  [--verbose|-v] switch port
     
    901902
    902903print <<'END';
    903 Klask - ports manager and finder for switch
     904klask - port and search manager for switches, map management
    904905Copyright (C) 2005-2017 Gabriel Moreau
    905906
     
    16371638#---------------------------------------------------------------
    16381639sub cmd_bad_vlan_id {
     1640   @ARGV = @_;
     1641
     1642   my $days_before_alert = $DEFAULT{'days-before-alert'} || 15;
     1643   my $verbose;
     1644
     1645   GetOptions(
     1646      'day|d=i'   => \$days_before_alert,
     1647      );
     1648
    16391649   test_maindb_environnement();
    16401650
     
    16681678      my $ip_timestamp_mod = $ip_timestamp;
    16691679      my $ip_timestamp_ref = $switchportdb{$swpt}->{timestamp};
    1670       $ip_timestamp_mod -= 15 * 24 * 3600 if $ip_hostname_fq =~ m/$RE_FLOAT_HOSTNAME/;
    1671       $ip_timestamp_ref -= 15 * 24 * 3600 if $switchportdb{$swpt}->{hostname_fq} =~ m/$RE_FLOAT_HOSTNAME/;
     1680      $ip_timestamp_mod -= $days_before_alert * 24 * 3600 if $ip_hostname_fq =~ m/$RE_FLOAT_HOSTNAME/;
     1681      $ip_timestamp_ref -= $days_before_alert * 24 * 3600 if $switchportdb{$swpt}->{hostname_fq} =~ m/$RE_FLOAT_HOSTNAME/;
    16721682
    16731683      if ($ip_timestamp_mod > $ip_timestamp_ref) {
     
    19211931#---------------------------------------------------------------
    19221932sub cmd_ip_free {
    1923    @ARGV = @_; # VLAN name with option
    1924 
    1925    my $days_to_dead = 365 * 2;
     1933   @ARGV = @_;
     1934
     1935   my $days_to_death = $DEFAULT{'days-to-death'} || 365 * 2;
    19261936   my $format = 'txt';
    19271937   my $verbose;
    19281938
    19291939   GetOptions(
    1930       'day|d=i'      => \$days_to_dead,
     1940      'day|d=i'      => \$days_to_death,
    19311941      'format|f=s'   => \$format,
    19321942      'verbose|v'    => \$verbose,
     
    19471957   my $timestamp = time;
    19481958
    1949    my $timestamp_barrier = $timestamp - (3600 * 24 * $days_to_dead );
     1959   my $timestamp_barrier = $timestamp - (3600 * 24 * $days_to_death);
    19501960
    19511961   my %result_ip = ();
     
    26632673 klask search-mac-on-switch [--verbose|-v] [--vlan|-i vlan-id] switch mac_addr
    26642674
    2665  klask ip-free  [--verbose|-v] --day number_of_day --format [txt|html] [vlan_name]
     2675 klask ip-free [--verbose|-v] [--day|-d days-to-death] --format [txt|html] [vlan_name]
     2676
     2677 klask bad-vlan-id [--day|-d days_before_alert]
    26662678
    26672679 klask enable  [--verbose|-v] switch port
     
    27772789=head2 updatesw
    27782790
     2791 klask updatesw [--verbose|-v]
     2792
    27792793This command build a map of your manageable switch on your network.
    2780 The list of the switch must be given in the file F</etc/klask/klask.conf>.
    2781 
    2782 
    2783 =head2 exportsw --format [txt|dot]
     2794The list of the switches must be given in the file F</etc/klask/klask.conf>.
     2795
     2796
     2797=head2 exportsw
     2798
     2799 klask exportsw --format [txt|dot]
    27842800
    27852801This command print the content of the switch database. There is actually two format.
     
    27882804 klask exportsw --format dot > /tmp/map.dot
    27892805 dot -Tpng /tmp/map.dot > /tmp/map.png
     2806
     2807
     2808=head2 ip-free
     2809
     2810 klask ip-free [--verbose|-v] [--day|-d days-to-death] --format [txt|html] [vlan_name]
     2811
     2812This command return IP address that was not use (detected by Klask) at this time.
     2813The list returned could be limited to just one VLAN.
     2814IP returned could have been never used or no computer have been detected since the number of days specified
     2815(2 years by default).
     2816This parameter could also be define in the configuration file F</etc/klask/klask.conf> (SEE CONFIGURATION).
     2817
     2818 default:
     2819   days-to-death: 730
     2820
     2821Computer that does not have the good IP but takes a float one (see L</cleandb>) are taken into account.
     2822
     2823
     2824=head2 bad-vlan-id
     2825
     2826 klask bad-vlan-id [--day|-d days_before_alert]
     2827
     2828This command return a list of switch port that are not configure with the good VLAN.
     2829Computer which are in bad VLAN are detected with the float regex parameter (see L</cleandb>)
     2830and another prior trace where they had the good IP (good DNS name).
     2831The computer must stay connected on a bad VLAN more than XX days (15 days by default) before alert.
     2832This parameter could also define in the configuration file F</etc/klask/klask.conf> (SEE CONFIGURATION).
     2833
     2834 default:
     2835   days-before-alert: 15
     2836
     2837This functionality is not need if your switch use RADIUS 802.1X configuration...
     2838
    27902839
    27912840
Note: See TracChangeset for help on using the changeset viewer.