Search This Blog

Showing posts with label Free. Show all posts
Showing posts with label Free. Show all posts

Tuesday, October 1, 2024

Oracle Linux and MySQL, Kafka and Python Flask Monitoring API

In this entry we will dig deeper into the previous post that dealt with invoking an Oracle MySQL stored procedure using Python. The focus of this entry is creating a Python API to monitor Kafka and MySQL running on an Oracle Linux VM. This API can be invoked from a User Interface that will allow the user to check the statuses of these different components.

To create a Python API that will execute the commands on your Oracle Linux or RHEL system to check the status of MySQL, Zookeeper, and Kafka, you can use the subprocess module in Python to run shell commands. 

Below is an example of how you can implement this.

Step-by-Step Implementation:

  • Create Python Functions to Check Status: Each function will execute the corresponding system command using subprocess.run and return the output.
  • Set Up Flask API: We'll use Flask to create a simple API that the UI can call to retrieve the status.

Python Code:

import subprocess
from flask import Flask, jsonify
app = Flask(__name__)

# Function to check MySQL status
def check_mysql_status():
try:
result = subprocess.run(['sudo', 'systemctl', 'status', 'mysqld'], capture_output=True, text=True)
return result.stdout
except subprocess.CalledProcessError as e:
return str(e)

# Function to check Zookeeper status
def check_zookeeper_status():
try:
result = subprocess.run(['sudo', 'systemctl', 'status', 'zookeeper'], capture_output=True, text=True)
return result.stdout
except subprocess.CalledProcessError as e:
return str(e)

# Function to check Kafka status
def check_kafka_status():
try:
result = subprocess.run(['sudo', 'systemctl', 'status', 'kafka'], capture_output=True, text=True)
return result.stdout
except subprocess.CalledProcessError as e:
return str(e)

# Flask API route to get MySQL status
@app.route('/status/mysql', methods=['GET'])
def get_mysql_status():
status = check_mysql_status()
return jsonify({'service': 'MySQL', 'status': status})

# Flask API route to get Zookeeper status
@app.route('/status/zookeeper', methods=['GET'])
def get_zookeeper_status():
status = check_zookeeper_status()
return jsonify({'service': 'Zookeeper', 'status': status})

# Flask API route to get Kafka status
@app.route('/status/kafka', methods=['GET'])
def get_kafka_status():
status = check_kafka_status()
return jsonify({'service': 'Kafka', 'status': status})

if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000)


Explanation:

  • subprocess.run: Executes the systemctl commands to check the status of MySQL, Zookeeper, and Kafka. The capture_output=True argument captures the output, while text=True ensures the output is returned as a string.
  • Flask: Provides an API endpoint for each service, which the UI can call to check the respective statuses.
  • Routes: Each API route (/status/mysql, /status/zookeeper, /status/kafka) responds to a GET request and returns the status of the requested service in JSON format.


Running the API:

To run the Flask API, ensure Flask is installed:

pip install Flask

To Start the Application:

python your_script_name.py


Creating the UI:

For the UI, you can use any front-end technology (HTML, React, etc.) and have buttons that call these API endpoints to display the status of each service.

For example:
  • A button for MySQL could call /status/mysql.
  • A button for Kafka could call /status/kafka.
  • A button for Zookeeper could call /status/zookeeper.
Note on Permissions:

Ensure that the user running the Python script has the appropriate permissions to run the systemctl commands using sudo. You may need to modify the sudoers file to allow passwordless sudo for these commands.

Tuesday, April 25, 2023

Low Code Development and Oracle APEX

Low code development is in fashion, and there's many offerings in the market that allow the power of low code development to be unlocked by the enterprise. The allure of low code is the time to market, where solutions, particularly web apps, can be quickly created by following a wizard, and can really be done by non-developers or "citizen" developers. Due to its benefits, many companies have adopted a low code strategy to supplement their existing software engineering offerings, where possible, specially where subject matter experts in the business could leverage low code in a self-service capacity, if the requirements aren't too complex.

Oracle APEX is available at no extra cost with your Oracle database, additionally, if you have an Autonomous database (in OCI), APEX (and ORDS - Oracle Rest Data services), already comes available and enabled in the autonomous databases. This allows you to create applications very quickly on top of the data you already have in your database, minimizing data movement, simplifying security and support, and more. For more information regarding APEX, and to try it for free, you can visit https://apex.oracle.com/en/.

I have observed where companies, who already own Oracle Database licenses and have a large footprint in the space, bypass Oracle APEX and jump on paid low code offerings from other vendors, and whereas this post will not focus heavily on what Oracle APEX is, because it's very well documented as it has been around for over 20 years already, there's definitely content that those trying to jump on APEX or even experienced users may not be aware of, and will be shared here.

The APEX Product Managers are Jayson Hanes and Monica Godoy, you can find them on LinkedIn and follow them for news, etc.


Below you will find information about the APEX Roadmap, training, events, and more:

  1. APEX 23.1 is out, the feature set can be viewed at https://apex.oracle.com/en/platform/features/whats-new-231/.
  2. Past Roadmap and Upcoming Road (see Appendix A)
  3. Training and Certifications (see Appendix B)
  4. Events calendar for APEX: https://apex.oracle.com/pls/apex/r/grand_prix/apex-events/events?session=6298691857842
  5. APEX Office Hours with Oracle (see Appendix C)
  6. APEX Idea Lab (Different from the Cloud Customer Connect Idea Lab) (see Appendix D)
  7. Cost model in OCI (see Appendix E)
Appendix A (Roadmaps)

Past Roadmap:



Upcoming Roadmap (Post 23.1):



Appendix B (Training)

You can try APEX for free at: https://apex.oracle.com/en/

There’s also professional training available, as seen below.


Appendix C (Office Hours)


Appendix D (Ideas)


Appendix E (OCI Cost)


If you own Oracle Databases and want a low code solution that uses data from your Oracle databases primarily (although APEX can connect to other sources via API's and "DB Links"), then APEX is truly your best bet, among all the low code solutions.

Monday, June 1, 2020

Oracle Cloud Free Training and Resources

As a young professional entering the market, knowing as much as you can about the Oracle Cloud products is a must, and as a seasoned professional that is recently transitioning into Cloud Products, or wants to transition, you also have the same need. Oracle's shift to the Cloud has been very intentional and we have to stay ahead.

To that end, I have consolidated my favorite FREE training and knowledge resources around Oracle's Cloud Products and I wanted to share them with you. I wrote about it on LinkedIn, the link is below!

#oraclecloud #emergingleaders #educationmatters

Check out my latest article: Oracle Cloud Free Training and Resources https://lnkd.in/ecVf94s via @LinkedIn

Monday, May 25, 2020

Oracle Cloud Development for Free!


Let's explore some Oracle Cloud Development capabilities! Some of which are free! I will cover the OCI Marketplace and Free Offerings there in a separate post, but there's an introduction to it at the end of this article. hashtag#oci hashtag#oracle hashtag#clouddevelopment hashtag#oraclecloud hashtag#backendwebdevelopment




I wrote this blog post in LinkedIn, so go to the link below to read it:

https://www.linkedin.com/pulse/oracle-cloud-development-free-julio-lois/