tag:blogger.com,1999:blog-87572250998444641252024-03-19T18:02:58.946+08:00Yeonki's CloudAnonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.comBlogger112125tag:blogger.com,1999:blog-8757225099844464125.post-60506877263848029412015-04-05T21:40:00.001+08:002015-04-06T06:36:02.082+08:00Ecalyptus block storage integration with Ceph<span style="font-family: Verdana;">
This week, my purpose was to deploy Ceph to be used block storage of Eucalyptus.
I created three machines, each machine had 4 X 10G - one for OS, three for OSD.<br><br>
</span>
<a href="http://3.bp.blogspot.com/-ePWSdpBATx8/VSFNDofQkUI/AAAAAAAAU_k/sPRbLwF-EGI/s1600/euca-ceph02.png" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" src="http://3.bp.blogspot.com/-ePWSdpBATx8/VSFNDofQkUI/AAAAAAAAU_k/sPRbLwF-EGI/s400/euca-ceph02.png" /></a>
<br><br>
<span style="font-family: Verdana;">
As see the above picture, three machines were added for Ceph storage and I also made Storage Controller node separated from Cluster Controller node.
<br><br>
When I was deploying these, I encountered two problems.
<ul style="list-style-type:circle">
<li>Ceph was in <b>HEALTH_WARN</b> - 192 pgs incomplete / 192 pgs stuck inactive / 192 pgs stuck unclean </li>
<li>Eucalyptus Storage was in <b>NOTREADY</b></li>
</ul>
<br>
I created just one cluster, after that, I validated the ceph cluster. It showed HEALTHY_WARN.<br>
</span>
<pre class="brush: bash">
ceph@ceph-node1:~/cluster01$ ceph osd tree
# id weight type name up/down reweight
-1 0 root default
-2 0 host ceph-node1
0 0 osd.0 up 1
1 0 osd.1 up 1
2 0 osd.2 up 1
-3 0 host ceph-node2
3 0 osd.3 up 1
4 0 osd.4 up 1
5 0 osd.5 up 1
-4 0 host ceph-node3
6 0 osd.6 up 1
7 0 osd.7 up 1
8 0 osd.8 up 1
ceph@ceph-node1:~/cluster01$ ceph status
cluster 565bb65e-775d-449d-8d57-f36c7cf4a1d5
health HEALTH_WARN 192 pgs incomplete; 192 pgs stuck inactive; 192 pgs stuck unclean
monmap e1: 1 mons at {ceph-node1=10.10.10.30:6789/0}, election epoch 2, quorum 0 ceph-node1
osdmap e28: 9 osds: 9 up, 9 in
pgmap v53: 192 pgs, 3 pools, 0 bytes data, 0 objects
296 MB used, 45683 MB / 45980 MB avail
192 incomplete
</pre>
<span style="font-family: Verdana;">
Whenever I tried to run command, I couldn't get the result.
</span>
<pre class="brush: bash">
ceph@ceph-node1:~/cluster01$ rados lspools
data
metadata
rbd
ceph@ceph-node1:~/cluster01$ rados -p metadata ls
</pre>
<span style="font-family: Verdana;">
Because of in-completed pgs, following requested becomes slow requests and query commands hang.<br><br>
Meanwhile, I got a hint from the blog <a href="http://bc-bd.org/blog/blog/2014/12/16/ceph/">"Ceph, Small Disks and Pgs Stuck Incomplete"</a>.
It said that If the drive is small enough, OSD weights can result in 0.00. My all OSD's weights were zero. According to the site, weights can be non-zero if it has at least 10G. Although HDD had 10GB each (10GB = 0.01), half partitioned as ceph journal. Aa s result, my OSD for storing data only had 5G each and it was 0.00<br><br>
So, I manually updated.
</span>
<pre class="brush: bash">
ceph@ceph-node1:~/cluster01$ ceph osd crush reweight osd.0 1
reweighted item id 0 name 'osd.0' to 1 in crush map
ceph@ceph-node1:~/cluster01$ ceph osd crush reweight osd.1 1
reweighted item id 1 name 'osd.1' to 1 in crush map
ceph@ceph-node1:~/cluster01$ ceph osd crush reweight osd.2 1
reweighted item id 2 name 'osd.2' to 1 in crush map
ceph@ceph-node1:~/cluster01$ ceph osd crush reweight osd.3 1
reweighted item id 3 name 'osd.3' to 1 in crush map
ceph@ceph-node1:~/cluster01$ ceph osd crush reweight osd.4 1
reweighted item id 4 name 'osd.4' to 1 in crush map
ceph@ceph-node1:~/cluster01$ ceph osd crush reweight osd.5 1
reweighted item id 5 name 'osd.5' to 1 in crush map
ceph@ceph-node1:~/cluster01$ ceph osd crush reweight osd.6 1
reweighted item id 6 name 'osd.6' to 1 in crush map
ceph@ceph-node1:~/cluster01$ ceph osd crush reweight osd.7 1
reweighted item id 7 name 'osd.7' to 1 in crush map
ceph@ceph-node1:~/cluster01$ ceph osd crush reweight osd.8 1
reweighted item id 8 name 'osd.8' to 1 in crush map
ceph@ceph-node1:~/cluster01$ ceph osd tree
# id weight type name up/down reweight
-1 9 root default
-2 3 host ceph-node1
0 1 osd.0 up 1
1 1 osd.1 up 1
2 1 osd.2 up 1
-3 3 host ceph-node2
3 1 osd.3 up 1
4 1 osd.4 up 1
5 1 osd.5 up 1
-4 3 host ceph-node3
6 1 osd.6 up 1
7 1 osd.7 up 1
8 1 osd.8 up 1
# Status is in HEALTH_OK
ceph@ceph-node1:~/cluster01$ ceph status
cluster 565bb65e-775d-449d-8d57-f36c7cf4a1d5
health HEALTH_OK
monmap e1: 1 mons at {ceph-node1=10.10.10.30:6789/0}, election epoch 2, quorum 0 ceph-node1
osdmap e56: 9 osds: 9 up, 9 in
pgmap v122: 192 pgs, 3 pools, 0 bytes data, 0 objects
316 MB used, 45664 MB / 45980 MB avail
192 active+clean
# Create pools for volumes and snapshots
ceph@ceph-node1:~/cluster01$ ceph osd pool create euca-volumes 128 128
ceph@ceph-node1:~/cluster01$ ceph osd pool create euca-snapshots 128 128
ceph@ceph-node1:~/cluster01$ ceph osd pool set euca-volumes size 2
set pool 4 size to 2
ceph@ceph-node1:~/cluster01$ ceph osd pool set euca-snapshots size 2
set pool 5 size to 2 </pre>
<span style="font-family: Verdana;">
Ceph's status changed to <b>HEALTH_OK</b>. There were no more hang for commands. <br><br>
Next, I am going to explain how I solved NOTREADY state for Storage service.
I had let this problem continued, so far, I focused on launching VMs, I didn't need to attach volumes or snapshots.
<br><br>
However, It's time to make it work. I always got the same result by running euca-describe-services.
</span>
<pre class="brush: bash">
[root@euca-clc ~]# euca-describe-services --all -E
...
SERVICE storage cluster01 sc-euca-clc NOTREADY 25 http://10.10.10.170:8773/services/Storage arn:euca:eucalyptus:cluster01:storage:sc-euca-clc/
ERROR storage cluster01 sc-euca-clc Failed to lookup host 10.10.10.170 for service arn:euca:eucalyptus:cluster01:storage:sc-euca-clc/. Current hosts are: [Host 192.168.1.169 #25 /192.168.1.169 coordinator=192.168.1.169 booted db:synched(synced) dbpool:ok started=1428187521637 [/10.10.10.169, /192.168.1.169], Host 192.168.1.170 #25 /192.168.1.170 coordinator=192.168.1.169 booted nodb started=1428187908203 [/10.10.10.170, /192.168.1.170]]
SERVICEEVENT 1ea068a2-83ea-4007-a8aa-33bd1befa68d arn:euca:eucalyptus:cluster01:storage:sc-euca-clc/
SERVICEEVENT 1ea068a2-83ea-4007-a8aa-33bd1befa68d ERROR
SERVICEEVENT 1ea068a2-83ea-4007-a8aa-33bd1befa68d Sun Apr 05 07:53:47 KST 2015
</pre>
I added storage controller on the private network (10.10.10.0/24). I found that coordinator - I wasn't sure what it was - was running on the different network (192.168.1.0/24). I suddenly thought how it would be when I added storage controller on the same network.
<pre class="brush: bash">
[root@euca-clc ~]# euca_conf --register-sc --partition cluster01 --host 192.168.1.171 --component sc-euca-sc
SERVICE storage cluster01 sc-euca-sc BROKEN 29 http://192.168.1.171:8773/services/Storage arn:euca:eucalyptus:cluster01:storage:sc-euca-sc/
</pre>
<span style="font-family: Verdana;">
After a while, I checked it again.<br>
</span><pre class="brush: bash">
[root@euca-clc ~]# euca-describe-services --all
..
SERVICE storage cluster01 sc-euca-sc ENABLED 62 http://192.168.1.171:8773/services/Storage arn:euca:eucalyptus:cluster01:storage:sc-euca-sc/
SERVICE cluster cluster01 cc-euca-cc ENABLED 62 http://10.10.10.170:8774/axis2/services/EucalyptusCC arn:euca:eucalyptus:cluster01:cluster:cc-euca-cc/
SERVICE node cluster01 10.10.10.178 ENABLED 62 http://10.10.10.178:8775/axis2/services/EucalyptusNC arn:euca:bootstrap:cluster01:node:10.10.10.178/
...
</pre>
<span style="font-family: Verdana;">
Finally, I got it working. <br><br>
The next steps will be configuring properties to use Ceph and The following is a site for well-explaining next steps - <a href="https://johnpreston78.wordpress.com/2015/02/21/eucalyptus-and-ceph-for-elastic-block-storage/">https://johnpreston78.wordpress.com/2015/02/21/eucalyptus-and-ceph-for-elastic-block-storage</a> <br>
</span>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-76604198702393361802015-03-29T14:25:00.002+08:002015-03-29T19:21:49.034+08:00Troubleshoot - Eucalyptus Instances do not get private IP address<span style="font-family: Verdana;">
I prepare 3 VMs on my VMware Workstation for testing Eucalyptus. These are Cloud Controller(CLC), Cluster Controller(CC) and Node Cluster(NC). <br /><br />
I installed components like the following:
</span>
<a href="http://4.bp.blogspot.com/-hILxFESE69U/VRdvRxvOTLI/AAAAAAAAU0U/7nqJXU45kXs/s1600/euca01.png" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" src="http://4.bp.blogspot.com/-hILxFESE69U/VRdvRxvOTLI/AAAAAAAAU0U/7nqJXU45kXs/s400/euca01.png" /></a><br>
<span style="font-family: Verdana;">
<ol>
<li>S/W: CentOS 6.6, Eucalyptus 4.1.0, euca2ools 3.2.0</li>
<li>Network Mode: Managed(NOVLAN)</li>
<li>IPs: Public 192.168.1.0/24, Private 10.10.10.0/24, Virtual Network: 172.16.0.0/16</li>
</ol>
DHCP daemon (yellow) installed on CC node and VMs of NC node had to get IP address from this daemon if don't have the problem. <br><br>
I created VM but failed to get IP address, specifically, the VM was able to get IP without turning off firewall service on NC node. <br><br>
I printed console when didn't get IP
</span>
<pre class="brush: bash">
[root@euca-clc ~]# euca-get-console-output i-9521eb03
...
Cloud-init v. 0.7.4 running 'init-local' at Tue, 24 Mar 2015 22:00:23 +0000. Up 60.61 seconds.
Starting cloud-init: /usr/lib/python2.6/site-packages/cloudinit/url_helper.py:40: UserWarning: Module backports was already imported from /usr/lib64/python2.6/site-packages/backports/__init__.pyc, but /usr/lib/python2.6/site-packages is being added to sys.path
import pkg_resources
Cloud-init v. 0.7.4 running 'init' at Tue, 24 Mar 2015 22:00:25 +0000. Up 61.88 seconds.
ci-info: +++++++++++++++++++++++Net device info+++++++++++++++++++++++
ci-info: +--------+------+-----------+-----------+-------------------+
ci-info: | Device | Up | Address | Mask | Hw-Address |
ci-info: +--------+------+-----------+-----------+-------------------+
ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | . |
ci-info: | eth0 | True | . | . | d0:0d:dc:bc:09:70 |
ci-info: +--------+------+-----------+-----------+-------------------+
ci-info: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Route info failed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
</pre>
<span style="font-family: Verdana;">
<br>
The root cause was that I did wrong firewall settings on NC node. The important thing was to add FOWARD rules of virtual network (172.16.0.0/16).
</span>
<pre class="brush: bash">
# Add FORWARD rules
[root@euca-nc01 ~]# iptables --append FORWARD --proto udp --sport 68 --dport 67 --jump ACCEPT
[root@euca-nc01 ~]# iptables --append FORWARD --source 172.16.0.0/16 --jump ACCEPT
[root@euca-nc01 ~]# iptables --append FORWARD --destination 172.16.0.0/16 --jump ACCEPT
# Recreate VM
[root@euca-clc ~]# euca-run-instances $image_id --instance-type m1.small --key euca-default --group default
[root@euca-clc ~]# euca-get-console-output $ins_id
...
Starting cloud-init: /usr/lib/python2.6/site-packages/cloudinit/url_helper.py:40: UserWarning: Module backports was already imported from /usr/lib64/python2.6/site-packages/backports/__init__.pyc, but /usr/lib/python2.6/site-packages is being added to sys.path
import pkg_resources
Cloud-init v. 0.7.4 running 'init-local' at Sun, 29 Mar 2015 07:56:50 +0000. Up 38.13 seconds.
Starting cloud-init: /usr/lib/python2.6/site-packages/cloudinit/url_helper.py:40: UserWarning: Module backports was already imported from /usr/lib64/python2.6/site-packages/backports/__init__.pyc, but /usr/lib/python2.6/site-packages is being added to sys.path
import pkg_resources
Cloud-init v. 0.7.4 running 'init' at Sun, 29 Mar 2015 07:56:52 +0000. Up 40.55 seconds.
ci-info: +++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++
ci-info: +--------+------+--------------+-----------------+-------------------+
ci-info: | Device | Up | Address | Mask | Hw-Address |
ci-info: +--------+------+--------------+-----------------+-------------------+
ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | . |
ci-info: | eth0 | True | 172.16.77.93 | 255.255.255.240 | d0:0d:f3:ab:33:87 |
ci-info: +--------+------+--------------+-----------------+-------------------+
ci-info: +++++++++++++++++++++++++++++++++Route info++++++++++++++++++++++++++++++++++
ci-info: +-------+--------------+--------------+-----------------+-----------+-------+
ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
ci-info: +-------+--------------+--------------+-----------------+-----------+-------+
ci-info: | 0 | 172.16.77.80 | 0.0.0.0 | 255.255.255.240 | eth0 | U |
ci-info: | 1 | 0.0.0.0 | 172.16.77.81 | 0.0.0.0 | eth0 | UG |
ci-info: +-------+--------------+--------------+-----------------+-----------+-------+
</pre>
<span style="font-family: Verdana;">
<br>
I made a inquiry of what should do to get IP properly and one of my colleague finally gave me <a href="https://eucalyptus.atlassian.net/browse/EUCA-5323">link</a> that was perfect answer.
According to link, provided the guidance for configuring the following settings on NC node.
</span>
<pre class="brush: bash">
# Generated by iptables-save v1.4.7 on Wed Mar 6 21:19:36 2013
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [294733:108329028]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8775 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -p udp -m udp --sport 68 --dport 67 -j ACCEPT
-A FORWARD -s 192.168.0.0/16 -j ACCEPT
-A FORWARD -d 192.168.0.0/16 -j ACCEPT
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Wed Mar 6 21:19:36 2013
</pre>
<span style="font-family: Verdana;">
<br>
One more thing that I need to mention. <br>
In case of not connecting metadata server when running VM, Please check if opens TCP port 8773 on CLC node. <br><br>
Let's see the picture.
<a href="http://1.bp.blogspot.com/-zJ2Cvl1YcFY/VReTcckx0bI/AAAAAAAAU0o/R0lARQILZlk/s1600/euca02.png" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-zJ2Cvl1YcFY/VReTcckx0bI/AAAAAAAAU0o/R0lARQILZlk/s400/euca02.png" /></a><br>
Metadata server is typically 169.254.169.254 and is added to eth1 on CC node. It looks like Medata server is running on CC node.<br><br>
Look at the next.<br>
<a href="http://2.bp.blogspot.com/-g1P-IeYRGhQ/VReW4AXb6MI/AAAAAAAAU00/iqgR5gtKpgw/s1600/euca03.png" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-g1P-IeYRGhQ/VReW4AXb6MI/AAAAAAAAU00/iqgR5gtKpgw/s400/euca03.png" /></a><br>
Eucalyptus automatically adds a PREROUTING rule which send Meatadata server traffic to 8773 port of CLC node.<br>So, the node which serves as Metadata server is CLC node, not CC node. As as result, it needs to check CLC node in dealing metadata.<br>
</span>
<span style="font-family: Verdana;">
<br><br>
References: <br>
1. <a href="https://www.eucalyptus.com/docs/eucalyptus/4.1.0/index.html#install-guide/configuring_iptables.html">https://www.eucalyptus.com/docs/eucalyptus/4.1.0/index.html#install-guide/configuring_iptables.html</a><br>
2. <a href="https://eucalyptus.atlassian.net/browse/EUCA-5323">https://eucalyptus.atlassian.net/browse/EUCA-5323</a>
</span>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-45103812919082057442014-11-26T01:04:00.000+08:002014-11-26T01:04:03.777+08:00Cookbook application_java and workaround to the error - undefined method 'create' for nil:NilClass<span style="font-family: Verdana;">These days, I developed cookbooks to deploy java web applications. To do this efficiently, need to combine some cookbooks: java, tomcat and application_java. As what they intend to do by their names, they certainly install and configure software related to java (JDK, java container server and java application). <br><br>
Developing java and tomcat cookbook wasn't a big deal, but, I encountered problem with an error in case of application_java. My code was follows:
</span>
<pre class="brush: bash">
include_recipe 'java'
application 'shop-admin' do
path '/var/shop-admin'
repository 'http://192.168.56.170/zabbix/shop.admin.war'
revision '1.0'
scm_provider Chef::Provider::RemoteFile::Deploy
java_webapp
tomcat
end
</pre>
<span style="font-family: Verdana;">My error message was:</span>
<pre class="brush: bash">
...
================================================================================
Error executing action `deploy` on resource 'deploy_revision[shop-admin]'
================================================================================
NoMethodError
-------------
undefined method `create' for nil:NilClass
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/application_java/libraries/provider_remote_file_deploy.rb:53:in `action_sync'
...
</pre>
<span style="font-family: Verdana;">
The solution was to change application_java cookbook. By default, Chef Supermarket links to <a href="https://github.com/poise/application_java">https://github.com/poise/application_java</a>.<br><br>
Other people who had same issue already posted and someone recommended to clone from <a href="https://github.com/jamiely/application_java">https://github.com/jamiely/application_java</a><br>
I replaced with "jamiely/application_java". After that, my war deployed well.
</span>
Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-51896394268629622552014-11-22T18:40:00.000+08:002014-11-22T18:41:35.175+08:00Cost comparision VMware and Redhat Cloud<span style="font-family: Verdana;">Comparison between VMware and Redhat - Redhat Cloud Infrastructure (RHCI includes Openstack and redhat currently mainatains RDO). VMware is often and still being compared with others. But cost saving is a silver bullet to attract IT manager. This image came from Redhat's webinar - <a href="http://www.redhat.com/en/about/events/building-and-managing-hybrid-cloud-red-hat-cloud-infrastructure">http://www.redhat.com/en/about/events/building-and-managing-hybrid-cloud-red-hat-cloud-infrastructure</a>.</span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-RbT2mVycOKU/VHBixgm-LgI/AAAAAAAAScQ/gXab4J-bD5I/s1600/rhci.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="//images-blogger-opensocial.googleusercontent.com/gadgets/proxy?url=http://3.bp.blogspot.com/-RbT2mVycOKU/VHBixgm-LgI/AAAAAAAAScQ/gXab4J-bD5I/s320/rhci.png&container=blogger&gadget=a&rewriteMime=image/*"></a></div>
<div style='clear: both;'></div>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-128786261871780282014-05-10T09:34:00.000+08:002014-05-10T09:39:37.340+08:00How to change network model for Windows instance in Openstack.<span style="font-family: Verdana;">I posted about <a href="http://hyper-choi.blogspot.kr/2014/05/installing-windows-server-2012-r2-with.html">installing virtio drivers on Windows 2012R2</a>. This was for as Openstack glance.<br><br>
I chose this image to create a Windows virtual instance using nova command and I found the instance had no network connection at all after boot.<br></span>
<a href="http://1.bp.blogspot.com/-riM7hH5ECGU/U20_pswnurI/AAAAAAAAQbY/gzVmK0g_wc0/s1600/no_active_connection.png" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" src="http://1.bp.blogspot.com/-riM7hH5ECGU/U20_pswnurI/AAAAAAAAQbY/gzVmK0g_wc0/s1600/no_active_connection.png" height="298" width="400" /></a><br><br>
<span style="font-family: Verdana;">My last post described how to install virtio scsi controller (HDD) and baloon (memory) driver. Network was not included.<br><br>
In Openstack, the compute node which has KVM hypervisor tries to add virtual network typed "virtio" for instances. My instance had also virtio one. </span>
<pre class="brush: bash">$ virsh dumpxml
...
<interface type='bridge'>
<mac address='fa:16:3e:82:9d:c3'/>
<source bridge='br-int'/>
<virtualport type='openvswitch'>
<parameters interfaceid='a3bc1442-e121-4730-9f6f-1abff6466f11'/>
</virtualport>
<target dev='tapa3bc1442-e1'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</pre>
<span style="font-family: Verdana;">Because I didn't installed virtio network driver for the glance image.<br>
So, What I did to enable network of the instance was to change network type from "virtio" to "e1000" (default ethernet driver in Linux) of the glance image.
</span><br>
<pre class="brush: bash">$ glance image-update --property hw_vif_model=e1000 $image_id2
+-------------------------+--------------------------------------+
| Property | Value |
+-------------------------+--------------------------------------+
| Property 'hw_vif_model' | e1000 |
| checksum | 572850147e8f2cf1814e4953065a6421 |
| container_format | bare |
| created_at | 2014-05-09T04:16:56 |
| deleted | False |
| deleted_at | None |
| disk_format | qcow2 |
| id | 0ec11912-6634-4e09-bf09-c97373da2a47 |
| is_public | True |
| min_disk | 0 |
| min_ram | 0 |
| name | windows2012r2 |
| owner | None |
| protected | False |
| size | 10739318784 |
| status | active |
| updated_at | 2014-05-09T07:48:21 |
+-------------------------+--------------------------------------+
</pre>
<br>
<span style="font-family: Verdana;">
After updating, I created the 2nd instance. This time, network in my 2nd instance is working well.<br>
<a href="http://2.bp.blogspot.com/-2lLIdrJSGfo/U210jFb36vI/AAAAAAAAQbs/yW99nGT002g/s1600/no_active_connection2.png" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" src="http://2.bp.blogspot.com/-2lLIdrJSGfo/U210jFb36vI/AAAAAAAAQbs/yW99nGT002g/s400/no_active_connection2.png" height="298" width="400" /></a><br><br>
Let's look at how the network type is added for the 2nd instance. <br></span>
<pre class="brush: bash">$ virsh dumpxml
...
<interface type='bridge'>
<mac address='fa:16:3e:57:cf:41'/>
<source bridge='br-int'/>
<virtualport type='openvswitch'>
<parameters interfaceid='1a3a7af8-945e-425f-a39f-e6a48b7d87f3'/>
</virtualport>
<target dev='tap1a3a7af8-94'/>
<model type='e1000'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
</pre>
<br>
<span style="font-family: Verdana;">
As to install virtio network driver, I added it to <a href="http://www.evernote.com/shard/s63/sh/7ca831a4-b275-4c6f-8886-4ba9103c0af3/5a912740e9ab14f342e3c194974390eb">my evernote</a>. Please refer to this link for further information. Of course, you don't need to change network type in case you've already installed virtio network driver.
</span>
Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-8918792513765866482014-05-05T12:07:00.001+08:002014-05-05T12:07:50.757+08:00Installing Windows Server 2012 R2 with VirtIO on KVM/QEMU.<br />
<span style="font-family: Verdana, sans-serif;">I'd like to share my evenote about installing Windows Server 2012 R2 with virtio on KVM/QEMU.</span><br />
<br />
<span style="font-family: Verdana, sans-serif;">VirtIO drivers which enable para-virtual in KVM generally provide better performance</span><span style="font-family: Verdana, sans-serif;"> than emulated devices under full-virtualization.</span><br />
<br />
<a href="http://3.bp.blogspot.com/-dPnXG6zcXnI/U2cNJ3_8VcI/AAAAAAAAQag/Fx8DxnGOKYc/s1600/vmm+panel.png" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" src="http://3.bp.blogspot.com/-dPnXG6zcXnI/U2cNJ3_8VcI/AAAAAAAAQag/Fx8DxnGOKYc/s1600/vmm+panel.png" height="232" width="400" /></a><br />
<br />
<span style="font-family: Verdana, sans-serif;">Tests in this note ran on a Ubuntu 12.04 machine. </span><br />
<span style="font-family: Verdana, sans-serif;">Here's my note :</span> <a href="https://www.evernote.com/shard/s63/sh/7ca831a4-b275-4c6f-8886-4ba9103c0af3/5a912740e9ab14f342e3c194974390eb" style="font-family: Verdana, sans-serif;">https://www.evernote.com/shard/s63/sh/7ca831a4-b275-4c6f-8886-4ba9103c0af3/5a912740e9ab14f342e3c194974390eb</a><br />
<br />
<br />
<br />
<span style="font-family: Verdana, sans-serif;"></span>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-29120526818168497382013-08-12T23:47:00.003+08:002013-08-12T23:47:59.801+08:00How to solve message "Starting nagios:No directory, logging in with HOME=/" when starting nagios deamon<span style="font-family: Verdana;">I wrote a script of installing nagios 3 named "install-nagios3.sh" on my github repository (<a href="https://github.com/yeonki-choi/nagios">https://github.com/yeonki-choi/nagios</a>) and tested it. After ran this, everything was fine excepts for message "Starting nagios:No directory, logging in with HOME=/" when starting nagios daemon. <br />
</span><pre class="brush: bash">$ sudo service nagios start
Starting nagios:No directory, logging in with HOME=/
done.
</pre><span style="font-family: Verdana;"><br />
I found this message was same-produced when I switched to user "nagios". It was caused there was no home directory for user "nagios". This script created the user "nagios" with no home directory during running to own nagios-core's home directory and start its daemon.</span><br />
<pre class="brush: bash">$ sudo su - nagios
No directory, logging in with HOME=/
</pre><span style="font-family: Verdana;"><br />
To do solve this, it just make home directory for that user</span><br />
<pre class="brush: bash"># Make a directory and changed the ownership
$ sudo mkdir /home/nagios
$ sudo chown -R nagios:nagios /home/nagios
# Setting the directory as the home of nagios
$ sudo usermod --home /home/nagios nagios
usermod: no changes
# Restarting nagios daemon, this time there is no above message
$ sudo service nagios restart
Running configuration check...done.
Stopping nagios: done.
Starting nagios: done.
</pre>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com3tag:blogger.com,1999:blog-8757225099844464125.post-2456942498914238962013-07-14T08:32:00.000+08:002013-07-14T08:32:14.299+08:00Warning :Remote branch XXX.. not found in upstream origin, using HEAD instead when cloning xen source<span style="font-family: Verdana;">When you clone git repository for xen 4.3, you would get the following message:<br />
"Remote branch RELEASE-4.3.0 not found in upstream origin, using HEAD instead"<br />
<br />
This is caused because of git version, prior version to 1.7.10 don't support checking out tag. <br />
</span><pre class="brush: bash"># My git version
$ git --version
git version 1.7.9.5
# Download Xen source
$ git clone -b RELEASE-4.3.0 git://xenbits.xen.org/xen.git
Cloning into 'xen'...
remote: Counting objects: 272877, done.
remote: Compressing objects: 100% (55538/55538), done.
remote: Total 272877 (delta 214914), reused 270399 (delta 212700)
Receiving objects: 100% (272877/272877), 53.61 MiB | 1.75 MiB/s, done.
Resolving deltas: 100% (214914/214914), done.
<br>warning: Remote branch RELEASE-4.3.0 not found in upstream origin, using HEAD instead</br>
</pre><span style="font-family: Verdana;"><br />
Simply, you are able to check out additionally.<br />
</span><pre class="brush: bash">$ cd xen
$ git checkout RELEASE-4.3.0
Note: checking out 'RELEASE-4.3.0'.
</pre><span style="font-family: Verdana;"><br />
Or, you can re-install the newer version of git.<br />
</span><pre class="brush: bash"># Remove the old git
$ sudo apt-get remove git
# Download git
$ wget https://git-core.googlecode.com/files/git-1.8.1.2.tar.gz
$ tar -xzvf ./git-1.8.1.2.tar.gz
$ cd git-1.8.1.2
$ make prefix=/usr/local all
$ sudo make prefix=/usr/local install
$ git --version
git version 1.8.1.2
# Download Xen source
$ git clone -b RELEASE-4.3.0 git://xenbits.xen.org/xen.git
Cloning into 'xen'...
remote: Counting objects: 272877, done.
remote: Compressing objects: 100% (55538/55538), done.
remote: Total 272877 (delta 214914), reused 270399 (delta 212700)
Receiving objects: 100% (272877/272877), 53.61 MiB | 4.01 MiB/s, done.
Resolving deltas: 100% (214914/214914), done.
Note: checking out 'f8cc9c2b713b1739b1d3d324716547fa639dce86'.
</pre><span style="font-family: Verdana;"><br />
References: <br />
1. <a href="http://stackoverflow.com/questions/17216067/git-clone-b-tag-results-in-warning-remote-branch-not-found-in-upstream-origi/17216068#17216068">http://stackoverflow.com/questions/17216067/git-clone-b-tag-results-in-warning-remote-branch-not-found-in-upstream-origi/17216068#17216068</a><br />
</span><br />
<br />
Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-47958043082227720782013-07-10T21:47:00.000+08:002013-07-10T21:47:17.028+08:00Note things in dealing with Nagios+Ndo2DB and properties in host configuration<span style="font-family: Verdana;">I'd like to point out two things related nagios. <br />
As we know, we are able to save status data of host and service into relational database using ndo2db module and I described how to setup <a href="http://hyper-choi.blogspot.kr/2012/07/monitoring-setting-up-nagois-ndoutils.html">at a post.</a><br />
<br />
When people have nagios + nod2db monitoring system in their environments, they may find that data is duplicated in the table "nagios_hosts" and what makes this happen. <br />
<br />
For example, this is result of the query of host definitions</span><br />
<pre class="brush: bash">mysql> SELECT host_id, alias, address, config_type FROM `nagios_hosts`;
+----------+-----------+----------------+---------------+
| host_id | alias | address | config_type |
+----------+-----------+----------------+---------------+
|10963 |test03 | 192.168.20.183 | 1 |
|10962 |cent-test | 192.168.20.175 | 1 |
|10961 |FDCMOCDB01 | 192.168.20.172 | 1 |
|10960 |test03 | 192.168.20.183 | 0 |
|10959 |cent-test | 192.168.20.175 | 0 |
|10958 |FDCMOCDB01 | 192.168.20.172 | 0 |
+----------+-----------+----------------+---------------+
</pre><span style="font-family: Verdana;">Like this, every host is duplicated except for config_type.<br />
<br />
Ndo2db can either get host definition from the original config file (It is usually located in /etc/nagios/objects/hosts.cfg) or retained config file(/var/log/nagios/status.dat)<br />
<br />
As default, config_output_options is 3 which means get both data from config file and retained config file.</span><br />
<pre class="brush: bash">$ cat /etc/nagios/ndomod.cfg | grep config*
...
# CONFIG OUTPUT OPTION
# This option determines what types of configuration data the NDO NEB module will dump from Nagios.
# Values can be OR'ed together.
# Values:
# 0 = Don't dump any configuration information
# 1 = Dump only original config (from config files)
# 2 = Dump config only after retained information has been restored
# 3 = Dump both original and retained configuration
config_output_options=3
</pre><span style="font-family: Verdana;">I changed this value to 2, I'd like to get data only from the retained file.</span><br />
<pre class="brush: bash">$ cat /etc/nagios/ndomod.cfg
...
config_output_options=2
</pre><span style="font-family: Verdana;">Then, Restarting Services</span><br />
<pre class="brush: bash">$ service ndo2db restart
$ service nagios restart
mysql> SELECT host_id, alias, address, config_type FROM `nagios_hosts`;
+----------+-----------+----------------+---------------+
| host_id | alias | address | config_type |
+----------+-----------+----------------+---------------+
|10972 |test03 | 192.168.20.183 | 1 |
|10971 |cent-test | 192.168.20.175 | 1 |
|10970 |FDCMOCDB01 | 192.168.20.172 | 1 |
+----------+-----------+----------------+---------------+
</pre><span style="font-family: Verdana;">Next topic, I think it is more important point.<br />
I usually edit config files in the directory "/etc/nagios/objects/" when need to change some properties, active_checks_enabled for instance. <br />
But I managed to know that nagios doesn't pick up some properties from config files. Rather, nagios relies retention files.<br />
<br />
It is said that the information from <a href="http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#host">nagios manual</a></span><br />
<blockquote class="tr_bq"><span style="font-family: Verdana; orphans: 2; text-align: -webkit-auto; widows: 2;">"It is important to point out that several directives in host, service, and contact definitions may not be picked up by Nagios when you change them in your configuration files. Object directives that can exhibit this behavior are marked with an asterisk (*). The reason for this behavior is due to the fact that Nagios chooses to honor values stored in the state retention file over values found in the config files, assuming you have state retention enabled on a program-wide basis and the value of the directive is changed during runtime with an external command."</span></blockquote><span style="font-family: Verdana;">And these are directives for host definition <br />
...<br />
active_checks_enabled *: .... <br />
passive_checks_enabled *: ....<br />
...<br />
<br />
The problem is that I cannot edit the retention status file which is read-only file and only editable by nagios. So, how can I do to change unchangeable properties by ending in config file in programming manner not using nagios web.<br />
<br />
Naiogs provides cmd.cgi interface and it can run like the below:</span><br />
<pre class="brush: bash">$ curl -d "cmd_mod=2&cmd_typ=48&host=FDCMOCDB01" "http://localhost/nagios/cgi-bin/cmd.cgi" -u "nagiosadmin:*******"
<html>
<head>
<link rel="shortcut icon" href="/nagios/images/favicon.ico" type="image/ico">
<title>
External Command Interface
</title>
<LINK REL='stylesheet' TYPE='text/css' HREF='/nagios/stylesheets/common.css'>
<LINK REL='stylesheet' TYPE='text/css' HREF='/nagios/stylesheets/cmd.css'>
</head>
<body CLASS='cmd'>
<!-- Produced by Nagios (http://www.nagios.org). Copyright (c) 1999-2007 Ethan Galstad. -->
<table border=0 width=100%>
<tr>
<td align=left valign=top width=33%>
<TABLE CLASS='infoBox' BORDER=1 CELLSPACING=0 CELLPADDING=0>
<TR><TD CLASS='infoBox'>
<DIV CLASS='infoBoxTitle'>External Command Interface</DIV>
Last Updated: Tue Jul 9 16:04:13 KST 2013<BR>
Nagios® Core™ 3.3.1 - <A HREF='http://www.nagios.org' TARGET='_new' CLASS='homepageURL'>www.nagios.org</A><BR>
Logged in as <i>nagiosadmin</i><BR>
</TD></TR>
</TABLE>
</td>
<td align=center valign=top width=33%>
</td>
<td align=right valign=bottom width=33%>
</td>
</tr>
</table>
<P><DIV CLASS='infoMessage'>Your command request was successfully submitted to Nagios for processing.<BR><BR>
Note: It may take a while before the command is actually processed.<BR><BR>
<A HREF='javascript:window.history.go(-2)'>Done</A></DIV></P>
<!-- Produced by Nagios (http://www.nagios.org). Copyright (c) 1999-2007 Ethan Galstad. -->
</body>
</html>
</pre><span style="font-family: Verdana;"><br />
This is how to run cmd.cgi with curl in the shell environment</span><br />
<pre class="brush: bash">$ curl -d cmd_typ=${cmd} \
-d cmd_mod=2 \
-d host=${host} \
-d service=${svc} \
-d btnSubmit=Commit \
-s \
-u 'user:pass \
"http://nagios.server/nagios/cgi-bin/cmd.cgi"
</pre><br />
As parameter "cmd_typ", constant values are defined in the header file "common.h"<br />
<pre class="brush: c">...
#define CMD_ENABLE_HOST_CHECK 47
#define CMD_DISABLE_HOST_CHECK 48
...
</pre><br />
If you implement this in java, you are able to execute it by using httpclient class (package org.apache.commons.httpclient) like my case. <br />
<span style="font-family: Verdana;"><br />
References: <br />
1. <a href="http://eggsonbread.com/2011/03/18/disable-enable-nagios-notifications-via-command-line-curl/">http://eggsonbread.com/2011/03/18/disable-enable-nagios-notifications-via-command-line-curl/</a><br />
2. <a href="https://github.com/ageric/nagios/blob/cc67733e82721546d9d04180c4441cdb41a6f9a2/include/common.h">https://github.com/ageric/nagios/blob/cc67733e82721546d9d04180c4441cdb41a6f9a2/include/common.h</a><br />
3. <a href="http://forums.cacti.net/post-133568.html">http://forums.cacti.net/post-133568.html</a><br />
</span> <br />
<br />
<br />
<br />
<br />
<br />
<br />
Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-57595347129375018272013-06-05T15:47:00.000+08:002013-06-05T15:48:38.299+08:00Xen 4.3 RC1 installation<span style="font-family: Verdana;">I'd like to share how to install Xen 4.3 RC (Release Candidate) as part of a testing on Xen test day. I freshly installed Ubuntu 12.04 on my physical machine.<br />
<br />
Xen source is able to download from git repository or tarball.</span><br />
<pre class="brush: bash"># download xen source from git repository
$ mkdir ~/xen-4.3
$ cd ~/xen-4.3
$ git clone -b 4.3.0-rc1 git://xenbits.xen.org/xen.git
Cloning into 'xen'...
remote: Counting objects: 271307, done.
remote: Compressing objects: 100% (59143/59143), done.
remote: Total 271307 (delta 213525), reused 263420 (delta 207531)
Receiving objects: 100% (271307/271307), 53.31 MiB | 748 KiB/s, done.
Resolving deltas: 100% (213525/213525), done.
Note: checking out '4de97462d34f7b74c748ab67600fe2386131b778'.
</pre><span style="font-family: Verdana;">If you not familiar with git, you can download tarball source</span><br />
<pre class="brush: bash">$ wget http://bits.xensource.com/oss-xen/release/4.3.0-rc1/xen-4.3.0-rc1.tar.gz
--2013-05-08 17:55:22-- http://bits.xensource.com/oss-xen/release/4.3.0-rc1/xen-4.3.0-rc1.tar.gz
Resolving bits.xensource.com (bits.xensource.com)... 63.80.4.58, 63.80.4.218
Connecting to bits.xensource.com (bits.xensource.com)|63.80.4.58|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16375588 (16M) [application/x-gzip]
Saving to: `xen-4.3.0-rc1.tar.gz'
34% [=================> ] 5,670,832 468K/s eta 25s
</pre><span style="font-family: Verdana;">Installing build tools and related modules.</span><br />
<pre class="brush: bash">$ sudo apt-get install build-essential
$ sudo apt-get install bcc bin86 gawk bridge-utils iproute libcurl3 libcurl4-openssl-dev bzip2 module-init-tools transfig tgif
$ sudo apt-get install texinfo texlive-latex-base texlive-latex-recommended texlive-fonts-extra texlive-fonts-recommended pciutils-dev mercurial
$ sudo apt-get install make gcc libc6-dev zlib1g-dev python python-dev python-twisted libncurses5-dev patch libvncserver-dev libsdl-dev libjpeg-dev
$ sudo apt-get install iasl libbz2-dev e2fslibs-dev git-core uuid-dev ocaml ocaml-findlib libx11-dev bison flex xz-utils libyajl-dev gettext markdown
$ sudo apt-get install libpixman-1-0 libpixman-1-dev
$ sudo apt-get install libc6-dev*
</pre><span style="font-family: Verdana;">Confuging the environment for installing.</span><br />
<pre class="brush: bash">$ sudo ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
Will build the following subsystems:
xen
kernels
tools
stubdom
docs
configure: creating ./config.status
config.status: creating ./config/Toplevel.mk
=== configuring in tools (/downloads/xen-4.3.0-rc1/tools)
configure: running /bin/bash ./configure --disable-option-checking '--prefix=/usr/local' --cache-file=/dev/null --srcdir=.
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
...
checking for fig2dev... /usr/bin/fig2dev
checking for pod2man... /usr/bin/pod2man
checking for pod2html... /usr/bin/pod2html
checking for pod2text... /usr/bin/pod2text
checking for markdown... /usr/bin/markdown
configure: creating ./config.status
config.status: creating ../config/Docs.mk
</pre><span style="font-family: Verdana;">To build all subsystems, use "dist" and then run "make install" to install xen.</span><br />
<pre class="brush: bash">################
# Build Xen
################
$ sudo make dist
make -C xen install
make[1]: Entering directory `/home/yeonki/xen-4.3/xen/xen'
make -f Rules.mk _install
make[2]: Entering directory `/home/yeonki/xen-4.3/xen/xen'
make -C tools
make[3]: Entering directory `/home/yeonki/xen-4.3/xen/xen/tools'
[ -d figlet ] && make -C figlet
make[4]: Entering directory `/home/yeonki/xen-4.3/xen/xen/tools/figlet'
gcc -o figlet figlet.c
make[4]: Leaving directory `/home/yeonki/xen-4.3/xen/xen/tools/figlet'
make symbols
make[4]: Entering directory `/home/yeonki/xen-4.3/xen/xen/tools'
gcc -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -Wdeclaration-after-statement -o symbols symbols.c
make[4]: Leaving directory `/home/yeonki/xen-4.3/xen/xen/tools'
make[3]: Leaving directory `/home/yeonki/xen-4.3/xen/xen/tools'
make -f /home/yeonki/xen-4.3/xen/xen/Rules.mk include/xen/compile.h
make[3]: Entering directory `/home/yeonki/xen-4.3/xen/xen'
make -C tools
make[4]: Entering directory `/home/yeonki/xen-4.3/xen/xen/tools'
[ -d figlet ] && make -C figlet
make[5]: Entering directory `/home/yeonki/xen-4.3/xen/xen/tools/figlet'
make[5]: `figlet' is up to date.
make[5]: Leaving directory `/home/yeonki/xen-4.3/xen/xen/tools/figlet'
make symbols
make[5]: Entering directory `/home/yeonki/xen-4.3/xen/xen/tools'
make[5]: `symbols' is up to date.
make[5]: Leaving directory `/home/yeonki/xen-4.3/xen/xen/tools'
make[4]: Leaving directory `/home/yeonki/xen-4.3/xen/xen/tools'
__ __ _ _ _____ _ _ _
\ \/ /___ _ __ | || | |___ / _ _ _ __ ___| |_ __ _| |__ | | ___
\ // _ \ '_ \ | || |_ |_ \ __| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
/ \ __/ | | | |__ _| ___) |__| |_| | | | \__ \ || (_| | |_) | | __/
/_/\_\___|_| |_| |_|(_)____/ \__,_|_| |_|___/\__\__,_|_.__/|_|\___|
...
make[1]: Leaving directory `/home/yeonki/xen-4.3/xen/docs'
install -d -m0755 -p /home/yeonki/xen-4.3/xen/dist/
install -m0644 -p ./COPYING /home/yeonki/xen-4.3/xen/dist
install -m0644 -p ./README /home/yeonki/xen-4.3/xen/dist
install -m0755 -p ./install.sh /home/yeonki/xen-4.3/xen/dist
################
# Install Xen
################
$ sudo make install
make -C xen install
make[1]: Entering directory `/home/yeonki/xen-4.3/xen/xen'
make -f Rules.mk _install
make[2]: Entering directory `/home/yeonki/xen-4.3/xen/xen'
make -C tools
make[3]: Entering directory `/home/yeonki/xen-4.3/xen/xen/tools'
[ -d figlet ] && make -C figlet
make[4]: Entering directory `/home/yeonki/xen-4.3/xen/xen/tools/figlet'
make[4]: `figlet' is up to date.
make[4]: Leaving directory `/home/yeonki/xen-4.3/xen/xen/tools/figlet'
make symbols
make[4]: Entering directory `/home/yeonki/xen-4.3/xen/xen/tools'
make[4]: `symbols' is up to date.
make[4]: Leaving directory `/home/yeonki/xen-4.3/xen/xen/tools'
make[3]: Leaving directory `/home/yeonki/xen-4.3/xen/xen/tools'
make -f /home/yeonki/xen-4.3/xen/xen/Rules.mk include/xen/compile.h
make[3]: Entering directory `/home/yeonki/xen-4.3/xen/xen'
__ __ _ _ _____ _ _ _
\ \/ /___ _ __ | || | |___ / _ _ _ __ ___| |_ __ _| |__ | | ___
\ // _ \ '_ \ | || |_ |_ \ __| | | | '_ \/ __| __/ _` | '_ \| |/ _ \
/ \ __/ | | | |__ _| ___) |__| |_| | | | \__ \ || (_| | |_) | | __/
/_/\_\___|_| |_| |_|(_)____/ \__,_|_| |_|___/\__\__,_|_.__/|_|\___|
...
set -x; make -C figs
+ make -C figs
make[2]: Entering directory `/home/yeonki/xen-4.3/xen/docs/figs'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/yeonki/xen-4.3/xen/docs/figs'
rm -rf //usr/local/share/doc/xen
install -d -m0755 -p //usr/local/share/doc/xen
install -d -m0755 -p //usr/local/share/man
cp -R man1 //usr/local/share/man
cp -R man5 //usr/local/share/man
[ ! -d html ] || cp -R html //usr/local/share/doc/xen
make[1]: Leaving directory `/home/yeonki/xen-4.3/xen/docs'
</pre>Xen is successfully installed. The next is to check whether xen boot files has created in /boot/ directory. <br />
<pre class="brush: bash">ls -al /boot/xen*
lrwxrwxrwx 1 root root 19 Jun 5 15:50 /boot/xen-4.3.gz -> xen-4.3-unstable.gz
-rw-r--r-- 1 root root 821559 Jun 5 15:50 /boot/xen-4.3-unstable.gz
lrwxrwxrwx 1 root root 19 Jun 5 15:50 /boot/xen-4.gz -> xen-4.3-unstable.gz
lrwxrwxrwx 1 root root 19 Jun 5 15:50 /boot/xen.gz -> xen-4.3-unstable.gz
-rw-r--r-- 1 root root 14012010 Jun 5 15:50 /boot/xen-syms-4.3-unstable
# Execute update-grub
$ sudo update-grub
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
dpkg: warning: version 'syms-4.3-unstable' has bad syntax: version number does not start with digit
dpkg: warning: version '/boot/xen.gz' has bad syntax: version number does not start with digit
dpkg: warning: version 'syms-4.3-unstable' has bad syntax: version number does not start with digit
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
dpkg: warning: version 'syms-4.3-unstable' has bad syntax: version number does not start with digit
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found memtest86+ image: /memtest86+.bin
done
# When run "update-grub", an error was occurred.
# To fix this, remove xen-syms-4.3-unstable and xen.gz
$ sudo rm /boot/xen-syms-4.3-unstable
$ sudo rm /boot/xen.gz
# Re-run update-grub
$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found linux image: /boot/vmlinuz-3.2.0-23-generic
Found initrd image: /boot/initrd.img-3.2.0-23-generic
Found memtest86+ image: /memtest86+.bin
done
#################################
# Register xen moduels as service
#################################
$ sudo update-rc.d xencommons defaults 19 18
update-rc.d: warning: xencommons start runlevel arguments (2 3 4 5) do not match LSB Default-Start values (2 3 5)
Adding system startup for /etc/init.d/xencommons ...
/etc/rc0.d/K18xencommons -> ../init.d/xencommons
/etc/rc1.d/K18xencommons -> ../init.d/xencommons
/etc/rc6.d/K18xencommons -> ../init.d/xencommons
/etc/rc2.d/S19xencommons -> ../init.d/xencommons
/etc/rc3.d/S19xencommons -> ../init.d/xencommons
/etc/rc4.d/S19xencommons -> ../init.d/xencommons
/etc/rc5.d/S19xencommons -> ../init.d/xencommons
$ sudo update-rc.d xendomains defaults 21 20
update-rc.d: warning: xendomains start runlevel arguments (2 3 4 5) do not match LSB Default-Start values (2 3 5)
Adding system startup for /etc/init.d/xendomains ...
/etc/rc0.d/K20xendomains -> ../init.d/xendomains
/etc/rc1.d/K20xendomains -> ../init.d/xendomains
/etc/rc6.d/K20xendomains -> ../init.d/xendomains
/etc/rc2.d/S21xendomains -> ../init.d/xendomains
/etc/rc3.d/S21xendomains -> ../init.d/xendomains
/etc/rc4.d/S21xendomains -> ../init.d/xendomains
/etc/rc5.d/S21xendomains -> ../init.d/xendomains
$ sudo update-rc.d xen-watchdog defaults 22 23
update-rc.d: warning: xen-watchdog start runlevel arguments (2 3 4 5) do not match LSB Default-Start values (2 3 5)
Adding system startup for /etc/init.d/xen-watchdog ...
/etc/rc0.d/K23xen-watchdog -> ../init.d/xen-watchdog
/etc/rc1.d/K23xen-watchdog -> ../init.d/xen-watchdog
/etc/rc6.d/K23xen-watchdog -> ../init.d/xen-watchdog
/etc/rc2.d/S22xen-watchdog -> ../init.d/xen-watchdog
/etc/rc3.d/S22xen-watchdog -> ../init.d/xen-watchdog
/etc/rc4.d/S22xen-watchdog -> ../init.d/xen-watchdog
/etc/rc5.d/S22xen-watchdog -> ../init.d/xen-watchdog
#################################
# rebooting boot with xen
#################################
$ cat /boot/grub/grub.cfg | grep Xen
submenu "Xen 4" {
menuentry 'Ubuntu GNU/Linux, with Xen 4 and Linux 3.2.0-23-generic' --class ubuntu --class gnu-linux --class gnu --class os --class xen {
echo 'Loading Xen 4 ...'
menuentry 'Ubuntu GNU/Linux, with Xen 4 and Linux 3.2.0-23-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os --class xen {
echo 'Loading Xen 4 ...'
submenu "Xen 4.3" {
menuentry 'Ubuntu GNU/Linux, with Xen 4.3 and Linux 3.2.0-23-generic' --class ubuntu --class gnu-linux --class gnu --class os --class xen {
echo 'Loading Xen 4.3 ...'
menuentry 'Ubuntu GNU/Linux, with Xen 4.3 and Linux 3.2.0-23-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os --class xen {
echo 'Loading Xen 4.3 ...'
submenu "Xen 4.3-unstable" {
menuentry 'Ubuntu GNU/Linux, with Xen 4.3-unstable and Linux 3.2.0-23-generic' --class ubuntu --class gnu-linux --class gnu --class os --class xen {
echo 'Loading Xen 4.3-unstable ...'
menuentry 'Ubuntu GNU/Linux, with Xen 4.3-unstable and Linux 3.2.0-23-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os --class xen {
echo 'Loading Xen 4.3-unstable ...'
$ sudo vi /etc/default/grub
...
GRUB_DEFAULT='Ubuntu GNU/Linux, with Xen 4.3 and Linux 3.2.0-23-generic'
..
$ sudo update-grub
$ sudo boot
</pre><span style="font-family: Verdana;"><br />
References: <br />
1. <a href="http://wiki.xen.org/wiki/Archived/Xen_4.3_RC1_test_instructions">http://wiki.xen.org/wiki/Archived/Xen_4.3_RC1_test_instructions</a><br />
2. <a href="http://wiki.xen.org/wiki/Compiling_Xen_From_Source">http://wiki.xen.org/wiki/Compiling_Xen_From_Source</a><br />
3. <a href="http://locatrix.com/build-and-install-xen-4-2-1-from-source-on-ubuntu-12-10/">http://locatrix.com/build-and-install-xen-4-2-1-from-source-on-ubuntu-12-10/</a><br />
4. <a href="http://blog.heidt.biz/blog/2012/09/17/setting-up-ubuntu-12-dot-04-precise-pangolin-as-xen-dom0/">http://blog.heidt.biz/blog/2012/09/17/setting-up-ubuntu-12-dot-04-precise-pangolin-as-xen-dom0/</a><br />
5. <a href="http://lists.xen.org/archives/html/xen-users/2013-05/msg00136.html">http://lists.xen.org/archives/html/xen-users/2013-05/msg00136.html</a><br />
</span>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com2tag:blogger.com,1999:blog-8757225099844464125.post-1196694385202026162013-04-27T07:32:00.000+08:002013-04-27T07:32:00.678+08:00Xen is moving foward<span style="font-family: Verdana, sans-serif;">Although Xen has not been included as default hypervisor in RHEL and has been losing some supporters. </span><span style="font-family: Verdana, sans-serif;">Xen is still attractive hypervisor. Xen is trying to support platforms in many ways. </span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <span style="font-family: Verdana, sans-serif;">There some highlighted projects: </span><br />
<ul><li><span style="font-family: Verdana, sans-serif;">Mirage OS: a library OS that supports the most common web protocols and enables the development of sealed Xen Project appliances that can be run without a guest operating system on any Xen Project based cloud - led by Cambridge University</span></li>
<li><span style="font-family: Verdana, sans-serif;">Support for ARMv7 and ARMv8 based servers - led by Citrix</span></li>
<li><span style="font-family: Verdana, sans-serif;">Improvements to Nested Virtualization: Virtualzation of guest machines - led by Intel</span></li>
<li><span style="font-family: Verdana, sans-serif;">Significant extensions to the Xen Project Security Modules and Flask - led by the National Security Agency</span></li>
<li><span style="font-family: Verdana, sans-serif;">A new virtualization mode called PVH (PV on HVM: improving performance by support PV, remove emulated hardware pocessing), which promises to combine the best aspects of hardware virtualization and paravirtualization - led by Oracle</span></li>
<li><span style="font-family: Verdana, sans-serif;">Significant performance and scalability improvements - led by SUSE</span></li>
</ul><br />
<div><span style="font-family: Verdana, sans-serif;">References:</span></div><div><span style="font-family: Verdana, sans-serif;">1. Xen became Linux Foundation Collaborative Project: <a href="http://blog.xen.org/index.php/2013/04/15/xen-is-now-a-linux-foundation-collaborative-project/">http://blog.xen.org/index.php/2013/04/15/xen-is-now-a-linux-foundation-collaborative-project/</a></span></div><div><span style="font-family: Verdana, sans-serif;">2. Xen Proejct home: <a href="http://www.xenproject.org/">http://www.xenproject.org/</a></span></div>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-13219252798010672362013-04-25T06:17:00.001+08:002013-04-25T16:37:55.171+08:00Openstack: How to solve pkg_resources.DistributionNotFound when executing glance<span style="font-family: Verdana;"><br />
I installed and configured glance to try openstack grizzly. I followed the instruction from <a href="http://docs.openstack.org/trunk/openstack-compute/install/apt/content/externals.html#d6e611" style="orphans: 2; text-align: -webkit-auto; widows: 2;">Grizzly install manual.</a> <br />
When I tried to create an image, I encountered the error and this was the error: </span><br />
<pre class="brush: bash">$ sudo glance image-create --name="tty-linux-kernel" --disk-format=aki --container-format=aki < ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz
Traceback (most recent call last):
File "/usr/bin/glance", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2711, in <module>
parse_requirements(__requires__), Environment()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: requests>=0.8.8</pre><span style="font-family: Verdana;"><br />
Glance has dependencies on other modules, for example, python-swiftclient, python-keystoneclient and so on. <br />
Even, python-swiftclient which installed here has dependencies on its own.<br />
In order to get a clue to solve the error, I printed the command "glance" </span><br />
<pre class="brush: bash">$ cat /usr/bin/glance
#!/usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'python-glanceclient==0.9.0','console_scripts','glance'
__requires__ = 'python-glanceclient==0.9.0'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('python-glanceclient==0.9.0', 'console_scripts', 'glance')()
)
</pre><span style="font-family: Verdana;"><br />
It seemed that it was something wrong with modules related to "python-glanceclient". Next, I looked at /usr/lib/python2.7/dist-packages/python_glanceclient-0.9.0.egg-info/requires.txt file. <br />
requires.txt fie is used to write a list of packages to install. </span><br />
<pre class="brush: bash">$ vi /usr/lib/python2.7/dist-packages/python_glanceclient-0.9.0.egg-info/requires.txt
prettytable&gh;=0.6,<0.8
python-keystoneclient>=0.2.3
pyOpenSSL
warlock>=0.7.0,<2</pre><span style="font-family: Verdana;"><br />
But, there was NO module named "requests" in here, so I tried to do other files which were indicated here. I opened the next file, requires.txt for keystoneclient. </span><br />
<pre class="brush: bash">$ vi /usr/lib/python2.7/dist-packages/python_keystoneclient-0.2.3.egg-info/requires.txt
iso8601>=0.1.4
prettytable
requests>=0.8.8
simplejson
oslo.config>=1.1.0</pre><span style="font-family: Verdana;"><br />
I finally found "request" in here and I checked the version of my request module to compare the version number. </span><br />
<pre class="brush: bash">$ sudo dpkg -l | grep request
ii python-requests 0.8.2-1 elegant and simple HTTP library for Python, built for human beings
</pre><span style="font-family: Verdana;"><br />
My python-requests module was 0.8.2. I changed it into:</span><br />
<pre class="brush: bash">$ vi /usr/lib/python2.7/dist-packages/python_keystoneclient-0.2.3.egg-info/requires.txt
iso8601>=0.1.4
prettytable
requests>=0.8.2
simplejson
oslo.config>=1.1.0</pre><span style="font-family: Verdana;"><br />
I was able to solve my problem by doing this. However, I got another problem with this. </span><br />
<pre class="brush: bash">$ sudo glance image-create --name="tty-linux-kernel" --disk-format=aki --container-format=aki --file=ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz
Authorization Failed: request() got an unexpected keyword argument 'verify'</pre><span style="font-family: Verdana;"><br />
This was caused because I had old-dated "python-requests", I needed to install 0.8.8 or higher to work "verify". I found how to solve from the site: <a href="https://answers.launchpad.net/keystone/+question/218143" style="text-align: -webkit-auto;">https://answers.launchpad.net/keystone/+question/218143</a></span><br />
<blockquote class="tr_bq"><span style="font-family: Verdana; orphans: 2; text-align: -webkit-auto; widows: 2;">"this duo to you OS has a low version of python-requests by defalut,now python-keystoneclient require a python-requests>0.8.8,<1.0 this bug has been fixed to master. you can first git pull the lastest python-keystoneclient code. then run pip install -r tools/pip-requires."</span></blockquote><span style="font-family: Verdana;">I downloaded new version of it from <a href="https://pypi.python.org/pypi/requests/1.2.0" style="font-family: Tahoma; orphans: 2; text-align: -webkit-auto; widows: 2;">https://pypi.python.org/pypi/requests/1.2.0</a></span><br />
<pre class="brush: bash">$ sudo tar -xzvf ./requests-1.2.0.tar.gz
$ cd requests-1.2.0
$ sudo ./setup.py build</pre><span style="font-family: Verdana;"><br />
Finally it worked.<br />
<br />
References: <br />
1. <a href="http://pedrojimenez.github.io/blog/2012/12/12/ubuntu-python-keystoneclient-dependency-error/" style="orphans: 2; text-align: -webkit-auto; widows: 2;">http://pedrojimenez.github.io/blog/2012/12/12/ubuntu-python-keystoneclient-dependency-error/</a><br />
2. <a href="https://answers.launchpad.net/keystone/+question/218143" style="orphans: 2; text-align: -webkit-auto; widows: 2;">https://answers.launchpad.net/keystone/+question/218143</a><br />
3. <a href="http://www.pip-installer.org/en/latest/requirements.html">http://www.pip-installer.org/en/latest/requirements.html</a><br />
<br />
</span>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com2tag:blogger.com,1999:blog-8757225099844464125.post-91124624834840138242013-03-06T09:34:00.001+08:002013-03-07T11:52:34.256+08:00VMware: Lable of VirtualDevice only accept alphabetical characters, If not, got InvalidRequest error <span style="font-family: Verdana;"><br />
vSphere API threw InvalidRequest error while I was trying to add a networkadapter of a VM.<br />
<br />
com.vmware.vim25.InvalidRequest<br />
at com.vmware.vim25.mo.VirtualMachine.reconfigVM_Task...<br />
<br />
My code was following: </span><pre class="brush: java">...
...
// Network Connection name
String[] network_name = {"VM Network"};
// Get the existing network devices of the VM
List<VirtualDevice> listNetworkDevice = new ArrayList<VirtualDevice>();
for (VirtualDevice vDevice: vm.getConfig().getHardware().getDevice()) {
if (vDevice.getDeviceInfo().getLabel().toLowerCase().indexOf("network") >= 0 || vDevice.getDeviceInfo().getLabel().indexOf("네트워크") >= 0)
listNetworkDevice.add(vDevice);
}
// Get the label of network device
String listNicLabel[] = listNetworkDevice.get(listNetworkDevice.size() - 1).getDeviceInfo().getLabel().split(" ");
int seqOfNIC = 0;
try {
if( listNicLabel != null && listNicLabel.length >= 2)
seqOfNIC = Integer.parseInt(listNicLabel[2]);
} catch (Exception e) {
listNicLabel = new String[] { "Network", "Adapter" };
}
// Unique key that distinguish the device from other devices in the same VM. Here, it is just a temporary value
int nicKeyVal = 0;
for (int i = 0; i < customServerInfo.getNetworkBridgeName().length; i++) {
VirtualEthernetCard nic = new VirtualVmxnet3();
VirtualEthernetCardNetworkBackingInfo nicBacking = new VirtualEthernetCardNetworkBackingInfo();
nicBacking.setDeviceName(customServerInfo.getNetworkBridgeName()[i]); // Network Connection
String nicLabel = listNicLabel[0] + " " + listNicLabel[1] + " " + (++seqOfNIC);
Description info = new Description();
info.setLabel(nicLabel);
info.setSummary(customServerInfo.getNetworkBridgeName()[i]);
nic.setDeviceInfo(info);
// type: "generated", "manual", "assigned" by VC
nic.setAddressType("generated");
nic.setBacking(nicBacking);
nic.setKey(-1 * (4000 + (nicKeyVal++)));
VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec();
deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.add);
deviceConfigSpec.setDevice(nic);
listDeviceConfigSpec.add(deviceConfigSpec);
}
if (listDeviceConfigSpec.size() > 0) {
vmSpec.setDeviceChange(listDeviceConfigSpec.toArray(new VirtualDeviceConfigSpec[listDeviceConfigSpec.size()]));
Task task = vm.reconfigVM_Task(vmSpec);
...
...
}
</pre><span style="font-family: Verdana;"><br />
In my above coding, I got the last label from the existing NetworkAdapter in line 21. (My VM already had two networks) and replaced the last sequence number with new one in line 35.<br />
e.g.)<br />
<<The last seq and name>> <<The new seq and name>><br />
Network Adapter 2 => Network Adapter 3<br />
<br />
However, Labels of vDevices were displayed in the language which you chose one when you installed vCenter. I installed it with Korean language, so I actually got the result of labels, for example, 네트워크 어댑터 1, 네트워크 어댑터 2 (They both mean "Network Adapter").<br />
<br />
In Label property of Description class in vSphere API, it doesn't accept characters other than Alphabetical(and number). <br />
So, You should change it with alphabetical characters for Label property. I changed this like: <br />
<pre class="brush: java">String nicLabel = "Network Adapter" + " " + (++seqOfNIC);
Description info = new Description();
info.setLabel(nicLabel);
...
</pre>When you get InvalidRequest error for VM Creation / Reconfig job and you try to debug it, it can be one of good solutions that you comment all of setter methods except for mandatory and then uncomment one setter method per testing, after that you can find where it is wrong in your code. It seems not to have easy solution about solvoing InvalidRequest error.<br />
</span><br />
<span style="font-family: Verdana;"><br />
References: <br />
1. <a href=" http://www.jarvana.com/jarvana/view/org/jvnet/hudson/vijava/2120100824/vijava-2120100824-sources.jar!/com/vmware/vim25/mo/samples/vm/CreateVM.java"> http://www.jarvana.com/jarvana/view/org/jvnet/hudson/vijava/2120100824/vijava-2120100824-sources.jar!/com/vmware/vim25/mo/samples/vm/CreateVM.java</a><br />
<br />
</span>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-64996022456147828392013-02-26T08:53:00.001+08:002013-02-26T08:53:44.682+08:00Book review: Nagios Core Administration Cookbook<span style="font-family: Verdana, sans-serif;"><span style="font-size: small; line-height: normal;">I've involved in a cloud development project. I use Nagios core for monitoring servers and devices in this project. </span>As we know, Nagios is one of famous open sourced monitoring tools. <span style="font-size: small;">I needed references in dealing with Nagios. </span><span style="font-size: small;">While I was reading this, </span><span style="font-size: small;">it remind me of basic concept of Nagios again. </span></span><br />
<span style="font-family: Verdana, sans-serif; font-size: small;"><br />
</span> <img border="0" height="400" src="http://4.bp.blogspot.com/--soVNc698x8/USwDWwNWFPI/AAAAAAAAKqY/yXgfyvGvyE0/s400/nagios+book.JPG" width="328" /><br />
<span style="font-family: Verdana, sans-serif; font-size: small;"><br />
</span> <span style="font-family: Verdana, sans-serif; font-size: small;">There are some sections in every chapter. "How to do it" , "How it works" and "There's more". i</span><span style="font-family: Verdana, sans-serif; font-size: small;">t describes how we start a certain feature of Nagios according to the section in "How to do it" and then explains its mechanism with easy way</span><br />
<span style="font-family: Verdana, sans-serif;"><span style="font-size: small; line-height: normal;">in "How it works" and finally there is additional contents related to the chapter in "There's more"</span></span><br />
<span style="font-family: Verdana, sans-serif; font-size: small;"><br />
</span> <span style="font-family: Verdana, sans-serif; font-size: small;">There is impressive paragraph in the book that nagios is close to <b>MONITORING FRAMWORK</b> rather than monitoring tool. It is perfect that describes nagios characteristic because it has already provide ecosystem, for example, lots of plugins support . And it is important to know where to find if need specific plugin that doesn't meet requirements. </span><span style="font-family: Verdana, sans-serif; font-size: small;">Author instructed that how to find a plugin that the administrator needs and where. </span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <span style="font-family: Verdana, sans-serif;">People who are unfamiliar with Nagios, in my opinion, they may be confused that Nagios has SOFT and HARD state in response to server or host failing. In chapter 3, author tries to explain the difference between two by giving an understandable example. </span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <span style="font-family: Verdana, sans-serif;">At last, in chapter 11, he gives an explanation about add-on projects like NRPE, NSClient++, NDOUtils and SNMP trap. If you need to extend the feature of Nagios to provide better-fitting solution on your own production, this will very helpful to you.</span><br />
<span style="font-family: Verdana, sans-serif;"><span style="font-size: small; line-height: normal;"><br />
</span></span> <span style="font-family: Verdana, sans-serif;"><span style="font-size: small; line-height: normal;">Book link: </span><a href="http://www.packtpub.com/nagios-core-administration-cookbook/book">http://www.packtpub.com/nagios-core-administration-cookbook/book</a></span><br />
<br />Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-91177011643130100612013-02-24T18:33:00.002+08:002013-02-24T18:33:32.542+08:00Nagios NDO2DB: Unicode problem<span style="font-family: Verdana, sans-serif;">I had encountered a problem related NDO2DB. I configured some of services' name in Korean character. It shows well in Nagios web, but these services' name could't be recognized in Mysql tables which Ndo2db saves into becuase </span><span style="font-family: Verdana, sans-serif;">Ndo2db </span><span style="font-family: Verdana, sans-serif;"> add-on processes data without considering uni-code data. It was not solved even though I changed character set to UTF-8 in the tables.</span><span style="font-family: Verdana, sans-serif;"> </span><span style="font-family: Verdana, sans-serif;"> </span><span style="font-family: Verdana, sans-serif;"> </span><span style="font-family: Verdana, sans-serif;"> </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">One of possible way to deal with is to change convert column which have to show by UTF8 in SQL query. </span><br />
<br />
<span style="font-family: Verdana, sans-serif;">The solutions is as following: </span><br />
<span style="font-family: Tahoma; text-align: -webkit-auto;">CONVERT(CAST(column_name) as BINARY) USING UTF8)</span><span style="font-family: Verdana, sans-serif;"> </span><br />
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">"This is a similar approach to our SELECT CONVERT(CAST(city as BINARY) USING utf8) trick above, where we basically hide the column’s actual data from MySQL by masking it as BINARY temporarily.</span> </blockquote>
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;">If you simply force the column to UTF-8 without the BINARY conversion, MySQL does a data-changing conversion of your “latin1″ characters into “UTF-8″ and you end up with improperly converted data. Converting the column to BINARY first forces MySQL to not realize the data was in UTF-8 in the first place.</span><span style="background-color: white; color: #555555; font-family: Verdana, sans-serif; line-height: 17px;">"</span></blockquote>
<span style="font-family: Verdana, sans-serif;">I referenced this from this site: </span><a href="http://nicj.net/mysql-converting-an-incorrect-latin1-column-to-utf8/" style="font-family: Verdana, sans-serif;">http://nicj.net/mysql-converting-an-incorrect-latin1-column-to-utf8/</a><br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-3872601446619648652013-01-24T16:54:00.001+08:002013-01-24T16:54:37.041+08:00Nagios: How to change datetime format of snmp trap<span style="font-family: Verdana;">After I installed and Configured SNMPTT, saving snmpt trap data into table worked well. <br />
Additionally, I needed to change the date format so that I could filter them easily by date and time.<br />
<br />
By default, date format should be "Sun Dec 16 15:23:47 2012", but I want it to look like <b>"2012-12-16 15:23:47"</b><br />
<br />
When look at /etc/snmp/snmptt.ini, there are some properties related to datetime format.<br />
<pre class="brush: bash">$ vi /etc/snmp/snmptt.ini
...
# The date time format in strftime() format for the date/time when logging to
# standard output, snmtt log files (log_file) and the unknown log file
# (unknown_trap_log_file). Defaults to localtime(). For SQL, see
# date_time_format_sql.
# Example: %a %b %e %Y %H:%M:%S
# date_time_format =
...
...
# The date time format for the traptime column in SQL, Defaults to
# localtime(). When a date/time field is used in SQL, this should be
# changed to follow a standard that is supported by the SQL server.
# Example: For a MySQL DATETIME, use %Y-%m-%d %H:%M:%S.
# date_time_format_sql =
...
</pre><br />
As we can know from the above description, snmptt uses strftime() format. <br />
The first format definition (<b>date_time_format</b>) is for log files. Generally, /var/log/snmptt/snmptt.log and /var/log/snmptt/snmpttunknown.log. The second definition (<b>date_time_format_sql</b>) is for traptime column of snmptt table in MySQL. <br />
<br />
Before change the format in snmptt.ini, you can validate the format like the following: <br />
<pre class="brush: bash">$ mydate=`perl -e 'use POSIX; print strftime "%Y-%m-%d %T", localtime time;'`
$ echo $mydate
2013-01-22 10:19:45
</pre>Then uncomment those lines and change the formats in snmptt.ini<br />
<pre class="brush: bash">$ vi /etc/snmp/snmptt.ini
...
date_time_format = %Y-%m-%d %T
...
date_time_format_sql = %Y-%m-%d %T
# It needs to restart
$ service snmptt restart
</pre><br />
Please visit the site to see various date time formats in strftime<br />
<a href="http://my.safaribooksonline.com/book/operating-systems-and-server-administration/bash/0596526784/reference-lists/date_and_time_string_formatting_with_strftime">http://my.safaribooksonline.com/book/operating-systems-and-server-administration/bash/0596526784/reference-lists/date_and_time_string_formatting_with_strftime</a><br />
<br />
References:<br />
1. <a href="http://stackoverflow.com/questions/13093709/how-to-use-shell-variables-in-perl-command-call-in-a-bash-shell-script">http://stackoverflow.com/questions/13093709/how-to-use-shell-variables-in-perl-command-call-in-a-bash-shell-script</a><br />
</span>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-58483472044775967542013-01-17T12:20:00.001+08:002013-01-18T08:16:51.797+08:00VMware vCenter Error: Database connection has failed.<span style="font-family: Verdana, sans-serif;"><br />
I got an error "Database connection has failed" during vCenter 5.1 SSO. </span><br />
<span style="font-family: Verdana, sans-serif;">The error message was: </span><br />
<a href="http://3.bp.blogspot.com/-CRtUOMcgW64/UPdks6jhgvI/AAAAAAAAKpY/j5x4SVbVs9Y/s1600/vcenter+5.1+sso+fail+02.PNG" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em; text-align: center;"><span style="font-family: Verdana, sans-serif;"><img border="0" height="156" src="http://3.bp.blogspot.com/-CRtUOMcgW64/UPdks6jhgvI/AAAAAAAAKpY/j5x4SVbVs9Y/s400/vcenter+5.1+sso+fail+02.PNG" width="400" /></span></a><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">VMware vCenter Sing Sign On service keeps data into a relational database. I installed MS SQL Server 2008 R2 express, which is provided as bundle database of vCenter. (It additionally needs to install SQL Server Management Studio GUI console)</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">After I was checking %temp%\vm-sso.javaLib.log, logs were follows: </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<div>
<div style="text-align: -webkit-auto;">
<span style="font-family: Verdana, sans-serif;">[2013-01-15 19:17:06,599] <span style="text-align: -webkit-auto;">INFO </span><span style="text-align: -webkit-auto;">... - IP stack is fine</span></span></div>
<div style="text-align: -webkit-auto;">
<span style="font-family: Verdana, sans-serif;">[2013-01-15 19:17:06,599]<span style="text-align: -webkit-auto;"> </span><span style="text-align: -webkit-auto;">INFO </span><span style="text-align: -webkit-auto;">... - IP Stack works</span></span></div>
<div style="text-align: -webkit-auto;">
<span style="font-family: Verdana, sans-serif;">[2013-01-15 19:18:46,392]<span style="text-align: -webkit-auto;"> </span><span style="text-align: -webkit-auto;">INFO</span><span style="text-align: -webkit-auto;"> ...</span><span style="text-align: -webkit-auto;"> - Validate database connection</span></span></div>
<div style="text-align: -webkit-auto;">
<span style="font-family: Verdana, sans-serif;">[2013-01-15 19:18:46,392]<span style="text-align: -webkit-auto;"> </span><span style="text-align: -webkit-auto;">INFO </span>... - DB information jdbcUrl:jdbc:sqlserver://;serverName=vcenter;port=1433;databaseName=RSA type: Mssql</span><br />
<span style="font-family: Verdana, sans-serif;">[2013-01-15 19:18:46,392] INFO ... - Initialize values of user DBA user RSA_DBA , other user RSA_USER</span><br />
<span style="font-family: Verdana, sans-serif;">[2013-01-15 19:18:46,392] INFO ... - DB information jdbcUrl:jdbc:sqlserver://;serverName=vcenter;port=1433;databaseName=RSA type: Mssql userName:RSA_DBA</span><br />
<span style="font-family: Verdana, sans-serif;">[2013-01-15 19:19:16,621]<span style="color: red;">ERROR</span> .... - Failed to established connection :com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host vcenter, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port."</span><br />
<span style="font-family: Verdana, sans-serif;">[2013-01-15 19:19:16,621] INFO .... - could not close JDBC connection</span></div>
<div style="text-align: -webkit-auto;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="font-family: Verdana, sans-serif;">The resolution was simpler than I expended. I found the answer from this site: <a href="http://vhomelab.com/2012/09/21/vmware-single-signon-service-inventory-service-vcenter-5-1-installation/">http://vhomelab.com/2012/09/21/vmware-single-signon-service-inventory-service-vcenter-5-1-installation/</a></span></div>
<div style="text-align: -webkit-auto;">
<span style="font-family: Verdana, sans-serif;">This post of the site has been well written about every step of installation of vCenter 5.1. </span></div>
<div style="text-align: -webkit-auto;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: -webkit-auto;">
<span style="font-family: Verdana, sans-serif;">Go to the manu "Microsoft SQL Server 2008 R2 > Configuration tools > SQL Configuration Manager" and should configure to set <b>TCP Port</b> property to 1433</span></div>
</div>
<a href="http://1.bp.blogspot.com/-009lvysdBjk/UPdzdMWXpZI/AAAAAAAAKp0/AGZQcRKGN5w/s1600/vcenter+5.1+sso+fail+03.PNG" imageanchor="1" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em; text-align: center;"><span style="font-family: Verdana, sans-serif;"><img border="0" height="265" src="http://1.bp.blogspot.com/-009lvysdBjk/UPdzdMWXpZI/AAAAAAAAKp0/AGZQcRKGN5w/s400/vcenter+5.1+sso+fail+03.PNG" width="400" /></span></a><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Before I found the site which gave me an resolution, I re-installed SQL server , and then created DB and users manually, however you won't need to do these useless tasks if you already set tcp port. </span><br />
<br />Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com3tag:blogger.com,1999:blog-8757225099844464125.post-81946988272859891592013-01-14T17:03:00.001+08:002013-01-14T17:03:22.137+08:00Nagios SNMP Trap: part 2 - Configuration<span style="font-family: Verdana;"><br />
In <a href="http://hyper-choi.blogspot.kr/2012/12/nagios-snmp-trap-part-1-snmptt.html">my last post</a>, I described how to install Nagios core, plugin and Snmptt. This time I'm going to focus on explanation of configuration. <br />
<br />
This step is converting CISCO MIB file (it is omitted, In my opinion, it should have showed on my last). <br />
<pre class="brush: bash"># ConvertMib of CISCO MIB file
$ snmpttconvertmib --in=/usr/share/snmp/mibs/CISCO-UNIFIED-COMPUTING-MIB.my --out=/etc/snmp/snmptt.conf.cisco --exec='/usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 1' --net_snmp_perl
exec: /usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 1
***** UCD-SNMP / NET-SNMP Perl module enabled *****
**** Processing MIB file *****
snmptranslate version: NET-SNMP version: 5.5
severity: Normal
File to load is: /usr/share/snmp/mibs/CISCO-UNIFIED-COMPUTING-MIB.my
File to APPEND TO: /etc/snmp/snmptt.conf.cisco
MIBS environment var: /usr/share/snmp/mibs/CISCO-UNIFIED-COMPUTING-MIB.my
mib name: CISCO-UNIFIED-COMPUTING-MIB
***** Using UCD-SNMP / NET-SNMP Perl module *****
Processing MIB: CISCO-UNIFIED-COMPUTING-MIB
#
Split line TRAP-TYPE / NOTIFICATION-TYPE found (MODULE-IDENTITY,).
Line: 15
NOTIFICATION-TYPE: MODULE-IDENTITY
Enterprise: ciscoMgmt
Looking up via snmptranslate: CISCO-UNIFIED-COMPUTING-MIB::MODULE-IDENTITY
Unknown object identifier: CISCO-UNIFIED-COMPUTING-MIB::MODULE-IDENTITY
OID:
#
Line: 2216
NOTIFICATION-TYPE: cucsFaultActiveNotif
Variables: cucsFaultDescription cucsFaultAffectedObjectId cucsFaultAffectedObjectDn cucsFaultCreationTime cucsFaultLastModificationTime cucsFaultCode cucsFaultType cucsFaultProbableCause cucsFaultSeverity cucsFaultOccur
Enterprise: ciscoUnifiedComputingMIBNotifs
Looking up via snmptranslate: CISCO-UNIFIED-COMPUTING-MIB::cucsFaultActiveNotif
OID: .1.3.6.1.4.1.9.9.719.0.1
#
Line: 2235
NOTIFICATION-TYPE: cucsFaultClearNotif
Variables: cucsFaultDescription cucsFaultAffectedObjectId cucsFaultAffectedObjectDn cucsFaultCreationTime cucsFaultLastModificationTime cucsFaultCode cucsFaultType cucsFaultProbableCause cucsFaultSeverity cucsFaultOccur
Enterprise: ciscoUnifiedComputingMIBNotifs
Looking up via snmptranslate: CISCO-UNIFIED-COMPUTING-MIB::cucsFaultClearNotif
OID: .1.3.6.1.4.1.9.9.719.0.2
Done
Total translations: 3
Successful translations: 2
Failed translations: 1
</pre>/etc/snmp/snmptt.conf.cisco file is successfully created.<br />
<br />
Next, it is configuration of Nagios. <br />
<pre class="brush: bash"># Create Nagios Service for SNMP TRAP
$ vi /usr/local/nagios/etc/objects/remote-host.cfg
# Define a host for the remote machine
define host {
use linux-server
host_name cisco-ucs
alias cisco ucs manager
address 192.168.20.228
}
# Define a service to "trap-service" the server
define service{
use generic-service
name trap-service
register 0
service_description TRAP
is_volatile 1
check_command check_host_alive
max_check_attempts 1
normal_check_interval 1
retry_check_interval 1
notification_interval 31536000
active_checks_enabled 0
passive_checks_enabled 1
}
# Define a service to check
define service{
use trap-service
host_name cisco-ucs
}
$ service nagios restart
</pre>MySQL Server installation, I assume that I already installed MySQL. so I just created SMNPTT tables on nagios_db (Originally, nagios_db is used store ndo2db data and I simply add tables without creating DB). Table scripts are copied from <a href="http://snmptt.sourceforge.net/docs/snmptt.shtml#LoggingDatabase-MySQL">here</a>. <br />
<pre class="brush: bash"># Crate new user "snmptt"
grant all privileges on nagios_db.* to 'snmptt'@'localhost' identified by 'snmptt';
mysql> grant all privileges on nagios_db.* to 'snmptt'@'%' identified by 'snmptt';
# Add tables into the database
CREATE TABLE snmptt (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
eventname VARCHAR(50),
eventid VARCHAR(50),
trapoid VARCHAR(100),
enterprise VARCHAR(100),
community VARCHAR(20),
hostname VARCHAR(100),
agentip VARCHAR(16),
category VARCHAR(20),
severity VARCHAR(20),
uptime VARCHAR(20),
traptime VARCHAR(30),
formatline VARCHAR(255));
CREATE TABLE snmptt_unknown (
trapoid VARCHAR(100),
enterprise VARCHAR(100),
community VARCHAR(20),
hostname VARCHAR(100),
agentip VARCHAR(16),
uptime VARCHAR(20),
traptime VARCHAR(30),
formatline VARCHAR(255));
CREATE TABLE snmptt_statistics (
stat_time VARCHAR(30),
total_received BIGINT,
total_translated BIGINT,
total_ignored BIGINT,
total_unknown BIGINT);
# Needs to install additional perl modules
# Download ftp://ftp.perl.org/pub/CPAN/authors/id/T/TI/TIMB/DBI-1.622.tar.gz and ftp://ftp.perl.org/pub/CPAN/authors/id/T/TI/TIMB/CHECKSUMS
# Copy to /root/.cpan/sources/authors/id/authors/id/T/TI/TIMB/
$ perl -MCPAN -e 'install DBI'
# Download ftp://ftp.perl.org/pub/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.022.tar.gz and ftp://ftp.perl.org/pub/CPAN/authors/id/C/CA/CAPTTOFU/CHECKSUMS
# Copy to /root/.cpan/sources/authors/id/C/CA/CAPTTOFU/
$ perl -MCPAN -e 'install DBD::mysql'
$ vi /etc/snmp/snmptt.ini
mysql_dbi_enable=1
mysql_dbi_host=localhost
mysql_dbi_port=3306
mysql_dbi_database=nagios_db
mysql_dbi_table=snmptt
mysql_dbi_table_unknown=snmptt_unknown
mysql_dbi_username=snmptt
mysql_dbi_password=snmptt
</pre>Those are two important tables here, <b>snmptt</b> table only stores data coming from H/Ws which have already registered MIB translating (In the example, CISCO UCS is my registered H/W) <br />
On the other hand, <b>snmptt_unknown</b> table stores other H/Ws which are not registered MIB files (If you have Oracle Tape Backup Library and you get event trap from this H/W, the data will be stored into <b>snmptt_unknown</b>. <br />
<br />
<pre class="brush: bash">$ service snmptt restart
$ mysql -u snmptt -p nagios_db;
mysql> select id, eventname, severity from snmptt;
id | eventname | severity
1 | EventMonitorTrapInfo | Normal
</pre>Finally, we are able to see an eventrap data in mysql.<br />
</span><br />
<span style="color: #660000; font-family: Verdana;"><b>Troubleshooting</b></span><span style="font-family: Verdana;"><br />
Problem: If you have an error, while trap data in inserted into the table: <br />
<b>Error :</b> mysql_error: 'Column 'next_notification' cannot be null'<br />
<br />
<b>Resolution : </b> Change the schema of the column of the table.<br />
<pre class="brush: bash">mysql> alter table nagios_servicestatus modify column next_notification datetime default '0000-00-00 00:00:00';
mysql> desc nagios_servicestatus;
----------------------------------------------------
Field | Type | Null | Key | Default | Extra
----------------------------------------------------
.....
next_notification | datetime | YES | | 0000-00-00 00:00:00 |
.....
</pre><br />
References: <br />
1. <a href="http://forum.centreon.com/archive/index.php/t-6766.html">http://forum.centreon.com/archive/index.php/t-6766.html</a><br />
</span><br />
Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com3tag:blogger.com,1999:blog-8757225099844464125.post-47812685716388882362012-12-26T19:24:00.001+08:002013-01-16T08:57:12.125+08:00Nagios SNMP Trap: part 1 - SNMPTT installationThis post is going to be separated into two parts. The first part is describing to install Nagios core, plugins and SNMPTT(SNMP Trap Translator), and the second part is going to be posted about registering SNMP evethandler to make Nagios aware these messages, converting MIB files and integrating MySQL database to store messages. <br />
<br />
SNMPTT is module to handle snmp trap message and written in perl. The follow describes how it works: <br />
<a href="http://4.bp.blogspot.com/-iHWq8IVIhE4/UNraHXn2PyI/AAAAAAAAKo4/Qn3RGxTn-54/s1600/snmptt-flow.jpg" imageanchor="1"><img border="0" height="320" src="http://4.bp.blogspot.com/-iHWq8IVIhE4/UNraHXn2PyI/AAAAAAAAKo4/Qn3RGxTn-54/s320/snmptt-flow.jpg" width="304" /></a><br />
[Figure] SNMPTT Flows (<a href="http://snmptt.sourceforge.net/about.shtml">http://snmptt.sourceforge.net/about.shtml</a>)<br />
<br />
<span style="color: #660000; font-family: Verdana;"><b>Install Nagios core</b></span><span style="font-family: Verdana;"></span><br />
<pre class="brush: bash"># pre-requisite
$ yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp*
# main module download
$ mkdir /downloads
$ cd /downloads
$ wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz
$ tar -xzvf ./nagios-3.4.1.tar.gz
# Adding the Nagios User and Group
$ useradd nagios
$ groupadd nagios
$ usermod -a -G nagcmd nagios
$ cd ./nagios
$ ./configure --with-command-group=nagios
*** Configuration summary for nagios 3.4.1 05-11-2012 ***:
....
General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagios
Embedded Perl: no
Event Broker: yes
Install ${prefix}: /usr/local/nagios
Lock file: ${prefix}/var/nagios.lock
Check result directory: ${prefix}/var/spool/checkresults
Init directory: /etc/rc.d/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /bin/mail
Host OS: linux-gnu
Web Interface Options:
------------------------
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP):
Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs.
# Install main program
$ make all
$ make install
# Makes auto start script
$ make install-init
# Make config files
$ make install-config
# install external command file
$ make install-commandmode
# Configure nagios web and connect to apache
$ make install-webconf
# Create an user of WebUI
$ htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin
</pre><br />
<span style="color: #660000; font-family: Verdana;"><b>Install Nagios plugins</b></span><br />
<span style="font-family: Verdana;"></span><br />
<pre class="brush: bash"># Download plugins and install.
$ wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz
$ tar -xzvf nagios-plugins-1.4.16.tar.gz
$ cd nagios-plugins-1.4.16
$ ./configure --with-nagios-user=nagios --with-nagios-group=nagios
$ make
$ make install
[....]
check_http.c:312: error: ‘ssl_version’ undeclared (first use in this function)
check_http.c:312: error: (Each undeclared identifier is reported only once
check_http.c:312: error: for each function it appears in.)
make[1]: *** [check_http.o] Error 1
make[1]: Leaving directory `/downloads/nagios-plugins-1.4.16/plugins'
make: *** [install-recursive] Error 1
# Need to install openssl module
$ yum install openssl-devel
$ make clean
$ ./configure --with-nagios-user=nagios --with-nagios-group=nagios
$ make
$ make install
# Registering these as AutoStart
$ chkconfig nagios on
$ chkconfig httpd on
</pre><br />
<span style="color: #660000; font-family: Verdana;"><b>SNMPTT (SNMP Trap Translator) installation</b></span><br />
<pre class="brush: bash"># download snmptt_1.3.tgz from http://sourceforge.net/projects/snmptt/
$ snmptt_1.3.tgz
$ tar -xzvf ./snmptt_1.3.tgz
$ cd snmptt_1.3
# Copy snmptt to /usr/sbin/ and ensure it is executable (chmod +x snmptt)
$ cp ./snmptt /usr/sbin/
$ chmod a+x /usr/sbin/snmptt
# Copy snmptthandler to /usr/sbin/ and ensure it is executable (chmod +x snmptthandler)
$ cp ./snmptthandler /usr/sbin/
$ chmod a+x /usr/sbin/snmptthandler
# Copy snmpttconvert to /usr/sbin/ and ensure it is executable (chmod +x snmptthandler)
$ cp ./snmpttconvert /usr/sbin/
$ chmod a+x /usr/sbin/snmpttconvert
# Copy snmpttconvertmib to /usr/sbin/ and ensure it is executable (chmod +x snmptthandler)
$ cp ./snmpttconvertmib /usr/sbin/
$ chmod a+x /usr/sbin/snmpttconvertmib
# Copy snmptthandler to /usr/sbin/ and ensure it is executable (chmod +x snmptthandler)
$ cp ./snmptthandler /usr/sbin/
$ chmod a+x /usr/sbin/snmptthandler
# Copy snmptt.ini to /etc/snmp/ or /etc/ and edit the options inside the file.
$ cp ./snmptt.ini /etc/snmp/
# Copy snmptt.ini to /etc/snmp/ or /etc/ and edit the options inside the file.
$ mkdir /var/log/snmptt
# Modify the Net-SNMP snmptrapd.conf file by adding the following line:
$ vi /etc/snmp/snmptrapd.conf
traphandle default /usr/sbin/snmptthandler
# Create the spool folder
$ mkdir /var/spool/snmptt/
# Copy the script to the init.d directory
$ cp snmptt.init.d /etc/rc.d/init.d/snmptt
</pre><br />
Here, SNMPTT uses some perl modules (CPAN: Comprehensive Perl Archive Network - <a href="http://www.cpan.org/misc/cpan-faq.html">http://www.cpan.org/misc/cpan-faq.html</a> ) and perl CPAN not installed by default on CentOS 6. <br />
<br />
<b>Notice</b>: Perl modules may be installed via YUM, but some of them are not included in YUM or needed higher version number than dependencies files in YUM <br />
<pre class="brush: bash">$ yum install net-snmp-perl, perl-CPAN
This step is to install Config::InitFiles and List::MoreUtils, I downloaded needed files in advance, because I cannot connected to internet.
# (1) Download ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz and copy to
/root/.cpan/sources/authors/
# (2) Download ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.gz and copy to
/root/.cpan/sources/modules/
# (3) Download ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz and copy to
/root/.cpan/sources/modules/
# (4) Download ftp://ftp.perl.org/pub/CPAN/authors/id/A/AD/ADAMK/List-MoreUtils-0.33.tar.gz, ftp://ftp.perl.org/pub/CPAN/authors/id/A/AD/ADAMK/CHECKSUMS and copy to
/root/.cpan/sources/authors/id/A/AD/ADAMK/
# (5) Download ftp://ftp.perl.org/pub/CPAN/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.78.tar.gz, ftp://ftp.perl.org/pub/CPAN/authors/id/S/SH/SHLOMIF/CHECKSUMS and copy to
/root/.cpan/sources/authors/id/S/SH/SHLOMIF/
# (6) Download ftp://ftp.perl.org.pub.CPAN/authors/id/M/MS/MSCHWERN/CHECKSUMS/Test-Simple-0.98.tar.gz, ftp://ftp.perl.org.pub.CPAN/authors/id/M/MS/MSCHWERN/CHECKSUMS
/root/.cpan/sources/authors/id/M/MS/MSCHWERN/
$ perl -MCPAN -e 'install List::MoreUtils'
$ perl -MCPAN -e 'install Config::InitFiles'
# If you have en error "Can't locate Module/Build/Compat.pm in @INC contain...", you should install the following module to solve dependencies.
$ yum install perl-Moudle-Build
</pre><br />
<br />
Put it simply, the connection between Nagios and snmptt is as follows:<br />
<a href="http://3.bp.blogspot.com/-HcRjAKgHMqM/UNgQ6zEV56I/AAAAAAAAKoU/cN0dQrq6zQ0/s1600/snmptt%2Bhow%2Bit%2Bworks.png" imageanchor="1"><img border="0" height="116" src="http://3.bp.blogspot.com/-HcRjAKgHMqM/UNgQ6zEV56I/AAAAAAAAKoU/cN0dQrq6zQ0/s400/snmptt%2Bhow%2Bit%2Bworks.png" width="400" /></a><br />
<br />
As can see how it works from the above image. When the server triggers trap messages, <b>snmptrapd</b> is the first to handle them on monitoring server. Look at the following script. It defines that handling of trap is delegating to <b>snmptt</b> in the configuration.<br />
<pre class="brush: bash">$ vi /etc/snmp/snmptrapd.conf
...
traphandle default /usr/sbin/snmptt
...
$ vi /etc/rc.d/init.d/snmptrapd
....
OPTIONS="-On -Lsd -p /var/run/snmptrapd.pid"
....
</pre>Next, <b>snmptt</b> makes decision whether the trap message is known or unknown based on predefined trapfiles: <br />
<pre class="brush: bash">$ vi /etc/snmp/snmptt.ini
...
[TRAPFILES]
snmptt_conf_files = <<END
/etc/snmp/snmptt.conf.cisco
/etc/snmp/snmptt.conf.emc
END
...
</pre><br />
The first part is finished at here. I originally decided not to divide, but I realized this would be long one for one blog. I'll post the second part of this as soon as possible. <br />
<br />
Here's the link about part 2: <a href="http://hyper-choi.blogspot.kr/2013/01/nagios-snmp-trap-part-2-configuration.html">http://hyper-choi.blogspot.kr/2013/01/nagios-snmp-trap-part-2-configuration.html</a><br />
<br />
<br />
References: <br />
1. Installation manual: <a href="http://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf">http://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf</a><br />
2. <a href="http://www.thesysadminhimself.com/2012/09/compiling-nagios-plugins-1416-throws.html">http://www.thesysadminhimself.com/2012/09/compiling-nagios-plugins-1416-throws.html</a><br />
3. <a href="http://www.linuxquestions.org/questions/linux-newbie-8/nagios-internal-server-error-903798/">http://www.linuxquestions.org/questions/linux-newbie-8/nagios-internal-server-error-903798/</a><br />
4. <a href="http://www.linuxquestions.org/questions/linux-software-2/snmp-monitoring-with-nagios-645270/">http://www.linuxquestions.org/questions/linux-software-2/snmp-monitoring-with-nagios-645270/</a><br />
5. <a href="http://it.bogema.nl/tag/centos-6-2/">http://it.bogema.nl/tag/centos-6-2/</a><br />
6. <a href="http://askaralikhan.blogspot.kr/2010/12/receiving-snmp-traps-in-nagios.html">http://askaralikhan.blogspot.kr/2010/12/receiving-snmp-traps-in-nagios.html</a>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com19tag:blogger.com,1999:blog-8757225099844464125.post-12251040010430724272012-12-14T23:37:00.000+08:002012-12-15T09:54:13.718+08:00New Year's Resolution<div class="separator" style="clear: both; text-align: none;">
<span style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0); font-family: Verdana, sans-serif;">I've been three years since working in cloud computing. It was a big change to me. I used to involve in ERP, which stands for Enterprise Resource Planning. I didn't know about Infrastructure. I just had to implement business logic of it. So, I wasn't interested in that much.</span></div>
<div class="separator" style="clear: both; text-align: none;">
<span style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0); font-family: Verdana, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: none;">
<a href="https://lh6.googleusercontent.com/-pLaPFuq7DlE/UMtHI1sDMFI/AAAAAAAAKn4/N8pdd5Xgul4/s685/Photo%2525202012.%25252012.%25252014.%252520%2525EC%252598%2525A4%2525ED%25259B%252584%25252011%25253A59.jpg" target="_blank"><span style="font-family: Verdana, sans-serif;"><img alt="" class="alignnone" height="332" id="blogsy-1355499302208.9998" src="https://lh6.googleusercontent.com/-pLaPFuq7DlE/UMtHI1sDMFI/AAAAAAAAKn4/N8pdd5Xgul4/s400/Photo%2525202012.%25252012.%25252014.%252520%2525EC%252598%2525A4%2525ED%25259B%252584%25252011%25253A59.jpg" width="400" /></span></a></div>
<span style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0); font-family: Verdana, sans-serif;"><br />
However, needless to say, It wouldn't say anything much without infra in cloud computing. In terms of this point, this year, I keep concentrating to learn linux servers and virtualization for further step. I am going to take knowledge about storage and network for next year. It would be good if I have any chance to involve in these fields.</span><br />
<div class="separator" style="clear: both; text-align: none;">
<span style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0); font-family: Verdana, sans-serif;"><br />
</span></div>
<div class="separator" style="clear: both; text-align: none;">
<span style="-webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0); font-family: Verdana, sans-serif;">I hope myself I enjoy dealing with cloud computing.</span></div>
<br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<div id="blogsy_footer" style="clear: both; font-size: small; text-align: right;">
<a href="http://blogsyapp.com/" target="_blank"><span style="font-family: Verdana, sans-serif;"><img alt="Posted in Blogsy (iPad)" height="20" src="http://blogsyapp.com/images/blogsy_footer_icon.png" style="margin-right: 5px; vertical-align: middle;" width="20" />Posted in Blogsy (iPad)</span></a></div>
Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-1353899066841183172012-12-10T08:43:00.004+08:002012-12-10T08:49:06.500+08:00Nagois Eventhandler <font face="Verdana"><br />
I wrote about how to resister remote process in nagios monitoring environment in my last writing. This time, I'd like to post about registering a action. The action is that when a process is sopped or is killed unexpectedly, then we should trgger the action which is sort of restart the killed process. In nagios, it is able to make action, which is called 'eventhandler'. <br />
<br />
As I was previously mentioned, my VMs were continusly shutting down and then I made services for monitoring if they were dead or alive. Now, it is time to make a eventhandler for actions. There are some important points to remember in configuring the eventhandler.<br />
<br />
- The property 'max_checks_attempts' in nagios.config<br />
- StateType: SOFT STATE vs HARD STATE<br />
<br />
Nagios comes to conclusion times when it calls the eventhandler or gives the administrator notification by these points. When monitoring a service and its state has been changed into 'Critical', nagios only calls eventhandler until the check time is reached to ckeck max_checks_attempts (the service is in SOFT state). If total check time is reached to max_check_attemps, nagios notifies the failure of the service (service is now in HARD state). <br />
<br />
The following link is descriptive well about statetype: <a href="http://nagios.sourceforge.net/docs/3_0/statetypes.html">http://nagios.sourceforge.net/docs/3_0/statetypes.html</a><br />
</font><br />
<span style="color: #660000; font-family: Verdana;"><b>Resistering eventhandler</b></span><br />
<font face="Verdana"><br />
1) Wiring a script <br />
<pre class="brush: bash">$ vi /usr/lib64/nagios/plugins/eventhandlers/restart-vm
#!/bin/sh
#
# Event handler script for restarting the nrpe server on the local machine
#
# Note: This script will only restart the nrpe server if the service is
# retried 3 times (in a "soft" state) or if the web service somehow
# manages to fall into a "hard" error state.
#
date=`date`
case "$1" in
OK)
# The service just came back up, so don't do anything...
;;
WARNING)
# We don't really care about warning states, since the service is probably still running...
;;
UNKNOWN)
# We don't know what might be causing an unknown error, so don't do anything...
;;
CRITICAL)
# Aha! The BLAH service appears to have a problem - perhaps we should restart the server...
# Is this a "soft" or a "hard" state?
case "$2" in
# We're in a "soft" state, meaning that Nagios is in the middle of retrying the
# check before it turns into a "hard" state and contacts get notified...
SOFT)
# What check attempt are we on? We don't want to restart the web server on the first
# check, because it may just be a fluke!
case "$3" in
# Wait until the check has been tried 2 times before restarting the web server.
# If the check fails on the 3rd time (after we restart the web server), the state
# type will turn to "hard" and contacts will be notified of the problem.
# Hopefully this will restart the web server successfully, so the 4th check will
# result in a "soft" recovery. If that happens no one gets notified because we
# fixed the problem!
2)
echo -n "Restarting the VM service (3rd soft critical state)..."
# Call the init script to restart the VM
/usr/bin/sudo /usr/sbin/xm start $4
echo "$date - restart $4 - SOFT" >> /tmp/eventhandlers
;;
esac
;;
# The BLAH service somehow managed to turn into a hard error without getting fixed.
# It should have been restarted by the code above, but for some reason it didn't.
# Let's give it one last try, shall we?
# Note: Contacts have already been notified of a problem with the service at this
# point (unless you disabled notifications for this service)
HARD)
case "$3" in
4)
echo -n "Restarting VM service..."
# Call the init script to restart the VM
echo "$date - restart $4 - HARD" >> /tmp/eventhandlers
/usr/bin/sudo /usr/sbin/xm start $4
;;
esac
;;
esac
;;
esac
exit 0
</pre><br />
I was writing the script file that made nagios call this the while my VM was in 'critical'. I set max_check_attempts to 3 in config file and defined to start VM when it became the second and the third continuous fail. <br />
<br />
2) The following works that giving execution permission to the script and add a command, service to nagios:<br />
<pre class="brush: bash"># give execution permission to the script
$ chmod a+x /usr/lib64/nagios/plugins/eventhandlers/restart-vm
# define the eventhandler as new command
$ vi /etc/nagios/objects/commands.cfg
define command{
command_name restart-vm
command_line /usr/lib64/nagios/plugins/eventhandlers/restart-vm $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ $SERVICEDESC$
}
# set the command to a specific service
$ vi /etc/nagios/objects/services.cfg
define service{
use generic-service
host_name localhost
hostgroup_name
service_description ad
active_checks_enabled 1
passive_checks_enabled 1
check_command check_local_procs!1:1!qemu-dm!'domain-name ad'
event_handler restart-vm
}
# Nagios always needs to be validation and restart after modified config files.
$nagios -v /etc/nagios/nagos.cfg
$service nagios restart
</pre><br />
When I looked at nagios.debug file (/var/log/nagios/nagios.debug), they were said like:<br />
<pre class="brush: bash">[1354857538.204205] [256.1] [pid=6862] Running command '/usr/lib64/nagios/plugins/eventhandlers/restart_vm CRITICAL SOFT 1 ad'...
[1354857538.251733] [256.1] [pid=6862] Execution time=0.047 sec, early timeout=0, result=0, output=(null)
[1354857548.035316] [256.1] [pid=6862] Running command '/usr/lib64/nagios/plugins/eventhandlers/restart_vm CRITICAL SOFT 2 ad'...
[1354857550.770515] [256.1] [pid=6862] Execution time=2.734 sec, early timeout=0, result=0, output=Restarting the VM service (2nd soft critical state)...Fri Dec 7 14:19:08 KST 2012 - restart ad - SOFT
[1354857558.040135] [256.1] [pid=6862] Running command '/usr/lib64/nagios/plugins/eventhandlers/restart_vm <strong>OK</strong> SOFT 3 ad'...
</pre></font><br />
<span style="color: #660000; font-family: Verdana;"><b>Troubleshooting</b></span><br />
<font face="Verdana">If the script doesn't work, check where the execution is given to the script file.<br />
<pre class="brush: bash">$ ls -al /usr/lib64/nagios/plugins/eventhandlers/restart-vm
-rwxr-xr-x 1 root root 3032 Dec 7 14:05 /usr/lib64/nagios/plugins/eventhandlers/restart-vm
</pre>Next is checking /etc/sudoers. In my case, the user "nagios" is the default user of Nagios monitoring server and give the permission of executing sudo without password and Defaults:nagios !requiretty <br />
<pre class="brush: bash">$ vi /etc/sudoers
Defaults:nagios !requiretty
nagios ALL=(ALL) NOPASSWD: ALL
</pre><br />
References:<br />
1. <a href="http://www.techadre.com/content/nagios-event-handler-restarting-local-service">http://www.techadre.com/content/nagios-event-handler-restarting-local-service</a><br />
2. <a href="http://forums.meulie.net/viewtopic.php?f=59&t=5918">http://forums.meulie.net/viewtopic.php?f=59&t=5918</a><br />
</font><br />
<br />
<div style="text-align: right; font-size: small; clear: both;" id="blogsy_footer"><a href="http://blogsyapp.com" target="_blank"><img src="http://blogsyapp.com/images/blogsy_footer_icon.png" alt="Posted in Blogsy (iPad)" style="vertical-align: middle; margin-right: 5px;" width="20" height="20" />Posted in Blogsy (iPad)</a></div>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-73561557480824829732012-12-07T16:32:00.000+08:002012-12-08T11:02:51.936+08:00Nagios: Monitor processes in remote host using regular expression<span style="font-family: Verdana;">I had encountered the problem that my VMs became repeatedly shutdown. Until now, I couldn't the solve this, but I had to work around of it. I took the second best for this was to detect the downtime of VMs and then started them by Nagios.</span><br />
<br />
<span style="font-family: Verdana;"><b>check_procs</b> plugin is used to monitor specific process count. It is able to set command name with -C parameter to watch the status of the process and when also able to set arguments with -a.</span><br />
<span style="font-family: Verdana;"><br />
</span> check_procs can be executed the following: <br />
<pre class="brush: bash">$ /usr/lib64/nagios/plugins/check_procs -c 1:1 -C altibase -a 'boot from admin'
PROCS OK: 1 process with command name 'altibase', args 'boot from admin'</pre><span style="font-family: Verdana, sans-serif;">-c parameter is to check the ranged of process count. Here, I set to raise critical error if the </span><span style="font-family: Verdana, sans-serif;">count</span><span style="font-family: Verdana, sans-serif;"> wasn't within from 1 to 1, -C parameter is for command name and -a parameter for arguments of the command, this is useful to distinguish one when some processes were found with the same command name. </span><br />
<br />
<span style="font-family: Verdana, sans-serif;">Command usage: </span><br />
<div><span style="font-family: Verdana, sans-serif;">check_procs -w <range> -c <range> [-m metric] [-s state] [-p ppid] [-u user] [-r rss] [-z vsz] [-P %cpu] [-a argument-array] [-C command] [-t timeout] [-v]</range></range></span><br />
<br />
<span style="font-family: Verdana, sans-serif;">However, </span><span style="font-family: Verdana;">check_procs</span><span style="font-family: Verdana;"> only monitor processes in local server. To do monitor processes in remote manner, it needs to send </span><span style="font-family: Verdana, sans-serif;">check_procs command to the remote host through check_nrpe.</span><br />
<br />
<span style="font-family: Verdana;"><span style="color: #660000;"><b>1) Define the new command name "check_process" in a monitored server.</b></span></span><br />
<pre class="brush: bash">$ vi /etc/nagios/nrpe.cfg
command[check_process]=/usr/lib64/nagios/plugins/check_procs $ARG1$
</pre><span style="color: #660000; font-family: Verdana;"><b>2) Define the new command in Nagios monitoring server</b></span><br />
<pre class="brush: bash">$ vi /etc/nagios/object/commands.cfg
# 'check_process' command definition
define command{
command_name check_process
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_process -a $ARG1$
}
</pre><span style="font-family: Verdana;">It was simple definition, I wanted to execute check_process with the argument, which is passed though $ARG1& variable. </span><br />
<span style="font-family: Verdana;"><br />
</span> <span style="font-family: Verdana;">Then I executed the command this on the monitoring server.</span><br />
<pre class="brush: bash">$ /usr/lib64/nagios/plugins/check_nrpe -H 192.168.20.174 -c check_process -a '-c 1:1 -C altibase -a 'boot from admin''
PROCS OK: 1 process with command name 'altibase', args 'boot'
</pre><span style="color: #660000; font-family: Verdana;"><b>3) It worked, but the result was different</b></span><br />
<span style="font-family: Verdana;">It resulted well, However, it was somewhat different with my expectation. It only with the argument 'boot', I needed to do it with the all arguments. </span><br />
<span style="font-family: Verdana;"><br />
</span> <span style="font-family: Verdana;">So, I </span><span style="font-family: Verdana;">tried many times to apply all args but they were not succeeded at all. It made my mind to find other ways. Indeed, check_procs supports finding process with regular expression, using </span><span style="font-family: Verdana; text-align: -webkit-auto;">--ereg-argument-array. </span><br />
<span style="font-family: Tahoma; text-align: -webkit-auto;"><br />
</span> <span style="font-family: Verdana;">I changed the command and it was succeeded: </span><br />
<pre class="brush: bash">$ /usr/lib64/nagios/plugins/check_nrpe -H 192.168.20.174 -c check_process -a '-c 1:1 -C altibase --ereg-argument-array='boot.from.admin0''
PROCS OK: 1 process with command name 'altibase', regex args 'boot.from.admin'
</pre></div><span style="font-family: Verdana;">In regular expression, </span><span style="font-family: Verdana;">A dot(.) means it </span><span style="font-family: Verdana;">represents any one word, for example, 'l..e' can be 'love' or 'life' etc.</span><span style="font-family: Verdana;"> </span><br />
<br />
<span style="font-family: Verdana;">References: </span><br />
<div><span style="font-family: Verdana, sans-serif;">1. <a href="http://linuxsysadminblog.com/2009/02/nagios-how-to-check-if-remote-process-is-running/" style="text-align: -webkit-auto;">http://linuxsysadminblog.com/2009/02/nagios-how-to-check-if-remote-process-is-running/</a></span></div><div><span style="font-family: Verdana, sans-serif;">2. <a href="http://blog.naver.com/choibit?Redirect=Log&logNo=140036351943">http://blog.naver.com/choibit?Redirect=Log&logNo=140036351943</a></span></div><br />
<br />
<div id="blogsy_footer" style="clear: both; font-size: small; text-align: right;"><a href="http://blogsyapp.com/" target="_blank"><span style="font-family: Verdana, sans-serif;"><img alt="Posted in Blogsy (iPad)" height="20" src="http://blogsyapp.com/images/blogsy_footer_icon.png" style="margin-right: 5px; vertical-align: middle;" width="20" />Posted in Blogsy (iPad)</span></a></div>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-700980825409077072012-12-03T22:37:00.001+08:002012-12-04T08:19:22.646+08:00MySql error: Can't start server: can't create PID file: No space left on device<span style="font-family: Verdana, sans-serif;">Today, MySQL server didn't start in the morning.</span><br />
<span style="font-family: Verdana, sans-serif;"> I checked log file of the server and found the following message:</span><br />
<span style="font-family: Verdana, sans-serif;">121203 13:31:12 [ERROR] <strong>Can't start server: can't create PID file: No space left on device</strong></span><br />
<span style="font-family: Verdana, sans-serif;">121203 13:31:12 mysqld_safe Number of processes running now: 1</span><br />
<span style="font-family: Verdana, sans-serif;">121203 13:31:12 mysqld_safe mysqld process hanging, pid 1708 - killed</span><br />
<span style="font-family: Verdana, sans-serif;">121203 13:31:12 mysqld_safe mysqld restarted</span><br />
<span style="font-family: Verdana, sans-serif;">121203 13:31:12 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">I examined the usage of HDDs of the host.</span><br />
<span style="font-family: Verdana, sans-serif;">$ df -h</span><br />
<span style="font-family: Verdana, sans-serif;">Filesystem Size Used Avail Use% Mounted on</span><br />
<strong><span style="font-family: Verdana, sans-serif;">/dev/mapper/vg_cloud-lv_root 953G 914G 0 100% /</span></strong><br />
<span style="font-family: Verdana, sans-serif;">tmpfs 3.3G 308K 3.3G 1% /dev/shm</span><br />
<span style="font-family: Verdana, sans-serif;">/dev/sda1 485M 67M 393M 15% /boot</span><br />
<span style="font-family: Verdana, sans-serif;">/dev/mapper/vg_cloud-lv_home 872G 249M 827G 1% /home</span><br />
<span style="font-family: Verdana, sans-serif;">xenstore 3.8G 104K 3.8G 1%. /var/lib/xenstored</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">The reason was that I created a big sized virtual hard disk for my testing environment and it caused insufficient disk size. Now, I deleted this VHD and I will move to big sizes files to /dev/mapper/vg_cloud-lv_home to make enough space on root directory soon.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">References</span><br />
<span style="font-family: Verdana, sans-serif;">1. <a href="http://hackerstv.blogspot.kr/2011/11/solved-mysql-cant-start-server-cant.html">http://hackerstv.blogspot.kr/2011/11/solved-mysql-cant-start-server-cant.html</a> </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<div id="blogsy_footer" style="clear: both; font-size: small; text-align: right;">
<a href="http://blogsyapp.com/" target="_blank"><span style="font-family: Verdana, sans-serif;"><img alt="Posted in Blogsy (iPad)" height="20" src="http://blogsyapp.com/images/blogsy_footer_icon.png" style="margin-right: 5px; vertical-align: middle;" width="20" />Posted in Blogsy (iPad)</span></a></div>
Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-53292504859229857442012-11-26T12:35:00.001+08:002012-11-26T12:37:35.687+08:00Get mac address of the remote host<span style="font-family: Verdana, sans-serif;">How can I do to get mac address of the remote server?</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">This question came from implementation of functionality that </span><span style="font-family: Verdana, sans-serif;">registering a new host into the management solution. The management server needs mac address of every new server to issue UID. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">I thought connecting to the remote host by ssh and run some commands. </span><br />
<span style="font-family: Verdana, sans-serif;">However, Windows server is including into environment. ssh doesn't work in Windows OS. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">I got an idea of using ARP(Address Resolution Protocol)</span> <span style="font-family: Verdana, sans-serif;">from: </span><a href="http://windowstipoftheday.blogspot.kr/2006/02/finding-mac-address-of-remote-computer.html" style="font-family: Verdana, sans-serif;">http://windowstipoftheday.blogspot.kr/2006/02/finding-mac-address-of-remote-computer.html</a><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">1) Ping checking to find mac address (Here, I used </span><span style="font-family: Verdana, sans-serif;">check_ping command, </span><span style="font-family: Verdana, sans-serif;">one of nagios plugins)</span><br />
<span style="font-family: Verdana, sans-serif;">$ /usr/lib64/nagios/plugins/check_ping -H 192.168.20.169 -w 3000.0,80% -c 5000.0,100% -p 5</span><br />
<span style="font-family: Verdana, sans-serif;">PING OK - Packet loss = 0%, RTA = 1.57 ms|rta=1.574000ms;3000.000000;5000.000000;0.000000 pl=0%;80;100;0</span><br />
<br />
<span style="font-family: Verdana, sans-serif;">2) If ping was succeed, run "arp -a ip" </span><br />
<span style="font-family: Verdana, sans-serif;">$ arp -a 192.168.20.169 | egrep -o '([0-9a-f]{2}:){5}[0-9a-f]{2}'</span><br />
<span style="font-family: Verdana, sans-serif;">00:16:3e:c3:7a:43</span><br />
<br />
<span style="font-family: Verdana, sans-serif;">References: </span><br />
<span style="font-family: Verdana, sans-serif;">1. <a href="http://windowstipoftheday.blogspot.kr/2006/02/finding-mac-address-of-remote-computer.html">http://windowstipoftheday.blogspot.kr/2006/02/finding-mac-address-of-remote-computer.html</a></span><br />
<span style="font-family: Verdana, sans-serif;">2. <a href="http://www.grymoire.com/Unix/Regular.html">http://www.grymoire.com/Unix/Regular.html</a></span><br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0tag:blogger.com,1999:blog-8757225099844464125.post-50257266002014168822012-11-22T20:29:00.000+08:002012-11-22T20:31:49.527+08:00Can't get result from Get-Template on ESXi<span style="font-family: Verdana, sans-serif;">VMware's Get-Template cmdlet returns a list of templates in vSphere environment. </span><span style="font-family: Verdana, sans-serif;">I ran the command many times to get the list, but, they were continuously failed.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">$ Get-Template NagiosTemplate</span><br />
<span style="color: #660000; font-family: Verdana, sans-serif;">Get-Template : 2012-11-22 PM 3:23:05 Get-Template Template with name 'NagiosTemplate' was not found using the specified filter(s).</span><br />
<span style="color: #660000; font-family: Verdana, sans-serif;">At line:1 char:13</span><br />
<span style="color: #660000; font-family: Verdana, sans-serif;">+ Get-Template <<<< NagiosTemplate -Verbose</span><br />
<span style="color: #660000; font-family: Verdana, sans-serif;"> + CategoryInfo : ObjectNotFound: (:) [Get-Template], VimException</span><br />
<span style="color: #660000; font-family: Verdana, sans-serif;"> + FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetTemplate</span><br />
<br />
<span style="font-family: Verdana, sans-serif;">Or, It was the same with no template name and there was no result.</span><br />
<span style="font-family: Verdana, sans-serif;">PS C:\> Get-Template</span><br />
<span style="font-family: Verdana, sans-serif;">PS C:\> </span><br />
<br />
<span style="font-family: Verdana, sans-serif;">I asked the question about this on VMware commnuity and </span><span style="font-family: Verdana, sans-serif;">I was recommended that connect to vCenter, not ESXi server. (</span><a href="http://communities.vmware.com/message/2151631#2151631" style="font-family: Verdana, sans-serif;">Q&A link</a><span style="font-family: Verdana, sans-serif;">)</span><br />
<span style="font-family: Verdana, sans-serif;">After I connected to vCenter again, this time, the command worked.</span><br />
<br />
<span style="font-family: Verdana, sans-serif;">PS C:\> Get-Template</span><br />
<span style="font-family: Verdana, sans-serif;">Name</span><br />
<span style="font-family: Verdana, sans-serif;">-----------------------</span><br />
<span style="font-family: Verdana, sans-serif;">NagiosTemplate</span><br />
<span style="font-family: Verdana, sans-serif;">altibase templ 3</span><br />
<span style="font-family: Verdana, sans-serif;">Altibase templ</span><br />
<span style="font-family: Verdana, sans-serif;">Altibase templ 2</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<span style="font-family: Verdana, sans-serif;">If you directly connect to ESXi host and run Get-Template cmdlet, you are not able to get anything. you must connect to vCenter server. </span><span style="font-family: Verdana, sans-serif;">Template management is not build-in feature of ESXi. This comes from vCenter Server. </span><br />
<br />
<span style="font-family: Verdana, sans-serif;"></span>Anonymoushttp://www.blogger.com/profile/13540668167785978652noreply@blogger.com0