Ad Widget

Collapse

how to monitor Server A ping to Server B

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • exfish
    Junior Member
    • Jun 2009
    • 18

    #1

    how to monitor Server A ping to Server B

    Sometimes, I need monitor if server A can ping to server B, or check the server B tcp port status from server A.

    Does anyone have a well method?
  • jerrylenk
    Member
    Zabbix Certified Specialist
    • May 2010
    • 62

    #2
    Code:
    ping -q -c1 host.example.com >/dev/null && echo 1 || echo 0
    This will output "1" if the ping succeeds, "0" otherwise.

    However, it relies on one single ICMP echo request.
    You could put it into a UserParameter on Server A:

    Code:
    UserParameter=user.pingto[*],ping -q -c1 $1 >/dev/null && echo 1 || echo 0
    and create an Item with key: user.pingto[<IP.Addr.of ServerB>]
    that will return service state Up(1) or Down(0)

    Jerry

    Comment

    • exfish
      Junior Member
      • Jun 2009
      • 18

      #3
      Thank you so much, it's a good way.
      Last edited by exfish; 14-07-2010, 11:30.

      Comment

      • jroberson
        Senior Member
        • May 2008
        • 124

        #4
        For windows ...

        I stumbled onto this thread because I wanted to do the same thing for Windows, BUT of course, it's a bit different.

        For anyone else that needs it, here is how I did it for Windows hosts:

        Code:
        UserParameter=pingto[*],ping -n 1 $1 > NUL && echo 1 || echo 0

        Comment

        Working...