Răsfoiți Sursa

draft: prepare perl backend for use postgresql

root 1 an în urmă
părinte
comite
8551947597

+ 1 - 1
scripts/check_dhcp_pool.pl

@@ -18,7 +18,7 @@ use NetAddr::IP;
 use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use eyelib::net_utils;
 use File::Basename;
 use File::Path;

+ 2 - 3
scripts/dhcp-log.pl

@@ -13,7 +13,7 @@ use lib "/opt/Eye/scripts";
 use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use eyelib::net_utils;
 use strict;
 use warnings;
@@ -95,8 +95,7 @@ if (!$pid) {
         my %leases;
 
         # Create new database handle. If we can't connect, die()
-        my $hdb = DBI->connect("dbi:mysql:database=$DBNAME;host=$DBHOST","$DBUSER","$DBPASS");
-        if ( !defined $hdb ) { die "Cannot connect to mySQL server: $DBI::errstr\n"; }
+        my $hdb = init_db();
 
         #parse log
         my $dhcp_log=File::Tail->new(name=>$log_file,maxinterval=>5,interval=>1,ignore_nonexistant=>1) || die "$log_file not found!";

+ 69 - 22
scripts/eye-statd.pl

@@ -16,12 +16,11 @@ use DateTime;
 use eyelib::config;
 use eyelib::main;
 use eyelib::net_utils;
-use eyelib::mysql;
+use eyelib::database;
 use Socket qw(AF_INET6 inet_ntop);
 use IO::Socket;
 use Data::Dumper;
-
-$debug = 1;
+use threads;
 
 my @router_ref = ();
 my @interfaces = ();
@@ -32,18 +31,17 @@ my %wan_dev;
 my %lan_dev;
 
 my @traffic = ();
+my $saving = 0;
 
 #user statistics for cached data
 my %user_stats;
 
 my $MAXREAD = 9216;
 
-my $childrunning = 0;
-
-my $fork_count = $cpu_count*10;
-
 my $timeshift = get_option($dbh,55)*60;
 
+my $thread_count = $cpu_count;
+
 #save traffic to DB
 my $traf_lastflush = time();
 
@@ -62,7 +60,7 @@ $SIG{HUP} = \&INIT;
 
 sub REAPER {
 	wait;
-	$childrunning = 0;
+	$saving = 0;
 	$SIG{CHLD} = \&REAPER;
 }
 
@@ -76,14 +74,13 @@ sub TERM {
 sub INIT {
 
 # Create new database handle. If we can't connect, die()
-my $hdb = DBI->connect("dbi:mysql:database=$DBNAME;host=$DBHOST","$DBUSER","$DBPASS");
-if ( !defined $hdb ) { die "Cannot connect to mySQL server: $DBI::errstr\n"; }
+my $hdb = init_db();
 
 InitSubnets();
 
 init_option($hdb);
 
-$timeshift = get_option($dbh,55)*60;
+$timeshift = get_option($hdb,55)*60;
 
 @router_ref = get_records_sql($hdb,"SELECT * FROM devices WHERE deleted=0 AND device_type=2 AND snmp_version>0 ORDER by ip" );
 @interfaces = get_records_sql($hdb,"SELECT * FROM `device_l3_interfaces` ORDER by device_id" );
@@ -103,7 +100,7 @@ foreach my $row (@interfaces) {
     }
 
 #get userid list
-my @auth_list_ref = get_records_sql($dbh,"SELECT id,ip,save_traf FROM User_auth where deleted=0 ORDER by id");
+my @auth_list_ref = get_records_sql($hdb,"SELECT id,ip,save_traf FROM User_auth where deleted=0 ORDER by id");
 
 foreach my $row (@auth_list_ref) {
     $user_stats{$row->{ip}}{auth_id}=$row->{id};
@@ -402,13 +399,14 @@ sub flush_traffic {
 
 my $force = shift || 0;
 
-if (!$force && ($childrunning || ((time - $traf_lastflush) < $timeshift))) { return; }
+if (!$force && ($saving || ((time - $traf_lastflush) < $timeshift))) { return; }
+
+$saving++;
 
-$childrunning = 1;
 my $pid = fork();
 
 if (!defined $pid) {
-    $childrunning = 0;
+    $saving = 0;
     print "cannot fork! Save traffic and exit...\n";
     } elsif ($pid != 0) {
         # in parent
@@ -419,7 +417,15 @@ if (!defined $pid) {
     }
 
 #create oper-cache
-my @flush_table = @traffic;
+my @flush_table = ();
+
+push(@flush_table,@traffic);
+
+#clean main cache
+INIT();
+
+print "Start save";
+timestamp();
 
 my $hdb=init_db();
 
@@ -505,11 +511,11 @@ my @detail_array = ($user_stats{$user_ip}->{auth_id},$router_id,$full_time,$traf
 push(@detail_traffic,\@detail_array);
 }
 
-if (scalar(@detail_traffic)) {
-    db_log_debug($hdb,"Start write traffic detail to DB. ".scalar @detail_traffic." lines count") if ($debug);
-    batch_db_sql_cached("INSERT INTO Traffic_detail (auth_id,router_id,timestamp,proto,src_ip,dst_ip,src_port,dst_port,bytes,pkt) VALUES(?,?,?,?,?,?,?,?,?,?)",\@detail_traffic);
-    db_log_debug($hdb,"Write traffic detail to DB stopped") if ($debug);
-    }
+@flush_table=();
+
+print "Stop calc stats";
+timestamp();
+
 
 #save statistics
 
@@ -572,16 +578,57 @@ foreach my $user_ip (keys %user_stats) {
 	}
     }
 
+print "Stop generate statistics";
+timestamp();
+
 #print Dumper(\@batch_sql_traf) if ($debug);
 
 #update statistics in DB
 batch_db_sql($hdb,\@batch_sql_traf);
+
+print "Stop write statistics";
+timestamp();
+
 db_log_debug($hdb,"Recalc quotes started");
 foreach my $router_id (keys %routers_found) { recalc_quotes($hdb,$router_id); }
 db_log_debug($hdb,"Recalc quotes stopped");
 
+print "Stop recalc quotes";
+timestamp();
+
+if (scalar(@detail_traffic)) {
+    db_log_debug($hdb,"Start write traffic detail to DB. ".scalar @detail_traffic." lines count") if ($debug);
+    if ($config_ref{DBTYPE} eq 'mysql') {
+		batch_db_sql_csv("Traffic_detail", \@detail_traffic);
+	} else {
+        my $index = 0;
+	my @tmp=();
+        my $item_per_thread = int(scalar @detail_traffic / $thread_count);
+        my @threads=();
+	foreach my $row (@detail_traffic) {
+    	    push(@tmp,$row);
+            $index++;
+	    if ($index<=$item_per_thread) { next; }
+    	    my @tmp1=();
+            push(@tmp1,@tmp);
+	    @tmp=();
+	    push(@threads, threads->create(\&batch_db_sql_csv, "Traffic_detail", \@tmp1));
+    	    }
+        if (scalar(@tmp)) {
+		push(@threads, threads->create(\&batch_db_sql_csv, "Traffic_detail", \@tmp));
+    	    }
+	    foreach my $t (@threads) { $t->join(); }
+	    @tmp=();
+	}
+    @detail_traffic = ();
+    print "Stop insert detalization ";
+    timestamp();
+    db_log_debug($hdb,"Write traffic detail to DB stopped") if ($debug);
+    }
+
 $hdb->disconnect();
 
-exit;
+$saving = 0;
 
+exit;
 }

+ 1 - 0
scripts/eyelib/config.pm

@@ -128,6 +128,7 @@ $config_ref{pid_file}="/var/run/".$FN[-1];
 $config_ref{log_dir}=$Config->{_}->{log_dir} || '/opt/Eye/scripts/log';
 $config_ref{log_common}=$config_ref{log_dir}."/$FN[-1].log";
 $config_ref{dhcpd_conf}=$Config->{_}->{dhcpd_conf} || "/etc/dnsmasq.d";
+$config_ref{DBTYPE}	= $Config->{_}->{DBTYPE} || 'mysql';
 $config_ref{DBHOST}	= $Config->{_}->{DBSERVER} || '127.0.0.1';
 $config_ref{DBNAME}	= $Config->{_}->{DBNAME} || "stat";
 $config_ref{DBUSER}	= $Config->{_}->{DBUSER} || "rstat";

+ 64 - 12
scripts/eyelib/mysql.pm → scripts/eyelib/database.pm

@@ -1,4 +1,4 @@
-package eyelib::mysql;
+package eyelib::database;
 
 #
 # Copyright (C) Roman Dmitiriev, rnd@rajven.ru
@@ -18,7 +18,7 @@ use Net::Patricia;
 use eyelib::net_utils;
 use Data::Dumper;
 use DateTime;
-use POSIX;
+use File::Temp qw(tempfile);
 use DBI;
 
 our @ISA = qw(Exporter);
@@ -26,6 +26,7 @@ our @ISA = qw(Exporter);
 our @EXPORT = qw(
 batch_db_sql
 batch_db_sql_cached
+batch_db_sql_csv
 db_log_warning
 db_log_debug
 db_log_error
@@ -160,11 +161,13 @@ $db->{AutoCommit} = 1;
 #---------------------------------------------------------------------------------------------------------------
 
 sub batch_db_sql_cached {
-my $db = DBI->connect("dbi:mysql:database=$DBNAME;host=$DBHOST","$DBUSER","$DBPASS", { RaiseError => 0, AutoCommit => 0 });
-if ( !defined $db ) { die "Cannot connect to mySQL server: $DBI::errstr\n"; }
-$db->do('SET NAMES utf8mb4');
-$db->{'mysql_enable_utf8'} = 1;
-$db->{'mysql_auto_reconnect'} = 1;
+my $db = DBI->connect("dbi:$config_ref{DBTYPE}:database=$DBNAME;host=$DBHOST","$DBUSER","$DBPASS", { RaiseError => 0, AutoCommit => 0 });
+if ( !defined $db ) { die "Cannot connect to $config_ref{DBTYPE} server: $DBI::errstr\n"; }
+if ($config_ref{DBTYPE} eq 'mysql') {
+    $db->do('SET NAMES utf8mb4');
+    $db->{'mysql_enable_utf8'} = 1;
+    $db->{'mysql_auto_reconnect'} = 1;
+    }
 my $table= shift;
 my $batch_sql=shift;
 return if (!$db);
@@ -181,6 +184,47 @@ $db->disconnect();
 
 #---------------------------------------------------------------------------------------------------------------
 
+sub batch_db_sql_csv {
+my $db;
+if ($config_ref{DBTYPE} eq 'mysql') {
+    $db = DBI->connect("dbi:$config_ref{DBTYPE}:database=$DBNAME;host=$DBHOST","$DBUSER","$DBPASS", { RaiseError => 1, mysql_local_infile=> 1 });
+    } else {
+    $db = DBI->connect("dbi:$config_ref{DBTYPE}:database=$DBNAME;host=$DBHOST","$DBUSER","$DBPASS", { RaiseError => 1 });
+    }
+if ( !defined $db ) { die "Cannot connect to $config_ref{DBTYPE} server: $DBI::errstr\n"; }
+
+return if (!$db);
+
+if ($config_ref{DBTYPE} eq 'mysql') {
+    $db->do('SET NAMES utf8mb4');
+    $db->{'mysql_enable_utf8'} = 1;
+    $db->{'mysql_auto_reconnect'} = 1;
+    }
+
+my $table= shift;
+my $data = shift;
+my $fh = File::Temp->new(UNLINK=>0);
+my $fname = $fh->filename;
+binmode($fh,':utf8');
+foreach my $row (@$data) {
+    next if (!$row);
+    my @tmp = @$row;
+    my $values = 'NULL';
+    for (my $i = 0; $i <@tmp ; $i++) {
+	$values.=',"'.$tmp[$i].'"';
+	}
+    $values =~s/,$//;
+    print $fh $values."\r\n";
+    }
+close $fh;
+my $query = qq{ LOAD DATA LOCAL INFILE '$fname' INTO TABLE $table FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'; };
+$db->do($query);
+$db->disconnect;
+#File::Temp::cleanup();
+}
+
+#---------------------------------------------------------------------------------------------------------------
+
 sub do_sql {
 my $db=shift;
 my $sql=shift;
@@ -190,7 +234,13 @@ if ($sql!~/^select /i) { log_debug($sql); }
 my $sql_prep = $db->prepare($sql) or die "Unable to prepare $sql: " . $db->errstr;
 my $sql_ref;
 my $rv = $sql_prep->execute() or die "Unable to execute $sql: " . $db->errstr;
-if ($sql=~/^insert/i) { $sql_ref = $sql_prep->{mysql_insertid}; }
+if ($sql=~/^insert/i) {
+    if ($config_ref{DBTYPE} eq 'mysql') {
+        $sql_ref = $sql_prep->{mysql_insertid};
+	} else {
+        ($sql_ref) = $db->selectrow_array("SELECT lastval()");
+	}
+    }
 if ($sql=~/^select /i) { $sql_ref = $sql_prep->fetchall_arrayref() or die "Unable to select $sql: " . $db->errstr; };
 $sql_prep->finish();
 return $sql_ref;
@@ -289,11 +339,13 @@ if ($log_level >= $L_WARNING) {
 
 sub init_db {
 # Create new database handle. If we can't connect, die()
-my $db = DBI->connect("dbi:mysql:database=$DBNAME;host=$DBHOST","$DBUSER","$DBPASS", { RaiseError => 0, AutoCommit => 1 });
+my $db = DBI->connect("dbi:$config_ref{DBTYPE}:database=$DBNAME;host=$DBHOST","$DBUSER","$DBPASS", { RaiseError => 0, AutoCommit => 1 });
 if ( !defined $db ) { die "Cannot connect to mySQL server: $DBI::errstr\n"; }
-$db->do('SET NAMES utf8mb4');
-$db->{'mysql_enable_utf8'} = 1;
-$db->{'mysql_auto_reconnect'} = 1;
+if ($config_ref{DBTYPE} eq 'mysql') {
+    $db->do('SET NAMES utf8mb4');
+    $db->{'mysql_enable_utf8'} = 1;
+    $db->{'mysql_auto_reconnect'} = 1;
+    }
 return $db;
 }
 

+ 1 - 0
scripts/eyelib/main.pm

@@ -176,6 +176,7 @@ die ($_[0]);
 
 sub timestamp {
 my $worktime = time()-$BASETIME;
+print "TimeStamp: $worktime sec.\n";
 log_info("TimeStamp: $worktime sec.");
 }
 

+ 1 - 1
scripts/eyelib/nagios.pm

@@ -11,7 +11,7 @@ use base 'Exporter';
 use vars qw(@EXPORT @ISA);
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use Time::Local;
 use Data::Dumper;
 

+ 1 - 1
scripts/fetch_new_arp.pl

@@ -21,7 +21,7 @@ use eyelib::config;
 use eyelib::main;
 use eyelib::net_utils;
 use eyelib::snmp;
-use eyelib::mysql;
+use eyelib::database;
 use NetAddr::IP;
 use Fcntl qw(:flock);
 use Parallel::ForkManager;

+ 1 - 1
scripts/garbage.pl

@@ -14,7 +14,7 @@ use strict;
 use DBI;
 use Date::Parse;
 use eyelib::config;
-use eyelib::mysql;
+use eyelib::database;
 use eyelib::net_utils;
 use DateTime;
 use Fcntl qw(:flock);

+ 1 - 1
scripts/gen_nagios_config.pl

@@ -19,7 +19,7 @@ use Net::Ping;
 use eyelib::config;
 use eyelib::main;
 use eyelib::nagios;
-use eyelib::mysql;
+use eyelib::database;
 use Fcntl qw(:flock);
 
 open(SELF,"<",$0) or die "Cannot open $0 - $!";

+ 2 - 3
scripts/hmonitor.pl

@@ -12,7 +12,7 @@ use strict;
 use Time::Local;
 use FileHandle;
 use eyelib::config;
-use eyelib::mysql;
+use eyelib::database;
 use eyelib::main;
 use eyelib::nagios;
 use Data::Dumper;
@@ -85,8 +85,7 @@ setpriority(0,0,19);
 while(1) {
 eval {
 
-my $hdb = DBI->connect("dbi:mysql:database=$DBNAME;host=$DBHOST","$DBUSER","$DBPASS");
-if ( !defined $hdb ) { die "Cannot connect to mySQL server: $DBI::errstr\n"; }
+my $hdb = init_db();
 
 #parse log
 my $nagios_log=File::Tail->new(name=>$config_ref{nagios_event_socket},maxinterval=>5,interval=>1,ignore_nonexistant=>1) || die "$config_ref{nagios_event_socket} not found!";

+ 1 - 1
scripts/import-system-dev.pl

@@ -11,7 +11,7 @@ use lib "$Bin/";
 use Data::Dumper;
 use Rstat::config;
 use Rstat::main;
-use Rstat::mysql;
+use Rstat::database;
 use Rstat::net_utils;
 use strict;
 use warnings;

+ 1 - 1
scripts/parse_flow.pl

@@ -20,7 +20,7 @@ use Socket;
 use eyelib::config;
 use eyelib::main;
 use eyelib::net_utils;
-use eyelib::mysql;
+use eyelib::database;
 use Parallel::ForkManager;
 
 if (!$ARGV[0]) { exit 110; }

+ 1 - 1
scripts/print-dnsmasq.pl

@@ -18,7 +18,7 @@ use NetAddr::IP;
 use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use eyelib::net_utils;
 use File::Basename;
 use File::Path;

+ 1 - 1
scripts/restart_port_snmp.pl

@@ -13,7 +13,7 @@ use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
 use eyelib::net_utils;
-use eyelib::mysql;
+use eyelib::database;
 use eyelib::snmp;
 use Net::SNMP qw(:snmp);
 

+ 2 - 3
scripts/stat-sync.pl

@@ -13,7 +13,7 @@ use lib "/opt/Eye/scripts";
 use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use eyelib::net_utils;
 use strict;
 use warnings;
@@ -84,9 +84,8 @@ if (!$pid) {
     while (1) {
         eval {
         # Create new database handle. If we can't connect, die()
-        my $hdb = DBI->connect("dbi:mysql:database=$DBNAME;host=$DBHOST","$DBUSER","$DBPASS");
+        my $hdb = init_db();
         if (time()-$last_refresh_config>=60) { init_option($hdb); }
-        if ( !defined $hdb ) { die "Cannot connect to mySQL server: $DBI::errstr\n"; }
         $urgent_sync=get_option($hdb,50);
         if ($urgent_sync) {
 	    #clean changed for dynamic clients or hotspot

+ 1 - 1
scripts/sync_mikrotik.pl

@@ -20,7 +20,7 @@ use eyelib::cmd;
 use Net::Patricia;
 use Date::Parse;
 use eyelib::net_utils;
-use eyelib::mysql;
+use eyelib::database;
 use DBI;
 use Fcntl qw(:flock);
 use Parallel::ForkManager;

+ 1 - 1
scripts/sync_mikrotik_poe_monitor.pl

@@ -16,7 +16,7 @@ use eyelib::cmd;
 use Net::Patricia;
 use Date::Parse;
 use eyelib::net_utils;
-use eyelib::mysql;
+use eyelib::database;
 use DBI;
 use utf8;
 use Fcntl qw(:flock);

+ 2 - 3
scripts/syslog-stat.pl

@@ -15,7 +15,7 @@ use Time::Local;
 use FileHandle;
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use Data::Dumper;
 use DBI;
 use Time::Local;
@@ -126,8 +126,7 @@ my %warning_patterns = (
 
 while (1) {
 eval {
-    my $db = DBI->connect("dbi:mysql:database=$DBNAME;host=$DBHOST","$DBUSER","$DBPASS");
-    if ( !defined $dbh ) { die "Cannot connect to mySQL server: $DBI::errstr\n"; }
+    my $db = init_db();
     open(SYSLOG,$socket_path) || die("Error open fifo socket $socket_path: $!");
     while (my $logline = <SYSLOG>) {
         next unless defined $logline;

+ 1 - 1
scripts/updates/db-patch-mysql-utf8.pl

@@ -10,7 +10,7 @@ use lib "/opt/Eye/scripts";
 use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use strict;
 use warnings;
 

+ 1 - 1
scripts/updates/upgrade.pl

@@ -9,7 +9,7 @@ use FindBin '$Bin';
 use lib "/opt/Eye/scripts";
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use strict;
 use warnings;
 

+ 1 - 1
scripts/utils/backupcfg.pl

@@ -16,7 +16,7 @@ use FileHandle;
 use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use eyelib::net_utils;
 use eyelib::cmd;
 use Fcntl qw(:flock);

+ 1 - 1
scripts/utils/bind/print-dns-zones.pl

@@ -13,7 +13,7 @@ use Net::Patricia;
 use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 
 setpriority(0,0,19);
 

+ 1 - 1
scripts/utils/mac-oids/update-mac-vendors.pl

@@ -10,7 +10,7 @@ use lib "/opt/Eye/scripts";
 use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use eyelib::net_utils;
 use strict;
 use warnings;

+ 1 - 1
scripts/utils/oxidized/print_devices_oxi.pl

@@ -13,7 +13,7 @@ use Data::Dumper;
 use Socket;
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 
 my @router_list = get_records_sql($dbh,"SELECT * FROM devices WHERE device_type<=2" );
 

+ 1 - 1
scripts/utils/print-ou-ip.pl

@@ -14,7 +14,7 @@ use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
 use eyelib::net_utils;
-use eyelib::mysql;
+use eyelib::database;
 
 my $OU_ID=$ARGV[0];
 my $ou_filter=" and L.ou_id=$OU_ID ";

+ 1 - 1
scripts/utils/print_cacti_create.pl

@@ -8,7 +8,7 @@ use strict;
 use DBI;
 use Date::Parse;
 use eyelib::config;
-use eyelib::mysql;
+use eyelib::database;
 use utf8;
 
 

+ 1 - 1
scripts/utils/print_cacti_hosts.pl

@@ -9,7 +9,7 @@ use strict;
 use DBI;
 use Date::Parse;
 use eyelib::config;
-use eyelib::mysql;
+use eyelib::database;
 use utf8;
 
 ##### unknown mac clean ############

+ 1 - 1
scripts/utils/print_devices.pl

@@ -16,7 +16,7 @@ use Socket;
 use eyelib::config;
 use eyelib::main;
 use eyelib::net_utils;
-use eyelib::mysql;
+use eyelib::database;
 use NetAddr::IP;
 
 setpriority(0,0,19);

+ 1 - 1
scripts/utils/reaply_rules.pl

@@ -20,7 +20,7 @@ use NetAddr::IP;
 use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use eyelib::net_utils;
 use File::Basename;
 use File::Path;

+ 1 - 1
scripts/utils/scan_ipcam.pl

@@ -19,7 +19,7 @@ use Net::Ping;
 use Net::SNMP qw(ticks_to_time TRANSLATE_NONE);
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use Fcntl qw(:flock);
 
 open(SELF,"<",$0) or die "Cannot open $0 - $!";

+ 1 - 1
scripts/utils/set_dns_record.pl

@@ -18,7 +18,7 @@ use NetAddr::IP;
 use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
-use eyelib::mysql;
+use eyelib::database;
 use eyelib::net_utils;
 use File::Basename;
 use File::Path;

+ 1 - 1
scripts/utils/set_port_descr.pl

@@ -17,7 +17,7 @@ use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
 use eyelib::net_utils;
-use eyelib::mysql;
+use eyelib::database;
 use eyelib::snmp;
 use eyelib::cmd;
 use Net::SNMP qw(:snmp);

+ 1 - 1
scripts/utils/trap_restart.pl

@@ -12,7 +12,7 @@ use FileHandle;
 use Data::Dumper;
 use Rstat::config;
 use Rstat::main;
-use Rstat::mysql;
+use Rstat::database;
 use Rstat::net_utils;
 use DBI;
 

+ 1 - 1
scripts/utils/win32/print-dhcpd-netsh.pl

@@ -13,7 +13,7 @@ use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
 use eyelib::net_utils;
-use eyelib::mysql;
+use eyelib::database;
 
 my $time_shift=$ARGV[0];
 

+ 1 - 1
scripts/utils/win32/sync-dhcpd-netsh.pl

@@ -13,7 +13,7 @@ use Data::Dumper;
 use eyelib::config;
 use eyelib::main;
 use eyelib::net_utils;
-use eyelib::mysql;
+use eyelib::database;
 use Text::Iconv;
 
 exit;