mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Added sample setting of 'agent_name_cmd' and sample external command.
(cherry picked from commit d6f33811aa59a3895115d531bcafb29498bd1cc6)
This commit is contained in:
parent
d7ab377d29
commit
722cbcd679
@ -30,6 +30,11 @@ temporal "$AgentTemp$"
|
|||||||
|
|
||||||
# agent_name My_Custom_Agent_name
|
# agent_name My_Custom_Agent_name
|
||||||
|
|
||||||
|
# To define agent name by specific command, define 'agent_name_cmd'.
|
||||||
|
# If agent_name_cmd is defined, agent_name is ignored.
|
||||||
|
# (In the following example, agent name is 'hostname_IP')
|
||||||
|
#agent_name_cmd cscript.exe //B "%ProgramFiles%\Pandora_Agent\util\agentname.vbs"
|
||||||
|
|
||||||
#Parent agent_name
|
#Parent agent_name
|
||||||
#parent_agent_name caprica
|
#parent_agent_name caprica
|
||||||
|
|
||||||
|
31
pandora_agents/win32/bin/util/agentname.vbs
Normal file
31
pandora_agents/win32/bin/util/agentname.vbs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
' agentname.vbs
|
||||||
|
'
|
||||||
|
' Pandora FMS external command sample for 'agent_name_cmd' token.
|
||||||
|
' This script returns agent name like 'hostname_IPaddress'.
|
||||||
|
' (c) 2014 Junichi Satoh <junichi@rworks.jp>
|
||||||
|
' ------------------------------------------
|
||||||
|
|
||||||
|
Option Explicit
|
||||||
|
|
||||||
|
Dim objNetWork
|
||||||
|
Dim oClassSet
|
||||||
|
Dim oClass
|
||||||
|
Dim oLocator
|
||||||
|
Dim oService
|
||||||
|
|
||||||
|
Set objNetWork = WScript.CreateObject("WScript.Network")
|
||||||
|
|
||||||
|
Set oLocator = WScript.CreateObject("WbemScripting.SWbemLocator")
|
||||||
|
Set oService = oLocator.ConnectServer
|
||||||
|
Set oClassSet = oService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration")
|
||||||
|
|
||||||
|
For Each oClass In oClassSet
|
||||||
|
|
||||||
|
If oClass.IPEnabled = True Then
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine objNetWork.ComputerName & "_" & oClass.IPAddress(0)
|
||||||
|
Exit For
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
Loading…
x
Reference in New Issue
Block a user