Ad Widget

Collapse

Mysql Template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cbtshare
    Junior Member
    • Aug 2016
    • 13

    #1

    Mysql Template

    I have a mysql template , but not sure where to enter the mysql username and password
    mysql -sNu{$MYSQL_USER} -p{$MYSQL_PASSWORD} -h{$MYSQL_HOST}

    Code:
     <version>2.0</version>
        <date>2015-03-24T16:05:26Z</date>
        <groups>
            <group>
                <name>Templates</name>
            </group>
        </groups>
        <templates>
            <template>
                <template>Service MySQL</template>
                <name>Service MySQL</name>
                <groups>
                    <group>
                        <name>Templates</name>
                    </group>
                </groups>
                <applications>
                    <application>
                        <name>Service::MySQL</name>
                    </application>
                    <application>
                        <name>Service::MySQL::check</name>
                    </application>
                    <application>
                        <name>SYS::processes</name>
                    </application>
                </applications>
                <items>
                    <item>
                        <name>Bytes_received</name>
                        <type>7</type>
                        <snmp_community/>
                        <multiplier>0</multiplier>
                        <snmp_oid/>
                        <key>system.run[/usr/bin/mysql -sNu{$MYSQL_USER} -p{$MYSQL_PASSWORD} -h{$MYSQL_HOST} -e &quot;select VARIABLE_VALUE from information_schema.GLOBAL_STATUS where VARIABLE_NAME='Bytes_received';&quot;,]</key>
                        <delay>60</delay>
                        <history>15</history>
                        <trends>365</trends>
  • cbtshare
    Junior Member
    • Aug 2016
    • 13

    #2
    Can anyone assist?, where do I declare the variables?

    Comment

    • kloczek
      Senior Member
      • Jun 2006
      • 1771

      #3
      Originally posted by cbtshare
      Can anyone assist?, where do I declare the variables?
      You have tree possibilities. You can define {$MYSQL_USER}, {$MYSQL_PASSWORD} macros in monitored host macros. You should be using this way only if you have only one MySQL engine to monitor or each of your engines have unique dedicated user and pwd used to monitor engine.
      If you have multiple engines but all of them are using the same user used to obtain monitoring data you can add these macros in global macros (Administration -> General -> Macros)
      Seems you are using my template If it is true you don't need to change {$MYSQL_HOST} because this macro definition is present in template and has "localhost" as value
      http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
      https://kloczek.wordpress.com/
      zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
      My zabbix templates https://github.com/kloczek/zabbix-templates

      Comment

      • cbtshare
        Junior Member
        • Aug 2016
        • 13

        #4
        Originally posted by kloczek
        You have tree possibilities. You can define {$MYSQL_USER}, {$MYSQL_PASSWORD} macros in monitored host macros. You should be using this way only if you have only one MySQL engine to monitor or each of your engines have unique dedicated user and pwd used to monitor engine.
        If you have multiple engines but all of them are using the same user used to obtain monitoring data you can add these macros in global macros (Administration -> General -> Macros)
        Seems you are using my template If it is true you don't need to change {$MYSQL_HOST} because this macro definition is present in template and has "localhost" as value
        thank you for your reply, if this is your script I did private message you but got no reply.By engines you mean if I have more than one mysql instances I want to monitor? There will be about 3 slave instances that I would like to monitor, and all have the same user name and password, so use option 1? and just create a macro for the username and password in monitored host macro?

        I am using zabbix 3.2.0 I am not seeing macros anywhere there.

        Comment

        • cbtshare
          Junior Member
          • Aug 2016
          • 13

          #5
          hi, any further assistance please? Will this work with my version of zabbix?

          Comment

          • kloczek
            Senior Member
            • Jun 2006
            • 1771

            #6
            Type in search line name of your host -> search -> click on your hostname in first Host column -> Macros tab and you will be able to add macros with user/pwd per host.
            http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
            https://kloczek.wordpress.com/
            zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
            My zabbix templates https://github.com/kloczek/zabbix-templates

            Comment

            • cbtshare
              Junior Member
              • Aug 2016
              • 13

              #7
              Originally posted by kloczek
              Type in search line name of your host -> search -> click on your hostname in first Host column -> Macros tab and you will be able to add macros with user/pwd per host.
              Thank you will try it and let you know

              Comment

              Working...