التركيب
المتطلبات الأساسية
يلزم وجود قاعدة بيانات PostgreSQL مع مستخدم مسموح له بتعديل كائنات قاعدة البيانات. يجب تثبيت غلاف البيانات الخارجية على نفس مثيل الخادم الذي يعمل عليه خادم قاعدة البيانات.
يرجى الاحتفاظ بالدليل الافتراضي PG_HOME في /var/lib/pgsql وتجنب نقله. كما يجب عدم إنشاء نقاط تثبيت إضافية داخل هذا الدليل (على سبيل المثال، تثبيت /var/lib/pgsql/17/data من جهاز مختلف). قد يؤدي تغيير التخطيط بهذه الطريقة إلى تعقيد عمليات ترقية PostgreSQL المستقبلية بشكل كبير. بدلاً من ذلك، قم بتثبيت /var/lib/pgsql مباشرة من جهاز آخر أو استخدم مساحات جداول إضافية كما هو موضح أدناه.
مثال: إنشاء قاعدة بيانات infosim مملوكة للدور infosim:
export DB_NAME=infosim
mkdir -p /var/lib/pgsql/custom/user_tblspc/${DB_NAME}_tblspc/tab_space/${DB_NAME} \
/var/lib/pgsql/custom/user_tblspc/${DB_NAME}_tblspc/idx_space/${DB_NAME} && \
chown -R postgres:postgres /var/lib/pgsql/custom/user_tblspc
psql -Upostgres -c "CREATE ROLE $DB_NAME WITH LOGIN PASSWORD '$DB_NAME';"
psql -Upostgres -c "CREATE TABLESPACE ${DB_NAME}_tab OWNER $DB_NAME \
LOCATION '/var/lib/pgsql/custom/user_tblspc/${DB_NAME}_tblspc/tab_space/$DB_NAME';"
psql -Upostgres -c "CREATE TABLESPACE ${DB_NAME}_idx OWNER $DB_NAME \
LOCATION '/var/lib/pgsql/custom/user_tblspc/${DB_NAME}_tblspc/idx_space/$DB_NAME';"
psql -Upostgres -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_NAME TEMPLATE template0 \
TABLESPACE ${DB_NAME}_tab ENCODING 'UTF8' LC_COLLATE 'de_CH.UTF-8' LC_CTYPE 'de_CH.UTF-8';"
التثبيت القياسي
تثبيت RPM من مستودع SKOOR
إذا كان يجب تثبيت StableNet FDW لإصدار رئيسي معين من SKOOR (على سبيل المثال 8)، فاستخدم
dnf install "eranger-stablenet-fdw-8.*"
وإلا استخدم
dnf install "eranger-stablenet-fdw"
التكوين
بعد تغيير التكوين، يجب إعادة تشغيل خادم PostgreSQL.
systemctl restart postgresql-17
ملف التكوين
/etc/stablenet-fdw/stablenet-fdw.conf
التكوين الأدنى
يجب ضبط الإعدادات التالية للحصول على تثبيت فعال.
[global]
default_user =
# Default user name for the StableNet® API.
# This is used in case no authorization
# is provided by the SQL client.
default_password =
# Default password for the StableNet® API.
# This is used in case no authorization
# is provided by the SQL client.
تتطلب بعض إصدارات Oracle القديمة تثبيت مكتبة عميل Oracle على النظام. قم بتثبيتها باستخدام أحدث أداة تثبيت Oracle Instant Client وقم بتكوين المسار
#oracle_client_lib_dir =
# Path to the Oracle client library directory.
# This is used to load the Oracle client library
# for the Oracle database connection.
# If omitted, the thin client is used which might have
# problems connectiong to older Oracle databases.
[webservice] # use te form werbservice_<server_id>
# to configure multiple StableNet® servers
# (see below).
url =
# URL of the StableNet® API
# Usually something like https://<stablenet-host>:5443/api/1
database_connection =
# Connection string to the StableNet® database.
# This is used for the measurement data sync.
# The connection string must be in the format:
# MySQL: mysql+pymysql://<user>:<password>@<host>:3306/<database>
# Oracle: oracle+oracledb://<user>:<password>@<host>:1521/?service_name=<service>
# Connection info can be found on the StableNet server in
# /opt/stablenet/snmw/wildfly/standalone/configuration/standalone.xml (<datasources>).
# It's usually a good idea to use a different user and service than the one used by StableNet.
تصفية القياسات / المقاييس
للحد من كمية البيانات التي يجب مزامنتها من قاعدة بيانات StableNet، قد يكون من المفيد تكوين بعض المرشحات أو تعطيل بعض أنواع القياس تمامًا.
#sync_ping_data = true
# Sync ping measurement data from the StableNet® database.
# Defaults to true.
#sync_snmp_data = true
# Sync SNMP measurement data from the StableNet® database.
# Defaults to true.
#sync_usrscript_data = true
# Sync usrscript measurement data from the StableNet® database.
# Defaults to true.
#sync_external_data = true
# Sync external measurement data from the StableNet® database.
#sync_derived_data = false
# Sync derived measurement data from the StableNet® database.
#ping_measurement_filter =
# Filter for the ping measurement.
#snmp_measurement_filter =
# Filter for the SNMP measurement.
#snmp_indexes =
# List of SNMP indexes to be used for the SNMP measurement.
# This is the number part of the metric key, e.g. #1234 -> 1234
#snmp_state_agg_measurements =
# Comma separated list of template name / metric_key pairs of measurements
# which should have state aggregation enabled.
# Example: Interface Relative IPMPLS 64Bit#1234,template2#5678
#usrscript_measurement_filter =
# Filter for the usrscript measurement.
#usrscript_indexes =
# List of usrscript indexes to be used for the usrscript measurement.
# This is the number part of the metric key, e.g. #1234 -> 1234
#usrscript_state_agg_measurements =
# Comma separated list of template name / metric_key pairs of measurements
# which should have state aggregation enabled.
# Example: Interface Relative IPMPLS 64Bit#1234,template2#5678
#external_measurement_filter =
# Filter for the external measurement.
#external_indexes =
# List of external indexes to be used for the external measurement.
# This is the number part of the metric key, e.g. #1234 -> 1234
#external_state_agg_measurements =
# Comma separated list of template name / metric_key pairs of measurements
# which should have state aggregation enabled.
# Example: Y.1731#1234,template2#5678
#derived_measurement_filter =
# Filter for the derived measurement.
#derived_indexes =
# List of derived indexes to be used for the derived measurement.
# This is the number part of the metric key, e.g. #1234 -> 1234
#derived_state_agg_measurements =
# Comma separated list of template name / metric_key pairs of measurements
# which should have state aggregation enabled.
# Example: Y.1731#1234,template2#5678
سياسات الاحتفاظ
يمكن تكوين مدة تخزين البيانات لكل تجميع.
[retention_days]
#raw = 1
#minutely = 1
#5_minutely = 14
#15_minutely = 31
# ~1 month
#hourly = 93
# ~3 months
#daily = 365
# ~1 years
#weekly = 365
# ~1 years
#monthly = 1825
# ~5 years
#quarterly = 1825
# ~5 years
#yearly = 3650
# ~10 years
الإعدادات المتقدمة
هناك العديد من الخيارات الأخرى التي يمكن استخدامها لضبط StableNet FDW بدقة. يتم وصف هذه الإعدادات في ملف التكوين مباشرةً.
استخدام متغيرات البيئة
يمكن أيضًا توفير الخيارات عن طريق متغيرات البيئة باستخدام البادئة STABLENET_FDW_WEBSERVICE_ واسم الخيار بأحرف كبيرة (على سبيل المثال STABLENET_FDW_WEBSERVICE_URL). بالنسبة لإعدادات global، يجب حذف GLOBAL من مفتاح ENV (على سبيل المثال STABLENET_FDW_DEFAULT_USER ).
url هو عنوان URL الأساسي لخدمة الويب StableNet® API. وعادةً ما يكون على الشكل https://<host>:5443/api/1.
خوادم StableNet متعددة
يمكن تعريف مثيلات StableNet® متعددة باستخدام أقسام webservice متعددة مع لاحقات server_id فريدة. يتم استخدام server_id كمعرف داخلي للحصول على سلسلة التفويض المطابقة من SKOOR Auth على سبيل المثال. يجب تعيين server_name مناسب يستخدم لتعريف الخادم في الجداول الخارجية والمجمعة. يمكن أيضًا تكوين هذا باستخدام متغيرات البيئة (على سبيل المثال STABLENET_FDW_WEBSERVICE_URL_TEST ، STABLENET_FDW_WEBSERVICE_SERVER_NAME_TEST).
[webservice_production] server_name = Production Server url = https://stablenet.prod:5443/api/1 database_connection = ... [webservice_staging] server_name = Staging Server url = https://stablenet.staging:5443/api/1 database_connection = ...
المدخل المقابل في SKOOR Auth (/etc/opt/eranger/eranger-auth.conf)
[provider.1] type = stablenet name = StableNet® webservice_url_production = https://stablenet.prod:5443/api/1 webservice_url_staging = https://stablenet.staging:5443/api/1
تهيئة الجداول الخارجية
تهيئة الجداول الخارجية التي يحتاجها غلاف البيانات الخارجية.
/opt/stablenet-fdw/init-foreign-tables.sh -h <host> -p <port> -d <database> -U <user> -o <owner>
على سبيل المثال
/opt/stablenet-fdw/init-foreign-tables.sh -U postgres -h localhost -p 5432 -d infosim -o infosim
يجب تنفيذ هذا الأمر بعد كل تحديث لـ eranger-stablenet-fdw للحصول على تعريفات الجداول الجديدة.
اختبار الاتصال
psql -h localhost -p 5432 -U infosim -d infosim -c "SELECT * from stablenet.stablenet_info;"
يجب أن يعرض هذا عدد الأجهزة في مثيل StableNet® المتصل.