Python 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).
Post Reply
Stefan
Posts: 22
Joined: Fri Feb 11, 2011 3:01 am

Python script

Post by Stefan »

Hello support-team,

I want to create a test which runs a python script.
I installed newest python 3.12.4 (32bit) for windows on my hostmonitor-machine. (Hostmon-service also runs as 32bit instance, too! | Version 14.04)

Unfortunately, I can not select "Python" into language field of "Active script" test properties. Hostmon does not recognize the python interpreter.
Is there anywhere a config whichs shows hostmon the location of phyton interpreter?

Second question:
Does you have a example of phyton script? (similar as "hello world")?
I found nothing into forum.

Regards,
Stefan
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Re: Python script

Post by KS-Soft »

Active Script test method kept for compatibility, it can work only in 32bit mode and not supported by HostMonitor x64.
We recommend to use Shell Script test method
https://www.ks-soft.net/hostmon.eng/mfr ... m#chkShell
Does you have a example of phyton script? (similar as "hello world")?
Never used Phyton but I will check...

Regards
Alex
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Re: Python script

Post by KS-Soft »

Sample for Shell Script test method

Code: Select all

statusAlive       = "scriptRes:Host is alive:"
statusDead        = "scriptRes:No answer:"
statusUnknown     = "scriptRes:Unknown:"
statusNotResolved = "scriptRes:Unknown host:"
statusOk          = "scriptRes:Ok:"
statusBad         = "scriptRes:Bad:"
statusBadContents = "scriptRes:Bad contents:"

if 5<10:
 print(statusOk+'5 ms')
else:
 print(statusDead)
Example how to check if file/folder exists

Code: Select all

import os
PATH = 'c:\\path\\file'
if os.path.isfile(PATH):
    print("scriptRes:Ok:")
else:
    print("scriptRes:Bad:")
Regards
Alex
Post Reply