lost and found ( for me ? )

Showing posts with label fedora 17. Show all posts
Showing posts with label fedora 17. Show all posts

httrack : copy web contents

httrack copies web contents you want to copy.


[root@fc17 ~]# uname -ri
3.4.6-2.fc17.x86_64 x86_64

[root@fc17 ~]# cat /etc/fedora-release
Fedora release 17 (Beefy Miracle)

install httrack via yum
[root@fc17 ~]# yum install httrack -y

create a directory to store web contents
$ mkdir web-copy

I’ll copy my blog site.
Please take care of copyright matters , bandwidth , load etc when you copy web contents.

run httrack
$ httrack

Welcome to HTTrack Website Copier (Offline Browser) 3.43-9+libhtsjava.so.2
Copyright (C) Xavier Roche and other contributors
To see the option list, enter a blank line or try httrack --help

Enter project name :my-blog-copy

Base path (return=/home/hattori/websites/) :/home/hattori/web-copy

Enter URLs (separated by commas or blank spaces) :http://lost-and-found-narihiro.blogspot.jp

Action:
(enter) 1 Mirror Web Site(s)
2 Mirror Web Site(s) with Wizard
3 Just Get Files Indicated
4 Mirror ALL links in URLs (Multiple Mirror)
5 Test Links In URLs (Bookmark Test)
0 Quit
: 1

Proxy (return=none) :

You can define wildcards, like: -*.gif +www.*.com/*.zip -*img_*.zip
Wildcards (return=none) :

You can define additional options, such as recurse level (-r<number>), separed by blank spaces
To see the option list, type help
Additional options (return=none) :

---> Wizard command line: httrack http://lost-and-found-narihiro.blogspot.jp  -O "/home/hattori/web-copy/my-blog-copy"  -%v   

Ready to launch the mirror? (Y/n) :y

Mirror launched on Tue, 24 Jul 2012 23:56:52 by HTTrack Website Copier/3.43-9+libhtsjava.so.2 [XR&CO'2010]
mirroring http://lost-and-found-narihiro.blogspot.jp with the wizard help..



Here’s a capture data
User-Agent Header seems to be Mozilla.
Hypertext Transfer Protocol
   GET /2012/01/linux-mint-12-configure-ip-aliases.html HTTP/1.1\r\n
       [Expert Info (Chat/Sequence): GET /2012/01/linux-mint-12-configure-ip-aliases.html HTTP/1.1\r\n]
           [Message: GET /2012/01/linux-mint-12-configure-ip-aliases.html HTTP/1.1\r\n]
           [Severity level: Chat]
           [Group: Sequence]
       Request Method: GET
       Request URI: /2012/01/linux-mint-12-configure-ip-aliases.html
       Request Version: HTTP/1.1
   Referer: http://lost-and-found-narihiro.blogspot.jp/\r\n
   Cookie: $Version=1; blogger_TID=xxx; $Path=/\r\n
   Connection: Keep-Alive\r\n
   Host: lost-and-found-narihiro.blogspot.jp\r\n
   User-Agent: Mozilla/4.5 (compatible; HTTrack 3.0x; Windows 98)\r\n
   Accept: image/png, image/jpeg, image/pjpeg, image/x-xbitmap, image/svg+xml, image/gif;q=0.9, */*;q=0.1\r\n
   Accept-Language: en, *\r\n
   Accept-Charset: iso-8859-1, iso-8859-*;q=0.9, utf-8;q=0.66, *;q=0.33\r\n
   Accept-Encoding: gzip, identity;q=0.9\r\n
   \r\n
   [Full request URI: http://lost-and-found-narihiro.blogspot.jp/2012/01/linux-mint-12-configure-ip-aliases.html]


after finishing copying web contents , web contents will be stored under “~/web-copy/my-blog-copy” directory.
[root@fc17 my-blog-copy]# pwd
/home/hattori/web-copy/my-blog-copy

[root@fc17 my-blog-copy]# ls
backblue.gif  hts-in_progress.lock  lost-and-found-narihiro.blogspot.jp
fade.gif      hts-log.txt
hts-cache     index.html


open index.html with an web browser.




or

you could copy web contents with wget command like this:

$ wget --user-agent=Mozilla --mirror --wait=1 http://zzzzz

perf : Performance monitoring for the Linux kernel

- about perf

https://perf.wiki.kernel.org/index.php/Tutorial



[root@fc17 ~]# cat /etc/fedora-release
Fedora release 17 (Beefy Miracle)

[root@fc17 ~]# uname -ri
3.4.0-1.fc17.x86_64 x86_64

install perf via yum
[root@fc17 ~]# yum install perf -y

[ example usage ]

# perf top

you can see which processes affect linux kernel performance.

you could also see the detail of specific process info.

select a process -> type enter





here’s an output of map details.





- perf record and perf repot

record kernel performance into a file

[root@fc17 ~]# perf record -a sleep 5
[ perf record: Woken up 5 times to write data ]
[ perf record: Captured and wrote 2.234 MB perf.data (~97596 samples) ]

info is written into perf.data file
.
read that data
“perf report” command reads info from perf.data file.
# perf report
Events: 14K cycles                                                              
12.32%          swapper  [kernel.kallsyms]                   [k] native_safe_ha
 5.25%              dig  ld-2.15.so                          [.] do_lookup_x
 2.75%              dig  ld-2.15.so                          [.] strcmp
 2.37%           chrome  libflashplayer.so                   [.] 0x00000000003d
 1.75%              dig  [kernel.kallsyms]                   [k] clear_page_c
 1.66%              dig  [kernel.kallsyms]                   [k] page_fault
 1.49%              dig  libc-2.15.so                        [.] __memset_x86_6
 1.38%              dig  ld-2.15.so                          [.] _dl_lookup_sym
 1.32%   gnome-terminal  libvte2_90.so.9.3200.1              [.] 0x000000000003
 1.20%              dig  [kernel.kallsyms]                   [k] unmap_single_v
 1.13%              dig  ld-2.15.so                          [.] _dl_relocate_o
 0.97%      gnome-shell  r600_dri.so                         [.] 0x000000000005

# perf report --sort=cpu
Events: 14K cycles                                                              
26.35%  3
25.43%  0
24.50%  1
23.73%  2

- monitor a specific process

check PID you want to monitor
[root@fc17 ~]# ps aux | grep unbound | grep -v grep
unbound   1772  0.1  0.1  51596  9884 ?        Ss   00:23   0:03 unbound -c /etc/unbound/unbound.conf

[root@fc17 ~]# perf stat -p 1772 sleep 5

Performance counter stats for process id '1772':

      2619.300788 task-clock                #    0.524 CPUs utilized           [100.00%]
            2,294 context-switches          #    0.876 K/sec                   [100.00%]
              147 CPU-migrations            #    0.056 K/sec                   [100.00%]
              252 page-faults               #    0.096 K/sec                  
    2,104,000,503 cycles                    #    0.803 GHz                     [49.81%]
      576,211,571 stalled-cycles-frontend   #   27.39% frontend cycles idle    [49.55%]
      702,855,782 stalled-cycles-backend    #   33.41% backend  cycles idle    [49.55%]
    1,512,642,754 instructions              #    0.72  insns per cycle        
                                            #    0.46  stalled cycles per insn [50.19%]
      296,171,521 branches                  #  113.073 M/sec                   [50.45%]
       23,773,996 branch-misses             #    8.03% of all branches         [50.45%]

      5.001789912 seconds time elapsed

interesting tool.

Fedora 17 64bit : boxgrinder 0.10.1 libvirt delivery plugin

Here’s an explanation of how to build a VM and deploy it in a KVM host with boxgrinder libvirt delivery plugin.

[root@fc17 ~]# uname -ri
3.3.7-1.fc17.x86_64 x86_64

[root@fc17 ~]# cat /etc/fedora-release
Fedora release 17 (Beefy Miracle)

install boxgrinder via yum
[root@fc17 ~]# yum install -y *boxgrinder*

[root@fc17 ~]# boxgrinder-build --version | head -1
BoxGrinder Build 0.10.1

make a working directory
[root@fc17 ~]# mkdir boxgrinder_works
[root@fc17 ~]# cd boxgrinder_works/

make a template file
[root@fc17 boxgrinder_works]# cat centos6-jeos.appl
name: "centos6-jeos"
summary: CentOS 6 Core

os:
 name: centos
 version: 6
 password: centos

hardware:
 cpus: 1
 memory: 256
 partitions:
   "/":
     size: 5  # 5GB
   "swap":
     size: 0.5  # 0.5GB

repos:
 - name: "rbel6"
   baseurl: "http://rbel.frameos.org/stable/el6/#BASE_ARCH#/"

packages:
 - coreutils
 - openssh-server

build centos6 jeos and deploy it in “/var/lib/libvirt/images” directory.
[root@fc17 boxgrinder_works]# boxgrinder-build centos6-jeos.appl -d libvirt --delivery-config connection_uri:qemu:///system,image_delivery_uri:/var/lib/libvirt/images

building the VM
[root@fc17 boxgrinder_works]# boxgrinder-build centos6-jeos.appl -d libvirt --delivery-config connection_uri:qemu:///system,image_delivery_uri:/var/lib/libvirt/images
I, [2012-06-05T00:03:12.223041 #2978]  INFO -- : Validating appliance definition from centos6-jeos.appl file...
I, [2012-06-05T00:03:12.224695 #2978]  INFO -- : Appliance definition is valid.
I, [2012-06-05T00:03:12.232729 #2978]  INFO -- : Building 'centos6-jeos' appliance for x86_64 architecture.
I, [2012-06-05T00:03:12.236035 #2978]  INFO -- : Resolving packages added to centos6-jeos appliance definition file...
I, [2012-06-05T00:03:38.005527 #2978]  INFO -- : All additional packages for centos6-jeos appliance successfully resolved.
I, [2012-06-05T00:03:38.005846 #2978]  INFO -- : Building centos6-jeos appliance...
supermin helper [00000ms] whitelist = (not specified), host_cpu = x86_64, kernel = (null), initrd = (null), appliance = (null)
supermin helper [00000ms] inputs[0] = /usr/lib64/guestfs/supermin.d
checking modpath /lib/modules/3.3.7-1.fc17.x86_64 is a directory
picked vmlinuz-3.3.7-1.fc17.x86_64 because modpath /lib/modules/3.3.7-1.fc17.x86_64 exists
checking modpath /lib/modules/3.3.4-5.fc17.x86_64 is a directory
picked vmlinuz-3.3.4-5.fc17.x86_64 because modpath /lib/modules/3.3.4-5.fc17.x86_64 exists
supermin helper [00000ms] finished creating kernel
supermin helper [00001ms] visiting /usr/lib64/guestfs/supermin.d
supermin helper [00001ms] visiting /usr/lib64/guestfs/supermin.d/base.img
supermin helper [00007ms] visiting /usr/lib64/guestfs/supermin.d/daemon.img
supermin helper [00014ms] visiting /usr/lib64/guestfs/supermin.d/hostfiles
supermin helper [00098ms] visiting /usr/lib64/guestfs/supermin.d/init.img
supermin helper [00098ms] adding kernel modules
supermin helper [00196ms] finished creating appliance
supermin helper [00000ms] whitelist = (not specified), host_cpu = x86_64, kernel = /tmp/guestfs.gIaqbT/kernel, initrd = /tmp/guestfs.gIaqbT/initrd, appliance = /tmp/guestfs.gIaqbT/root
supermin helper [00000ms] inputs[0] = /usr/lib64/guestfs/supermin.d
checking modpath /lib/modules/3.3.7-1.fc17.x86_64 is a directory
picked vmlinuz-3.3.7-1.fc17.x86_64 because modpath /lib/modules/3.3.7-1.fc17.x86_64 exists
checking modpath /lib/modules/3.3.4-5.fc17.x86_64 is a directory
picked vmlinuz-3.3.4-5.fc17.x86_64 because modpath /lib/modules/3.3.4-5.fc17.x86_64 exists
supermin helper [00000ms] finished creating kernel
supermin helper [01219ms] finished mke2fs
supermin helper [01220ms] visiting /usr/lib64/guestfs/supermin.d
supermin helper [01220ms] visiting /usr/lib64/guestfs/supermin.d/base.img
supermin helper [05841ms] visiting /usr/lib64/guestfs/supermin.d/daemon.img
supermin helper [05881ms] visiting /usr/lib64/guestfs/supermin.d/hostfiles
supermin helper [17090ms] visiting /usr/lib64/guestfs/supermin.d/init.img
supermin helper [17095ms] adding kernel modules
supermin helper [30948ms] closing ext2 filesystem
supermin helper [30948ms] finished creating appliance
W, [2012-06-05T00:11:50.557966 #2978]  WARN -- : Loading SELinux policy failed. SELinux may be not fully initialized.
I, [2012-06-05T00:12:00.319755 #2978]  INFO -- : Executing post operations after build...
I, [2012-06-05T00:12:00.694046 #2978]  INFO -- : Base image for centos6-jeos appliance was built successfully.
I, [2012-06-05T00:12:00.718734 #2978]  INFO -- : Copying disk build/appliances/x86_64/centos/6/centos6-jeos/1.0/centos-plugin/centos6-jeos-sda.raw to: /var/lib/libvirt/images...
I, [2012-06-05T00:12:48.573367 #2978]  INFO -- : Determining remotely.
I, [2012-06-05T00:12:50.454926 #2978]  INFO -- : Defining domain centos6-jeos-1-0-centos-6-x86_64-raw

centos jeos VM has been deployed !
[root@fc17 boxgrinder_works]# virsh list --all
Id    Name                           State
----------------------------------------------------
-     centos6-jeos-1-0-centos-6-x86_64-raw shut off


virsh # dumpxml centos6-jeos-1-0-centos-6-x86_64-raw
<domain type='qemu'>
 <name>centos6-jeos-1-0-centos-6-x86_64-raw</name>
 <uuid>4e2aeb27-2aa4-2751-ad51-a0ac798466b8</uuid>
 <description>CentOS 6 Core</description>
 <memory unit='KiB'>262144</memory>
 <currentMemory unit='KiB'>262144</currentMemory>
 <vcpu>1</vcpu>
 <os>
   <type arch='x86_64' machine='pc-0.15'>hvm</type>
   <boot dev='hd'/>
 </os>
 <features>
   <pae/>
 </features>
 <clock offset='utc'/>
 <on_poweroff>destroy</on_poweroff>
 <on_reboot>restart</on_reboot>
 <on_crash>destroy</on_crash>
 <devices>
   <emulator>/usr/bin/qemu-system-x86_64</emulator>
   <disk type='file' device='disk'>
     <driver name='qemu' type='raw'/>
     <source file='/var/lib/libvirt/images/centos6-jeos-sda.raw'/>
     <target dev='hda' bus='ide'/>
     <address type='drive' controller='0' bus='0' target='0' unit='0'/>
   </disk>
   <controller type='usb' index='0'>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
   </controller>
   <controller type='ide' index='0'>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
   </controller>
   <interface type='network'>
     <mac address='52:54:00:91:44:2b'/>
     <source network='default'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
   </interface>
   <serial type='pty'>
     <target port='0'/>
   </serial>
   <console type='pty'>
     <target type='serial' port='0'/>
   </console>
   <input type='mouse' bus='ps2'/>
   <graphics type='vnc' port='-1' autoport='yes'/>
   <video>
     <model type='cirrus' vram='9216' heads='1'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
   </video>
   <memballoon model='virtio'>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
   </memballoon>
 </devices>
</domain>

virsh #



start the VM
virsh # start centos6-jeos-1-0-centos-6-x86_64-raw
Domain centos6-jeos-1-0-centos-6-x86_64-raw started

virsh # list --all
Id    Name                           State
----------------------------------------------------
1     centos6-jeos-1-0-centos-6-x86_64-raw running