Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
bac9d111
Commit
bac9d111
authored
Sep 16, 2003
by
Leigh B. Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plab stats page for the plab people.
parent
aba854b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
160 additions
and
0 deletions
+160
-0
www/plabstats.php3
www/plabstats.php3
+160
-0
No files found.
www/plabstats.php3
0 → 100644
View file @
bac9d111
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
include
(
"defs.php3"
);
include
(
"showstuff.php3"
);
#
# Standard Testbed Header
#
if
(
!
isset
(
$xml
))
{
PAGEHEADER
(
"Emulab on Planetlab Stats"
);
}
#
# Get current user, if any. We return info to logged in admin users,
# or to someone who has the right key.
#
$uid
=
GETLOGIN
();
if
(
$uid
)
{
LOGGEDINORDIE
(
$uid
);
if
(
!
ISADMIN
(
$uid
))
{
USERERROR
(
"You do not have permission to view this page!"
,
1
);
}
}
else
{
#
# Must be SSL, even though we do not require an account login.
#
if
(
!
isset
(
$SSL_PROTOCOL
))
{
USERERROR
(
"Must use https:// to access this page!"
,
1
);
}
$subnet
=
long2ip
(
ip2long
(
$REMOTE_ADDR
)
&
ip2long
(
"255.255.255.0"
));
if
(
strcmp
(
$subnet
,
"155.98.60.0"
)
&&
strcmp
(
$subnet
,
"155.98.63.0"
)
&&
strcmp
(
$subnet
,
"134.134.248.0"
)
&&
strcmp
(
$subnet
,
"134.134.136.0"
))
{
USERERROR
(
"You do not have permission to view this page (
$subnet
)!"
,
1
);
}
}
# Page args,
if
(
isset
(
$slice
))
{
if
(
preg_match
(
"/^emulab_[-\w]*_([\d]*)$/"
,
$slice
,
$matches
))
{
$wclause
=
"and s.exptidx='
$matches[1]
'"
;
}
else
{
USERERROR
(
"Invalid 'slice' argument!"
,
1
);
}
}
else
{
$wclause
=
""
;
}
# Show just the last N records unless request is different.
if
(
isset
(
$records
))
{
if
(
!
preg_match
(
"/^[\d]*$/"
,
$records
))
{
USERERROR
(
"Invalid 'records' argument!"
,
1
);
}
$limit
=
$records
;
}
else
{
$limit
=
100
;
}
$query_result
=
DBQueryFatal
(
"select s.pid,s.eid,t.uid,r.plabnodes,start_time,t.action, "
.
" u.usr_email,u.usr_name,s.exptidx, "
.
" UNIX_TIMESTAMP(start_time) as ustart "
.
" from experiment_resources as r "
.
"left join experiment_stats as s on r.exptidx=s.exptidx "
.
"left join testbed_stats as t on t.rsrcidx=r.idx "
.
"left join users as u on u.uid=t.uid "
.
"where r.plabnodes!=0 and t.exitcode=0 and "
.
" (t.action='start' or t.action='swapin' or "
.
" t.action='swapout')
$wclause
"
.
"order by t.end_time desc,t.idx desc limit
$limit
"
);
if
(
!
isset
(
$xml
))
{
echo
"<table align=center border=1>
<tr>
<th>Slice</th>
<th>Uid</th>
<th>Pid</th>
<th>Eid</th>
<th>Date</th>
<th>Action (Nodes)</th>
</tr>
\n
"
;
}
else
{
echo
"<?xml version=
\"
1.0
\"
encoding=
\"
ISO-8859-1
\"
standalone=
\"
yes
\"
?>
<!DOCTYPE EMULABONPLAB_XML [
<!ELEMENT EMULABONPLAB_XML (EXPERIMENT)*>
<!ATTLIST EMULABONPLAB_XML VERSION CDATA #REQUIRED>
<!ELEMENT EXPERIMENT EMPTY>
<!ATTLIST EXPERIMENT SLICE CDATA #REQUIRED>
<!ATTLIST EXPERIMENT PID CDATA #REQUIRED>
<!ATTLIST EXPERIMENT EID CDATA #REQUIRED>
<!ATTLIST EXPERIMENT UID CDATA #REQUIRED>
<!ATTLIST EXPERIMENT NAME CDATA #REQUIRED>
<!ATTLIST EXPERIMENT EMAIL CDATA #REQUIRED>
<!ATTLIST EXPERIMENT TIMESTAMP CDATA #REQUIRED>
<!ATTLIST EXPERIMENT NODES CDATA #REQUIRED>
<!ATTLIST EXPERIMENT ACTION (swapin | swapout) #REQUIRED>
]>
\n
"
;
echo
"<EMULABONPLAB_XML VERSION=
\"
0.1
\"
>
\n
"
;
}
while
(
$row
=
mysql_fetch_assoc
(
$query_result
))
{
$pid
=
$row
[
pid
];
$eid
=
$row
[
eid
];
$uid
=
$row
[
uid
];
$name
=
$row
[
usr_name
];
$email
=
$row
[
usr_email
];
$start
=
$row
[
start_time
];
$ustart
=
$row
[
ustart
];
$action
=
$row
[
action
];
$pnodes
=
$row
[
plabnodes
];
$exptidx
=
$row
[
exptidx
];
$slice
=
"emulab_${pid}_${eid}_${exptidx}"
;
if
(
!
strcmp
(
$action
,
"start"
))
{
$action
=
"swapin"
;
}
if
(
isset
(
$xml
))
{
echo
"<EXPERIMENT SLICE=
\"
$slice
\"
"
;
echo
"PID=
\"
$pid
\"
EID=
\"
$eid
\"
UID=
\"
$uid
\"
"
;
echo
"NAME=
\"
$name
\"
"
;
echo
"EMAIL=
\"
$email
\"
TIMESTAMP=
\"
$ustart
\"
NODES=
\"
$pnodes
\"
"
;
echo
"ACTION=
\"
$action
\"
>
\n
"
;
}
else
{
echo
"<tr>
<td>
$slice
</td>
<td>
$uid
(
$email
)</td>
<td>
$pid
</td>
<td>
$eid
</td>
<td>
$start
</td>
<td>
$action
(
$pnodes
)</td>
</tr>
\n
"
;
}
}
if
(
isset
(
$xml
))
{
echo
"</EMULABONPLAB_XML>
\n
"
;
}
else
{
echo
"</table>
\n
"
;
#
# Standard Testbed Footer
#
PAGEFOOTER
();
}
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment