Can you suggest please : One single Datasource for Multiple server
When i use One single Datasource for Multiple servers it then displays all the Raw Data on any of the server from Datasource.
Can I force it to display only specific Data point outputs on the RawDat tab.
Thank you
Please ask me if you need more elaboration.
Ashiwad
Posted 6 years ago·Last reply 6 years ago
12 comments
LM User
·6 years agoIf you have an active discovery script, you won't need to manually add instances. If you want to discover different instances, like folders instead of partition names, you'll need to adjust your query. You might consider pulling from the Win32_Directory class instead of the Win32_LogicalDisk class.
Not sure what you tried to setup here.
From the looks of your script, you could probably do this without a script by using the built in WMI collector. To help you get started, this is how you would set it up to pull free space on each logical drive. I did this so you can compare it to what you already have in your script. To make it for folders, like I said above, you'd need to use the Win32_Directory class instead. I'm not familiar with that class, so you'd have to do a little research.
Ashiwad
OP6 years agoHey Stuart
After spending some time on it i managed to get some sample scripts and understood exactly what it does and how.
## Active Script ##
$hostname = '##SYSTEM.HOSTNAME##'
$namespace = "root\cimv2"
$query = "SELECT NAME FROM Win32_LogicalDisk"
$output = Get-WmiObject -Namespace $namespace -ComputerName $hostname -Query $query
foreach ($instance in $output) {
$name = $instance.Name
Write-Host "$name##$name"
}
exit
## Collector Script ##
$hostname = '##SYSTEM.HOSTNAME##'
$wildvalue = '##WILDVALUE##'
$namespace = "root\cimv2"
$query = "SELECT * FROM Win32_LogicalDisk WHERE NAME='$wildvalue'"
$output = Get-WmiObject -Namespace $namespace -ComputerName $hostname -Query $query
Write-Host "Size=$($output.Size)"
Write-Host "FreeSpace=$($output.FreeSpace)"
exit
Now i remain with few other questions
1. This is WMI so gets me the partition names, how can i get the paths to iterate in Active script
So I manually Added monitored instances under my resource, but didn't work for me.
2. Tried Setting up UNC.PATH, didn't work
I'll spend time trying few things here n there until I hear back from you.
Please advice
Thank you
Ashiwad
OP6 years agoHey Stuart ..... Thanks again for the assistance so far
Considering i am very new to Logicmonitor and Powershell as well, could you please help me with a sample Activ Script for passing multiple paths ?
I couldn't decode much from the support documents.
Questions ; 1. After the activ scripting in DS, do I still need to add instance on my resource?
2. Where do I specify ##WILDVALUES##, in the instances right?..... What if they are multiple values, how does the name convention work for it ?
Also i read it that wildvalues cannot have '\' in it. So how can i specify paths to different folders.
Sorry for those Newbie noob questions
Thank you
Ashiwad
OP6 years agoThanks Stuart for showing interest in helping out
Yes definitely the requirements is of varied data under one datasource.
Can be like :
Server 1 check for Size of folders at a directory
Server 2 check for Oldest file lying in the given folder
Server 3 check for certain no of files greater than certain size
Can this requirement be satisfied by multi instance Datasource?
And if yes then it maintains the raw separately?..... Meaning i cannot see other raw data from this server.
LM User
·6 years agoIf you want different data, you need different datasources.
However, it sounds like you would probably want this all in one datasource. What's your intent? You might consider a multi-instance DS where you have an instance for each folder. Give me more of an idea what you want to accomplish.
Ashiwad
OP6 years agoThank you for your assistance.
But if my logic within would be changing for different servers
For eg:
Invoke command - computername Server1 - scriptblock { Logic to Size of folder = x }
Invoke command - computername Server2 - scriptblock { Logic to Number of empty folder = y }
Invoke command - computername Server3 - scriptblock { Logic to Name of oldest folder = z }
So still do we see a way out of this?
Or then we have to create 2 separate Data sources?
LM User
·6 years agoOk, cool. What you need to do is adjust your script so that it talks to only one server and outputs only one datapoint. Instead of manually specifying server1, server2, and server3 in your script, you would bring the server name in as a variable.
How you do this depends on a few things. Is this a multi-instance datasource? If so, are you in script or batchscript mode?
If it's a single instance datasource, you'll be using script mode, so the collector will run your script once for each server. To get the hostname into a variable in your powershell script like this:
Then your invoke command would only happen once and would look like this:
So, each execution of the script would output metrics for that one server. The number of metrics for one server would be the same number of datapoints defined.
Ashiwad
OP6 years agoMy powershell script in the datasource box is like below
Invoke command - computername Server1 - scriptblock { Logic to Size of folder = x }
Invoke command - computername Server2 - scriptblock { Logic to Size of folder = y }
Invoke command - computername Server3 - scriptblock { Logic to Size of folder = z }
So each script output is like eg: X= 20
Data points collecting key value pairs
Datapoint1 =x..... Datapoint2=y and Datapoint3=z
My Requirement : Server1 should display only Datapoint1 Raw data and not other 2 data.
Anything you could help or point me to?
Thank you
LM User
·6 years agoOk, what are the three datapoints for? The number of datapoints should represent the number of datapoints you'd see on one server. So, if you are collecting CPU %, Memory %, and Swap %, you'd have 9 datapoints (3 servers x 3 datapoints). If you have three datapoints, one for each server, what you really want is one datapoint.
What does the "collector" field look like? Does it say script or batchscript? What does your script output look like?
Ashiwad
OP6 years agoThank you
Yes this a powershell based Datasource.
For example :
My "AppliesTo" picks 3 servers from the pool.
So now this Datasource is common to the three servers.
3 Data points are built into the Datasource.
Problem: While viewing each Server individually from "Resources"..... I can see Raw Data for all three servers.
Question : Can I make this Data point specific. I mean if I navigate to Server1, I should only see Raw Data for Server 1.
Thank you, Please questions if scenario isn't clear.
LM User
·6 years agoCan you post the details of the DataSource you've built? I assume this is still to do with the powershell based datasource?