Changeset 389


Ignore:
Timestamp:
Jan 5, 2018, 11:41:47 AM (6 years ago)
Author:
g7moreau
Message:
  • Update documentation and add it for insertdb new command
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r388 r389  
    1010use strict;
    1111use warnings;
    12 use version; our $VERSION = qv('0.7.6');
     12use version; our $VERSION = qv('0.7.7');
    1313
    1414use Readonly;
     
    7676   'searchdb'             => \&cmd_searchdb,
    7777   'removedb'             => \&cmd_removedb,
    78    'addentrydb'           => \&cmd_addentrydb,
     78   'insertdb'             => \&cmd_insertdb,
    7979   'cleandb'              => \&cmd_cleandb,
    8080   'search'               => \&cmd_search,
     
    288288   $ret{'ipv4_address'} = inet_ntoa($packed_ip);
    289289   #if ($ret{'ipv4_address'} !~ m/$RE_IPv4_ADDRESS/) {
    290    #   print "Error: for computer $param_ip_or_host on interface $interface, IP $ret{'ipv4_address'} is not valide\n";
     290   #   print "Error: for computer $param_ip_or_host on interface $interface, IPv4 $ret{'ipv4_address'} is not valide\n";
    291291   #   return %ret;
    292292   #   }
     
    11971197 klask updatedb [--verbose|-v] [--verb-description|-d] [--chk-hostname|-h] [--chk-location|-l] [--no-rebuildsw|-R]
    11981198 klask exportdb [--format|-f txt|html]
    1199  klask removedb IP* computer*
     1199 klask removedb ipv4_addr* computer*
     1200 klask insertdb --ip ipv4_addr --mac mac_addr --network vlan_name
    12001201 klask cleandb  [--verbose|-v] --day number_of_day --repair-dns
    12011202
     
    15731574
    15741575#---------------------------------------------------------------
    1575 sub cmd_addentrydb {
     1576sub cmd_insertdb {
    15761577   my @ARGV = @_;
    15771578
     
    16091610
    16101611   if ($resol_arp{'hostname_fq'} eq 'unknow') {
    1611       print {*STDERR} "Error: DNS name not defined for IP $ip (mandatory)\n";
     1612      print {*STDERR} "Error: DNS name not defined for IPv4 $ip (mandatory)\n";
    16121613      exit 1;
    16131614      }
    16141615
    16151616   if ($resol_arp{'ipv4_address'} ne $ip) {
    1616       print {*STDERR} "Error: IP DNS resolution strange between $ip and $resol_arp{'ipv4_address'}\n";
     1617      print {*STDERR} "Error: IPv4 DNS resolution strange between $ip and $resol_arp{'ipv4_address'}\n";
    16171618      exit 1;
    16181619      }
     
    16241625   for my $current_ip (keys %{$computerdb}) {
    16251626      if ($current_ip eq $ip) {
    1626          print {*STDERR} "Error: IP $ip already exists in the computer database\n";
     1627         print {*STDERR} "Error: IPv4 $ip already exists in the computer database\n";
    16271628         exit 1;
    16281629         }
     
    28492850   print <<'END_HTML';
    28502851<table class="sortable">
    2851  <caption>Klask Free IP Database</caption>
     2852 <caption>Klask Free IPv4 Database</caption>
    28522853 <thead>
    28532854  <tr>
     
    34263427 klask updatedb [--verbose|-v] [--verb-description|-d] [--chk-hostname|-h] [--chk-location|-l] [--no-rebuildsw|-R]
    34273428 klask exportdb [--format|-f txt|html]
    3428  klask removedb IP* computer*
     3429 klask removedb ipv4_addr* computer*
     3430 klask insertdb --ip ipv4_addr --mac mac_addr --network vlan_name
    34293431 klask cleandb  [--verbose|-v] --day number_of_day --repair-dns
    34303432
     
    34693471so other switch cannot find the real downlink port...
    34703472One way to work around this problem is, if you have a computer directly connected on the switch,
    3471 to put this IP as the fake ip for the switch.
     3473to put this IPv4 as the fake ip for the switch.
    34723474The MAC address associated will be use just for the map detection.
    34733475The C<fake-ip> parameter is defined in the config file.
     
    35493551The network parameter C<scan-mode> can have two values: C<active> or C<passive>.
    35503552By default, a network is C<active>.
    3551 This means that an C<fping> command is done at the beginning on all the IP of the network
     3553This means that an C<fping> command is done at the beginning on all the IPv4 of the network
    35523554and the computers that was not detected in this pass, but where their Klask entry is less than one week,
    35533555will have an C<arping>
     
    35713573=head2 removedb
    35723574
    3573  klask removedb IP* computer*
     3575 klask removedb ipv4_addr* computer*
    35743576
    35753577This command remove an entry in the database.
    3576 There is only one kind of parameter, the IP of the computers to be removed.
    3577 You can put as many IP as you want...
     3578There is only one kind of parameter, the IPv4 of the computers to be removed.
     3579You can put as many IPv4 as you want...
    35783580
    35793581Computer DNS names are also a valid entry because a DNS resolver is executed at the beginning.
     3582
     3583=head2 insertdb
     3584
     3585 klask insertdb --ip ipv4_addr --mac mac_addr --network vlan_name
     3586
     3587This command insert an entry in the database.
     3588The IPv4 must not exist previously in the database
     3589and the DNS resolution name muts be active.
     3590
     3591The date or timestamp of the entry will be C<number_of_day> in the past (see L<cleandb>)
     3592from today or from the oldest entry with the same MAC-Address.
     3593This command can be use to add pseudo entry and help in the process to detect bad vlan configuration (see L<bad-vlan-id>).
    35803594
    35813595=head2 cleandb
     
    35873601This could be configure with the global regex parameter C<float-regex> in the configuration file F</etc/klask/klask.conf>.
    35883602This functionality could be use when computer define in VLAN 1
    3589 could have a float IP when they are connected on VLAN 2.
     3603could have a float IPv4 when they are connected on VLAN 2.
    35903604In the Klask database, the float DNS entries are less important.
    35913605
     
    36393653 klask ip-free [--verbose|-v] [--day|-d days-to-death] [--format|-f txt|html] [vlan_name]
    36403654
    3641 This command return IP address that was not use (detected by Klask) at this time.
     3655This command return IPv4 address that was not use (detected by Klask) at this time.
    36423656The list returned could be limited to just one VLAN.
    36433657IP returned could have been never used or no computer have been detected since the number of days specified
     
    36483662   days-to-death: 730
    36493663
    3650 Computer that does not have the good IP but takes a float one (see L</cleandb>) are taken into account.
     3664Computer that does not have the good IPv4 but takes a float one (see L</cleandb>) are taken into account.
    36513665
    36523666
     
    36573671This command return a list of switch port that are not configure with the good VLAN.
    36583672Computer which are in bad VLAN are detected with the float regex parameter (see L</cleandb>)
    3659 and another prior trace where they had the good IP (good DNS name).
     3673and another prior trace where they had the good IPv4 (good DNS name).
    36603674The computer must stay connected on a bad VLAN more than XX days (15 days by default) before alert.
    36613675This parameter could also define in the configuration file F</etc/klask/klask.conf> (see L</CONFIGURATION>).
Note: See TracChangeset for help on using the changeset viewer.