Quantcast
Channel: Gokhan Atil’s Technology Blog
Viewing all articles
Browse latest Browse all 163

Installing EM13c Agents on Microsoft Windows Target Hosts

$
0
0

If your EM13c OMS installed on Unix-based OS, and want to deploy agents to Windows servers, you need to install Cygwin to target windows server to use regular deployment process. You can also use PsExec utility but in this case, you need a Microsoft Windows staging server. Installing Cygwin to enable SSH on Windows may sound like an unnecessarily complex solution at first, but Cygwin is easy to install and it comes with lots of useful utilities. So It’s worth installing. In this blog, I’ll show how to deploy EM agent on Microsoft Windows target. I’ll download and install Cygwin to the target server, enable SSH service and create user for SSH. After these steps, I’ll use Enterprise Manager Add Host page to deploy Enterprise Manager agent to the target Windows server like it’s just another Linux host.

First login to the target Windows server with administrator user and download Cygwin from https://www.cygwin.com/install.html. Depending on your CPU architecture (is there any one still using 32bit?) you need to download setup-x86.exe or setup-x86_64.exe from the installation page. These are very small executables, and they will download the required packages from the internet.

cygwin2

When you run the setup-x86_64.exe, you see the welcome screen. You click NEXT to choose a download source. If your target server has no internet access, you can install packages from a local directory. That means, you can use the packages downloaded by another Cygwin installation on another server. All you need is to use a shared location or copy files from other server which is already Cygwin installed. Click NEXT to continue.

cygwin3

In this screen you set the installation path. Be careful that, Cygwin 64bit’s default installation path is “C:\Cygwin64”, but in “ssPaths_msplats.properties” file of Oracle Enterprise Manager, Cygwin path is defined as “C:\Cygwin” so So if you use a different path than “C:\Cygwin”, you need to modify all path variables in the file ($OMS_HOME\oui\prov\resources\ssPaths_msplats.properties). At first, I left it as it is, then I had to modify the “ssPaths_msplats.properties” file:

# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.

IDENTITY=identity
IDENTITY_PUB=identity.pub
FALSE=C:/cygwin64/bin/false.exe
#SSH_PATH=C:\\Program Files\\OpenSSH\\bin\\ssh.exe
#SCP_PATH=C:\\Program Files\\OpenSSH\\bin\\scp.exe
SSH_PATH=C:/cygwin64/bin/ssh.exe
SCP_PATH=C:/cygwin64/bin/scp.exe
PING_ARGS=-n 5 -w
PING_PATH=%SYSTEMROOT%\\system32\\ping.exe
LS_PATH=C:/cygwin64/bin/ls.exe
LS_ARGS=-A
MKDIR_PATH=C:/cygwin64/bin/mkdir.exe
MKDIR_ARGS=-p
ZIP_PATH=C:/cygwin64/bin/zip.exe
UNZIP_PATH=C:/cygwin64/bin/unzip.exe
...

After setting the correct path, click NEXT button. It will ask you where it should download the packages, how your server connects to internet, which download site should be used. Usually it’s okay to accept the defaults until you see “select packages” screen.

cygwin7

All you need is to select “openssh and openssl” packages. So type “opens” into the search box, expand the “Net” category, and select the openssh and openssl packages. Cygwin installer will detect the additional required packages, just accept them and click NEXT until installation start, then wait for downloads and installations of packages are done.

After the installation is done, right-click on Cygwin64 Terminal icon on the desktop and choose “run as administrator”. So the terminal will start with admin rights.

Run ssh-host-config and give the following answers to the questions:

Query: Should StrictModes be used? (yes/no) yes
Query: Should privilege separation be used? (yes/no) yes
Query: new local account ‘sshd’? (yes/no) yes
Query: Do you want to install sshd as a service? yes
Query: Enter the value of CYGWIN for the daemon: []
Query: Do you want to use a different name? (yes/no) no
Query: Create new privileged user account ‘SQL01\cyg_server’ (Cygwin name: ‘cyg_server’)? (yes/no) yes
Query: Please enter the password: password
Query: Reenter: password

It should say “Host configuration finished” at the end. In my installation, it couldn’t find “cyg_server” for SSHD although it created, so it used “SYSTEM” user. That’s fine. Now open “C:\cygwin\etc\sshd_config” file (you can use vi or any other editor). Add the following line at the end of the time:

KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1

Then start SSH service:

$ net start sshd
The CYGWIN sshd service is starting.
The CYGWIN sshd service was started successfully.

For now, you do not have any users in Cygwin environment. I’ll add my current (local) user to the Cygwin environment so we’ll be able to use it when deploying agent.

/bin/mkpasswd -l -u dbadmin >> /etc/passwd

$ cat /etc/passwd
SQL01+dbadmin:*:197613:197121:U-SQL01\dbadmin,XXXXXXXXXX:/home/dbadmin:/bin/bash

As you can see I checked if there’s any line added to /etc/passwd. If you see your username there, you should be able to connect the target Windows server using SSH.

addtargets

Now we need to login to EM13c console, go to “Add Targets Manually” page, click “Install Agent on Host”.

addhost1

Enter host name and select the platform, click NEXT to go to “installation details” screen. Of course, you should have already installed the agent for Windows platform to be able to choose it on “the platform select box”.

addhost2

Enter the path in Windows format, for example: “C:\oracle\emagent”. Enter the username you added to “/etc/passwd” on the target Windows server. Click “NEXT” and deploy the agent. That’s all. Now we can deploy Microsoft SQL Server plugin to this agent and monitor our Microsoft SQL Servers, but I’ll tell it on another blog post 🙂


Viewing all articles
Browse latest Browse all 163