<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by amit pawar on Medium]]></title>
        <description><![CDATA[Stories by amit pawar on Medium]]></description>
        <link>https://medium.com/@amit61508?source=rss-e0a4a47aa89d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3NbBP2R1IcHmAv45la4swA.jpeg</url>
            <title>Stories by amit pawar on Medium</title>
            <link>https://medium.com/@amit61508?source=rss-e0a4a47aa89d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 02:04:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amit61508/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Oracle Database Monitoring With The Zabbix (ODBC)]]></title>
            <link>https://medium.com/@amit61508/oracle-database-monitoring-in-the-zabbix-c6e1bb310525?source=rss-e0a4a47aa89d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6e1bb310525</guid>
            <category><![CDATA[monitoring-tools]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[zabbix]]></category>
            <category><![CDATA[oracle-database]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[amit pawar]]></dc:creator>
            <pubDate>Fri, 28 Oct 2022 07:41:54 GMT</pubDate>
            <atom:updated>2022-11-01T13:07:55.837Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*UXczroj75XA_eMlYhZTiVg.png" /></figure><h3>Oracle</h3><p>Oracle Database is a multi-model database management system produced and marketed by Oracle Corporation. It is a database commonly used for running online transaction processing (OLTP), data warehousing (DW) and mixed (OLTP &amp; DW) database workloads.</p><h3>Purpose</h3><p>In DevOps, Monitoring is a key practice for detecting issues with a system before they cause problems.</p><p>There are some of the takeaways of monitoring.</p><ol><li>It allows you to identify and fix problems early.</li><li>It increases adaptability and flexibility.</li><li>Improvements based on data can improve the overall well-being of the system.</li><li>Teams can communicate better and more clearly.</li><li>Increased productivity and fewer delays.</li></ol><p>This article describes how to set up Oracle Database Monitoring in the Zabbix tool for monitoring the Database performance parameters.</p><h3>Prerequisites</h3><ul><li>Zabbix Tool Intermediate Knowledge.</li><li>Knowledge of Shell/Python Scripting and Linux Commands.</li><li>Firewall or Network Security</li><li>Knowledge of Oracle Database, and ODBC Drivers.</li><li>API, JSON.</li></ul><h3>Implementation</h3><p><strong>Step 1 </strong>: Create an Oracle DB user for monitoring and grant him the all required permission</p><pre>### Create the user</pre><pre>CREATE USER zabbix_mon IDENTIFIED BY &lt;PASSWORD&gt;;</pre><pre>### Grant access to the zabbix_mon user.</pre><pre>GRANT CONNECT, CREATE SESSION TO zabbix_mon;<br>GRANT SELECT ON v$instance TO zabbix_mon;<br>GRANT SELECT ON v$database TO zabbix_mon;<br>GRANT SELECT ON v$sysmetric TO zabbix_mon;<br>GRANT SELECT ON v$system_parameter TO zabbix_mon;<br>GRANT SELECT ON v$session TO zabbix_mon;<br>GRANT SELECT ON v$recovery_file_dest TO zabbix_mon;<br>GRANT SELECT ON v$active_session_history TO zabbix_mon;<br>GRANT SELECT ON v$osstat TO zabbix_mon;<br>GRANT SELECT ON v$restore_point TO zabbix_mon;<br>GRANT SELECT ON v$process TO zabbix_mon;<br>GRANT SELECT ON v$datafile TO zabbix_mon;<br>GRANT SELECT ON v$pgastat TO zabbix_mon;<br>GRANT SELECT ON v$sgastat TO zabbix_mon;<br>GRANT SELECT ON v$log TO zabbix_mon;<br>GRANT SELECT ON v$archive_dest TO zabbix_mon;<br>GRANT SELECT ON v$asm_diskgroup TO zabbix_mon;<br>GRANT SELECT ON sys.dba_data_files TO zabbix_mon;<br>GRANT SELECT ON DBA_TABLESPACES TO zabbix_mon;<br>GRANT SELECT ON DBA_TABLESPACE_USAGE_METRICS TO zabbix_mon;<br>GRANT SELECT ON DBA_USERS TO zabbix_mon;</pre><p><strong>Step 2 </strong>: Once the User is created and granted user all the required permission, we need to test the database connectivity from the Zabbix production server to the monitored DB host. For that, we need to install the Oracle ODBC API drivers &amp; UnixODBC Drivers packages on the Zabbix server.</p><p>ODBC is a C programming language middle-ware API for accessing database management systems (DBMS).</p><p>Zabbix may query any database, which is supported by ODBC. To do that, Zabbix does not directly connect to the databases but uses the ODBC interface and drivers set up in ODBC. This function allows for more efficient monitoring of different databases for multiple purposes — for example, checking specific database queues, usage statistics, and so on. Zabbix supports unixODBC, which is one of the most commonly used open-source ODBC API implementations (Reference: <a href="https://www.zabbix.com/documentation/6.0/en/manual/config/items/itemtypes/odbc_checks?hl=ODBC%2Codbc">Zabbix Documentation</a>).</p><p>The suggested way of installing unixODBC is to use the Linux operating system’s default package repositories. In the most popular Linux distributions unixODBC is included in the package repository by default. If it’s not available, it can be obtained at the unixODBC homepage: <a href="http://www.unixodbc.org/download.html">http://www.unixodbc.org/download.html.</a></p><pre>Installing unixODBC on RedHat/Fedora-based systems using the <em>yum</em> package manager:</pre><pre>shell&gt; yum -y install unixODBC unixODBC-devel</pre><p>Install the ODBC driver on the Zabbix server or the Zabbix proxy.</p><p>See Oracle documentation for instructions:</p><p><a href="https://www.oracle.com/database/technologies/releasenote-odbc-ic.html">https://www.oracle.com/database/technologies/releasenote-odbc-ic.html</a></p><p><a href="https://www.oracle.com/cis/database/technologies/instant-client/linux-x86-64-downloads.html">Instant Client for Linux x86-64 (64-bit)</a></p><p>List of all OS version ODBC drivers: <a href="https://www.oracle.com/cis/database/technologies/instant-client/downloads.html">https://www.oracle.com/cis/database/technologies/instant-client</a></p><p>Important Packages to install on the Zabbix Linux Server:</p><ul><li>Basic Package (OL8 RPM) (<a href="https://download.oracle.com/otn_software/linux/instantclient/218000/oracle-instantclient-basic-21.8.0.0.0-1.el8.x86_64.rpm">oracle-instantclient-basic-21.8.0.0.0–1.el8.x86_64.rpm</a>)</li><li>SQL*Plus Package (OL8 RPM) (#For testing the connectivity)</li><li>ODBC Package (OL8 RPM) (<a href="https://download.oracle.com/otn_software/linux/instantclient/218000/oracle-instantclient-odbc-21.8.0.0.0-1.el8.x86_64.rpm">oracle-instantclient-odbc-21.8.0.0.0–1.el8.x86_64.rpm</a>)</li></ul><p><strong>Installation of RPM files:</strong></p><ol><li>Download the desired Instant Client RPM packages on your linux machine. All installations require a Basic or Basic Light RPM.</li></ol><p>2. Install the packages with yum. For example:</p><pre>sudo yum install <a href="https://download.oracle.com/otn_software/linux/instantclient/218000/oracle-instantclient-basic-21.8.0.0.0-1.el8.x86_64.rpm">oracle-instantclient-basic-21.8.0.0.0–1.el8.x86_64.rpm</a></pre><pre>sudo yum install <a href="https://download.oracle.com/otn_software/linux/instantclient/218000/oracle-instantclient-odbc-21.8.0.0.0-1.el8.x86_64.rpm">oracle-instantclient-odbc-21.8.0.0.0–1.el8.x86_64.rpm</a></pre><pre>sudo yum install <a href="https://download.oracle.com/otn_software/linux/instantclient/218000/oracle-instantclient-sqlplus-21.8.0.0.0-1.el8.x86_64.rpm">oracle-instantclient-sqlplus-21.8.0.0.0-1.el8.x86_64.rpm</a></pre><p>Note that from 19.3, by default only one version of the Instant Client RPM libraries can be installed at a time.</p><p>3. If you intend to co-locate optional Oracle configuration files such as tnsnames.ora, sqlnet.ora ldap.ora, or oraaccess.xml with Instant Client, put them in the network/admin subdirectory. This needs to be created for 12.2 and earlier, for example:</p><pre>sudo mkdir -p /usr/lib/oracle/12.2/client64/lib/network/admin</pre><p>This is the default Oracle configuration directory for applications linked with this Instant Client.</p><p>Alternatively, Oracle configuration files can be put in another, accessible directory. Then set the environment variable TNS_ADMIN to that directory name.</p><p>Lets see the content of the tnsnames.ora, sqlnet.ora ldap.orafiles which are located under the path <strong>/usr/lib/oracle/12.2/client64/lib/network/admin</strong></p><p>For example,</p><ul><li>ldap.ora</li></ul><pre>DIRECTORY_SERVERS= (stage-oid.xyz.com:3061:3132)</pre><pre>DEFAULT_ADMIN_CONTEXT = &quot;dc=xyznet,dc=com&quot;</pre><pre>DIRECTORY_SERVER_TYPE = OID</pre><ul><li>Sqlnet.ora</li></ul><pre>SQLNET.WALLET_OVERRIDE = TRUE</pre><pre>WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/app/oracle/admin/$ORACLE_SID/wallet)))</pre><p>4. After installing the all Oracle Instant clinet and ODBC drivers, Configure Zabbix server or Zabbix proxy for Oracle ENV Usage. Edit or add a new file:</p><p>Edit or add new file</p><p>/etc/sysconfig/zabbix-server # for server</p><p>/etc/sysconfig/zabbix-proxy # for proxy</p><pre>export ORACLE_HOME=/usr/lib/oracle/19.6/client64</pre><pre>export PATH=$PATH:$ORACLE_HOME/bin</pre><pre>export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib64:/usr/lib: $ORACLE_HOME/bin</pre><pre>export TNS_ADMIN=$ORACLE_HOME/network/admin</pre><pre>export PATH=/usr/lib/oracle/19.3/client64/bin:$PATH</pre><p>6. Start your Zabbix server services.</p><p><strong>Step 3 </strong>: Once the drivers are installed, validate the path of the installed ODBC drivers and also look into the <em>odbcinst.ini</em> file to check the entry for the drivers. If there is no driver entry into that file, make the manual entry for the Oracle driver path.</p><p>unixODBC provides the odbcinst and isql command line utilities used to install, configure, and test the driver. To verify whether unixODBC is installed, execute the following commands:</p><pre>shell&gt; which odbcinst<br><br>shell&gt; which isql</pre><pre>shell&gt; odbcinst -j</pre><p>odbcinst.ini is used to list the installed ODBC database drivers.</p><pre>#Path for odbcinst.ini file on the zabbix server</pre><pre>shell&gt; cd /etc/<br><br>shell&gt; cat /etc/odbcinst.inishell&gt; <br>[PostgreSQL]<br>Description = PostgreSQL driver for GNU/Linux<br>Driver      = /usr/lib/psqlodbcw.so<br>Setup       = /usr/lib/libodbcpsqlS.so<br>FileUsage   = 1<br>UsageCount  = 1</pre><pre>[mysql]<br>Description = ODBC for MySQL<br>Driver      = /usr/lib/libmyodbc5.so<br>FileUsage   = 1<br>UsageCount  = 1</pre><pre>[ODBC Driver 18 for SQL Server]<br>Description = Microsoft ODBC Driver 18 for SQL Server<br>Driver      = /opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1<br>UsageCount  = 1</pre><pre>[OracleODBC]<br>Description= ORACLE ODBC Driver<br>Driver=/usr/lib/oracle/21/client64/lib/libsqora.so.21.1<br>UsageCount=1<br>Driver Logging = 7</pre><p>Parameter details:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/0*WfGQZTSasAAp4eRc.png" /></figure><p><strong>Step 4: </strong>Make the Data Source Name (DSN) entry into odbc.ini file and database instances entry into tnsnames.ora for making the database connectivity with Monitored DB server.</p><pre>#Path for tnsnames.ora file<br>shell&gt; cd /usr/lib/oracle/21/client64/lib/network/admin<br>shell&gt;  ls<br>ldap.ora  README  sqlnet.ora  tnsnames.ora</pre><p>For example,</p><p>We have Oracle sever and it is having two database instances i.e PQR and ABC, then the entry into the tnsnames.ora file will be,</p><pre># Entry in tnsnames.ora file for PQR database instance.<br>PQR=<br>  (DESCRIPTION =<br>      (ADDRESS =<br>      (PROTOCOL = TCP)<br>      (HOST =  127.0.0.1)<br>      (PORT = 1521)<br>      )<br>     (CONNECT_DATA =<br>        (SERVER = DEDICATED)<br>        (SERVICE_NAME = PQR.XYZ.net)<br>      )</pre><pre>)<br># Entry in tnsnames.ora file for ABC database instance.</pre><pre>ABC=<br>  (DESCRIPTION =<br>      (ADDRESS =<br>      (PROTOCOL = TCP)<br>      (HOST =  127.0.0.1)<br>      (PORT = 1521)<br>      )<br>     (CONNECT_DATA =<br>        (SERVER = DEDICATED)<br>        (SERVICE_NAME = ABC.XYZ.net)<br>      )<br> )</pre><p>For more details about the tnsnames.ora file, See also<a href="https://docs.oracle.com/database/121/NETRF/tnsnames.htm#NETRF007"> Oracle Documentation</a>.</p><p>After making the changes into <strong><em>tnsnames.ora </em></strong>file, make the changes into <strong><em>odbc.ini </em></strong>file as per below</p><pre>[PQR]<br>Driver = OracleODBC<br>Description = Oracle non prod DB server<br>ServerName = PQR<br>DSN = PQR<br>FileUsage = 1<br>Trace = Yes<br>Driver Logging = 7<br>TrustServerCertificate = Yes</pre><pre>[ABC]<br>Driver = OracleODBC<br>Description = Oracle non-prod DB server<br>ServerName = ABC<br>DSN = ABC<br>FileUsage = 1<br>Trace = Yes<br>Driver Logging = 7<br>TrustServerCertificate = Yes</pre><blockquote><strong>Note:</strong> Put the same value of net_service_name in tnsnames.ora file (i.e PQR &amp; ABC ) into DSN and ServerName parameter field for odbc.ini file.</blockquote><p><strong>Step 5: </strong>After making the entries in both <strong><em>odbc.ini and tnsnames.ora</em></strong> files, check the database connectivity from Zabbix server to remote DB server.</p><pre>#command to check the Database connectivity from Zabbix server</pre><pre>shell&gt; isql -v PQR &lt;DB_user&gt; &lt;DB_password&gt;</pre><pre>shell&gt; isql -v ABC &lt;DB_user&gt; &lt;DB_password&gt;</pre><p>To verify if the ODBC connection is working successfully, a database connection should be tested. That can be done with the <strong>isql</strong> utility (included in the unixODBC package):</p><pre>shell&gt; isql -v PQR &lt;DB_user&gt; &lt;DB_password&gt;<br>       +---------------------------------------+<br>       | Connected!                            |<br>       |                                       |<br>       | sql-statement                         |<br>       | help [tablename]                      |<br>       | quit                                  |<br>       |                                       |<br>       +---------------------------------------+<br>       SQL&gt;</pre><blockquote>Note: Make sure firewall ports are open and policies are allowed to make the DB connectivity without any issues.</blockquote><p><strong>Step 6 : </strong>Once the DB connectivity is checked, apply the Oracle template to monitored host and fill the necessary macros values like<strong> </strong>{$ORACLE.DSN1}, {$ORACLE.DSN2}, {$ORACLE.USER}, {$ORACLE.PASSWORD}. Also validate the oracle driver path location.</p><p>Link To Download the Oracle DB Template: <a href="https://github.com/pawaramit1423/Zabbix-Templates">pawaramit1423/Zabbix-Templates (github.com)</a></p><blockquote>Note: I have created the template for two instances monitoring only if your servers having the multiple databases on single DB server then clone the items, trigger and macros for those multiple databases.</blockquote><p>Once the template is applied and filled in the required macros, check the availability of the listener process and latest data on the Zabbix application for real-time data validation.</p><h3>Reference</h3><p>Zabbix Documentation: <a href="https://www.zabbix.com/integrations/oracle#oracle_odbc">zabbix.com/integrations/oracle#oracle_odbc</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6e1bb310525" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MySQL/MariaDB (MySQL) Database Monitoring with Zabbix]]></title>
            <link>https://medium.com/@amit61508/mysql-mariadb-mysql-database-monitoring-with-zabbix-46761d421ae3?source=rss-e0a4a47aa89d------2</link>
            <guid isPermaLink="false">https://medium.com/p/46761d421ae3</guid>
            <dc:creator><![CDATA[amit pawar]]></dc:creator>
            <pubDate>Thu, 27 Oct 2022 11:52:03 GMT</pubDate>
            <atom:updated>2022-10-27T11:54:08.837Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*YHVvvIQdxmrRBCwhEIm_YQ.png" /><figcaption>Fig. Zabbix-MySQL Integration</figcaption></figure><h3>Purpose</h3><p>In DevOps, Monitoring is a key practice for detecting issues with a system before they cause problems.</p><p>There are some of the takeaways of monitoring.</p><ol><li>It allows you to identify and fix problems early.</li><li>It increases adaptability and flexibility.</li><li>Improvements based on data can improve the overall well-being of the system.</li><li>Teams can communicate better and more clearly.</li><li>Increased productivity and fewer delays.</li></ol><p>This article describes how to set up MySQL Database Monitoring in the Zabbix tool for monitoring the Database performance parameters.</p><h3>Prerequisites</h3><ul><li>Zabbix Tool Intermediate Knowledge.</li><li>Knowledge of Shell/Python Scripting and Linux Commands.</li><li>Firewall or Network Security</li><li>Knowledge of MySQL Database, and ODBC Drivers.</li><li>API, JSON.</li></ul><h3>Implementation</h3><p><strong>Step 1 </strong>: Create a MySQL user for monitoring ( Create the &lt;password&gt; as per your choice) and also grant the all required permission:</p><pre>CREATE USER &#39;zbx_monitor&#39;@&#39;%&#39; IDENTIFIED BY &#39;&lt;password&gt;&#39;;</pre><pre>GRANT REPLICATION CLIENT,PROCESS,SHOW DATABASES,SHOW VIEW ON *.* TO &#39;zbx_monitor&#39;@&#39;%&#39;;</pre><p>See Also, MySQL Documentation: <a href="https://dev.mysql.com/doc/refman/8.0/en/grant.html">https://dev.mysql.com/doc/refman/8.0/en/grant.html</a></p><p><strong>Step 2 </strong>: Once the User is created and granted user all the required permission, we need to test the database connectivity from the Zabbix production server to the monitored DB host. For that, we need to install the MySQL ODBC API drivers &amp; UnixODBC Drivers packages on the Zabbix server.</p><p>ODBC is a C programming language middle-ware API for accessing database management systems (DBMS).</p><p>Zabbix may query any database, which is supported by ODBC. To do that, Zabbix does not directly connect to the databases but uses the ODBC interface and drivers set up in ODBC. This function allows for more efficient monitoring of different databases for multiple purposes — for example, checking specific database queues, usage statistics, and so on. Zabbix supports unixODBC, which is one of the most commonly used open-source ODBC API implementations (Reference: <a href="https://www.zabbix.com/documentation/6.0/en/manual/config/items/itemtypes/odbc_checks?hl=ODBC%2Codbc">Zabbix Documentation</a>).</p><p>The suggested way of installing unixODBC is to use the Linux operating system’s default package repositories. In the most popular Linux distributions unixODBC is included in the package repository by default. If it’s not available, it can be obtained at the unixODBC homepage: <a href="http://www.unixodbc.org/download.html">http://www.unixodbc.org/download.html.</a></p><pre>Installing unixODBC on RedHat/Fedora-based systems using the <em>yum</em> package manager:</pre><pre>shell&gt; yum -y install unixODBC unixODBC-devel</pre><p>Installing MySQL database driver on RedHat/Fedora-based systems using the <em>yum</em> package manager:</p><pre>shell&gt; yum install mysql-connector-odbc</pre><p>Installing MariaDB database driver on RedHat/Fedora-based systems using the <em>yum</em> package manager:</p><pre>mkdir odbc_package<br>cd odbc_package<br>wget https://downloads.mariadb.com/Connectors/odbc/connector-odbc-3.1.7/mariadb-connector-odbc-3.1.7-ga-rhel7-x86_64.tar.gz<br>tar -xvzf mariadb-connector-odbc-3.1.7-ga-rhel7-x86_64.tar.gz<br>sudo install lib64/libmaodbc.so /usr/lib64/<br>sudo install -d /usr/lib64/mariadb/<br>sudo install -d /usr/lib64/mariadb/plugin/<br>sudo install lib64/mariadb/plugin/auth_gssapi_client.so /usr/lib64/mariadb/plugin/<br>sudo install lib64/mariadb/plugin/caching_sha2_password.so /usr/lib64/mariadb/plugin/<br>sudo install lib64/mariadb/plugin/client_ed25519.so /usr/lib64/mariadb/plugin/<br>sudo install lib64/mariadb/plugin/dialog.so /usr/lib64/mariadb/plugin/<br>sudo install lib64/mariadb/plugin/mysql_clear_password.so /usr/lib64/mariadb/plugin/<br>sudo install lib64/mariadb/plugin/sha256_password.so /usr/lib64/mariadb/plugin/</pre><p>See also for <a href="https://mariadb.com/kb/en/about-mariadb-connector-odbc/#:~:text=MariaDB%20Connector%2FODBC%20packages%20can%20also%20be%20downloaded%20by%20selecting,package%20for%20your%20operating%20system">MariaDB Documentation</a>,</p><p><strong>Step 3</strong>: Once the drivers are installed, validate the path of the installed ODBC drivers and also look into the <em>odbcinst.ini</em> file to check the entry for the drivers. If there is no driver entry into that file, make the manual entry for the MySQL/MariaDB driver path.</p><p>unixODBC provides the odbcinst and isql command line utilities used to install, configure, and test the driver. To verify whether unixODBC is installed, execute the following commands:</p><pre>shell&gt; which odbcinst<br><br>shell&gt; which isql</pre><pre>shell&gt; odbcinst -j</pre><p>odbcinst.ini is used to list the installed ODBC database drivers.</p><pre># Path for <em>odbcinst.ini</em> file on the Zabbix server.<br>shell&gt; cat /etc/odbcinst.inishell&gt; <br>[PostgreSQL]<br>Description = PostgreSQL driver for GNU/Linux<br>Driver      = /usr/lib/psqlodbcw.so<br>Setup       = /usr/lib/libodbcpsqlS.so<br>FileUsage   = 1<br>UsageCount  = 1</pre><pre>[mysql]<br>Description = ODBC for MySQL<br>Driver      = /usr/lib/libmyodbc5.so<br>FileUsage   = 1<br>UsageCount  = 1</pre><pre>[mariadb]<br>Description = ODBC for MariaDB<br>Driver      = /usr/lib/libmaodbc.so<br>FileUsage   = 1<br>UsageCount  = 1</pre><pre>[ODBC Driver 18 for SQL Server]<br>Description = Microsoft ODBC Driver 18 for SQL Server<br>Driver      = /opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1<br>UsageCount  = 1</pre><p>Parameter details:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/0*Tm2pWTjONEtAjQRq.png" /></figure><p><strong>Step 4:</strong> Define the Data Source Name (DSN) entry for MariaDB/MySQL instance into the odbc.ini file. <strong>odbc.ini</strong> is used to define data sources.</p><pre>#Path for odbc.ini file on the Zabbix server</pre><pre>shell&gt; cat /etc/odbc.ini</pre><pre>[test]<br>Description = MySQL test database<br>Driver      = mysql<br>Server      = 127.0.0.1 or &lt;IP for Database Server&gt;<br>User        = zbx_monitor<br>Password    =<br>Port        = 3306<br>Database    = zabbix</pre><pre>#MariaDB Driver Configuartion</pre><pre>[test2]<br>Description = MySQL/MariaDB test database<br>Driver      = mariadb<br>Server      = 127.0.0.1 or &lt;IP for Database Server&gt;<br>User        = zbx_monitor<br>Password    =<br>Port        = 3306<br>Database    = zabbix</pre><p>Parameter details:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/0*9zzC-q35uWvtpqo3.png" /></figure><p><strong>Step 5: </strong>After making the entries into the both odbc.ini &amp; odbcinst.ini files, check the database connectivity from the Zabbix server to the remote MySQL database server.</p><p>To verify if the ODBC connection is working successfully, a database connection should be tested. That can be done with the <strong>isql</strong> utility (included in the unixODBC package):</p><pre>#command to check the Database connectivity from Zabbix server</pre><pre>shell&gt; isql -v test &lt;DB_user&gt; &lt;DB_password&gt;</pre><pre>or</pre><pre>#Connectivity through MariaDB Drivers</pre><pre>shell&gt; isql -v test2 &lt;DB_user&gt; &lt;DB_password&gt;  </pre><pre><br>#############################################################</pre><pre>shell&gt; isql -v test &lt;DB_user&gt; &lt;DB_password&gt;<br>       +---------------------------------------+<br>       | Connected!                            |<br>       |                                       |<br>       | sql-statement                         |<br>       | help [tablename]                      |<br>       | quit                                  |<br>       |                                       |<br>       +---------------------------------------+<br>       SQL&gt;</pre><p>Note: Make sure firewall ports are open and policies are allowed to make the DB connectivity without any issues.</p><p><strong>Step 6 : </strong>Once the DB connectivity is checked, apply the MySQL template to monitored host and fill the necessary macros values like<strong> </strong>{$MYSQL.DSN} , {$MYSQL.PASSWORD} , {$MYSQL.USER} , {$MYSQL.PORT}.</p><p>Link To Download the MySQL DB Template: <a href="https://github.com/pawaramit1423/Zabbix-Templates">pawaramit1423/Zabbix-Templates (github.com)</a></p><p>Once the template is applied and filled in the required macros, check the latest data on the Zabbix application for real-time data validation.</p><h3>Reference</h3><p>Zabbix Documentation: <a href="https://www.zabbix.com/integrations/mysql">zabbix.com/integrations/mysql</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46761d421ae3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microsoft SQL (MS SQL) Database Monitoring with Zabbix]]></title>
            <link>https://medium.com/@amit61508/microsoft-sql-ms-sql-database-monitoring-with-zabbix-dffd1f5b0f0a?source=rss-e0a4a47aa89d------2</link>
            <guid isPermaLink="false">https://medium.com/p/dffd1f5b0f0a</guid>
            <category><![CDATA[odbc]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[zabbix]]></category>
            <category><![CDATA[mssql]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[amit pawar]]></dc:creator>
            <pubDate>Tue, 25 Oct 2022 09:27:55 GMT</pubDate>
            <atom:updated>2022-10-28T06:23:46.883Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*2zq7Ne7eMS2PcHRATibsfQ.png" /><figcaption>Fig. Zabbix-MSSQL Integration</figcaption></figure><h3>Microsoft SQL</h3><p>Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications — which may run either on the same computer or on another computer across a network.</p><h3><strong>Purpose</strong></h3><p>In DevOps, Monitoring is a key practice for detecting issues with a system before they cause problems.</p><p>There are some of the takeaways of monitoring.</p><ol><li>It allows you to identify and fix problems early.</li><li>It increases adaptability and flexibility.</li><li>Improvements based on data can improve the overall well-being of the system.</li><li>Teams can communicate better and more clearly.</li><li>Increased productivity and fewer delays.</li></ol><p>This article describes how to set up the MSSQL Database Monitoring in the Zabbix tool for monitoring the Database performance parameters.</p><h3>Prerequisites</h3><ul><li>Zabbix Tool Intermediate Knowledge.</li><li>Knowledge of Shell/Python Scripting and Linux Commands.</li><li>Firewall or Network Security</li><li>Knowledge of MSSQL DataBase, and ODBC Drivers.</li><li>API, JSON.</li></ul><h3>Implementation</h3><p><strong>Step 1</strong>: Create an MSSQL user for monitoring. For example, zbx_monitor. <strong>View Server State</strong> and <strong>View Any Definition</strong> permissions should be granted to the user. Grant this user read permissions to the sysjobschedules, sysjobhistory, and sysjobs tables.</p><p>For Example, T-SQL Commands</p><pre>GRANT SELECT ON OBJECT::msdb.dbo.sysjobs TO zbx_monitor<br>GRANT SELECT ON OBJECT::msdb.dbo.sysjobservers TO zbx_monitor<br>GRANT SELECT ON OBJECT::msdb.dbo.sysjobactivity TO zbx_monitor <br>GRANT EXECUTE ON OBJECT::msdb.dbo.agent_datetime TO zbx_monitor</pre><p>For More Details. See Also, Microsoft Documentation:</p><p><a href="https://learn.microsoft.com/en-us/sql/relational-databases/security/authentication-access/create-a-database-user?view=sql-server-ver15">Create a database user</a></p><p><a href="https://docs.microsoft.com/en-us/sql/t-sql/statements/grant-server-permissions-transact-sql?view=sql-server-ver15">GRANT Server Permissions</a></p><p><a href="https://learn.microsoft.com/en-in/sql/ssms/agent/configure-a-user-to-create-and-manage-sql-server-agent-jobs?view=sql-server-ver15">Configure a User to Create and Manage SQL Server Agent Jobs</a></p><p><strong>Step 2</strong>: Once the User is created and granted user all the required permission, we need to test the database connectivity from the Zabbix production server to the monitored DB host. For that, we need to install the MSSQL ODBC API drivers &amp; UnixODBC Drivers packages on the Zabbix server.</p><p>ODBC is a C programming language middle-ware API for accessing database management systems (DBMS).</p><p>Zabbix may query any database, which is supported by ODBC. To do that, Zabbix does not directly connect to the databases but uses the ODBC interface and drivers set up in ODBC. This function allows for more efficient monitoring of different databases for multiple purposes — for example, checking specific database queues, usage statistics, and so on. Zabbix supports unixODBC, which is one of the most commonly used open-source ODBC API implementations (Reference: <a href="https://www.zabbix.com/documentation/6.0/en/manual/config/items/itemtypes/odbc_checks?hl=ODBC%2Codbc">Zabbix Documentation</a>).</p><p>The suggested way of installing unixODBC is to use the Linux operating system’s default package repositories. In the most popular Linux distributions unixODBC is included in the package repository by default. If it’s not available, it can be obtained at the unixODBC homepage: <a href="http://www.unixodbc.org/download.html">http://www.unixodbc.org/download.html.</a></p><pre>Installing unixODBC on RedHat/Fedora-based systems using the <em>yum</em> package manager:</pre><pre>shell&gt; yum -y install unixODBC unixODBC-devel</pre><p>See Microsoft documentation for instructions: <a href="https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15">https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver15</a>.</p><pre>sudo su</pre><pre>#Download appropriate package for the OS version<br>#Choose only ONE of the following, corresponding to your OS version</pre><pre>#Red Hat Enterprise Server 7 and Oracle Linux 7<br>curl <a href="https://packages.microsoft.com/config/rhel/7/prod.repo">https://packages.microsoft.com/config/rhel/7/prod.repo</a> &gt; /etc/yum.repos.d/mssql-release.repo</pre><pre>#Red Hat Enterprise Server 8 and Oracle Linux 8<br>curl <a href="https://packages.microsoft.com/config/rhel/8/prod.repo">https://packages.microsoft.com/config/rhel/8/prod.repo</a> &gt; /etc/yum.repos.d/mssql-release.repo</pre><pre>exit<br>sudo yum remove unixODBC-utf16 unixODBC-utf16-devel #to avoid conflicts<br>sudo ACCEPT_EULA=Y yum install -y msodbcsql18<br># optional: for bcp and sqlcmd<br>sudo ACCEPT_EULA=Y yum install -y mssql-tools18<br>echo &#39;export PATH=&quot;$PATH:/opt/mssql-tools18/bin&quot;&#39; &gt;&gt; ~/.bashrc<br>source ~/.bashrc<br># optional: for unixODBC development headers<br>sudo yum install -y unixODBC-devel</pre><p><strong>Step 3 </strong>: Once the drivers are installed, validate the path of the installed ODBC drivers and also look into the <em>odbcinst.ini</em> file to check the entry for the drivers. If there is no driver entry into that file, make the manual entry for the MSSQL driver path.</p><p>unixODBC provides the odbcinst and isql command line utilities used to install, configure, and test the driver. To verify whether unixODBC is installed, execute the following commands:</p><pre>shell&gt; which odbcinst<br><br>shell&gt; which isql</pre><pre>shell&gt; odbcinst -j</pre><p>odbcinst.ini is used to list the installed ODBC database drivers.</p><pre># Path for <em>odbcinst.ini</em> file on the Zabbix server.<br>shell&gt; cat /etc/odbcinst.ini</pre><pre>shell&gt; <br>[PostgreSQL]<br>Description = PostgreSQL driver for GNU/Linux<br>Driver      = /usr/lib/psqlodbcw.so<br>Setup       = /usr/lib/libodbcpsqlS.so<br>FileUsage   = 1<br>UsageCount  = 1</pre><pre>[mysql]<br>Description = ODBC for MySQL<br>Driver      = /usr/lib/libmyodbc5.so<br>FileUsage   = 1<br>UsageCount  = 1</pre><pre>[ODBC Driver 18 for SQL Server]<br>Description = Microsoft ODBC Driver 18 for SQL Server<br>Driver      = /opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1<br>UsageCount  = 1</pre><p>Parameter details:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*zWVJmscqN0szhSwngaYNlQ.png" /></figure><p><strong>Step 4:</strong> Define the Data Source Name (DSN) entry into the odbc.ini file. <strong>odbc.ini</strong> is used to define data sources.</p><pre>#Path for odbc.ini file on the Zabbix server</pre><pre>shell&gt; cat /etc/odbc.ini</pre><pre>[test]<br>Description = MSSQL test database<br>Driver      = ODBC Driver 18 for SQL Server<br>Server      = 127.0.0.1 or &lt;IP for Database Server&gt;<br>User        = zbx_monitor<br>Password    =<br>Port        = 1433<br>Database    = zabbix</pre><p>Parameter details:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*Gs0I45G_5ayMJncWDwArvA.png" /></figure><p><strong>Step 5: </strong>After making the entries into the both odbc.ini &amp; odbcinst.ini files, check the database connectivity from the Zabbix server to the remote MSSQL database server.</p><pre>#command to check the Database connectivity from Zabbix server</pre><pre>shell&gt; isql -v test &lt;DB_user&gt; &lt;DB_password&gt;</pre><p>To verify if the ODBC connection is working successfully, a database connection should be tested. That can be done with the <strong>isql</strong> utility (included in the unixODBC package):</p><pre>shell&gt; isql -v test &lt;DB_user&gt; &lt;DB_password&gt;<br>       +---------------------------------------+<br>       | Connected!                            |<br>       |                                       |<br>       | sql-statement                         |<br>       | help [tablename]                      |<br>       | quit                                  |<br>       |                                       |<br>       +---------------------------------------+<br>       SQL&gt;</pre><p>Note: Make sure firewall ports are open and policies are allowed to make the DB connectivity without any issues.</p><p><strong>Step 6 : </strong>Once the DB connectivity is checked, apply the MSSQL template to monitored host and fill the necessary macros values like<strong> </strong>{$MSSQL.DSN} , {$MSSQL.PASSWORD} , {$MSSQL.USER} , {$MSSQL.PORT}.</p><p>Link To Download the MSSQL DB Template: <a href="https://github.com/pawaramit1423/Zabbix-Templates">pawaramit1423/Zabbix-Templates (github.com)</a></p><p>Once the template is applied and filled in the required macros, check the latest data on the Zabbix application for real-time data validation.</p><h3><strong>Reference</strong></h3><p>Zabbix Documentation: <a href="https://www.zabbix.com/integrations/mssql">https://www.zabbix.com/integrations/mssql</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dffd1f5b0f0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Remote Script or Remote Command Execution With Zabbix Agent2]]></title>
            <link>https://medium.com/@amit61508/remote-script-or-remote-command-execution-with-zabbix-agent2-2cd148a2179d?source=rss-e0a4a47aa89d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2cd148a2179d</guid>
            <category><![CDATA[monitoring-software]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[devops-tool]]></category>
            <category><![CDATA[remote-command-execution]]></category>
            <category><![CDATA[zabbix]]></category>
            <dc:creator><![CDATA[amit pawar]]></dc:creator>
            <pubDate>Thu, 15 Sep 2022 10:56:22 GMT</pubDate>
            <atom:updated>2022-09-15T11:05:00.254Z</atom:updated>
            <content:encoded><![CDATA[<p>Date: 15/09/2022</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TJGMGtdQjQnC1Rq8Eku0fg.jpeg" /></figure><h3><strong>Purpose</strong></h3><p>Ever thought of executing the remote scripts or remote system command on the client monitored host with Zabbix Agent, once the zabbix trigger the alert event when services were down? few months back, I was working on the one task which was application team want to execute the script immediatly on the monitored host once the monitoring application is not responding. So it will automatically execute the script without any human intervention and send the report to the respective team over the email.</p><p>This article describe how to setup the remote command or remote scripts execution on the remote server with Zabbix Agent2.</p><p>With remote command feature we can execute the commands or the scripts automatically on the monitored host upon some defined condition in the trigger action.</p><p>Some of the features you can try:</p><ul><li>Automatically restart some application (web server, middleware, CRM) if it does not respond</li><li>Use IPMI ‘reboot’ command to reboot some remote server if it does not answer requests</li><li>Automatically free disk space (removing older files, cleaning /tmp) if running out of disk space</li><li>Migrate a VM from one physical box to another depending on the CPU load</li><li>Add new nodes to a cloud environment upon insufficient CPU (disk, memory, whatever) resources</li><li>Send the Error logs report to application team once they identified the flaws in the monitoring system.</li><li>Send the zabbix logs to Application team once the agent down on the monitored host.</li></ul><p>See also for more details<a href="https://www.zabbix.com/documentation/6.0/en/manual/config/notifications/action/operation/remote_command"><em> : Zabbix Documentation</em></a></p><h3>Prerequisites</h3><ul><li>Zabbix Tool Intermediate Knowledge.</li><li>Knowledge of Shell/Python Scripting and Linux Commands.</li><li>Firewall or Network Security</li></ul><h3><strong>Access Permissions</strong></h3><p>Make sure that the ‘zabbix’ user has execute permissions for configured commands.</p><p>For Example,<br>If zabbix want to execute the <em>Oracle</em> user commands then <em>Zabbix</em> should have the required permission (i.e Either <em>zabbix</em> user is able switch to <em>Oracle</em> user without prompting for the password). If some commands having the pervilaged access like root, zabbix user should have the sudo access with no password to execute those previlaged commands. (Note : Make necessary changes into the sudoers file)</p><p>For Example,</p><blockquote># visudo</blockquote><blockquote># allows ‘zabbix’ user to run all commands without password.<br> zabbix ALL=NOPASSWD: ALL<br> <br> # allows ‘zabbix’ user to restart apache without password.<br> zabbix ALL=NOPASSWD: /etc/init.d/apache restart</blockquote><h3><strong>Implementation</strong></h3><p><strong>Step 1 </strong>: Make sure you have onbaorded the host on zabbix application. Install the zabbix agent2 on the monitored host and validate the agent running status.</p><blockquote># To Check the Status for the Zabbix Agent2<br><strong>sudo systemctl status zabbix-agent2.service</strong></blockquote><p><strong>Step 2 :</strong> Make the required changes into Zabbix Agent2 Configuation file.</p><p>Both on Zabbix agent and Zabbix proxy remote scripts are disabled by default. They can be enabled by:</p><blockquote>#Agent Configuration file path<br><strong>$ /etc/zabbix/zabbix_agent2.conf</strong></blockquote><ul><li>Enable logging of Executed shell command plugin to see the remote command execution logs</li></ul><blockquote><strong>Plugins.SystemRun.LogRemoteCommands=1</strong></blockquote><ul><li>Add the below parameter in the agent configuration file</li></ul><blockquote><strong>AllowKey=system.run[*]</strong></blockquote><blockquote><strong>Attention</strong> : Remote commands do not work with <strong>active Zabbix agents</strong>.</blockquote><p><strong>Step 3 :</strong></p><p>In the<strong> <em>Administration → Scripts</em></strong> section, we can configured and list out the user-defined global scripts.</p><p>The scripts are executed on Zabbix agent, Zabbix server (proxy) or Zabbix server only. See also For more details <a href="https://www.zabbix.com/documentation/6.0/en/manual/web_interface/frontend_sections/administration/scripts?hl=Scripts%2Cglobal%2Cscripts%2CGlobal"><em>: Zabbix Documentation</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AYc_IZx45hf5XqhtxcqJfA.png" /><figcaption><strong>Source : </strong><a href="https://www.zabbix.com/documentation/6.0/en/manual/web_interface/frontend_sections/administration/scripts?hl=Scripts%2Cglobal%2Cscripts%2CGlobal"><strong>Zabbix Document</strong></a></figcaption></figure><h4>Configuring a global script</h4><p>In the <em>Scope field, </em>We can click on Action operation to perform the script execution on the selected event source like tigger, discovery, autoregistration, internal actions etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*t9fL2cHlIhx6KrjOyZTh8g.png" /><figcaption><strong>Source : </strong><a href="https://www.zabbix.com/documentation/6.0/en/manual/web_interface/frontend_sections/administration/scripts?hl=Scripts%2Cglobal%2Cscripts%2CGlobal"><strong>Zabbix Document</strong></a></figcaption></figure><p><strong>Step 4 : </strong>Setup the trigger Action to execute the global script (i.e Restart webserver) on the monitored host immediatly, once the apache service is down and event is triggered.</p><p>when configuring a new action in <strong><em>Configuration → Actions</em>:<br></strong>Define the appropriate conditions. In this example, set that the action is activated upon any disaster severity problems with one of Apache applications and operation which is going to perform is <strong><em>“Restart webserver”.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*DV_x4up5ewte8TMihlPsaA.png" /><figcaption><strong>Source : </strong><a href="https://www.zabbix.com/documentation/6.0/en/manual/config/notifications/action/operation/remote_command"><strong>Zabbix Document</strong></a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/234/1*5ajDflaj7cvOsQ080nCLZA.png" /><figcaption><strong>Source : </strong><a href="https://www.zabbix.com/documentation/6.0/en/manual/config/notifications/action/operation/remote_command"><strong>Zabbix Document</strong></a></figcaption></figure><p><strong>Step 5 : </strong>We can validate wheather script or remote command is exceuted successfully on the client server by validating the zabbix agent logs on the server.</p><blockquote><strong>tail -10 /etc/zabbix/zabbix_agent2.logs | grep -i system.run</strong></blockquote><p>For more information and you want to read about the more features or processes See also <a href="https://www.zabbix.com/documentation/6.0/en/manual/"><strong><em>zabbix documentation</em></strong></a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cd148a2179d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>