富捷 IT 培訓 (原奇科電腦) www.geego.com.tw 是培訓與職業轉型的先驅,專門研究當今最需要的技能。也是培訓、職涯成長和職業轉換的主要資源;長年來,我們已培養了一群追求自己鍾愛職業生涯的專業人士。 意者請洽+886-2-27116373。 http://www.geego.com.tw; e-mail:service@geego.com.tw Linux LPIC-1 / Linux LPIC-2 / CCENT / CCNA /CCNP / Java OCPJP / Android App / Android Advanced / Android Security / Swift / iOS App / Python / Python x Crawler / Python x Database / Oracle Database / HTML5 / CSS3 / JavaScript / MySQL / PHP /
2012年12月26日 星期三
2012年12月25日 星期二
2012年12月23日 星期日
Perl program uses parallel processes( fork() ) to manage numeric Cisco equipment/device
Cisco Perl Telnet Script:
A single process Perl program fetches Cisco routers/switches config or other info may take 2 seconds per equipment. If you have 1,000 Cisco routers/switches, it will take 2,000 seconds which will be 33+ minutes. This Perl multi-processes program will save tons of your time to gather info like around 10 seconds. Please enjoy!1. Successful messages( scalar type ) are stored in hash of hash : $hostinfo{ “$hostname” }->{ “$cmd” }
2. Failed messages( scalar type ) are stored in hash of hash : $hosterrinfo{ “$hostname” }->{ “$cmd” }
#!/usr/bin/perl -w
# This perl script is main to be doing numeric cisco equipment management
use strict;
use IPC::Shareable;
$SIG{ 'CHLD' } = 'IGNORE';
my @hosts = ( ''host name or IP', ''host name or IP' );
my @cmds = ( 'sh geego', 'sh ver', 'sh clock', 'sh queueing', 'sh hosts' );
my $username = 'username'; # cisco telnet username
my $passwd = 'password'; # cisco telnet username
my $enable_passwd = 'enable password';
my %hostinfo = ();
my %hosterrinfo = ();
my @children = ();
my %ipcoptions = ( create => 'yes',
exclusive => 0,
mode => 0644,
destroy => 'yes' );
tie %hostinfo, 'IPC::Shareable', 'good', \%ipcoptions or die "Can't tie %hostinfo.\n";
tie %hosterrinfo, 'IPC::Shareable', 'err', \%ipcoptions or die "Can't tie %hosterrinfo\n";
foreach my $host ( @hosts )
{
my $pid = fork();
die "Can't fork.:$!\n" unless defined( $pid );
if( $pid == 0 ) # this is child process
{
print "Child process is $$\n";
get_info( $host );
exit( 0 );
}
else # This is parent process
{
print "$$ -> Process $pid is processing $host now.\n";
push( @children, $pid );
}
}
foreach ( @children )
{
#my $child_pid = waitpid( $_, 0 );
my $child_pid = wait();
print "Process $_ is done.\n";
}
sub get_info
{
use Net::Telnet::Cisco; #Special Perl Cisco Telnet module
my ( $hostname ) = @_;
my $cisco = Net::Telnet::Cisco->new( 'Host' => $hostname,
'Errmode'=> 'return' ); #Perl Cisco Telnet Object initialization
$cisco->login( Password => "$passwd" );
$cisco->ignore_warnings;
foreach my $cmd ( @cmds )
{
my @output = $cisco->cmd( "$cmd" );
if( $cisco->errmsg() )
{
$hosterrinfo{ $hostname }->{ $cmd } = $cisco->errmsg();
}
else
{
my $out = join( "", @output );
$hostinfo{ $hostname }->{ $cmd } = $out;
}
}
}
foreach my $host ( keys %hostinfo )
{
foreach my $cmd ( keys %{$hostinfo{ $host }} )
{
print "$host => $cmd =>\n $hostinfo{ $host }->{ $cmd }\n";
}
}
More technical tips see:http://www.geego.com/tech_support/new-tip-list
Cisco Perl threads program to manage numeric Cisco equipments
Cisco Perl Telnet Script:
A single thread Perl program fetches Cisco routers/switches config or other info may take 2 seconds per equipment. If you have 1,000 Cisco routers/switches, it’ll take 2,000 seconds which will be 33+ mins. This Perl threads program will save tons of your time to gather info like within 10 seconds. Please enjoy!1. Successful messages( scalar type ) are stored in hash of hash : $hostinfo{ “$hostname” }->{ “$cmd” }
2. Failed messages( scalar type ) are stored in hash of hash : $hosterrinfo{ “$hostname” }->{ “$cmd” }
#!/usr/bin/perl -w
# This perl script is main to be doing numeric cisco equipment management
use strict;
use threads;
use threads::shared;
my @hosts = ( 'host name or IP', 'host name or IP' );
my @threads = ();
# Shared data declaration
my @cmds :shared = ( 'sh geego', 'sh ver', 'sh clock', 'sh queueing', 'sh hosts' );
my $username :shared = 'username'; # cisco telnet username
my $passwd :shared = 'password'; # cisco telnet username
my $enable_passwd :shared = 'enable password';
my %hostinfo :shared = ();
my %hosterrinfo :shared = ();
foreach my $host ( @hosts )
{
$hostinfo{ "$host" } = &share( {} );
$hosterrinfo{ "$host" } = &share( {} );
push( @threads, threads->new( \&get_info, $host ) );
}
foreach ( @threads )
{
$_->join();
}
sub get_info
{
use Net::Telnet::Cisco; #Special Perl Cisco Telnet module
my ( $hostname ) = @_;
my $cisco = Net::Telnet::Cisco->new( 'Host' => $hostname,
'Errmode'=> 'return' ); #Perl Cisco Telnet Object initialization
$cisco->login( Password => "$passwd" );
$cisco->ignore_warnings;
foreach my $cmd ( @cmds )
{
my @output = $cisco->cmd( "$cmd" );
if( $cisco->errmsg() )
{
$hosterrinfo{ $hostname }->{ $cmd } = $cisco->errmsg();
}
else
{
my $out = join( "", @output );
$hostinfo{ $hostname }->{ $cmd } = $out;
}
}
}
foreach my $host ( keys %hostinfo )
{
foreach ( keys %{$hostinfo{ $host }} )
{
print " $host => $_ => $hostinfo{ $host }->{ $_ }";
}
}
More technical tips see:http://www.geego.com/tech_support/new-tip-list
2012年12月18日 星期二
奇科電腦 平行多程序( fork() )的Cisco設備的Perl程式
Cisco Perl Telnet Script:
利用telnet取得每個Cisco路由器或交換器的組態或訊息所需時間約2秒鐘,如果貴公司有1,000台Cisco設備,一般單執行緒程式恐耗時 2,000秒相當於33+分鐘,本Perl程式使用平行多程序同時對所有的Cisco設備進行存取,所需時間可能不到10秒鐘;請各位試試看。1. 執行成功訊息輸出(scalar type)儲存於$hostinfo{ 主機名稱 }->{ 執行指令 }
2. 執行失敗訊息輸出(scalar type)儲存於$hosterrinfo{ 主機名稱 }->{ 執行指令 }
#!/usr/bin/perl -w
# This perl script is main to be doing numeric cisco equipment management
use strict;
use IPC::Shareable;
$SIG{ 'CHLD' } = 'IGNORE';
my @hosts = ( '主機名稱或IP定址', '主機名稱或IP定址' );
my @cmds = ( 'sh geego', 'sh ver', 'sh clock', 'sh queueing', 'sh hosts' );
my $username = '登入帳號名稱'; # cisco telnet 的帳號
my $passwd = '帳號之密碼'; # cisco telnet 的密碼
my $enable_passwd = 'enable的密碼';
my %hostinfo = ();
my %hosterrinfo = ();
my @children = ();
my %ipcoptions = ( create => 'yes',
exclusive => 0,
mode => 0644,
destroy => 'yes' );
tie %hostinfo, 'IPC::Shareable', 'good', \%ipcoptions or die "Can't tie %hostinfo.\n";
tie %hosterrinfo, 'IPC::Shareable', 'err', \%ipcoptions or die "Can't tie %hosterrinfo\n";
foreach my $host ( @hosts )
{
my $pid = fork();
die "Can't fork.:$!\n" unless defined( $pid );
if( $pid == 0 ) # this is child process
{
print "Child process is $$\n";
get_info( $host );
exit( 0 );
}
else # This is parent process
{
print "$$ -> Process $pid is processing $host now.\n";
push( @children, $pid );
}
}
foreach ( @children )
{
#my $child_pid = waitpid( $_, 0 );
my $child_pid = wait();
print "Process $_ is done.\n";
}
sub get_info
{
use Net::Telnet::Cisco; # 特別的 Perl Cisco Telnet的模組
my ( $hostname ) = @_;
my $cisco = Net::Telnet::Cisco->new( 'Host' => $hostname,
'Errmode'=> 'return' ); # Perl Cisco Telnet的物件初始化
$cisco->login( Password => "$passwd" );
$cisco->ignore_warnings;
foreach my $cmd ( @cmds )
{
my @output = $cisco->cmd( "$cmd" );
if( $cisco->errmsg() )
{
$hosterrinfo{ $hostname }->{ $cmd } = $cisco->errmsg();
}
else
{
my $out = join( "", @output );
$hostinfo{ $hostname }->{ $cmd } = $out;
}
}
}
foreach my $host ( keys %hostinfo )
{
foreach my $cmd ( keys %{$hostinfo{ $host }} )
{
print "$host => $cmd =>\n $hostinfo{ $host }->{ $cmd }\n";
}
}
更多技術小秘訣請看:http://www.geego.com.tw/tech_support/new-tip-list
奇科電腦 Perl執行緒程式用於部署大量Cisco設備的組態或收集資訊
Cisco Perl Telnet Script:
利用telnet取得每個Cisco路由器或交換器的組態或訊息所需時間約2秒鐘,如果貴公司有1,000台Cisco設備,一般單執行緒程式恐耗時 2,000秒相當於33+分鐘,本多執行緒Perl程式可同時對所有的Cisco設備進行存取,所需時間可能不到10秒鐘;請各位試試看。1. 執行成功訊息輸出(scalar type)儲存於hash of hash : $hostinfo{ 主機名稱 }->{ 執行指令 }
2. 執行失敗訊息輸出(scalar type)儲存於hash of hash: $hosterrinfo{ 主機名稱 }->{ 執行指令 }
#!/usr/bin/perl -w
# This perl script is main to be doing numeric cisco equipment management
use strict;
use threads;
use threads::shared;
my @hosts = ( '主機名稱或IP', '主機名稱或IP' );
my @threads = ();
# Shared data declaration
my @cmds :shared = ( 'sh geego', 'sh ver', 'sh clock', 'sh queueing', 'sh hosts' );
my $username :shared = '登入帳號名稱'; # cisco telnet 的帳號
my $passwd :shared = '登入密碼'; # cisco telnet 的帳號
my $enable_passwd :shared = 'enable的密碼';
my %hostinfo :shared = ();
my %hosterrinfo :shared = ();
foreach my $host ( @hosts )
{
$hostinfo{ "$host" } = &share( {} );
$hosterrinfo{ "$host" } = &share( {} );
push( @threads, threads->new( \&get_info, $host ) );
}
foreach ( @threads )
{
$_->join();
}
sub get_info
{
use Net::Telnet::Cisco; # 特別的 Perl Cisco Telnet的模組
my ( $hostname ) = @_;
my $cisco = Net::Telnet::Cisco->new( 'Host' => $hostname,
'Errmode'=> 'return' ); # Perl Cisco Telnet的物件初始化
$cisco->login( Password => "$passwd" );
$cisco->ignore_warnings;
foreach my $cmd ( @cmds )
{
my @output = $cisco->cmd( "$cmd" );
if( $cisco->errmsg() )
{
$hosterrinfo{ $hostname }->{ $cmd } = $cisco->errmsg();
}
else
{
my $out = join( "", @output );
$hostinfo{ $hostname }->{ $cmd } = $out;
}
}
}
foreach my $host ( keys %hostinfo )
{
foreach ( keys %{$hostinfo{ $host }} )
{
print " $host => $_ => $hostinfo{ $host }->{ $_ }";
}
}
更多技術小秘訣請看:http://www.geego.com.tw/tech_support/new-tip-list
2012年12月11日 星期二
奇科電腦 從零到考取CCNA的Cisco CCNA課程
游承翰分享~
在學生時代就一直想踏入IT產業的我,總是因為成績的關係一直無法順利進入相關科系導致只能一直在PC這塊打轉,除了PC相關以外的職務求職總是碰壁。知道自身條件不夠好之後便下定決心要好好努力並且開始找尋相關資訊,此時發現”網路”好像是進入IT產業的根本,無論是網路工程師、系統工程師還是各公司的MIS都多少要會一點網路,因此我決定要從網路入門。
在某一天因緣際會下接到了奇科電腦的電話,對話的內容感覺不像坊間補習班會讓人有壓力,非常的親切專業度也相當的夠。後來也上網查了許多相關的補習班,進行仔細的比較後發現奇科才能真正符合我的需求,一人一機又能遠端上課再加上超強的師資,讓我從一個年初時連TCP/IP是什麼、Port又是什麼都不知道的小夥子在今年的10月考取CCNA的證照。
比起其他坊間補習班的業務”騷擾式推銷”,奇科電腦裡的每一個人都相當的親切甚至比我媽還親切(咦?),感覺真的是很用心再替學員著想很用心在替學員規畫學習歷程。老師的部分專業度及經驗也都是一等一,師資真的是無話可說,各個都是業界名師,而且環境部分無論是到現場上課還是遠距離上課都能享受到一人一機環境,我想這是絕大多數坊間補習班都比不上的。
最後在這裡一定要推薦有心想要進入IT產業,真的想要學到東西的朋友們一定要來奇科看看,保證不會後悔的!也在這裡大力推薦Cisco課程,想學Cisco的朋友們來聽課絕對不會錯啦!
奇科電腦 LPIC-1 102課程視頻教學:簡化指令 alias/unalias使用教學
更多相關資訊請參考以下網頁
http://www.geego.com.tw/edm/system_linux_lpic1_new_version/index.php?v=blogger&c=video&k=linux&p=system&t=lpic1_new_version
奇科電腦提供台灣地區最優質、最專業的系統管理。意者請洽+886-2-27116373。
http://www.geego.com.tw;
e-mail:service@geego.com.tw
GeeGo Systems offer high quality and leading of training solution on Linux Traininig in Taiwan. More information about GeeGo, please call +886-2-27116373, http://www.geego.com or mail to service@geego.com.tw
2012年12月6日 星期四
奇科電腦 條理分明的iPhone程式教學
吳承洋分享~
我的背景是航運管理科系,念書時即開始學習網頁、網站設計相關軟體,後來跨入程式資料庫領域來擴充自己的能力,因為非資訊相關科系畢業,大多是自己找書來學,對於補習班的課程時間規劃很有壓力,所以只曾上過大專院校對外開的課程,如JAVA。
記得第一次與奇科的邂逅是在幾年前,那時對嵌入式設計很感興趣,所以打算去電腦補習班學習,期望能創作出自己的作品,同時也可習得一技之長,轉換領域。後來因為工作關係,沒有當下參與課程。直到今年看到奇科電腦有看到iPhone App程式設計課程,便毅然決然再次與奇科電腦進行聯繫。
對於奇科的印象是設備相當專業,課程規劃師讓我尤其印象深刻,在耐心仔細解說和了解下,我對奇科有更多的認識,尤其是線上學習相當方便,不僅可複習,更重要的是遠距上課無時差,與老師同步還可即時提問,再次謝謝課程規劃師有問必答與不厭其煩地向我解釋,這次面談花了將近3個小時,但課程規劃師依然是很和悅地為我服務!
這次iPhone APP Programming課程的老師不僅教學認真,堅持把所有課程上完 (還多幫我們加了兩堂課!)條理分明的上課風格也值得推崇,幫助我有效率的建立重要的觀念,每堂課結束後的問卷調查與建議,讓老師可了解學員的需求做適時調整,可見奇科對教學品質相當的要求與用心。
奇科電腦 CCNP SWITCH課程視頻教學:End-to-End VLAN 與Local VLAN使用時機
更多相關資訊請參考以下網頁
http://www.geego.com.tw/edm/network_ccnp_lab_exercise/index.php?v=blogger&c=video&k=ccnp&p=network&t=lab_exercise
奇科電腦提供台灣地區最優質、最專業的網路管理教學。意者請洽+886-2-27116373。
http://www.geego.com.tw;
e-mail:service@geego.com.tw
GeeGo Systems offer high quality and leading of training solution on Programming in Taiwan. More information about GeeGo, please call +886-2-27116373, http://www.geego.com or mail to service@geego.com.tw
訂閱:
文章 (Atom)

