2016年8月9日火曜日

[XenServer 6.5] Monittoring average CPU frequency


 I was successful to monitor average CPU frequency on XenServer 6.5 by Zabbix 2.2 by followings, although "cpu MHz" in /proc/cpuinfo cannot monitor real-time CPU frequency unlike other Linux distributions..

○ Environment:


CPU : AMD FX-9590 (4.7 GHz)
Mother board : ASRock 990Fx Extream 9
Phisycal Memory : 8G x 2
HDD : Western Digital WD2002FAEX x 2  (RAID 1 by mdadm)
Hypervisor : Citrix  XenServer 6.5

○xenpm command


1.xenpm start command starts measuring CPU frequency and status,  when the CTLR-C is pressed the result of the term from command execution to CTLR-C  will be shown on the console.
[root@servername ~]# xenpm start
Start sampling, waiting for CTRL-C or SIGINT or SIGALARM signal ...
(#Press CTRL-C.)
CPU0:   Residency(ms)           Avg Res(ms)
  C0    22078   (14.05%)        0.07
  C1    103813  (66.08%)        0.37
  C2    31201   (19.86%)        2.33

  P0    1539    ( 7.72%)
  P1    216     ( 1.09%)
  P2    322     ( 1.62%)
  P3    872     ( 4.38%)
  P4    319     ( 1.60%)
  P5    16670   (83.60%)
  Avg freq      1739000 KHz

CPU1:   Residency(ms)           Avg Res(ms)
  C0    22118   (14.08%)        0.07
  C1    103991  (66.20%)        0.37
  C2    30983   (19.72%)        2.36

  P0    1668    ( 8.22%)
  P1    242     ( 1.19%)
  P2    253     ( 1.25%)
  P3    844     ( 4.16%)
  P4    329     ( 1.62%)
  P5    16951   (83.55%)
  Avg freq      1786000 KHz

CPU2:   Residency(ms)           Avg Res(ms)
  C0    21972   (13.99%)        0.07
  C1    105369  (67.07%)        0.36
  C2    29752   (18.94%)        2.36

  P0    1410    ( 7.03%)
  P1    238     ( 1.19%)
  P2    296     ( 1.48%)
  P3    824     ( 4.11%)
  P4    288     ( 1.44%)
  P5    17009   (84.76%)
  Avg freq      1739000 KHz

CPU3:   Residency(ms)           Avg Res(ms)
  C0    22239   (14.16%)        0.07
  C1    105942  (67.44%)        0.36
  C2    28912   (18.40%)        2.38

  P0    1459    ( 7.17%)
  P1    287     ( 1.41%)
  P2    293     ( 1.44%)
  P3    894     ( 4.40%)
  P4    298     ( 1.47%)
  P5    17122   (84.11%)
  Avg freq      1786000 KHz

CPU4:   Residency(ms)           Avg Res(ms)
  C0    21750   (13.85%)        0.07
  C1    102451  (65.22%)        0.37
  C2    32891   (20.94%)        2.45

  P0    1401    ( 7.03%)
  P1    207     ( 1.04%)
  P2    242     ( 1.22%)
  P3    965     ( 4.85%)
  P4    289     ( 1.45%)
  P5    16817   (84.41%)
  Avg freq      1739000 KHz

CPU5:   Residency(ms)           Avg Res(ms)
  C0    21613   (13.76%)        0.07
  C1    103763  (66.05%)        0.37
  C2    31715   (20.19%)        2.38

  P0    1391    ( 7.03%)
  P1    229     ( 1.16%)
  P2    287     ( 1.45%)
  P3    1013    ( 5.12%)
  P4    295     ( 1.49%)
  P5    16571   (83.74%)
  Avg freq      1786000 KHz

CPU6:   Residency(ms)           Avg Res(ms)
  C0    22060   (14.04%)        0.07
  C1    104338  (66.42%)        0.36
  C2    30694   (19.54%)        2.43

  P0    1426    ( 7.06%)
  P1    145     ( 0.72%)
  P2    302     ( 1.50%)
  P3    921     ( 4.56%)
  P4    307     ( 1.52%)
  P5    17094   (84.64%)
  Avg freq      1739000 KHz

CPU7:   Residency(ms)           Avg Res(ms)
  C0    21691   (13.81%)        0.07
  C1    105650  (67.25%)        0.37
  C2    29751   (18.94%)        2.37

  P0    1332    ( 6.71%)
  P1    217     ( 1.09%)
  P2    314     ( 1.58%)
  P3    999     ( 5.03%)
  P4    255     ( 1.29%)
  P5    16741   (84.30%)
  Avg freq      1786000 KHz

Socket 0
         Core 0 CPU 0
         Core 1 CPU 1
         Core 2 CPU 2
         Core 3 CPU 3
         Core 4 CPU 4
         Core 5 CPU 5
         Core 6 CPU 6
         Core 7 CPU 7

 If the argument for timeout(sec.) is given to xenpm command like the below, the user don't need to press CTRL-C to show the results.
[root@servername ~]# xenpm start 10

○ Setting Zabbix 2.2 Agent on XenServer 6.5

1. Set the sudo configuration on XenServer .5 so that zabbix user can execute xenpm command.Add the following to /etc/sudoers if zabbix user is added to wheel group on XenServer 6.5.
 %wheel  ALL=(ALL)       NOPASSWD:       /usr/sbin/xenpm

2.  Set Timeout parameter in /etc/zabbix/zabbix_server.conf on Zabbix Server. Add the following to conf file.(Default = 3).
Timeout=30

3. Set Timeout parameter in /etc/zabbix/zabbix_agentd.conf on XenServer 6.5. Add the following to conf file.(Default = 3)
Timeout=30

4. Add the followings to /etc/zabbix/zabbix-agentd.conf on XenServer 6.5 to report .
 UserParameter=xenpm_start[*],sudo xenpm start 10|grep $2|sed -n -e $1"p"|awk '{print $$3}'
5. Restart Zabbix server and agent on XenServer 6.5 in order to reflect configuration changes.
  [root@servername ~]# /etc/init.d/zabbix-agent restart
  [root@servername2 ~]# /etc/init.d/zabbix-server restart
6. Add a new Item for average CPU frequency.of XenServer 6.5 on Zabbix Server


7. You can get the following result after creating the graph.


○ Reference:

1. http://wiki.xenproject.org/wiki/Xenpm_command






2016年8月1日月曜日

[XenServer 6.5] CPU Temperature Monitoring by Zabbix 2.2


 I was successful to monitor CPU temp. on XenServer 6.5 by Zabbix 2.2 by followings.

○ Environment:


CPU : AMD FX-9590 (4.7 GHz)
Mother board : ASRock 990Fx Extream 9
Phisycal Memory : 8G x 2
HDD : Western Digital WD2002FAEX x 2  (RAID 1 by mdadm)
Hypervisor : Citrix  XenServer 6.5

○ Install lm_sensors package


1.Download lm_sensors binary file from the below link
ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/archive.fedoraproject.org/fedora/linux/releases/10/Fedora/x86_64/os/Packages/lm_sensors-3.0.2-1.fc10.x86_64.rpm 
2. Install the lm_sensors by rmp command.
[root@servername ~]# rpm -ivh lm_sensors-3.0.2-1.fc10.x86_64.rpm
3. Configure lm_sensors.
[root@servername ~]# sensors-detect
(#Answer "Y" to all questions.)
[root@servername ~]# modprobe  -v k10temp     (#Load driver)
[root@servername ~]# modprobe -v w83627ehf     (#Load driver)
[root@xenserver-ixyaeoht ~]# modprobe -v w83627ehf
insmod /lib/modules/3.10.0+2/kernel/drivers/hwmon/hwmon-vid.ko
insmod /lib/modules/3.10.0+2/kernel/drivers/hwmon/w83627ehf.ko
[root@servername ~]# sernsors
k10temp-pci-00c3
Adapter: PCI adapter
temp1:       +21.6°C  (high = +70.0°C, crit = +70.0°C)

nct6776-isa-0290
Adapter: ISA adapter
in0:         +0.89 V  (min =  +0.00 V, max =  +1.74 V)
in1:         +1.85 V  (min =  +0.00 V, max =  +0.00 V)   ALARM
in2:         +3.25 V  (min =  +0.00 V, max =  +0.00 V)   ALARM
in3:         +3.25 V  (min =  +0.00 V, max =  +0.00 V)   ALARM
in4:         +1.48 V  (min =  +0.00 V, max =  +0.00 V)   ALARM
in5:         +1.69 V  (min =  +0.00 V, max =  +0.00 V)   ALARM
in7:         +3.46 V  (min =  +0.00 V, max =  +0.00 V)   ALARM
in8:         +3.36 V  (min =  +0.00 V, max =  +0.00 V)   ALARM
fan1:          0 RPM  (min =    0 RPM)  ALARM
fan2:          0 RPM  (min =    0 RPM)  ALARM
fan3:          0 RPM  (min =    0 RPM)  ALARM
fan4:          0 RPM  (min =    0 RPM)  ALARM
fan5:          0 RPM  (min =    0 RPM)  ALARM
SYSTIN:      +33.0°C  (high =  +0.0°C, hyst =  +0.0°C)  ALARM  sensor = thermistor
CPUTIN:      +36.5°C  (high = +80.0°C, hyst = +75.0°C)  sensor = thermistor
AUXTIN:       +2.0°C  (high = +80.0°C, hyst = +75.0°C)  sensor = thermistor
cpu0_vid:   +1.550 V
[root@servername ~]# sernsors -u
 k10temp-pci-00c3
Adapter: PCI adapter
temp1:
  temp1_input: 28.25
  temp1_max: 70.00
  temp1_crit: 70.00
  temp1_crit_hyst: 67.00

nct6776-isa-0290
Adapter: ISA adapter
in0:
  in0_input: 1.50
  in0_min: 0.00
  in0_max: 1.74
  in0_alarm: 0.00
in1:
  in1_input: 1.85
  in1_min: 0.00
  in1_max: 0.00
  in1_alarm: 1.00
in2:
  in2_input: 3.25
  in2_min: 0.00
  in2_max: 0.00
  in2_alarm: 1.00
in3:
  in3_input: 3.25
  in3_min: 0.00
  in3_max: 0.00
  in3_alarm: 1.00
in4:
  in4_input: 1.47
  in4_min: 0.00
  in4_max: 0.00
  in4_alarm: 1.00
in5:
  in5_input: 1.69
  in5_min: 0.00
  in5_max: 0.00
  in5_alarm: 1.00
in7:
  in7_input: 3.46
  in7_min: 0.00
  in7_max: 0.00
  in7_alarm: 1.00
in8:
  in8_input: 3.36
  in8_min: 0.00
  in8_max: 0.00
  in8_alarm: 1.00
fan1:
  fan1_input: 0.00
  fan1_min: 0.00
  fan1_alarm: 1.00
fan2:
  fan2_input: 0.00
  fan2_min: 0.00
  fan2_alarm: 1.00
fan3:
  fan3_input: 0.00
  fan3_min: 0.00
  fan3_alarm: 1.00
fan4:
  fan4_input: 0.00
  fan4_min: 0.00
  fan4_alarm: 1.00
fan5:
  fan5_input: 0.00
  fan5_min: 0.00
  fan5_alarm: 1.00
SYSTIN:
  temp1_input: 33.00
  temp1_max: 0.00
  temp1_max_hyst: 0.00
  temp1_alarm: 1.00
  temp1_type: 4.00
  temp1_offset: 0.00
CPUTIN:
  temp2_input: 36.00
  temp2_max: 80.00
  temp2_max_hyst: 75.00
  temp2_alarm: 0.00
  temp2_type: 4.00
  temp2_offset: 0.00
AUXTIN:
  temp3_input: 2.50
  temp3_max: 80.00
  temp3_max_hyst: 75.00
  temp3_alarm: 0.00
  temp3_type: 4.00
  temp3_offset: 0.00
cpu0_vid:
  cpu0_vid: 1.55
    I need only CPU temp. , so I don't care that fan speed can't be obtained.

○ Setting Zabbix 2.2 Agent on XenServer 6.5

1. Add the followings to /etc/zabbix/zabbix-agentd.conf on XenServer 6.5 to report .
 UserParameter=lm_sensors[*],sensors -u $1|grep $2|cut -d ":" -f2|cut -d " " -f2
2. Restart Zabbix agent on XenServer 6.5
  [root@servername ~]# /etc/init.d/zabbix-agent restart
3. Add a new Item for CPU temp.of XenServer 6.5 on Zabbix Server


4. You can get the following result after creating the graph.


○ Reference:

1. http://hidenosuke.org/diary/?date=20130429
2. http://blog.goo.ne.jp/shigen417/e/0207cc853b4a8a173fe4baa116bc14bf