Ad Widget

Collapse

Trigger on Regex value returned

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ahahum
    Member
    • Jan 2009
    • 79

    #1

    Trigger on Regex value returned

    I have an item that returns values like this:
    5 Sec (6.19%), 1 Min (5.97%), 5 Min (6.70%)

    I'm looking for a way to alert based on 1 or any of these values being greater than X.

    Is that possible with a Regex? If not, how can I do that?
  • aib
    Senior Member
    • Jan 2014
    • 1615

    #2
    Originally posted by ahahum
    I have an item that returns values like this:
    5 Sec (6.19%), 1 Min (5.97%), 5 Min (6.70%)

    I'm looking for a way to alert based on 1 or any of these values being greater than X.

    Is that possible with a Regex? If not, how can I do that?
    How you store that data in DB? As TEXT / Character?
    In that case you cannot do any mathematical calculation, you can only use text function to compare string with sub-string or find sub-string in string.

    You can modify your collecting script to convert data to numeric value before storing to DataBase, and then you can have the full power of mathematical functions.
    Sincerely yours,
    Aleksey

    Comment

    • ahahum
      Member
      • Jan 2009
      • 79

      #3
      Originally posted by aib
      How you store that data in DB? As TEXT / Character?
      In that case you cannot do any mathematical calculation, you can only use text function to compare string with sub-string or find sub-string in string.

      You can modify your collecting script to convert data to numeric value before storing to DataBase, and then you can have the full power of mathematical functions.
      Thanks for the quick reply sir. I am storing it as text so I guess I'll have to adjust my item to get the data into the DB in numerical form.

      Comment

      • aib
        Senior Member
        • Jan 2014
        • 1615

        #4
        Originally posted by ahahum
        Thanks for the quick reply sir. I am storing it as text so I guess I'll have to adjust my item to get the data into the DB in numerical form.
        Yes, and sorry about that.
        It sometimes painful when the manufacturer decide to send data as text (37 F) instead of just number (37).
        And you have to create additional scripts just to remove extra numbers and spaces.

        Sorry again.
        Sincerely yours,
        Aleksey

        Comment

        • ahahum
          Member
          • Jan 2009
          • 79

          #5
          Originally posted by aib
          Yes, and sorry about that.
          It sometimes painful when the manufacturer decide to send data as text (37 F) instead of just number (37).
          And you have to create additional scripts just to remove extra numbers and spaces.

          Sorry again.
          No doubt, this is a dell switch and this is the only way I can find to poll the CPU usage...

          Comment

          • aib
            Senior Member
            • Jan 2014
            • 1615

            #6
            Originally posted by ahahum
            No doubt, this is a dell switch and this is the only way I can find to poll the CPU usage...
            I think it all depend on switch model.
            After short browsing I found topic from DELL with some nice examples
            http://www.force10networks.com/CSPor...lwithSNMP.aspx
            And in that examples snmpwalk give only numbers, not text strings.

            Check your switch. May be you had use wrong OID.
            Sincerely yours,
            Aleksey

            Comment

            • ahahum
              Member
              • Jan 2009
              • 79

              #7
              Originally posted by aib
              I think it all depend on switch model.
              After short browsing I found topic from DELL with some nice examples
              http://www.force10networks.com/CSPor...lwithSNMP.aspx
              And in that examples snmpwalk give only numbers, not text strings.

              Check your switch. May be you had use wrong OID.
              Yeah, that's what I'd hoped, but I've not had any luck. I've walked the device and can't find any hits on those OIDs in the link you provided. I've also grep'd for CPU and only get 2 (useless) hits.

              iso.3.6.1.2.1.2.2.1.2.625 = STRING: " CPU Interface for Unit: 0 Slot: 5 Port: 1"
              iso.3.6.1.2.1.31.1.1.1.1.625 = STRING: "CPU Interface: 0/5/1"

              Comment

              • aib
                Senior Member
                • Jan 2014
                • 1615

                #8
                Do you mind to tell me the exact model of your switch and Firmware?
                May be I'll be more lucky to find any information about MIB / OID's / etc. in different segments of Internet (russian, for example)
                Sincerely yours,
                Aleksey

                Comment

                • ahahum
                  Member
                  • Jan 2009
                  • 79

                  #9
                  Dell 6248 (2 of them stacked)
                  FW: 3.3.3.3
                  Thanks a lot for your assistance, Aleksey!
                  Last edited by ahahum; 11-03-2015, 17:59. Reason: Firmware

                  Comment

                  • aib
                    Senior Member
                    • Jan 2014
                    • 1615

                    #10
                    In topic
                    http://en.community.dell.com/support...866/t/19513154
                    I found this command line
                    Code:
                    snmpwalk -v 2c 10.11.12.13 1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8
                    Do you mind to show the result of SNMPWALK and "show system" from CLI ?
                    Sincerely yours,
                    Aleksey

                    Comment

                    • ahahum
                      Member
                      • Jan 2009
                      • 79

                      #11
                      Originally posted by aib
                      In topic
                      http://en.community.dell.com/support...866/t/19513154
                      I found this command line
                      Code:
                      snmpwalk -v 2c 10.11.12.13 1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8
                      Do you mind to show the result of SNMPWALK and "show system" from CLI ?
                      This seems to be the Temperature of the CPU.

                      Output:
                      snmpwalk -v 2c -c community x.x.x.x 1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8
                      iso.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.1 .0 = INTEGER: 0
                      iso.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.2 .0 = INTEGER: 1
                      iso.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.3 .0 = INTEGER: 1
                      iso.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.4 .0 = INTEGER: 29

                      HOSTNAME#show system
                      System Description: Dell Ethernet Switch
                      System Up Time: 922 days, 12h:45m:31s
                      System Contact:
                      System Name: HOSTNAME
                      System Location:
                      Burned In MAC Address: 0023.AEC3.84BD
                      System Object ID: 1.3.6.1.4.1.674.10895.3011
                      System Model ID: PCT6248
                      Machine Type: PowerConnect 6248
                      Temperature Sensors:

                      Unit Temperature (Celsius) Status
                      ---- --------------------- ------
                      1 30 OK
                      2 28 OK

                      Fans:

                      Unit Description Status
                      ---- ----------- ------
                      1 Fan 1 OK
                      1 Fan 2 OK


                      1 Fan 3 OK
                      1 Fan 4 OK
                      2 Fan 1 OK
                      2 Fan 2 OK
                      2 Fan 3 OK
                      2 Fan 4 OK

                      Power Supplies:

                      Unit Description Status Source
                      ---- ----------- ----------- ------
                      1 Main OK AC
                      1 Secondary Not present DC
                      2 Main OK AC
                      2 Secondary Not present DC

                      Comment

                      • aib
                        Senior Member
                        • Jan 2014
                        • 1615

                        #12
                        Originally posted by ahahum
                        This seems to be the Temperature of the CPU.

                        Output:
                        snmpwalk -v 2c -c community x.x.x.x 1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8
                        ................
                        iso.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.4 .0 = INTEGER: 29

                        HOSTNAME#show system
                        Unit Temperature (Celsius) Status
                        ---- --------------------- ------
                        1 30 OK
                        It looks like you can use that OID to collect Integer value of temperatures, without messing up with some conversion.
                        Code:
                        1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.4.0
                        Try to do the same snmpwalk for second device, if it has an IP-address.
                        Sincerely yours,
                        Aleksey

                        Comment

                        • ahahum
                          Member
                          • Jan 2009
                          • 79

                          #13
                          I'm trying to poll the CPU utilization, not the temperature.

                          There is not IP for the 2nd member, just an IP for each of the VLANs I have on it.

                          Thanks again for your help, I feel like you've hit the same roadblock that I did initially so that at least validates my efforts!!

                          Comment

                          • aib
                            Senior Member
                            • Jan 2014
                            • 1615

                            #14
                            sorry for misunderstanding
                            I forgot your initial question

                            So, back to script: create something on any language which you like (request SNMP OID from device, select 3 numbers from answer {5_sec_load, 1_min_load, 5_min_load} and send it back to server, using zabbix_sender.

                            Then use cron to start script regularly.

                            And have fun!
                            Sincerely yours,
                            Aleksey

                            Comment

                            • ahahum
                              Member
                              • Jan 2009
                              • 79

                              #15
                              The string I get back is:
                              Code:
                              iso.3.6.1.4.1.674.10895.5000.2.6132.1.1.1.1.4.4.0 = STRING: "5 Sec (6.51%), 1 Min (6.76%), 5 Min (6.49%)"
                              I just want to extract the middle value (1 Min) then I'll populate that into the database.

                              Any ideas on that?

                              Comment

                              Working...