Several bug fixes for remote agents,CLI lead loading, vdc_db_query
docs updated git-svn-id: svn://192.168.202.10@775 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
# It is good practice to keep this program running by placing the associated
|
||||
# KEEPALIVE script running every minute to ensure this program is always running
|
||||
#
|
||||
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 50215-0954 - First version of script
|
||||
@@ -34,6 +34,7 @@
|
||||
# 70214-1243 - Added queuemetrics_log_id field to queue_log logging
|
||||
# 70222-1606 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL
|
||||
# 70417-1346 - Fixed bug that would add unneeded simulated agent lines
|
||||
# 80128-0105 - Fixed calls_today bug
|
||||
#
|
||||
|
||||
### begin parsing run-time options ###
|
||||
@@ -240,18 +241,20 @@ while($one_day_interval > 0)
|
||||
&event_logger;
|
||||
|
||||
##### grab number of calls today in this campaign and increment
|
||||
$stmt="SELECT calls_today FROM vicidial_live_agents WHERE extension LIKE \"R/%\";";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {print "$stmt\n";}
|
||||
$vla_cc_ct = mysql_num_rows($rslt);
|
||||
$stmtA="SELECT calls_today FROM vicidial_live_agents WHERE extension LIKE \"R/%\";";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$vla_cc_ct=$sthA->rows;
|
||||
if ($vla_cc_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$calls_today =$row[0];
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$calls_today = "$aryA[0]";
|
||||
$rec_count++;
|
||||
}
|
||||
else
|
||||
{$calls_today ='0';}
|
||||
$calls_today++;
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "UPDATE vicidial_live_agents set status='INCALL', last_call_time='$SQLdate',comments='REMOTE',calls_today='$calls_today' where server_ip='$server_ip' and status IN('QUEUE') and extension LIKE \"R/%\";";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# It is recommended that you run this program on the local Asterisk machine
|
||||
#
|
||||
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
#
|
||||
# CHANGES
|
||||
@@ -25,6 +25,7 @@
|
||||
# 70510-1518 - Added campaign and system duplicate check and phonecode override
|
||||
# 70801-0912 - Added called count and status to import leads format (fields 24 and 25)
|
||||
# 70815-2128 - Added entry_date to import leads format (field 26)
|
||||
# 80128-0105 - Fixed bugs in file loading
|
||||
#
|
||||
|
||||
$secX = time();
|
||||
@@ -194,11 +195,11 @@ else
|
||||
{
|
||||
print "no command line options set\n";
|
||||
$args = "";
|
||||
$i=0;
|
||||
$forcelistid = '';
|
||||
}
|
||||
### end parsing run-time options ###
|
||||
|
||||
$i=0;
|
||||
$US = '_';
|
||||
$phone_list = '|';
|
||||
|
||||
@@ -277,8 +278,8 @@ if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOC
|
||||
$multi_insert_counter=0;
|
||||
$multistmt='';
|
||||
|
||||
if ($DB)
|
||||
# while (<infile>)
|
||||
#if ($DB)
|
||||
while (<infile>)
|
||||
{
|
||||
|
||||
# print "$a| $number\n";
|
||||
|
||||
+19
-19
@@ -31,16 +31,16 @@ PHASE 1: INSTALLING ASTERISK
|
||||
1. follow these command line steps:
|
||||
mkdir /usr/src/asterisk
|
||||
cd /usr/src/asterisk
|
||||
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.24.tar.gz
|
||||
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.21.tar.gz
|
||||
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.5.tar.gz
|
||||
gunzip asterisk-1.2.24.tar.gz
|
||||
tar xvf asterisk-1.2.24.tar
|
||||
gunzip zaptel-1.2.21.tar.gz
|
||||
tar xvf zaptel-1.2.21.tar
|
||||
gunzip libpri-1.2.5.tar.gz
|
||||
tar xvf libpri-1.2.5.tar
|
||||
cd ./zaptel-1.2.21
|
||||
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.26.2.tar.gz
|
||||
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.23.tar.gz
|
||||
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.7.tar.gz
|
||||
gunzip asterisk-1.2.26.2.tar.gz
|
||||
tar xvf asterisk-1.2.26.2.tar
|
||||
gunzip zaptel-1.2.23.tar.gz
|
||||
tar xvf zaptel-1.2.23.tar
|
||||
gunzip libpri-1.2.7.tar.gz
|
||||
tar xvf libpri-1.2.7.tar
|
||||
cd ./zaptel-1.2.23
|
||||
wget http://www.freedomphones.net/files/newt-0.51.6.tar.gz
|
||||
gunzip newt-0.51.6.tar.gz
|
||||
tar xvf newt-0.51.6.tar
|
||||
@@ -54,11 +54,11 @@ make clean
|
||||
make zttool
|
||||
make
|
||||
make install
|
||||
cd ../libpri-1.2.5
|
||||
cd ../libpri-1.2.7
|
||||
make clean
|
||||
make
|
||||
make install
|
||||
cd ../asterisk-1.2.24
|
||||
cd ../asterisk-1.2.26.2
|
||||
(1.2 tree) If you want to include Answering Machine Detection ability
|
||||
you will need to download app_amd.c and amd.conf and alter the
|
||||
apps/Makefile to compile it properly
|
||||
@@ -73,11 +73,11 @@ cd ../asterisk-1.2.24
|
||||
wget http://www.eflo.net/files/amd2.conf
|
||||
mkdir /etc/asterisk
|
||||
mv amd2.conf /etc/asterisk/amd.conf
|
||||
*OPTIONAL*(1.2.23 thru 1.2.24) apply the meetme DTMF passthru patch
|
||||
*OPTIONAL*(1.2.23 thru 1.2.26.2) apply the meetme DTMF passthru patch
|
||||
wget http://www.eflo.net/files/meetme_DTMF_passthru-1.2.23.patch
|
||||
patch -p1 < ./meetme_DTMF_passthru-1.2.23.patch
|
||||
- File to patch: app_meetme.c
|
||||
*OPTIONAL*(1.2.12.1 thru 1.2.24) apply the meetme volume control patch
|
||||
*OPTIONAL*(1.2.12.1 thru 1.2.26.2) apply the meetme volume control patch
|
||||
*Different patches available for 1.2.7.1 through 1.2.14
|
||||
wget http://www.eflo.net/files/meetme_volume_control_1.2.16.patch
|
||||
patch -p1 < ./meetme_volume_control_1.2.16.patch
|
||||
@@ -89,7 +89,7 @@ cd ../asterisk-1.2.24
|
||||
patch -p1 < ./cli_chan_concise_delimiter.patch
|
||||
- File to patch: cli.c
|
||||
|
||||
*OPTIONAL*(1.2.14 thru 1.2.24) rewrite of waitforsilence
|
||||
*OPTIONAL*(1.2.14 thru 1.2.26.2) rewrite of waitforsilence
|
||||
wget http://www.eflo.net/files/app_waitforsilence.c
|
||||
mv -f app_waitforsilence.c apps/app_waitforsilence.c
|
||||
|
||||
@@ -267,7 +267,7 @@ use asterisk;
|
||||
##### make sure on these queries that you change the server_ip "10.10.10.15"
|
||||
##### to the server IP that you are using
|
||||
|
||||
insert into servers (server_id,server_description,server_ip,active,asterisk_version)values('TESTasterisk','Test install of Asterisk server', '10.10.10.15','Y','1.2.24');
|
||||
insert into servers (server_id,server_description,server_ip,active,asterisk_version)values('TESTast','Test install of Asterisk server', '10.10.10.15','Y','1.2.26.2');
|
||||
|
||||
insert into server_updater values('10.10.10.15','');
|
||||
|
||||
@@ -554,9 +554,9 @@ PHASE 5: ADDING STARTUP ENTRIES FOR ASTGUICLIENT/VICIDIAL SCRIPTS
|
||||
# /usr/share/astguiclient/ip_relay/relay_control start 2>/dev/null 1>&2
|
||||
|
||||
# Disable console blanking and powersaving
|
||||
/usr/bin/setterm -blank
|
||||
/usr/bin/setterm -powersave off
|
||||
/usr/bin/setterm -powerdown
|
||||
setterm -blank
|
||||
setterm -powersave off
|
||||
setterm -powerdown
|
||||
|
||||
### start time server
|
||||
/usr/local/bin/ntpdate -u 18.145.0.30
|
||||
|
||||
@@ -97,7 +97,6 @@ TESTTRUNK = Zap/g2
|
||||
TESTSIPTRUNK = SIP/VICItest:test@10.10.10.16:5060
|
||||
|
||||
[default]
|
||||
;exten => _91999NXXXXXX,1,AGI(call_log.agi)
|
||||
exten => _91999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
|
||||
exten => _91999NXXXXXX,2,Dial(${TESTTRUNK}/${EXTEN:2},,tTo)
|
||||
exten => _91999NXXXXXX,3,Hangup
|
||||
@@ -105,3 +104,32 @@ exten => _91999NXXXXXX,3,Hangup
|
||||
exten => 999999999999,1,Answer
|
||||
exten => 999999999999,2,Dial(${TESTSIPTRUNK}/${EXTEN},,tTo)
|
||||
exten => 999999999999,2,Hangup
|
||||
|
||||
|
||||
In the sip.conf file of the test server:
|
||||
register => ASTtest2:test@10.10.10.16:5060
|
||||
|
||||
[VICItest]
|
||||
disallow=all
|
||||
allow=ulaw
|
||||
type=friend
|
||||
username=VICItest
|
||||
secret=test
|
||||
host=dynamic
|
||||
dtmfmode=inband
|
||||
defaultip=10.10.10.16
|
||||
qualify=1000
|
||||
|
||||
|
||||
In the sip.conf file of the control server:
|
||||
|
||||
[VICItest]
|
||||
disallow=all
|
||||
allow=ulaw
|
||||
type=friend
|
||||
username=VICItest
|
||||
secret=test
|
||||
host=dynamic
|
||||
dtmfmode=inband
|
||||
defaultip=10.10.10.16
|
||||
qualify=1000
|
||||
|
||||
@@ -12,23 +12,32 @@ cd make-3.81
|
||||
make
|
||||
make install
|
||||
|
||||
cd /usr/local
|
||||
wget http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-4.0/mysql-4.0.27.tar.gz
|
||||
gunzip mysql-4.0.27.tar.gz
|
||||
tar xvf mysql-4.0.27.tar
|
||||
cd mysql-4.0.27
|
||||
cd /usr/local/
|
||||
wget http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-5.0/mysql-5.0.45.tar.gz
|
||||
gunzip mysql-5.0.45.tar.gz
|
||||
tar xvf mysql-5.0.45.tar
|
||||
cd mysql-5.0.45
|
||||
groupadd mysql
|
||||
useradd -g mysql mysql
|
||||
./configure --prefix=/usr/local/mysql --enable-large-files --enable-shared=yes --with-readline
|
||||
./configure --prefix=/usr/local/mysql --enable-shared=yes --with-readline --enable-thread-safe-client --enable-large-files --enable-assembler --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-big-tables
|
||||
make
|
||||
make install
|
||||
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin/
|
||||
export PATH
|
||||
cp /usr/local/mysql-5.0.45/libmysql/.libs/libmysqlclient.so /usr/lib/
|
||||
cp /usr/local/mysql-5.0.45/libmysql/.libs/libmysqlclient.so.15 /usr/lib/
|
||||
cd /usr/local/mysql-5.0.45
|
||||
scripts/mysql_install_db
|
||||
chown -R root /usr/local/mysql
|
||||
chown -R mysql /usr/local/mysql/var
|
||||
chgrp -R mysql /usr/local/mysql
|
||||
cp support-files/my-medium.cnf /etc/my.cnf
|
||||
cp support-files/my-huge.cnf /etc/my.cnf
|
||||
/usr/local/mysql/bin/mysqld_safe --user=mysql --skip-name-resolve --skip-host-cache &
|
||||
ln -s /tmp/mysql.sock /var/run/mysql/mysql.sock
|
||||
vi /etc/my.cnf
|
||||
# add this line below 'skip-locking'
|
||||
skip-name-resolve
|
||||
# comment out the line 'log-bin=mysql-bin'
|
||||
|
||||
|
||||
perl -MCPAN -e shell
|
||||
@@ -169,7 +178,7 @@ make install
|
||||
|
||||
|
||||
cd /usr/local
|
||||
wget http://apache.secsup.org/dist/httpd/httpd-2.0.61.tar.gz
|
||||
wget http://mirror.candidhosting.com/pub/apache/httpd/httpd-2.0.61.tar.gz
|
||||
gunzip httpd-2.0.61.tar.gz
|
||||
tar xvf httpd-2.0.61.tar
|
||||
wget http://us2.php.net/distributions/php-4.4.7.tar.gz
|
||||
@@ -288,16 +297,16 @@ make install
|
||||
|
||||
mkdir /usr/src/asterisk
|
||||
cd /usr/src/asterisk
|
||||
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.24.tar.gz
|
||||
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.21.tar.gz
|
||||
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.5.tar.gz
|
||||
gunzip asterisk-1.2.24.tar.gz
|
||||
tar xvf asterisk-1.2.24.tar
|
||||
gunzip zaptel-1.2.21.tar.gz
|
||||
tar xvf zaptel-1.2.21.tar
|
||||
gunzip libpri-1.2.5.tar.gz
|
||||
tar xvf libpri-1.2.5.tar
|
||||
cd ./zaptel-1.2.21
|
||||
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.26.2.tar.gz
|
||||
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.23.tar.gz
|
||||
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.7.tar.gz
|
||||
gunzip asterisk-1.2.26.2.tar.gz
|
||||
tar xvf asterisk-1.2.26.2.tar
|
||||
gunzip zaptel-1.2.23.tar.gz
|
||||
tar xvf zaptel-1.2.23.tar
|
||||
gunzip libpri-1.2.7.tar.gz
|
||||
tar xvf libpri-1.2.7.tar
|
||||
cd ./zaptel-1.2.23
|
||||
wget http://www.freedomphones.net/files/newt-0.51.6.tar.gz
|
||||
gunzip newt-0.51.6.tar.gz
|
||||
tar xvf newt-0.51.6.tar
|
||||
@@ -311,11 +320,11 @@ make clean
|
||||
make zttool
|
||||
make
|
||||
make install
|
||||
cd ../libpri-1.2.5
|
||||
cd ../libpri-1.2.7
|
||||
make clean
|
||||
make
|
||||
make install
|
||||
cd ../asterisk-1.2.24
|
||||
cd ../asterisk-1.2.26.2
|
||||
cd apps
|
||||
wget http://www.eflo.net/files/app_amd2.c
|
||||
mv app_amd2.c app_amd.c
|
||||
@@ -386,6 +395,10 @@ mv -f *.mp3 ../orig-mp3/
|
||||
|
||||
|
||||
############# INSTRUCTIONS FOR Asterik 1.4 release ####################
|
||||
Downgrading back to 1.2.X from 1.4.X:
|
||||
rm -f /usr/lib/asterisk/modules/*
|
||||
rm -f /usr/include/asterisk/*
|
||||
|
||||
|
||||
NOTE: If you want to use Asterisk 1.4, you will need to make sure that you set
|
||||
the servers table "asterisk_version" field to the proper version number and you
|
||||
@@ -412,24 +425,24 @@ rm -f /usr/lib/asterisk/modules/pbx_functions.so
|
||||
|
||||
mkdir /usr/src/asterisk-1.4
|
||||
cd /usr/src/asterisk-1.4
|
||||
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.14.tar.gz
|
||||
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.6.tar.gz
|
||||
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.4.2.tar.gz
|
||||
gunzip asterisk-1.4.14.tar.gz
|
||||
tar xvf asterisk-1.4.14.tar
|
||||
gunzip zaptel-1.4.6.tar.gz
|
||||
tar xvf zaptel-1.4.6.tar
|
||||
gunzip libpri-1.4.2.tar.gz
|
||||
tar xvf libpri-1.4.2.tar
|
||||
cd ./zaptel-1.4.6
|
||||
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.17.tar.gz
|
||||
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.8.tar.gz
|
||||
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.4.3.tar.gz
|
||||
gunzip asterisk-1.4.17.tar.gz
|
||||
tar xvf asterisk-1.4.17.tar
|
||||
gunzip zaptel-1.4.8.tar.gz
|
||||
tar xvf zaptel-1.4.8.tar
|
||||
gunzip libpri-1.4.3.tar.gz
|
||||
tar xvf libpri-1.4.3.tar
|
||||
cd ./zaptel-1.4.8
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
cd ../libpri-1.4.2
|
||||
cd ../libpri-1.4.3
|
||||
make clean
|
||||
make
|
||||
make install
|
||||
cd ../asterisk-1.4.14
|
||||
cd ../asterisk-1.4.17
|
||||
wget http://www.eflo.net/files/enter.h
|
||||
wget http://www.eflo.net/files/leave.h
|
||||
mv -f enter.h apps/enter.h
|
||||
|
||||
@@ -681,7 +681,7 @@ installation on another machine)
|
||||
Go to http://www.php.net/ and download the php unix source code
|
||||
- to install this directly on the command line type:
|
||||
- cd /usr/local
|
||||
- wget http://apache.secsup.org/dist/httpd/httpd-2.0.61.tar.gz
|
||||
- wget http://mirror.candidhosting.com/pub/apache/httpd/httpd-2.0.61.tar.gz
|
||||
- gunzip httpd-2.0.61.tar.gz
|
||||
- tar xvf httpd-2.0.61.tar
|
||||
- wget http://us2.php.net/distributions/php-4.4.7.tar.gz
|
||||
|
||||
@@ -8,8 +8,8 @@ jitterbuffer=no
|
||||
tos=lowdelay
|
||||
|
||||
;register => 1112223333:PASSWORD@iax.binfone.com
|
||||
register => ASTloop:test@1270.0.1:40569
|
||||
register => ASTblind:test@1270.0.1:41569
|
||||
register => ASTloop:test@127.0.0.1:40569
|
||||
register => ASTblind:test@127.0.0.1:41569
|
||||
|
||||
[ASTloop]
|
||||
type=friend
|
||||
|
||||
@@ -1115,7 +1115,7 @@ if ($stage == "end")
|
||||
$closer_logged=0;
|
||||
if ($check_inbound > 0)
|
||||
{
|
||||
$four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d")-1,date("Y")));
|
||||
$four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y")));
|
||||
|
||||
$stmt = "UPDATE vicidial_closer_log set end_epoch='$StarTtime', length_in_sec='$length_in_sec' where lead_id='$lead_id' and call_date > \"$four_hours_ago\" order by start_epoch desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?
|
||||
# AST_server_performance.php
|
||||
#
|
||||
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
@@ -9,6 +9,7 @@
|
||||
# - Added required user/pass to gain access to this page
|
||||
# 70417-1106 - Changed time frame to be definable per time range on a single day
|
||||
# - Fixed vertical scaling issues
|
||||
# 80118-1508 - Fixed horizontal scale marking issues
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
@@ -16,8 +17,6 @@ require("dbconnect.php");
|
||||
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||
$PHP_SELF=$_SERVER['PHP_SELF'];
|
||||
if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];}
|
||||
elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];}
|
||||
if (isset($_GET["begin_query_time"])) {$begin_query_time=$_GET["begin_query_time"];}
|
||||
elseif (isset($_POST["begin_query_time"])) {$begin_query_time=$_POST["begin_query_time"];}
|
||||
if (isset($_GET["end_query_time"])) {$end_query_time=$_GET["end_query_time"];}
|
||||
@@ -54,9 +53,8 @@ $NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$STARTtime = date("U");
|
||||
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
if (!isset($begin_query_time)) {$begin_query_time = '09:00:00';}
|
||||
if (!isset($end_query_time)) {$end_query_time = '15:30:00';}
|
||||
if (!isset($begin_query_time)) {$begin_query_time = "$NOW_DATE 09:00:00";}
|
||||
if (!isset($end_query_time)) {$end_query_time = "$NOW_DATE 15:30:00";}
|
||||
if (!isset($group)) {$group = '';}
|
||||
|
||||
$stmt="select server_ip from servers;";
|
||||
@@ -87,9 +85,8 @@ while ($i < $servers_to_print)
|
||||
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo "<TITLE>VICIDIAL: Server Performance</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
|
||||
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
|
||||
echo "Date: <INPUT TYPE=TEXT NAME=query_date SIZE=12 MAXLENGTH=10 VALUE=\"$query_date\"> \n";
|
||||
echo "Time: <INPUT TYPE=TEXT NAME=begin_query_time SIZE=10 MAXLENGTH=8 VALUE=\"$begin_query_time\"> \n";
|
||||
echo "to <INPUT TYPE=TEXT NAME=end_query_time SIZE=10 MAXLENGTH=8 VALUE=\"$end_query_time\"> \n";
|
||||
echo "Date/Time Range: <INPUT TYPE=TEXT NAME=begin_query_time SIZE=22 MAXLENGTH=19 VALUE=\"$begin_query_time\"> \n";
|
||||
echo "to <INPUT TYPE=TEXT NAME=end_query_time SIZE=22 MAXLENGTH=19 VALUE=\"$end_query_time\"> \n";
|
||||
echo "Server: <SELECT SIZE=1 NAME=group>\n";
|
||||
$o=0;
|
||||
while ($servers_to_print > $o)
|
||||
@@ -109,16 +106,15 @@ echo "<PRE><FONT SIZE=2>\n";
|
||||
if (!$group)
|
||||
{
|
||||
echo "\n";
|
||||
echo "PLEASE SELECT A SERVER, DATE AND TIME RANGE ABOVE AND CLICK SUBMIT\n";
|
||||
echo "PLEASE SELECT A SERVER AND DATE/TIME RANGE ABOVE AND CLICK SUBMIT\n";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
$query_date_BEGIN = "$query_date $begin_query_time";
|
||||
$query_date_END = "$query_date $end_query_time";
|
||||
$time_BEGIN = "$begin_query_time";
|
||||
$time_END = "$end_query_time";
|
||||
$query_date_BEGIN = $begin_query_time;
|
||||
$query_date_END = $end_query_time;
|
||||
|
||||
|
||||
echo "VICIDIAL: Server Performance $NOW_TIME\n";
|
||||
|
||||
@@ -182,7 +178,7 @@ $PNGfile = "$group$query_date$shift$filedate$PNG";
|
||||
$HTMfp = fopen ("$DOCroot/$HTMfile", "a");
|
||||
$DATfp = fopen ("$DOCroot/$DATfile", "a");
|
||||
|
||||
$stmt="select DATE_FORMAT(start_time,'%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='" . mysql_real_escape_string($group) . "' and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' order by timex;";
|
||||
$stmt="select DATE_FORMAT(start_time,'%Y-%m-%d.%H:%i:%s') as timex,sysload,processes,channels_total,live_recordings,cpu_user_percent,cpu_system_percent from server_performance where server_ip='" . mysql_real_escape_string($group) . "' and start_time <= '" . mysql_real_escape_string($query_date_END) . "' and start_time >= '" . mysql_real_escape_string($query_date_BEGIN) . "' order by timex;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rows_to_print = mysql_num_rows($rslt);
|
||||
@@ -190,6 +186,8 @@ $i=0;
|
||||
while ($i < $rows_to_print)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($i<1) {$time_BEGIN = $row[0];}
|
||||
$time_END = $row[0];
|
||||
$row[5] = intval(($row[5] + $row[6]) * $HIGHmulti);
|
||||
$row[6] = intval($row[6] * $HIGHmulti);
|
||||
fwrite ($DATfp, "$row[5]\t$row[6]\t$row[0]\t$row[1]\t$row[2]\t$row[3]\n");
|
||||
@@ -199,11 +197,10 @@ fclose($DATfp);
|
||||
|
||||
$rows_to_max = ($rows_to_print + 100);
|
||||
|
||||
#print "rows: $i\n";
|
||||
|
||||
$time_scale_abb = '5 minutes';
|
||||
$time_scale_tick = '1 minute';
|
||||
if ($i > 1000) {$time_scale_abb = '10 minutes'; $time_scale_tick = '2 minutes';}
|
||||
if ($i > 1500) {$time_scale_abb = '15 minutes'; $time_scale_tick = '3 minutes';}
|
||||
if ($i > 2000) {$time_scale_abb = '20 minutes'; $time_scale_tick = '4 minutes';}
|
||||
if ($i > 3000) {$time_scale_abb = '30 minutes'; $time_scale_tick = '5 minutes';}
|
||||
if ($i > 4000) {$time_scale_abb = '40 minutes'; $time_scale_tick = '10 minutes';}
|
||||
@@ -211,6 +208,8 @@ if ($i > 5000) {$time_scale_abb = '60 minutes'; $time_scale_tick = '15 minutes
|
||||
if ($i > 6000) {$time_scale_abb = '90 minutes'; $time_scale_tick = '15 minutes';}
|
||||
if ($i > 7000) {$time_scale_abb = '120 minutes'; $time_scale_tick = '30 minutes';}
|
||||
|
||||
print "rows: $i tick: $time_scale_abb scale: $time_scale_tick\n";
|
||||
|
||||
$HTMcontent = '';
|
||||
$HTMcontent .= "#proc page\n";
|
||||
$HTMcontent .= "#if @DEVICE in png,gif\n";
|
||||
@@ -219,20 +218,20 @@ $HTMcontent .= "\n";
|
||||
$HTMcontent .= "#endif\n";
|
||||
$HTMcontent .= "#proc getdata\n";
|
||||
$HTMcontent .= "file: $DOCroot/$DATfile\n";
|
||||
$HTMcontent .= "fieldnames: userproc sysproc time load processes channels\n";
|
||||
$HTMcontent .= "fieldnames: userproc sysproc datetime load processes channels\n";
|
||||
$HTMcontent .= "\n";
|
||||
$HTMcontent .= "#proc areadef\n";
|
||||
$HTMcontent .= "title: Server $group $query_date_BEGIN to $query_date_END\n";
|
||||
$HTMcontent .= "titledetails: size=14 align=C\n";
|
||||
$HTMcontent .= "rectangle: 1 1 14 7\n";
|
||||
$HTMcontent .= "xscaletype: time hh:mm:ss\n";
|
||||
$HTMcontent .= "rectangle: 1 1 12 7\n";
|
||||
$HTMcontent .= "xscaletype: datetime yyyy-mm-dd.hh:mm:ss\n";
|
||||
$HTMcontent .= "xrange: $time_BEGIN $time_END\n";
|
||||
$HTMcontent .= "yrange: 0 $HIGHlimit\n";
|
||||
$HTMcontent .= "\n";
|
||||
$HTMcontent .= "#proc xaxis\n";
|
||||
$HTMcontent .= "stubs: inc $time_scale_abb\n";
|
||||
$HTMcontent .= "minorticinc: $time_scale_tick\n";
|
||||
$HTMcontent .= "stubformat: hh:mm:ssa\n";
|
||||
$HTMcontent .= "stubformat: hh:mma\n";
|
||||
$HTMcontent .= "\n";
|
||||
$HTMcontent .= "#proc yaxis\n";
|
||||
$HTMcontent .= "stubs: inc 50\n";
|
||||
@@ -241,7 +240,7 @@ $HTMcontent .= "gridskip: min\n";
|
||||
$HTMcontent .= "ticincrement: 100 1000\n";
|
||||
$HTMcontent .= "\n";
|
||||
$HTMcontent .= "#proc lineplot\n";
|
||||
$HTMcontent .= "xfield: time\n";
|
||||
$HTMcontent .= "xfield: datetime\n";
|
||||
$HTMcontent .= "yfield: userproc\n";
|
||||
$HTMcontent .= "linedetails: color=purple width=.5\n";
|
||||
$HTMcontent .= "fill: lavender\n";
|
||||
@@ -249,7 +248,7 @@ $HTMcontent .= "legendlabel: user proc%\n";
|
||||
$HTMcontent .= "maxinpoints: $rows_to_max\n";
|
||||
$HTMcontent .= "\n";
|
||||
$HTMcontent .= "#proc lineplot\n";
|
||||
$HTMcontent .= "xfield: time\n";
|
||||
$HTMcontent .= "xfield: datetime\n";
|
||||
$HTMcontent .= "yfield: sysproc\n";
|
||||
$HTMcontent .= "linedetails: color=yelloworange width=.5\n";
|
||||
$HTMcontent .= "fill: dullyellow\n";
|
||||
@@ -257,28 +256,28 @@ $HTMcontent .= "legendlabel: system proc%\n";
|
||||
$HTMcontent .= "maxinpoints: $rows_to_max\n";
|
||||
$HTMcontent .= "\n";
|
||||
$HTMcontent .= "#proc curvefit\n";
|
||||
$HTMcontent .= "xfield: time\n";
|
||||
$HTMcontent .= "xfield: datetime\n";
|
||||
$HTMcontent .= "yfield: load\n";
|
||||
$HTMcontent .= "linedetails: color=blue width=.5\n";
|
||||
$HTMcontent .= "legendlabel: load\n";
|
||||
$HTMcontent .= "maxinpoints: $rows_to_max\n";
|
||||
$HTMcontent .= "\n";
|
||||
$HTMcontent .= "#proc curvefit\n";
|
||||
$HTMcontent .= "xfield: time\n";
|
||||
$HTMcontent .= "xfield: datetime\n";
|
||||
$HTMcontent .= "yfield: processes\n";
|
||||
$HTMcontent .= "linedetails: color=red width=.5\n";
|
||||
$HTMcontent .= "legendlabel: processes\n";
|
||||
$HTMcontent .= "maxinpoints: $rows_to_max\n";
|
||||
$HTMcontent .= "\n";
|
||||
$HTMcontent .= "#proc curvefit\n";
|
||||
$HTMcontent .= "xfield: time\n";
|
||||
$HTMcontent .= "xfield: datetime\n";
|
||||
$HTMcontent .= "yfield: channels\n";
|
||||
$HTMcontent .= "linedetails: color=green width=.5\n";
|
||||
$HTMcontent .= "legendlabel: channels\n";
|
||||
$HTMcontent .= "maxinpoints: $rows_to_max\n";
|
||||
$HTMcontent .= "\n";
|
||||
$HTMcontent .= "#proc legend\n";
|
||||
$HTMcontent .= "location: max-2 max\n";
|
||||
$HTMcontent .= "location: max-1 max\n";
|
||||
$HTMcontent .= "seglen: 0.2\n";
|
||||
$HTMcontent .= "\n";
|
||||
|
||||
@@ -290,7 +289,7 @@ passthru("/usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile");
|
||||
|
||||
sleep(1);
|
||||
|
||||
echo "</PRE>\n";
|
||||
echo "</PRE>";
|
||||
echo "\n";
|
||||
echo "<IMG SRC=\"/$PLOTroot/$PNGfile\">\n";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user