2013/07/07

Копирование Fedora, CentOS, RedHat на VMware

ОКРУЖЕНИЕ: VMware ESXi 5.1, CentOS 6, RedHat 6, Fedora 19
ЦЕЛЬ: Подготовить виртуальную машину для копирования или клонирования с VMware ESXi на VMware ESXi .
ПРОБЛЕМА: Не работает сеть после копирования или клонирования
РЕШЕНИЕ:
# Выполняется от пользователя root
# Скопировать конфигурционные файлы в домашнюю директорию
yes | cp -f /etc/udev/rules.d/70-persistent-net.rules ~/.
yes | cp -f /etc/sysconfig/network-scripts/ifcfg-eth0 ~/.
# Изменить конфигурционные файлы
sed -i 's/^SUBSYSTEM/#SUBSYSTEM/g' /etc/udev/rules.d/70-persistent-net.rules
sed -i 's/^UUID/#UUID/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/^MACADDR/#MACADDR/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/^HWADDR/#HWADDR/g' /etc/sysconfig/network-scripts/ifcfg-eth0
# Почистить перед копированием
rm -rf $(find /tmp -type f)
rm -rf $(find /var/log -type f)
rm -rf $(find /home -type f -name ".bash_history")
rm -fr ~/.bash_history
# Выключить виртуальную машину
poweroff
Скоприровать или экспортировать виртуальную машину.
Восстановить конфигурционные файлы на мастере (если нужно):
yes | cp -f ~/70-persistent-net.rules /etc/udev/rules.d/
yes | cp -f ~/ifcfg-eth0 /etc/sysconfig/network-scripts/
СКАЧАТЬ:

2012/08/09

Check on Nagios the latest files in folder with NSClient++ 0.3.9

CURRENT CONFIGURATION: Linux OpenSuSe, Nagios 3.2.3, NRPE; Windows 2003R2 x64 server, NSClient++ 0.3.9.330 2011-09-02
OBJECTIVE: Monitor MSSQL backup, IIS logs replication with Nagios. Check FOLDER with files (MSSQL backup, IIS logs, S3 logs, etc.). Send WARNING if files are older than some hours.
SOLUTION:
NRPE has to work on Nagios server and on Windows client computer with NSClient++.
Nagios server command.cfg file:
define command{
  command_name    check_nrpe_files_written
  command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c CheckFiles -a "path=$ARG1$" "pattern=$ARG2$" "filter=written gt -$ARG3$" truncate=4096 "master-syntax=files: %total%" max-dir-depth=$ARG4$ MinWarn=0
}

define command{
  command_name    check_nrpe_files_creation
  command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c CheckFiles -a "path=$ARG1$" "pattern=$ARG2$" "filter=creation gt -$ARG3$" truncate=4096 "master-syntax=files: %total%" max-dir-depth=$ARG4$ MinWarn=0
}

Nagios server somename.cfg file examples:


define service{
...
  check_command           check_nrpe_files_creation!F:\\Backup\\SERVER01\\mssql\\backup\\default\\full!*.bkz!30h!0
  normal_check_interval   720
}
define service{
...
  check_command           check_nrpe_files_creation!F:\\Backup\\SERVER06\\ServiceDesk\\backup!*.data!30h!0
  normal_check_interval   720
}
define service{
...
  check_command           check_nrpe_files_creation!F:\\backup\\SERVER01!*-exchange_1_storage_group.bkf!8d!0
  normal_check_interval   1440
}
define service{
...
  check_command           check_nrpe_files_written!D:\\Logs\\IISLogs!*WEB01*.log!6h!4
  normal_check_interval   180
}
define service{
...
  check_command           check_nrpe_files_written!D:\\Replica\\UploadCopy\\s3!LastReplication.log!30h!0
  normal_check_interval   720
}

NSClient++ NSC.ini file:

[modules]
NRPEListener.dll
[NRPE]
allow_arguments=1
allow_nasty_meta_chars=1
Big thanks to NSClient++ author for program and excellent support.

2012/06/11

Amazon AWS windows instance w32time service issue

CURRENT CONFIGURATION:  Windows 2008R2 SP1 instance on Amazon AWS VPC
OBJECTIVE: Time synchronise
ISSUE:
C:\>sc start w32time
[SC] StartService FAILED 1290:
The service start failed since one or more services in the same process have anincompatible service SID type setting. A service with restricted service SID type can only coexist in the same process with other services with a restricted SID type. If the service SID type for this service was just configured, the hosting process must be restarted in order to start this service.
C:\>sc start Ec2Config
[SC] StartService FAILED 1068:
The dependency service or group failed to start.
SOLUTION:
Uninstall Ec2ConfigService. Delete all in c:\Program Files\Amazon\Ec2ConfigService\ except  config files in c:\Program Files\Amazon\Ec2ConfigService\Settings\ .
Uninstall w32time by command
w32tm /unregister
Reboot server.
Install and start w32time service by command
w32tm /register
@ping localhost -n 5 >; nul
sc start w32time
Configure w32time service. Example:
w32tm /config /update /manualpeerlist:0.ie.pool.ntp.org,0.europe.pool.ntp.org,3.europe.pool.ntp.org /syncfromflags:MANUAL
@ping localhost -n 2 >; nul
w32tm /monitor /computers:0.ie.pool.ntp.org
w32tm /resync
Reboot the server ant test w32time service. Example
w32tm /monitor /computers:0.ie.pool.ntp.org
w32tm /resync
w32tm /query /peers
w32tm /query /configuration
If w32time service works as you expected download and install Ec2ConfigService
Reboot the server.
LINKS: Reinstall ec2config

2011/10/21

Cannot open default admin shares on Windows 2008R2

CURRENT CONFIGURATION: Windows 2008 R2 SP1 (In workgroup), Windows 7

ISSUE: Cannot open default admin shares on Windows 2008R2 (C$, etc.) with account credentials in local Administrators group but the account is not Administrator. I could connect to non standard shares with the same credentials

C:\>net use \\MyServerName\c$ /user:MyServerName\MyAdminUser MyPassword

System error 5 has occurred.

Access is denied.

SOLUTION:

Please open regedit, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

Create new DWORD (32-bit) Value "LocalAccountTokenFilterPolicy"

Change in data 0 to 1

Please open Start –> Administrative Tools –> Server Manager –> Roles –> File Services –> Share and Storage Management

Right click on C$ –> Stop sharing

Open Command Promt as administrator

C:\>sc stop LanmanServer

C:\>sc start LanmanServer

DOWNLOAD: Download md5: 8062a4edaf664c0f742500c61293153c HKLM_W2008R2_Access_to_admin_shares_fix.zip

LINKS: kb947232

 

2011/05/24

WSUS issue: directory permissions and shares disappeared

CURRENT CONFIGURATION: Windows 2003 R2 x64 SP2, WSUS 3.0 SP1 and remote MS SQL 2005 server
OBJECTIVE: Fix issue with WSUS directory permissions and shares.
ISSUE: WSUS folder content was restored to the same location D:\WSUS but with folder and share permissions issue. WSUS shares were disappeared after server restart. 
Server Event ID: 10012 The permissions on directory D:\ are incorrect. 
Clients logs:
80070005    AutomaticUpdates    Failure    Content Download    Error: Download failed.
SOLUTION: 
Use \Program Files\Update Services\Tools\wsusutil.exe
Create new empty folder WSUS2
Run next commands.
"C:\Program Files\Update Services\Tools\wsusutil.exe" movecontent D:\WSUS2 d:\move.log -skipcopy
"C:\Program Files\Update Services\Tools\wsusutil.exe" movecontent D:\WSUS d:\move2.log -skipcopy
It would takes a while.
move2.log:
Successfully stopped WsusService.
Beginning content file location change to D:\WSUS
Did not copy files due to -skipcopy flag.
Successfully changed WUS configuration.
Successfully changed IIS virtual directory path.
Successfully removed existing local content network shares.
Successfully created local content network shares.
Successfully changed registry value for content store directory.
Successfully changed content file location.
Successfully started WsusService.
Content integrity check and repair...
Initiated content integrity check and repair.
Check WSUS status
"C:\Program Files\Update Services\Tools\wsusutil.exe" checkhealth
Done. Please check event log for events with source "Windows Server Update Services".