cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 15

APM script variables

Jump to solution

I want to run a script that will show the current replication status of a domain controller.

if you run: "for /f "tokens=12 delims=," %a in ('repadmin /showrepl <CentralHUBServerName> /csv ^| find /i """DC=domain,DC=com""" ^|find /i "${Node.Caption}"') do @echo Statistic: %a & exit %a"

it would work, but only if I could get ${Node.Caption} to resolve, any ideas?

it might go to unknown status instead of down depending on what that field becomes, but that ok.

1 Solution
Level 12

Unfortunately it is not possible to use ${Node.Caption} macro within script body. 

But maybe you could use {IP} macro (please note there is no '$'). It will give you IP address of a node. If this command does not support using IP instead of name, then you could extend the script to do reverse DNS lookup of node name based on node's IP and then use resolved DNS name in this command?

View solution in original post

0 Kudos
13 Replies
Level 13

You can also use the macro ${IP} to get the node's IP address into the script.

0 Kudos
Level 14

@m-milligan,

Sorry to hijack this thread but couldn't find any other way to contact you regarding a question I hve on your post 'Group status bullseye style charts'.

Can you PM me when you a sec so I can ask you a question?

 

sotherls

0 Kudos
Level 12

Unfortunately it is not possible to use ${Node.Caption} macro within script body. 

But maybe you could use {IP} macro (please note there is no '$'). It will give you IP address of a node. If this command does not support using IP instead of name, then you could extend the script to do reverse DNS lookup of node name based on node's IP and then use resolved DNS name in this command?

View solution in original post

0 Kudos
Level 15

Can I ask for this as a feature enhancement?  It would be very nice if we could get data any data out of the database - note.name node.customproperty1

Or you could give us the ability to give monitors custom properties and then we could use them in scripts... or alerts.

0 Kudos
Product Manager
Product Manager

Got it. Tracking internally as FB78184.

0 Kudos

Did anything ever come of the feature request (FB78184)?

0 Kudos
Product Manager
Product Manager

The following additional macros are now available in the SAM 6.0 RC (available now)

  • ${USER}
  • ${PASSWORD}
  • ${PORT}
  • ${Node.SysName}
  • ${Node.Caption}
  • ${Node.DNS}
  • ${Node.ID}
  • ${Component.ID}
  • ${Component.Name}
  • ${Application.Id}
  • ${Application.Name}
  • ${Application.TemplateId
  • ${Threshold.Warning}
  • ${Threshold.Critical}
  • Node Custom Property Macros ${Node.CustomPropertyName}
  • Application Custom Property Macros ${Application.CustomPropertyName}
Level 10

aLTeReGo,  I am having difficulty calling our Node Custom Properties.  We have SAM 6.0.0 installed, is there something else I need to do in order to call the variables?

Thanks in advance...

CustomPropertyUpload.PNG

0 Kudos
Product Manager
Product Manager

Those macros are available only within the script body. Not within the Script Arguments field.

0 Kudos
Level 10

Thanks for the quick reply, here is the results of moving the variables to the script body.  FYI, this is a PowerShell monitor.

CustomPropertyUpload2.PNG

Product Manager
Product Manager

Sorry for the confusion. The issue is that the node custom property macro is ${Node.Custom.XXX}, not ${Node.CustomPropertyName} as referenced above. For example, if you have a node Custom Property named "City", the macro you would use in the script monitor is ${Node.Custom.City}.

Level 10

Thanks aLTeReGo, that did the Trick!

0 Kudos
Product Manager
Product Manager

There's actually quite a bit of information on the use of SAM macros in script available in the thread below.

0 Kudos