Using Connection Manager to run a remote script?

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
mrw
Posts: 195
Joined: Mon Oct 08, 2012 6:11 am

Using Connection Manager to run a remote script?

Post by mrw »

Hi,
I´d like to have Hostmon to run a Script test on a remote server, but I need to use different credentials for it to work.
But when I set up a new connection I don´t have the option to use it for scripts. The same connection works for CPU Usage, but not for my scripts.
Is this a bug or due to some other limitation? Or am I just doing it wrong?

//Andreas..
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Well, I don't know host HostMonitor can run script on remote server (unless you are using RMA installed on remote server).
HostMonitor starts scripts on local system only.

If your script using some code to establish connection with remote system, that does not have anything to do with Connection Manager.

Regards
Alex
mrw
Posts: 195
Joined: Mon Oct 08, 2012 6:11 am

Post by mrw »

Not sure I understand what you mean..
This script is a vbscript that uses some WMI. The script itself connects to the server with a supplied ipaddress as a parameter.
I´m using this script on lots of servers, some are using RMA and some are using the Hostmon server directly.

The difference with this server is that it´s not using the same account as the local administrator on the Hostmon server, or the account used by a RMA.

So I need to setup an account for this test somehow. A "Connect As" feature would have been nice when using a script test or some way to specify that this test is using this Connection account..

Is there a way that this can be accomplished?

//Andreas..
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Remote connection credentials should be specified in the script.
I assume you are using moniker string to establish WMI connection with remote system using current user account credentials, like the following:

Code: Select all

Set objWMIService = GetObject("winmgmts:" & _
    "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")
However, if you need to specify different user account credentials, your script should use WbemScripting.SWbemLocator object.
Remote WMI connection should look like the following:

Code: Select all

Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer _
    (strComputer, "root\cimv2", strUser, strPsw)
where strComputer, strUser and strPsw are variables that represent host, username and password for remote connection.
Please check the following MSDN article:
http://msdn.microsoft.com/en-us/library ... p/aa389290
mrw
Posts: 195
Joined: Mon Oct 08, 2012 6:11 am

Post by mrw »

Ok I will try that to see if it´s doable.
Although I would prefer to just tell Hostmon to run this script as a specified user. Like a RunAs cscript shell or similar.

Since I use the same script on lots of other servers I don´t want to modify it if I really don´t have to.

Better yet would ofcourse be so I don´t need the script at all. The script gets disk/memory usage in %. If Hostmon had a simpler builtin test for this using snmp I´d be very happy and I wouldn´t need this script at all.

//Andreas..
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Starting from HostMonitor 9.22, you may use Drive Free Space test to perform remote check for disk usage:
http://www.ks-soft.net/hostmon.eng/news.htm#v922
http://www.ks-soft.net/hostmon.eng/mfra ... #diskspace
Also, next release will include new Memory test that can use WMI or SNMP to check memory usage on Windows and Unix systems.
mrw
Posts: 195
Joined: Mon Oct 08, 2012 6:11 am

Post by mrw »

I can´t use the Drive Free Space test since I need to have the result in %.
I also want the result to be Used Space, not Free. I could probably convert that somehow if I atleast got the result in %.

Sounds great with the new memory test using snmp on Windows!!
Would this test be able to check drive partitions? And will we get the result in %?

//Andreas..
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

I can´t use the Drive Free Space test since I need to have the result in %.
I also want the result to be Used Space, not Free. I could probably convert that somehow if I atleast got the result in %
Just select threshold unit "%" (there are 5 possible threshold units: KB, MB, GB, TB, %)
Would this test be able to check drive partitions? And will we get the result in %?
I don't think we will include drive partitions check in this test.
mrw
Posts: 195
Joined: Mon Oct 08, 2012 6:11 am

Post by mrw »

Nice, I must have missed the percentage option!
But is there a way I can convert the returned value to display Used space in percentage instead of Free?
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Just enable "Tune up Reply value" option and specify the following expression:
[100 - %SuggestedReply_Integer%] %
"Tune up Reply value" option is located on Test properties dialog and can be hidden (if it's hidden - just press [+] above the "Help" button).
mrw
Posts: 195
Joined: Mon Oct 08, 2012 6:11 am

Post by mrw »

Thanks!
This was great!
When you release the version with the builtin memory test I won´t need my scripts anymore!

Thanks again for your excellent support?

BTW, do you have an ETA on when that version will be released?
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Thanks again for your excellent support
You are welcome :)
BTW, do you have an ETA on when that version will be released?
Don't think it will take much time, we are on testing phase now.
mrw
Posts: 195
Joined: Mon Oct 08, 2012 6:11 am

Post by mrw »

Do you have a mailinglist or similar so I can get an email when you release a new version?
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

We do not send e-mail notifications.
HostMonitor may check for Updates automatically.
This option can be enabled or disabled using menu Options->Misc->Update check.
You may also preform manual check using HostMonitor/RCC menu Help -> Update check...
mrw
Posts: 195
Joined: Mon Oct 08, 2012 6:11 am

Post by mrw »

Thank you!
Post Reply