Ad Widget

Collapse

Monitoring multiple oracle instances

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marcino
    Junior Member
    • Nov 2024
    • 13

    #1

    Monitoring multiple oracle instances

    I have Zabbix 7.0 and I'm using this template: https://www.zabbix.com/integrations/oracle to monitor Oracle databases using Zabbix Agent 2 (active mode).

    On my server, I have multiple instances, such as TEST and DEV. Is it possible to monitor them using this template? I want to avoid installing a second agent.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2


    Using named sessions

    Named sessions allow to define specific parameters for each Oracle instance. Currently, there are only four supported parameters: Uri, User, Password and Service. This option to store the credentials is slightly more secure way compared to item keys or macros.

    For example, if you have two Oracle instances: "Oracle12" and "Oracle19", you should add the following options to the agent configuration file:
    Plugins.Oracle.Sessions.Oracle12.Uri=tcp://192.168.1.1:1521
    Plugins.Oracle.Sessions.Oracle12.User=<USERFORORAC LE12>
    Plugins.Oracle.Sessions.Oracle12.Password=<Passwor dForOracle12>
    Plugins.Oracle.Sessions.Oracle12.Service=orcl

    Plugins.Oracle.Sessions.Oracle19.Uri=tcp://192.168.1.2:1521
    Plugins.Oracle.Sessions.Oracle19.User=<USERFORORAC LE19>
    Plugins.Oracle.Sessions.Oracle19.Password=<Passwor dForOracle19>
    Plugins.Oracle.Sessions.Oracle19.Service=orcl


    Then you will be able to use these names as the first parameter (ConnString) in keys instead of URIs. For example:
    oracle.ping[Oracle12]
    oracle.ping[Oracle19]


    Note: session names are case-sensitive.
    you cannot assign same template twice (or more) to a host... but create a host per DB (agent interface still points to same server i all) and then you can already drive that template to the direction you need...

    Comment


    • marcino
      marcino commented
      Editing a comment
      But doing it this way requires adding all items to Zabbix manually. I want to automate as much as possible.
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #3
    OOB templates are not always all.powerful.. So sometimes you may need to tweak them.. I have never used that Oracle template myself.. but you could recreate it with a discovery of DB-s in some form, which then creates all those items, what are present in OOB templates from prototypes, by adding connection string to parameters... That would of course require something, that updates agent config also... So maybe you can configure that first and your discovery can pick up the config file, extract session names from it and then you are good to go ..

    Comment


    • marcino
      marcino commented
      Editing a comment
      When using LLD, is it possible to use {#ORACLE.SERVICE} in the discovery database role, which was discovered in another role - instance discovery?
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #4
    If you have one master item and all your discoveries use is as source (discovery type: dependent item), then yes.. if they have completely different sources, then no..

    Comment

    • marcino
      Junior Member
      • Nov 2024
      • 13

      #5
      Originally posted by cyber
      If you have one master item and all your discoveries use is as source (discovery type: dependent item), then yes.. if they have completely different sources, then no..
      What are these different sources? Is it a different discovery role?


      I have the roles Instance Discovery and Database Discovery.
      In the Instance Discovery role, instance names are detected, whereas in the Database Discovery role, databases are detected. Now, I want to discover all databases across all instances.
      To achieve this, I need to use the macro {#ORACLE.SERVICE} from the Instance Discovery role in the Database Discovery role. Alternatively, I could use the {#DBNAME} macro in the Instance Discovery role.
      Unless I'm missing something and there is another way to do this?

      {#ORACLE.SERVICE} = Instance name
      {#DBNAME} = database name
      Last edited by marcino; 14-03-2025, 12:10.

      Comment

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

        #6
        If you think how discovery usually works... you get some data and your discovery does magic, discovers things in that source, creates items/triggers etc... and in most cases source data is just discarded, as it has served its purpose. How would you point to this from other discovery rule? Not really possible...
        But if you have one master item, which will return all data at once... instance and all the db-s under it etc... now you can use this as source for multiple discoveries and you can use all the data that is available in source in all of those discoveries... All those discoveries are of type "dependent item"... each time master item gets a refresh, every dicovery gets a rerun.. This way you can also get data all at once.. creating items from discovery, which are dependent on the same master item and extract data from there with preprocessing..

        Comment

        • marcino
          Junior Member
          • Nov 2024
          • 13

          #7
          Originally posted by cyber
          If you think how discovery usually works... you get some data and your discovery does magic, discovers things in that source, creates items/triggers etc... and in most cases source data is just discarded, as it has served its purpose. How would you point to this from other discovery rule? Not really possible...
          But if you have one master item, which will return all data at once... instance and all the db-s under it etc... now you can use this as source for multiple discoveries and you can use all the data that is available in source in all of those discoveries... All those discoveries are of type "dependent item"... each time master item gets a refresh, every dicovery gets a rerun.. This way you can also get data all at once.. creating items from discovery, which are dependent on the same master item and extract data from there with preprocessing..
          Thanks. I was hoping I could use the discovery feature that's already built into Zabbix, but unfortunately, it's used for a different role.

          I wrote my own discovery script, and it returns a JSON like this:

          Code:
          {
            "data": [
              {
                "id": 1,
                "instance": "TEST1",
                "tablespaces": [
                  {
                    "tablespace": "IFSAPP_ARCHIVE_DATA",
                    "contents": "PERMANENT"
                  },
                  {
                    "tablespace": "IFSAPP_ARCHIVE_INDEX",
                    "contents": "PERMANENT"
                  }
                ]
              },
              {
                "id": 2,
                "instance": "TEST2",
                "tablespaces": [
                  {
                    "tablespace": "IFSAPP_ARCHIVE_DATA",
                    "contents": "PERMANENT"
                  },
                  {
                    "tablespace": "IFSAPP_ARCHIVE_INDEX",
                    "contents": "PERMANENT"
                  }
                ]
              }
            ]
          }
          Is there any way to handle this in Zabbix so that, based on this JSON, it creates items like:
          • Oracle TBS '{#TABLESPACE}': Open status - Instance {#ORACLE.SERVICE}
          • Oracle TBS '{#TABLESPACE}': Get tablespaces stats - Instances {#ORACLE.SERVICE}
          I’m getting the following error:

          Failed to retrieve tablespace query: incorrect tablespace type {#CONTENTS}: Invalid parameters.

          In the template, I have the following LLD macros set:

          {#CONTENTS} - $.data[*].tablespaces[*].contents
          {#TABLESPACE} - $.data[*].tablespaces[*].tablespace
          {#ORACLE.SERVICE} - $.data[*].instance

          The macro {#ORACLE.SERVICE} is correctly replaced with the instance name, while the macro {#TABLESPACE} is not being replaced with the table name. Will this work with such a JSON? Or do I need to structure the JSON differently?
          Last edited by marcino; 20-03-2025, 17:11.

          Comment

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

            #8
            Those paths give you all tablespaces and all contents at once, but they should return only those at hand, related to specific instance

            There are definitely smarter people around, who know their way around jsonpath... I have already started to think, that it is absolutley incompatible with my brainstructure...

            Comment

            Working...