1

I have a request to check for a file modification time if its more that 10 minutes. it should alert in ITRS as well as send a mail. The netprobe is installed on Windows. I have tried to use use Toolkit plugin and placed a powershell script in the samplescript section like "powershell -command path\filename" and in the Advanced section randomly put the filename as "test.txt" and when am trying to sample its showing "script path not found"

 $source="C:\Users\Desktop\manoj.txt"
    $Now=GET-DATE
    $ModTime=(Get-ItemProperty -path $source -Name LastWriteTime).lastwritetime
    "Filename,Sysdate,Last Modified,Time difference
    $source,$now,$ModTime,$TimDiff"|ConvertTo-Csv -NoTypeInformation

Requirements

  1. how to pass powershell command in "samplescript section"
  2. how to get the output of the powerscript to the geneos
  3. codes to send mail from geneos
  4. a sample code showing creating rules for a column

Thanks in advance!!!

Manoj
  • 83
  • 7

2 Answers2

0
  1. Use plugin as FKM to monitor the file. In the advanced section of the sampler, chose to display the file modified time.
  2. Define an 'Action' that sends email
  3. Define a rule on the file modified time and run the action defined in step 2 when the value exceeds 600 seconds.

Sample rule:
If value > 600 then
Severity critical
Run action_name
Else
Severity ok
endif

Irfan N
  • 93
  • 1
  • 1
  • 7
  • Will try and revert back Irfan!. Meanwhile any thought how to add powershell script in geneos – Manoj Apr 13 '16 at 15:23
  • my answer was too lengthy to fit as a comment. see the other answer below. – Irfan N Apr 14 '16 at 09:38
  • Irfan, the first workaround worked really good but if i make the sample interval to 1 sec then will it be a problem. – Manoj Apr 18 '16 at 08:37
  • Also if you could let me know the code for email action item:-) – Manoj Apr 18 '16 at 08:38
  • Define an action and select 'script' under options. You can google for a script that sends email. The script name goes under executable. – Irfan N Apr 22 '16 at 04:23
0

You dont' really need to put anything in the advanced section (you could, but its not mandatory. The objective of the scripts and content field in the advanced tab is different). In the basic tab, simply run the powershell file along with the arguments in the sampler script section.

powershell -ExecutionPolicy ByPass file_name.ps1 "argument1" "argument2"  

output of a program used in toolkit should be in a csv format along with a header. That is how Geneos reads the output.

Irfan N
  • 93
  • 1
  • 1
  • 7