cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Configuring DNA agent to save capture files to another drive

robbie_dixon
Newcomer

Hi,

I've installed the DNA agent on 24 servers, and learnt after the installations that I needed to the agent to save the capture files created by unattended captures off to a different drive away from the system drive.

Is this possible and can I be stepped through it please?

Thanks,

Robbie.

2 REPLIES 2

Tomasz_Szreder
Advisor

Hi Robbie,

I don’t
think we’ve ever tried that, but I believe it should be easy to do. The
settings related to agent disk cache are stored in the Registry at this
location:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Compuware\Vantage
Agent\CurrentVersion

See keys
named DataDir and DiskCacheDirectory (not sure about the difference,
but it’s probably best to make both point at the same location).

The procedure
would be as follows:

#
(Optional) Clear agent disk cache as it won’t be moved automatically (using
Unattended capture screen or Agent Commander)

# Open
Services, locate DNA agent service and stop it

# Update
keys DataDir and DiskCacheDirectory as needed

# Start
agent service and see if it saves cache to the new location

I saw agent
service create intermediate directories for the disk cache on its own, but if
you created the folder yourself, please make sure agent service can read/write
to that location. Let me know if you’d need the old agent cache migrated to the
new location – I’d have to test it out, but it’s possible just a simple folder
move should be sufficient.

I’ve just
tested the procedure in the lab and all looks good to me, so feel free to try
it yourself. Another option would be to reinstall agent using a different
DATADIR parameter, but that shouldn’t be necessary.

I'm not
sure how to automate this task, but I suppose you could create a simple
Registry script and use PsExec and sc (or PsService) to do these things
remotely, like below:

sc stop VantageAgent
... (update Registry, clear old cache)
sc start VantageAgent

Regards

Tomasz

robbie_dixon
Newcomer

Hi,

This worked, but I also developed a powershell script to perform the task programmatically as I was working with over 20 servers. The variables at the top of the script should be changed to contain the relevant information.

It doesn't clear the cache as there wasn't any on my severs.

Thanks,

Robbie.

PS : the formatting of the script changed with I pasted it into the form.

 ##  DYNATRACE NETWORK ANALYZER CACHE AND DATA DIR RE-CONFIGURATION.
##
## The $serverlist variable should show the location of csv containing server names to target.
## The csv requires the headers 'server_name', 'log_unc_path' and 'dna_log_location'
## server_name = MYDNASERVER, log_unc_path = \\MYDNASERVER\t$\MyLogLocation\, dna_log_location = t:\MyLogLocation\ (the final \ is required)
## The update is performed by the SetRemoteRegistryKey function, and this has been commented out for prudence. (lines 94 and 95)


$ServerList = 'c:\serverList.csv'


function SetRemoteRegistryKey()
{
param (
[Parameter(Mandatory=$true)]
[string]$Area, ## HKEY_xxx (HKEY_LOCAL_MACHINE becomes LocalMachine)
[Parameter(Mandatory=$true)]
[string]$Server, ## Remote Server Name
[Parameter(Mandatory=$true)]
[string]$Location, ## Location of the Registry key to update
[Parameter(Mandatory=$true)]
[string]$Key, ## Registry key to update
[Parameter(Mandatory=$true)]
[string]$Value, ## The desired value of the registry key
[Parameter(Mandatory=$true)]
[string]$ValueType ## The data type of the desired value
)

if (Test-Connection $server -Count 1 -Quiet)
{
$w32reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($area,$server)

if (!($w32reg.OpenSubKey($location).GetValue($key) -eq $value))
{
try
{
Write-Host "Attempting to set the registry value '$value' to $key..."
$set = $w32reg.OpenSubKey($location,$true)
$set.SetValue($key,$value,$valueType)
Write-Host "The registry key has been updated."
}
catch
{
Write-Host "There was an error writing to the registry value.... $error" -ForegroundColor Red
$Error.clear()
}
}
else
{
Write-Host $server\$area\$location\$key " is already set to $value. No update attempted" -ForegroundColor Yellow
}
}
else
{
Write-Host "Unable to contact remote server : $server" -ForegroundColor Yellow
}
}


function GetRemoteRegistryKey()
{
param (
[Parameter(Mandatory=$true)]
[string]$Area, ## HKEY_xxx (HKEY_LOCAL_MACHINE becomes LocalMachine)
[Parameter(Mandatory=$true)]
[string]$Server, ## Remote Server Name
[Parameter(Mandatory=$true)]
[string]$Location, ## Location of the Registry key to update
[Parameter(Mandatory=$true)]
[string]$Key
)

if (Test-Connection $server -Count 1 -Quiet)
{
$w32reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($area,$server)

$w32reg.OpenSubKey($location).GetValue($key)
}
else
{
Write-Host "Unable to contact remote server : $server" -ForegroundColor Yellow
}
}


## BEGIN
foreach ($server in Import-Csv $ServerList)
{
$s = $server.server_name
write-host "Performing actions on - $s"

if (Test-Connection -Count 1 -Quiet -ComputerName $s)
{
if (!( Test-Path $server.log_unc_path )) { New-Item -ItemType Directory -Path $server.log_unc_path}

get-service -name 'VantageAgent' -cn $s | Set-Service -Status 'Stopped'
get-service -name 'VantageAgent' -cn $s
# SetRemoteRegistryKey -Server $s -Area 'LocalMachine' -Location 'SOFTWARE\Wow6432Node\Compuware\Vantage Agent\CurrentVersion' -Key 'DataDir' -Value $server.dna_log_location -ValueType 'String'
# SetRemoteRegistryKey -Server $s -Area 'LocalMachine' -Location 'SOFTWARE\Wow6432Node\Compuware\Vantage Agent\CurrentVersion' -Key 'DiskCacheDirectory' -Value $server.dna_log_location -ValueType 'String'
getRemoteRegistryKey -Server $s -Area 'LocalMachine' -Location 'SOFTWARE\Wow6432Node\Compuware\Vantage Agent\CurrentVersion' -Key 'DataDir'
getRemoteRegistryKey -Server $s -Area 'LocalMachine' -Location 'SOFTWARE\Wow6432Node\Compuware\Vantage Agent\CurrentVersion' -Key 'DiskCacheDirectory'
get-service -name 'VantageAgent' -cn $s | Set-Service -Status 'Running'
get-service -name 'VantageAgent' -cn $s
}
else
{
Write-Host "A connection to $s could not be established. Skipping" -ForegroundColor Yellow
}
}