Ad Widget

Collapse

SSH running on a different port

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Florius
    Junior Member
    • Jan 2017
    • 15

    #1

    SSH running on a different port

    Hi.

    Is someone able to help me out? I'm running SSH on a different port, sao I have a second item, of which the key is "net.tcp.service[ssh,,1341]".
    My trigger is "{Template App SSH Service:net.tcp.service[ssh].max(#3)}=0 or {Template App SSH Service:net.tcp.service[ssh,,1341].max(#3)}=0" but still Zabbix says that SSH is down?

    Does anyone see something wrong with this? Thank you!
  • dimir
    Zabbix developer
    • Apr 2011
    • 1080

    #2
    What does "Monitoring -> Latest data" show about the latest values of those items?

    Comment

    • Florius
      Junior Member
      • Jan 2017
      • 15

      #3
      Hi Dimir. Thanks for taking the time to reply. It seems that 'that' is correct: https://ibb.co/d9oYWy

      Comment

      • dimir
        Zabbix developer
        • Apr 2011
        • 1080

        #4
        So the 22 port check is failing correctly or it is running but agent says it's not?

        Comment

        • Florius
          Junior Member
          • Jan 2017
          • 15

          #5
          No Zabbix is running on port 1341. So it correctly says that SSH on port 1341 is up.
          But still it triggers stating it fails with the OR...

          Comment

          • dimir
            Zabbix developer
            • Apr 2011
            • 1080

            #6
            Your trigger expression says: alert if 3 subsequent FAILs on port 22 OR 3 subsequent FAILs on port 1341. To me it works correctly, since first part of the expression is true.

            Comment

            • Florius
              Junior Member
              • Jan 2017
              • 15

              #7
              Ah okay. I think I get it... How would I make sure it triggers on either one of the 2?

              I have several hundreds of hosts with different SSH ports, so a specific trigger per host would be impossible...

              Comment

              • dimir
                Zabbix developer
                • Apr 2011
                • 1080

                #8
                1. Currently it already triggers on failure of any of the 2.
                2. Have a host/template macro where you define the port, e. g.:
                  • "Template App SSH Service" has:
                    • 2 items:
                      • net.tcp.service[ssh,,{$SSH_PORT1}]
                      • net.tcp.service[ssh,,{$SSH_PORT2}]
                    • a trigger with expression:
                      • {Template App SSH Service:net.tcp.service[ssh,,{$SSH_PORT1}].max(#3)}=0 or {Template App SSH Service:net.tcp.service[ssh,,{$SSH_PORT2}].max(#3)}=0
                  • When you link "Template App SSH Service" to a host add 2 host macros:
                    • {$SSH_PORT1}=22
                    • {$SSH_PORT2}=1341

                Comment

                • Florius
                  Junior Member
                  • Jan 2017
                  • 15

                  #9
                  Well that works just fine. Now I don't get why mine doesn't work, as it is the same?
                  Except you have variables defined for the SSH ports?

                  EDIT: Well the alert works, as I just stopped SSH daemon, but now it won't recover?
                  Last edited by Florius; 19-07-2018, 09:38.

                  Comment

                  • dimir
                    Zabbix developer
                    • Apr 2011
                    • 1080

                    #10
                    How often is the check made? Check latest data to see if the items get correct values.

                    Comment

                    • Florius
                      Junior Member
                      • Jan 2017
                      • 15

                      #11
                      Latest data is correct, about every 5 minutes... https://ibb.co/nvZKjJ See attached screenshot.
                      '0' is the check on port 22. '1' is on port 1341.

                      Comment

                      • dimir
                        Zabbix developer
                        • Apr 2011
                        • 1080

                        #12
                        The alert will recover when it will be '1' on port 22.

                        Comment

                        Working...