2013年5月8日 星期三

[Emulab 管理] Node Status欄位值


狀況:如Node仍無法自己重reloading中跑回free,檢查「Startup Status」欄位。
檢查點:「none」為正常,「1」為有問題


處理方式:update nodes set startstatus='none' where node_id='<Node_id>';

狀況外:
如果仍不可解決,先丟回hwdown



[Emulab 管理] 砍使用者、Node、Project


del user:
1. web 砍帳號
2. delete from users where uid="帳號";

----------------------------------------------------------------------------
砍Node:
withadminprivs /usr/testbed/sbin/deletenode pc35

----------------------------------------------------------------------------

砍project:
delete from projects where pid='xxx';
delete from users where uid='hmlee';

[Emulab 管理] ErrorNum was -24


boss# wap snmpit -l

*** WARNING: snmpit:
***   SNMP GET failed - In snmpit
***   SNMPIT get failed for device es1 (try 30 of 30)
***   Variable was [sysDescr,0,(undefined),(undefined)]
***   Returned (undefined), ErrorNum was -24
***   Error string is: Timeout
RPC::Async::Server: Disconnecting client for error: SNMP GET failed - In snmpit
SNMPIT get failed for device es1 (try 30 of 30)
Variable was [sysDescr,0,(undefined),(undefined)]
Returned (undefined), ErrorNum was -24
Error string is: Timeout

原因:
snmp_community設錯

處理方式:
mysql> update switch_stack_types set snmp_community='private' where stack_id='Experiment';



[系統] 監控HD容量


檔名:/shell/disk.sh

#####################
說明:利用 mount 指令解決 Read-only file system 問題
#####################
#!/bin/sh
ADMIN="xxx@crypto.ee.ncku.edu.tw"
# set alert level 90% is default
ALERT=90
day=`date +"%Y%m%d%H%M"`

df -H | grep -vE '^Filesystem|dev/da0s1a|devfs' | awk '{ print $5 " " $6 }' | while read output;
do
 echo $output
 usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )
 partition=$(echo $output | awk '{ print $2 }' )
 if [ $usep -ge $ALERT ]; then
   echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
    mail -s "Alert: Almost out of disk space $usep%" $ADMIN

# clear ops server /var/mail/root file
   if [ $partition=="/usr/testbed/usersvar" ]; then
     mount -o rw  /usr/testbed/usersvar
     cp -p /usr/testbed/usersvar/mail/root /mnt/backup2/ops_var_log_bak/mail/root."$day"
     cat /dev/null > /usr/testbed/usersvar/mail/root
    umount /usr/testbed/usersvar
   fi

# clear boss server /var/log
   if [ $partition=="/var" ]; then
     cp -p /var/log/auth.log /mnt/backup2/boss_var_log_bak/auth.log."$day"
     cat /dev/null > /var/log/auth.log
     cp -p /var/log/maillog /mnt/backup2/boss_var_log_bak/maillog."$day"
     cat /dev/null > /var/log/maillog
   fi
 fi

done

-----------------------------------------------------------------------
修改crontab

#ee /etc/crontab

-----------------------------------------------------------------------
新增底下二行!! 每5分鐘檢查一次
# mointor disk
*/5     *       *       *       *       root    /shell/disk.sh


[Emulab 管理] Node卡在reloading處理方式


root@boss[/root]# sched_reserve emulab-ops hwdown <Node_id>

Checking if <Node_id> is reserved...Reserved  - Scheduling next reservation...

root@boss[/root]# su adminemu
% nfree emulab-ops reloading <Node_id> 

Moving<Node_id> to emulab-ops/hwdown.


% nfree emulab-ops hwdown <Node_id>
Moving
<Node_id>
to emulab-ops/reloaing.

註解:先將Node丟回hwdown,再重新丟Free之(reloading),Node將重新開機

[Emulab 管理] 手動指派Node到Proj



指派指令:update nodes set reserved_pid='<pid>' where node_id='<Node_id>';

清除指令:
update nodes set reserved_pid=NULL;

[Emulab 管理] 更換主機版設定


如有更換主機版機器,網卡需重新設定。
於資料庫更新MAC


update interfaces set mac='0090fb2f3b56' where node_id='pc21' and card='0';
update interfaces set mac='0090fb2f3b57' where node_id='pc21' and card='1';
update interfaces set mac='0090fb2f3b58' where node_id='pc21' and card='2';
update interfaces set mac='0090fb2f3b59' where node_id='pc21' and card='3';
update interfaces set mac='0090fb2f3b5a' where node_id='pc21' and card='4';
update interfaces set mac='0090fb2f3b5b' where node_id='pc21' and card='5';

[Emulab 管理] 指派單一node到已存在的實驗內


指令:nalloc [-d] [-p] <pid> <eid> <node> <node> <...>

root@boss[/root]#su adminemu You have mail.
%wap nalloc cryptolab TWISC-Project pc145

[Emulab 管理] Web介面限制使用者登入指令


限制所有成員之網頁介面登入指令:update sitevariables set value='1' where name='web/nologins';

開發所有成員之網頁介面登入指令:update sitevariables set value='0' where name='web/nologins';

限制特定Project成員之網頁介面登入指令:

update users u inner join  group_membership g  on u.uid=g.uid set
weblogin_frozen=1
where  pid='NS-NCKUEE';

開放特定Project成員之網頁介面登入指令:


update users u inner join  group_membership g  on u.uid=g.uid set
weblogin_frozen=0
where  pid='NS-NCKUEE';


[Emulab 管理] 重載Image指令

大眾用指令:os_load -i <imageid> <node>

Image專屬某Porject指令:os_load [-p <PID>] -i <imageid> <node>

2013年5月3日 星期五