Changeset 224
- Timestamp:
- Feb 18, 2017, 10:23:58 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r223 r224 870 870 871 871 print <<'END'; 872 klask - port s manager and finder for switch872 klask - port and search manager for switches, map management 873 873 874 874 klask version 875 klask help 875 876 876 877 klask updatedb [--verbose|-v] [--verb-description|-d] [--chk-hostname|-h] [--chk-location|-l] … … 879 880 klask cleandb [--verbose|-v] --day number_of_day --repair-dns 880 881 881 klask updatesw 882 klask updatesw [--verbose|-v] 882 883 klask exportsw --format [txt|dot] 883 884 … … 886 887 klask search-mac-on-switch switch mac_addr 887 888 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] 891 892 892 893 klask enable [--verbose|-v] switch port … … 901 902 902 903 print <<'END'; 903 Klask - ports manager and finder for switch 904 klask - port and search manager for switches, map management 904 905 Copyright (C) 2005-2017 Gabriel Moreau 905 906 … … 1637 1638 #--------------------------------------------------------------- 1638 1639 sub 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 1639 1649 test_maindb_environnement(); 1640 1650 … … 1668 1678 my $ip_timestamp_mod = $ip_timestamp; 1669 1679 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/; 1672 1682 1673 1683 if ($ip_timestamp_mod > $ip_timestamp_ref) { … … 1921 1931 #--------------------------------------------------------------- 1922 1932 sub cmd_ip_free { 1923 @ARGV = @_; # VLAN name with option1924 1925 my $days_to_dea d =365 * 2;1933 @ARGV = @_; 1934 1935 my $days_to_death = $DEFAULT{'days-to-death'} || 365 * 2; 1926 1936 my $format = 'txt'; 1927 1937 my $verbose; 1928 1938 1929 1939 GetOptions( 1930 'day|d=i' => \$days_to_dea d,1940 'day|d=i' => \$days_to_death, 1931 1941 'format|f=s' => \$format, 1932 1942 'verbose|v' => \$verbose, … … 1947 1957 my $timestamp = time; 1948 1958 1949 my $timestamp_barrier = $timestamp - (3600 * 24 * $days_to_dea d);1959 my $timestamp_barrier = $timestamp - (3600 * 24 * $days_to_death); 1950 1960 1951 1961 my %result_ip = (); … … 2663 2673 klask search-mac-on-switch [--verbose|-v] [--vlan|-i vlan-id] switch mac_addr 2664 2674 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] 2666 2678 2667 2679 klask enable [--verbose|-v] switch port … … 2777 2789 =head2 updatesw 2778 2790 2791 klask updatesw [--verbose|-v] 2792 2779 2793 This 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] 2794 The 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] 2784 2800 2785 2801 This command print the content of the switch database. There is actually two format. … … 2788 2804 klask exportsw --format dot > /tmp/map.dot 2789 2805 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 2812 This command return IP address that was not use (detected by Klask) at this time. 2813 The list returned could be limited to just one VLAN. 2814 IP returned could have been never used or no computer have been detected since the number of days specified 2815 (2 years by default). 2816 This 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 2821 Computer 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 2828 This command return a list of switch port that are not configure with the good VLAN. 2829 Computer which are in bad VLAN are detected with the float regex parameter (see L</cleandb>) 2830 and another prior trace where they had the good IP (good DNS name). 2831 The computer must stay connected on a bad VLAN more than XX days (15 days by default) before alert. 2832 This parameter could also define in the configuration file F</etc/klask/klask.conf> (SEE CONFIGURATION). 2833 2834 default: 2835 days-before-alert: 15 2836 2837 This functionality is not need if your switch use RADIUS 802.1X configuration... 2838 2790 2839 2791 2840
Note: See TracChangeset
for help on using the changeset viewer.