MarcusOngKianSiong / Cartrack-internship

A document containing output I produced during my time here
0 stars 0 forks source link

Not knowing what visualization I am suppose to create #2

Open MarcusOngKianSiong opened 1 month ago

MarcusOngKianSiong commented 1 month ago

The hint

image

MarcusOngKianSiong commented 1 month ago

Attempting to pinpoint directions using the model

  1. squeeze_bi_sense_live_geofence_location job failed 3 times in a row.
  2. squeeze terminal status job failed
  3. nightly pre-proc job failed
  4. dlt add masterlist preproc job failed

application stat fuel alerts:

  1. Application stopped schedule confirmation fitment SMS dbobserver.
  2. Application stopped thailand fitment reminder: dbobserver.

Key words analysis:

Key words:

Converting to specific computing aspects they observe

  1. Business logic used

Understanding the structure of the monitoring tool

Time Status Host Problem

NOTE: THE GOAL IS TO IMPLEMENT A "LEGIT" SYSTEM THAT LOOKS LIKE WHAT THEY HAVE. THE PROBLEM IS THAT THEY ARE MONITORING THINGS THAT ARE BEYOND THE SCOPE OF MY PROJECT. FOR EXAMPLE, THEY ARE MONITORING THE BUSINESS LOGIC (dbobserver), WHICH REQUIRE THE DIRECT MONITORING OF THE CODE BASE (I THINK). MY CODE BASE IS SIMPLE AS I AM JUST CONNECTING THINGS AND MAKING SURE THEY FLOW SMOOTHLY.

I think I will use my own needs as the basis for determining the dashboard needs.

MarcusOngKianSiong commented 1 month ago

Creating my own direction using my own needs

Query: What would I want to know in my system?

I am always worried that some link in the system breaks

I am worried that some components suddenly fail to work when I did not change anything beyond a specific supposed safe area (e.g. https://github.com/MarcusOngKianSiong/personal_website_backend_python/issues/3).

What are some painpoints I face when maintaining the system?

  1. Can I get data from the API
  2. Can I get data from a specific route
  3. Can the broker receive data or not?
  4. Can the apache receive data?
  5. ✅ Can I get data from the database?

    ✅ Is the database running? ✅ Can I reach the port the database is listening to? ✅ Is the port attached to the database?

Visualisation: Can I get data from the database?

Curate a list of item checklist, and specify last checked detail.

Revised direction:

  1. Focus on the database and what you want to know in the database.
  2. What are some things that must not happen in a system?
    • Must not go down
      • CPU limits:
      • Ram?
      • available storage
MarcusOngKianSiong commented 1 month ago

Current problem: making zabbix agent able to see the output of lsof -i :5433 command.

❌ Potential Cause 1: I think it is the file permission issue

On the database VM OS, I run the command as a root and as marcus user. The former produced the desired output. The latter produces nothing (empty).

"other directives"

Efficiency: It is likely that I need to change permissions a lot. I cannot remember the exact commands and have to ask the chatbot, which is slow. I need to contextualise the commands, as I remember what I create much better.

Create an executable script that can

  1. ✅ Create groups: [x] group create <group name>
  2. ✅ Attach groups to files: [x] attach group <group name> <file path>
  3. ✅ Add users to groups: [x] group add <group name> <user name>
  4. Change group permission for that file
  5. Remove group
  6. ✅ List groups in table format: [x] show groups

Knowledge used

  1. Only one user AND one group can own a file at a time

✅ Stumbled upon a solution

Chaining commands, and have the next command read stdin

cmd: echo <password> | sudo -S lsof -i :5433 image

Appendix

  1. The item I am trying to create

    image

  2. The current output in zabbix front end

    image

  3. Output I need

    image

MarcusOngKianSiong commented 1 month ago

Zabbix mechanics

How to make it such that I can modify the data obtained by the item?

Use preprocessing tab in the item

How to get data directly from commands?

system.run[<command here>]

When using commands directly, how to fulfil the password requirement? Chaining: echo "<password>" | <command> -S <others>

How to directly get data from the database through a remote connection (not using the zabbix agent to help you)?

  1. You need the middleman between driver and the application: unixodbc

    An intermediary between database drivers and applications.

    Component files:

    • File that defines ODBC drivers: odbcinst.ini

      A list of database drivers in the system.

    • File that defines data sources: odbc.ini

      A list of data sources, OR CAN BE DEFINED AS a list with each containing details required to concretely establish a connection with a specific database (e.g. hostname, port).

    Relations:

    odbcinst.ini specifies all the database drivers that is available in the system, and odbc.ini uses the defined drivers specified in odbcinst.ini to create connections with the database.

    • Data sources:
  2. Database driver: postgresql-odbc
    • Uses ODBC protocol (Can it be used across networks or is it only for local connections?), which is the standard API for accessing database management systems.
  3. Understand db.odbc.select parameters
    1. db.odbc.select: Perform queries using ODBC connections (Open Database Connectivity)
MarcusOngKianSiong commented 1 month ago

Current problem: Trying to make Zabbix get value from the database through the remote connection

Not through zabbix agent, since the goal is to validate the certainty of the remote connection.

Problem 1: No database monitoring tool

Need to download the required package.

Problem 2:

Cannot connect to ODBC DSN: [SQL_ERROR]:[08001][101][[unixODBC]connection to server on socket "/run/postgresql/.s.PGSQL.5433" failed: No such file or directory Is the server runni] Analysis

Appendix

MarcusOngKianSiong commented 1 month ago

Problem: The out of scope error coming in to derail me.

I need to learn how to configure widgets in Zabbix to properly display the items I configured ( check database reachability). But the the server produced an error (error 500), and now I am pushed away from the main path, towards a side path, where the goal is to try and get back on the main path.

I felt like this is a repeat of another previously encountered problem: https://github.com/MarcusOngKianSiong/personal_website_backend_python/issues/3

Sudden error 500 when configuring widgets in zabbix.

image

It is like the web browser cannot reach it.

Information gathering:

  1. What does error 500 http mean?

    The client application gets an HTTP status code of 500 with the message Internal Server Error as a response for API calls.

    The HTTP status code 500 is a generic error response. It means that the server encountered an unexpected condition that prevented it from fulfilling the request. This error is usually returned by the server when no other error code is suitable.

The hints:

  1. I was in the middle of adding code to create a widget that it failed.
  2. Error log in NGINX stated this file as the source:

    2024/10/21 15:05:27 [error] 19454#19454: *68 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Class "Modules\LessonGaugeChart\Includes\CWidgetFieldTextBox" not found in /usr/share/zabbix/modules/test/includes/WidgetForm.php:14

  3. I tried making a request using nc command and Invoke-WebRequest, and it worked

    I can see the html in the content of the response. I can even put that into a html file and display it.

After I deleted the test directory inside /usr/share/zabbix/modules, it suddenly worked again.

What other problems will I face? No items are gathering data.

Error: cannot find modules/test

When I added back test directory with the manifest.json file with some configuration specifications, the error disappeared, and I can collect item data once again. Based on ChatGPT, when you "run" the widget, it becomes stored in the database.