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
594a9d10
Commit
594a9d10
authored
Mar 11, 2016
by
Gary Wong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a basic "top"-multiplexing daemon to allow monitoring of shared nodes.
parent
19c0e454
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
136 additions
and
0 deletions
+136
-0
clientside/tmcc/linux/GNUmakefile.in
clientside/tmcc/linux/GNUmakefile.in
+2
-0
clientside/tmcc/linux/xen/topd
clientside/tmcc/linux/xen/topd
+50
-0
clientside/tmcc/linux/xen/topd-init
clientside/tmcc/linux/xen/topd-init
+84
-0
No files found.
clientside/tmcc/linux/GNUmakefile.in
View file @
594a9d10
...
...
@@ -396,6 +396,8 @@ xen-install: dir-install xen-udev-install xen-upstart-install
fi
$(INSTALL) -m 755 $(SRCDIR)/xen/GrubConf.py \
/usr/lib/xen-default/lib/python/grub/
$(INSTALL) -m 755 $(SRCDIR)/xen/topd $(BINDIR)/
$(INSTALL) -m 755 $(SRCDIR)/xen/topd-init $(SYSETCDIR)/init.d/topd
genirack-install:
$(INSTALL) -m 755 $(SRCDIR)/xen/restorevm.pl $(BINDIR)/restorevm.pl
...
...
clientside/tmcc/linux/xen/topd
0 → 100755
View file @
594a9d10
#!/usr/bin/python
import
os
import
pty
import
select
import
socket
PIDFILE
=
"/var/run/topd.pid"
PORT
=
4097
listener
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
,
0
)
listener
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_REUSEADDR
,
1
)
listener
.
bind
(
(
""
,
PORT
)
)
listener
.
listen
(
4
)
if
os
.
fork
()
>
0
:
os
.
_exit
(
0
)
try
:
f
=
open
(
PIDFILE
,
"w"
)
f
.
write
(
str
(
os
.
getpid
()
)
)
f
.
close
()
os
.
setuid
(
65534
)
except
:
pass
clients
=
[]
(
pid
,
top
)
=
pty
.
fork
()
if
pid
==
0
:
os
.
execl
(
"/usr/bin/top"
,
"top"
)
os
.
_exit
(
1
)
while
True
:
(
r
,
w
,
x
)
=
select
.
select
(
[
listener
,
top
],
[],
[]
)
if
listener
in
r
:
(
n
,
addr
)
=
listener
.
accept
()
n
.
setblocking
(
0
)
clients
.
append
(
n
)
os
.
write
(
top
,
"0"
)
# Ugly hack to draw entire screen for
# new client... old clients will get refreshed too. Too bad.
if
top
in
r
:
buf
=
os
.
read
(
top
,
1024
)
for
c
in
clients
:
try
:
c
.
send
(
buf
)
except
Exception
as
e
:
c
.
close
()
clients
.
remove
(
c
)
clientside/tmcc/linux/xen/topd-init
0 → 100755
View file @
594a9d10
#!/bin/sh
### BEGIN INIT INFO
# Provides: topd
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Remote top daemon
# Description: Remote top daemon
### END INIT INFO
.
/lib/init/vars.sh
.
/lib/lsb/init-functions
PATH
=
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/etc/emulab
DESC
=
"Remote top daemon"
PIDFILE
=
/var/run/topd.pid
ROLE
=
$(
cat
/var/emulab/boot/role
)
topd_start
()
{
if
[
$ROLE
!=
"sharedhost"
]
;
then
return
0
fi
log_progress_msg
"topd"
topd
return
$?
}
topd_stop
()
{
if
[
$ROLE
!=
"sharedhost"
]
;
then
return
0
fi
log_progress_msg
"topd"
kill
$(
cat
$PIDFILE
)
return
$?
}
topd_restart
()
{
if
[
$ROLE
!=
"sharedhost"
]
;
then
return
0
fi
log_progress_msg
"topd"
kill
$(
cat
$PIDFILE
)
topd
return
0
}
case
"
$1
"
in
start
)
log_daemon_msg
"Starting
$DESC
"
topd_start
log_end_msg 0
;;
stop
)
log_daemon_msg
"Stopping
$DESC
"
topd_stop
log_end_msg
$ret
;;
restart|force-reload
)
log_daemon_msg
"Restarting
$DESC
"
topd_restart
log_end_msg
$ret
;;
*
)
echo
"Usage:
$0
{start|stop|restart|force-reload}"
>
&2
exit
3
;;
esac
exit
0
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