Ad Widget

Collapse

MailCleaner Template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • doughall
    Junior Member
    • Feb 2010
    • 5

    #1

    MailCleaner Template

    HI.
    I'm in the process of creating a MailCleaner Template.

    I have a small list of MIBS, Messages, Bytes, Spam, and Virus's//
    There is a MIB for Spool status. There are 3 spools, Incoming, Filtering, and Outgoing.
    When I SNMPWALK the mib
    Code:
    /usr/bin/snmpwalk -v2c -c STRING  SERVERNAME 1.3.6.1.4.1.2021.8.1.101.6
    I get the following
    Code:
    1.3.6.1.4.1.2021.8.1.101.6 = STRING: "|4|0|0"
    How can I translate the result, into 3 seperate Items, one for each spool, and put that into the template??
    Many thanks in advance.
    Doug - UK


    Template so far if anyone is interested.

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <zabbix_export>
        <version>3.0</version>
        <date>2016-06-24T23:33:20Z</date>
        <groups>
            <group>
                <name>Templates</name>
            </group>
        </groups>
        <templates>
            <template>
                <template>Template SNMP MailCleaner</template>
                <name>Template SNMP MailCleaner</name>
                <description/>
                <groups>
                    <group>
                        <name>Templates</name>
                    </group>
                </groups>
                <applications>
                    <application>
                        <name>Status</name>
                    </application>
                </applications>
                <items>
                    <item>
                        <name>Total Messages Today</name>
                        <type>4</type>
                        <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                        <multiplier>0</multiplier>
                        <snmp_oid>1.3.6.1.4.1.2021.8.1.101.1</snmp_oid>
                        <key>1.3.6.1.4.1.2021.8.1.101.1</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts/>
                        <units/>
                        <delta>0</delta>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <formula>1</formula>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <description/>
                        <inventory_link>0</inventory_link>
                        <applications>
                            <application>
                                <name>Status</name>
                            </application>
                        </applications>
                        <valuemap/>
                        <logtimefmt/>
                    </item>
                    <item>
                        <name>Total SPAM Today</name>
                        <type>4</type>
                        <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                        <multiplier>0</multiplier>
                        <snmp_oid>1.3.6.1.4.1.2021.8.1.101.2</snmp_oid>
                        <key>1.3.6.1.4.1.2021.8.1.101.2</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts/>
                        <units/>
                        <delta>0</delta>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <formula>1</formula>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <description/>
                        <inventory_link>0</inventory_link>
                        <applications>
                            <application>
                                <name>Status</name>
                            </application>
                        </applications>
                        <valuemap/>
                        <logtimefmt/>
                    </item>
                    <item>
                        <name>Total BYTES Today</name>
                        <type>4</type>
                        <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                        <multiplier>0</multiplier>
                        <snmp_oid>1.3.6.1.4.1.2021.8.1.101.3</snmp_oid>
                        <key>1.3.6.1.4.1.2021.8.1.101.3</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts/>
                        <units/>
                        <delta>0</delta>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <formula>1</formula>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <description/>
                        <inventory_link>0</inventory_link>
                        <applications>
                            <application>
                                <name>Status</name>
                            </application>
                        </applications>
                        <valuemap/>
                        <logtimefmt/>
                    </item>
                    <item>
                        <name>Total VIRUS Today</name>
                        <type>4</type>
                        <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                        <multiplier>0</multiplier>
                        <snmp_oid>1.3.6.1.4.1.2021.8.1.101.4</snmp_oid>
                        <key>1.3.6.1.4.1.2021.8.1.101.4</key>
                        <delay>30</delay>
                        <history>90</history>
                        <trends>365</trends>
                        <status>0</status>
                        <value_type>3</value_type>
                        <allowed_hosts/>
                        <units/>
                        <delta>0</delta>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <formula>1</formula>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <data_type>0</data_type>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <description/>
                        <inventory_link>0</inventory_link>
                        <applications>
                            <application>
                                <name>Status</name>
                            </application>
                        </applications>
                        <valuemap/>
                        <logtimefmt/>
                    </item>
                </items>
                <discovery_rules>
                    <discovery_rule>
                        <name>Spools</name>
                        <type>4</type>
                        <snmp_community>{$SNMP_COMMUNITY}</snmp_community>
                        <snmp_oid>1.3.6.1.4.1.2021.8.1.101.6</snmp_oid>
                        <key>1.3.6.1.4.1.2021.8.1.101.6</key>
                        <delay>30</delay>
                        <status>0</status>
                        <allowed_hosts/>
                        <snmpv3_contextname/>
                        <snmpv3_securityname/>
                        <snmpv3_securitylevel>0</snmpv3_securitylevel>
                        <snmpv3_authprotocol>0</snmpv3_authprotocol>
                        <snmpv3_authpassphrase/>
                        <snmpv3_privprotocol>0</snmpv3_privprotocol>
                        <snmpv3_privpassphrase/>
                        <delay_flex/>
                        <params/>
                        <ipmi_sensor/>
                        <authtype>0</authtype>
                        <username/>
                        <password/>
                        <publickey/>
                        <privatekey/>
                        <port/>
                        <filter>
                            <evaltype>0</evaltype>
                            <formula/>
                            <conditions/>
                        </filter>
                        <lifetime>30</lifetime>
                        <description/>
                        <item_prototypes/>
                        <trigger_prototypes/>
                        <graph_prototypes/>
                        <host_prototypes/>
                    </discovery_rule>
                </discovery_rules>
                <macros/>
                <templates/>
                <screens/>
            </template>
        </templates>
    </zabbix_export>
    Last edited by doughall; 25-06-2016, 01:37. Reason: typo
  • JackoAC
    Member
    • May 2023
    • 35

    #2
    Hello, from 2023 .

    Did you get any solution regarding this ?
    I'm facing the same issue.

    Kind regard,

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4806

      #3
      Looks like simple case of splitting received value to 3 dependent items...

      Comment


      • JackoAC
        JackoAC commented
        Editing a comment
        Thank for you fast answer i'll check on internet and in the manual.
        I'll come back here if i dont find
        Thank
    • JackoAC
      Member
      • May 2023
      • 35

      #4
      Hello,

      i did some research in the documentation.
      But i have some questions.

      I created a new item with the discovery rule of the template from above.
      I do get the information like this "1|0|0"

      But i dont understand how to create my dependant item and to get only the "1" and "0" and "0".
      Could you help me ?
      I apologize if my questions seem silly, i'm new on Zabbix and i try more than i understand .

      Thanks in advance,
      Kind regard
      Last edited by JackoAC; 01-06-2023, 11:09.

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4806

        #5
        You need to create 3 dependent items, with a little bit regex preprocessing. For each you should take out required field from original data.. for example you can add regex like "(\d)|(\d)|(\d)" in all of them and for return value you set \1 for first, \2 for second and \3 for third item...

        Each time you pull a value to your master item, it will be spread out to dependent items also.


        Comment


        • JackoAC
          JackoAC commented
          Editing a comment
          Thanks for your answer !
          to be honest i was kind of afraid of doing regex but guess i have no choice now.
          Thank i'll try to do something with the doc you just send and with the information you gave me.
      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4806

        #6
        Zabbix docs should be first thing to look into...

        Comment


        • JackoAC
          JackoAC commented
          Editing a comment
          I agree, but I didn't understand the examples used in the documentation.
      • JackoAC
        Member
        • May 2023
        • 35

        #7
        It work for the first one but when i try to do the same for the second items it doesn't get the "3" from the master in the latest data.

        Here is the configuration for the second item.

        Click image for larger version

Name:	image.png
Views:	261
Size:	13.9 KB
ID:	465274
        And when i test it
        Click image for larger version

Name:	image.png
Views:	255
Size:	14.4 KB
ID:	465275

        He is supposed to give me to "2", what does "chaine vide" mean ?


        My configuration for the first dependent item work fine as we can see on latest data.
        Click image for larger version

Name:	image.png
Views:	263
Size:	6.7 KB
ID:	465276

        I'm probably doing something wrong. but i dont have any error :/

        Comment

        • cyber
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • Dec 2006
          • 4806

          #8
          chaine vide - google translaet says "empty string"..

          But as your data is "|1|3|0" not "1|3|0" (as of pic nr 2), then regex does not match .. I guess my example was also a bit rushed... try with "\|(\d)\|(\d)\|(\d)" as regex and then output \1 or \2 or \3...
          Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust.

          regex101 is a good place to test such things.

          Comment


          • JackoAC
            JackoAC commented
            Editing a comment
            Yeah i tried on the regex on this site and it worked fine, thats why i didn't understand,it was this simple, guess i was doing that for a while and my brain was like "nah i'm done".
            Thank for you help it work now.
            Have a nice day
            Last edited by JackoAC; 02-06-2023, 09:12.
        Working...