Hi, We are running a Zabbix server (1.6.5) monitoring, amongst many, a Linux server (with the Zabbix agent installed). We have established a VPN-tunnel between an external IP-address (172.20.184.240) to the Linux agent server ONLY (for security reasons). We would like to monitor the VPN-tunnel. The Zabbix server can not ping the external address so we would like the agent server to ping it and report it back to the Zabbix server. Does anyone have an idea how to create an item and trigger to do this for that host ??
Ad Widget
Collapse
Ping an external IP-address from a Zabbix agent.
Collapse
X
-
Add to zabbix_agentd.conf on linux serverHi, We are running a Zabbix server (1.6.5) monitoring, amongst many, a Linux server (with the Zabbix agent installed). We have established a VPN-tunnel between an external IP-address (172.20.184.240) to the Linux agent server ONLY (for security reasons). We would like to monitor the VPN-tunnel. The Zabbix server can not ping the external address so we would like the agent server to ping it and report it back to the Zabbix server. Does anyone have an idea how to create an item and trigger to do this for that host ??
UserParameter=CheckVPN,fping x.x.x.x | grep alive | wc -l
where x.x.x.x internal IP address of second end of VPN-tunnel
Create item with type zabbix agent(active), key CheckVPN, value type integer. Create trigger, if value = 0 - vpn down -
Another alternative:
UserParameter=CheckIP[],fping $1 | grep -c aliveComment
-
i have a solution for Windows agents
create a pingcheck.vbs script (i found this on internet):
add a UserParameter in zabbix_agentd.conf like this:Code:'Use a remote computer to ping another remote computer Option Explicit 'Change the SourceServer and RemoteServer Strings below to servernames or IP addresses for you. 'wscript.Echo RemotePing("SourceComputer", "DestinationComputer") wscript.Echo RemotePing(".", WScript.Arguments(0)) Function RemotePing( SourceComputer, DestinationComputer) Dim strComputer1, strComputer2 Dim objWMIService, colItems, objItem strComputer1 = SourceComputer strComputer2 = DestinationComputer On Error Resume Next ' error control block Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}//" & strComputer1 & "\root\cimv2") Set colItems = objWMIService.ExecQuery ("Select * from Win32_PingStatus " & "Where Address = '" & strComputer2 & "'") For Each objItem in colItems If objItem.StatusCode = 0 Then RemotePing = 1 Else RemotePing = 0 End If Next On Error GoTo 0 End function
restart the windows agent.Code:UserParameter=PingCheck[*],cscript.exe c:\scripts\pingcheck.vbs $1 //NoLogo
create a new item for the host from where you want to ping from in zabbix:
type: zabbix agent
key: PingCheck[10.0.0.1]
type of information: Numeric (unsigned)
data type: decimal
remember to change the pingcheck ip-address to your needs!Comment
-
Watch out for the catcha here. If the agent is behind a VPN and that VPN goes down, it won't be able to report a ping value other than the last value reported.
You'll need to add something like {vpn.ping}.nodata(300)=1 to trigger an alert if it doesn't receive data for 5 minutes.Comment
-
Sorry... it's working, stupid me :\
Hi,
i've got similar problem - i need to monitor vpn connections and where is possible i use:
UserParameter=VPN_check[*],/usr/local/sbin/fping $1 | grep alive | wc -l
but, sometimes other side doesn't allow ICMP, so the only way to monitor is to do telnet to "their" server to some port.
But don't how to do such thing, does anybody has some glue for this?
ps. i can't do net.tcp.service from zabbix server (it's in different part of network and NAT is not possible), it must be done from AS (application server).
Regards,Last edited by arucard; 01-08-2012, 14:18.Comment
-
you can simply use the net.tcp.service as an agent item on your AS. that way the AS will check the port for you from the agent.
yay!
GhozComment
-
I've mananged to hobble a vbs script together that will return the response times for a remote host from a windows agent.
Couple with a few posts from above, this can return TTL, RESPONSE rather than just if a host is alive.
1. Call the file whatever you want but in this example pingcheck.vbs and place in C:\scripts\pingcheck.vbsCode:Function Ping(strHost) Dim oPing, oRetStatus, bReturn Set oPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address='" & strHost & "'") For Each oRetStatus In oPing If IsNull(oRetStatus.StatusCode) Or oRetStatus.StatusCode <> 0 Then bReturn = False WScript.Echo "Status code is " & oRetStatus.StatusCode Else bReturn = True ' UNCOMMENT BELOW WHAT RESPONSE YOU WANT RETURNED eg oRetStatus.ResponseTime 'Wscript.Echo oRetStatus.BufferSize Wscript.Echo oRetStatus.ResponseTime 'Wscript.Echo oRetStatus.ResponseTimeToLive End If Set oRetStatus = Nothing Next Set oPing = Nothing Ping = bReturn End Function
And then exactly like ATRAN (thank you) posted above:
2. add a UserParameter in zabbix_agentd.conf like this:
3. restart the windows agent.Code:UserParameter=[B]PingCheck[*][/B],cscript.exe c:\scripts\pingcheck.vbs $1 //NoLogo
4. create a new item for the host from where you want to ping from in zabbix:
type: zabbix agent
key: PingCheck[10.0.0.1] <<< this must match the UserParameter in zabbix_agentd.conf
type of information: Numeric (unsigned)
data type: decimal
NB: remember to change the PingCheck[<ip-address>] above to your needs!
5. wait for the results to roll in!Last edited by louis-m; 13-05-2014, 14:40.Comment
-
In my case fping does not work on Windows. in Debug logging writes that values, received drom agent cannot be accepted, or something like that.
Thus i have a questons about.
1. Can you, please, give us exact example how can i write UserParameter in .conf file.
For example
UserParameter=ping_ReoteServer,icmpping[10.20.30.40]
UserParameter=fping_RemoteServer,fping 10.20.30.40 | grep alive | wc -l
2. Do i need add something after icmppin[10.20.30.40]? like echo something...?
ThanxComment
-
I am aware that this is an old post, but I am trying to ping from host to another host by using this script posted here earlier. Both machines are running on windows environment and there are configured agents up and running
Function Ping(strHost)
Dim oPing, oRetStatus, bReturn
Set oPing = GetObject("winmgmts:{impersonationLevel=impersonat e}").ExecQuery("select * from Win32_PingStatus where address='" & strHost & "'")
For Each oRetStatus In oPing
If IsNull(oRetStatus.StatusCode) Or oRetStatus.StatusCode <> 0 Then
bReturn = False
WScript.Echo "Status code is " & oRetStatus.StatusCode
Else
bReturn = True
' UNCOMMENT BELOW WHAT RESPONSE YOU WANT RETURNED eg oRetStatus.ResponseTime
'Wscript.Echo oRetStatus.BufferSize
Wscript.Echo oRetStatus.ResponseTime
'Wscript.Echo oRetStatus.ResponseTimeToLive
End If
Set oRetStatus = Nothing
Next
Set oPing = Nothing
Ping = bReturn
End Function
I have followed the instructions louis-m told, but I get no results from this. In latest data it shows empty values when I choose the type of information as "text", otherwise I get error telling me that numeric values are not supported
My knowledge about this topic is relatively low.
If anybody could help me out on this and tell me is there any steps I need to do before using this or am I just shooting blanks here?Last edited by Zabbixtrainee; 29-04-2016, 13:27.Comment
Comment