Category Archives: Uncategorized

VMware 6 ESXi Hardware Health States are not displayed (with Fujitsu CIM-Provider)

After setting up a ESXi-Cluster with VSAN based on VMware 6 the Fujitsu CIM-Providers did not provide any hardware health states and also the Fujitsu vCenter plugin did not provide any data. The service always timed out an no data where gathered. Instead the following error message was diplaed:

No new host data available. Data will be updated in 5 minutes

All that happened after updating the ESXi & FJ CIM providers with the VMware Update Manager.

After some investigation it seemed that the ESXi could not communicate with the CIM-Server. A restart of the CIM-Provider and clearing of the sensor-data and event-log seemed to fix the problem and the server was finaly able to gather data.

Sync Redhat repositories to a local deployment server [RHEL6/7]

Redhat offers a great tool with Redhat satellite server especially with Satellite 6.  But the price is quite high, and if you need to provides packages and updates to multiple separated environments it’s out of the picture.
(For those who are interessted – Katello is the upstream project of Redhat’s Satellite 6).

So the question is now, how to get the the Redhat repos to your deployment server.
First a subscription is needed and only channels/repos included in this subscription can be synchronized.
If we have the channels/repos availalbe on our system which we want to use to sync we can use reposync to pull all the repositoriers from the internet.
The follwoing example shows a list of repositories which are available on my machine:

[pastacode lang=”bash” message=”Available channels” highlight=”” provider=”manual”]

[root@server~]# yum repolist
Loaded plugins: downloadonly, refresh-packagekit, rhnplugin, security
This system is receiving updates from RHN Classic or RHN Satellite.
repo id                                    repo name                                                          status
epel                                       Extra Packages for Enterprise Linux 6 - x86_64                     11,588
rhel-x86_64-server-6                       Red Hat Enterprise Linux Server (v. 6 for 64-bit x86_64)           14,872
rhel-x86_64-server-6-rhscl-1               Red Hat Software Collections 1 (RHEL 6 Server x86_64)               3,003
rhel-x86_64-server-dts-6                   Red Hat Developer Toolset (for RHEL 6 Server for x86_64)               84
rhel-x86_64-server-dts2-6                  Red Hat Developer Toolset 2 (for RHEL 6 Server for x86_64)            469
rhel-x86_64-server-extras-6                RHEL Server Extras (v. 6 for 64-bit x86_64)                            17
rhel-x86_64-server-ha-6                    RHEL Server High Availability (v. 6 for 64-bit x86_64)                423
rhel-x86_64-server-optional-6              RHEL Server Optional (v. 6 64-bit x86_64)                           8,313
rhel-x86_64-server-rh-common-6             Red Hat Common (for RHEL 6 Server x86_64)                              59
rhel-x86_64-server-supplementary-6         RHEL Server Supplementary (v. 6 64-bit x86_64)                        514
repolist: 39,342
[root@server~]#

[/pastacode]

 

The easiest way to sync a repo is to just call the following command:

[pastacode lang=”bash” message=”Sync repos” highlight=”” provider=”manual”]

reposync -p /path/to/storeage/dir/RHserv6-general_64/ --repoid=rhel-x86_64-server-6 -l

[/pastacode]

Important is to add the -l option to the command. The command enables the yum-plugins and to be able to sync directly from Redhat those plugins have to be enabeld!

But I think the most people don’t want to run the synchronization by hand and some metadata also would be nice – so you can use/adapt the following script and add it as a cronjob.

[pastacode lang=”bash” message=”automated sync script” highlight=”” provider=”manual”]

	#!/bin/bash
############################################################################
#
#       @Author: fweixelb@fawcs.info
#
#       @Description:
#               Script synchronizes the RH-repos
#
###########################################################################


datetime=$(date +"%F_%T")

#General
reposync -p /path/to/storeage/dir/RHserv6-general_64/ --repoid=rhel-x86_64-server-6 -l --download-metadata > /var/log/reposync/general_$datetime.log
compsfile=$(echo "$(ls -d /path/to/storeage/dir/RHserv6-general_64/* | grep rhel)/comps.xml")
createrepo /path/to/storeage/dir/RHserv6-general_64/ -g $compsfile --update

#Common
reposync -p /path/to/storeage/dir/RHserv6-common_64/ --repoid=rhel-x86_64-server-rh-common-6 -l --download-metadata > /var/log/reposync/common_$datetime.log
compsfile=$(echo "$(ls -d /path/to/storeage/dir/RHserv6-common_64/* | grep rhel)/comps.xml")
createrepo /path/to/storeage/dir/RHserv6-common_64/ -g $compsfile --update

#Optional
reposync -p /path/to/storeage/dir/RHserv6-optional_64/ --repoid=rhel-x86_64-server-optional-6 -l --download-metadata > /var/log/reposync/optional_$datetime.log
compsfile=$(echo "$(ls -d /path/to/storeage/dir/RHserv6-optional_64/* | grep rhel)/comps.xml")
createrepo /path/to/storeage/dir/RHserv6-optional_64/ -g $compsfile --update

#rhel Software Collection
reposync -p /path/to/storeage/dir/RHserv6-rhscl_64/ --repoid=rhel-x86_64-server-6-rhscl-1 -l --download-metadata > /var/log/reposync/scl_$datetime.log
compsfile=$(echo "$(ls -d /path/to/storeage/dir/RHserv6-rhscl_64/* | grep rhel)/comps.xml")
createrepo /path/to/storeage/dir/RHserv6-scl_64/ -g $compsfile --update

[/pastacode]

So, what does this script do?
Because it’s intended to be used as a cronjob it logs the sync-process to /var/log/reposync – I don’t do any logrotation because the files are quite small and the cronjobs runs only once a week – so there is not too much space used by the logfiles and I clean them from hand. but if its ran more often you should think about log rotation.

Reposync itself creates a subfolder in the spceified directory which is named like the repoid and contains the metadata (comps & updateinfo + a directory called getPackage which contains the rpm-packages).  The comps-file contains all the group-infos and updateinfo is needed if you want to use yum just for security updates.
Herefor the yum-plugin “yum-plugin-security” is a good choice.

 

UPDATE:
With the “–download-metadata” parameter in the reposync command the updateinfo.xml-files are also downloaded (as far as they exist for the repo). Normaly the file is downloaded in the following format: <HASH>-updateinfo.xml.gz

To use the updateinfo-file in your synchronized repo the file has to be gunziped and renamed to updateinfo.xml – so the hash at the beginning of the filname needs to be striped away. Otherwise it is likely that the updates are not recognized correctly! So convert your downloaded updateinfo-metadata file to updateinfo.xml and run use modify repo to update your repository with the security update informations from the updateinfo.xml.

[pastacode lang=”bash” message=”update the metadata of the local repo” highlight=”” provider=”manual”]

modifyrepo updateinfo.xml repodata

[/pastacode]

 

Cisco SFP – useful DOM

For some of Ciscos SFP modules Cisco implemented some DOM (Digital optical monitoring) capabilities. This means, that you can debug fibre-links to a certain grade with thos DOM-enabeld fibre modules. For example the GLC-LH-SMD is such a modules.

With DOM-capbale modules the command

[pastacode lang=”python” message=”Cisco – Show transceiver status” highlight=”” provider=”manual”]

sh interface transceiver

[/pastacode]
can be executed on the switch and the RX & TX power on the modules links are displayed. It’s a cool feature to quickly debug a fibre link and check the attenuation on a link.

Further infos and an example can be found at:
https://supportforums.cisco.com/document/75181/digital-optical-monitoring-dom

UNIX/DOS-encoding – ^M

Ever had the problem that you tried running a script on a linux-machine and got an error message like the following one?
-bash: ./getRaidFromIrmc.php: /usr/bin/php^M: bad interpreter: No such file or directory

The ^M indicatees that e file you are trying to run is DOS-encoded. This means that its using a CHAR 13 instead of CHAR 10 for a line break and Linux does not like that kind of line break. That often happens if you are writing a script or config file on a Windows machine and transfer it to a Linux machine.
If you try to run/parse the file in linux -> wrong encoding and BAM

The first time I ran into this problem was while deploying a RHEL machine with a faulty kickstart file, but if you know what the problem is it’s quite easy to fix it. Just run “dos2unix” over your file and everything should work again as it should work.

If you often have to modify Linux-files on widows machines I’ld recommend you to use Notepadd++, because it has a feature implemented to set the correct EOL-conversion and lots of more cool and useful plugins like the built in FTP/SFTP-plugin.

Windows performance counters and zabbix

There already quite a lot of blog posts out there which describe how to add performance counters to zabbix. In fact – its not that hard – the tricky thing is, to have one template which gets performance counters from systems wich have different languages installed.

In this case it’s a good idea to use the index of a counter. Indexes of all performance counters can be obtained from teh registry.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ Windows NT\CurrentVersion\Perflib
In this path there should be a key named “009” (would be englisch, “007” german) or similar, which contains all the key-value pairs.
The easiest way is to copy everything to an editor and look up the keys you need.

I tried to verify the counter ids by using them with “typeperf” – eg: typeperf \234(_Total)\202 but most times the result was:
Error: No valid counters.
If i used the names instead of the keys everything worked fine.

Atm I still don’t know what the reason for this error is, but, if you try it with  zabbix_get everything works fine.
zabbix_get -s server-01 -k “perf_counter[\234(_Total)\202]”
0.000000

Further details about performance counters in Zabbix can be found at:
https://www.packtpub.com/books/content/monitoring-windows-zabbix-18

Slow SSH connection / SSH needs some time to establish connection

While connecting with putty (or any other ssh-client) it could happen, that the initial connection needs some time (up to a lot of time) to establish the connection to the target system.

The Problem could occure if the system is trying to look up the DNS entry of the connecting system. If you have not configured DNS in your environment or the system can’t be found it always takes some time till the connection is established.

To disable this problem the following line has to be added/uncommented in the SSHD-conf of the target system:

#UseDNS yes

to

UseDNS no