LazarenkoA / prometheus_1C_exporter

Мониторинг кластера 1С, отправка данных в prometheus
Mozilla Public License 2.0
130 stars 35 forks source link

Не стартует экспортер под линукс ubuntu20.04 #36

Closed mvbelik closed 1 year ago

mvbelik commented 1 year ago

Сам сервер и база находятся в докере, при старте экспортера получаю в статусе такое:

`1c_exporter.service - Prometheus 1C exporter Loaded: loaded (/etc/systemd/system/1c_exporter.service; disabled; vendor preset: enabled) Active: failed (Result: exit-code) since Fri 2023-11-10 05:53:16 UTC; 7min ago Process: 2140480 ExecStart=/usr/local/bin/1c_exporter --settings=/opt/1cexporter/settings.yaml (code=exited, status=2) Main PID: 2140480 (code=exited, status=2)

Nov 10 05:53:16 1c-server-stage-ams3 1c_exporter[2140480]: github.com/LazarenkoA/prometheus_1C_exporter/explorers.(ExplorerConnects).StartExplore.func1(0xc0002961c0, {0xc0000c0270, 0x14}) Nov 10 05:53:16 1c-server-stage-ams3 1c_exporter[2140480]: /home/runner/work/prometheus_1C_exporter/prometheus_1C_exporter/explorers/Connects.go:68 +0x103 Nov 10 05:53:16 1c-server-stage-ams3 1c_exporter[2140480]: github.com/LazarenkoA/prometheus_1C_exporter/explorers.(ExplorerConnects).StartExplore(0xc0002961c0) Nov 10 05:53:16 1c-server-stage-ams3 1c_exporter[2140480]: /home/runner/work/prometheus_1C_exporter/prometheus_1C_exporter/explorers/Connects.go:86 +0x2c7 Nov 10 05:53:16 1c-server-stage-ams3 1c_exporter[2140480]: github.com/LazarenkoA/prometheus_1C_exporter/explorers.(*BaseExplorer).Start(0xc0002961c0, {0x7f588c69aa10, 0xc0002961c0}) Nov 10 05:53:16 1c-server-stage-ams3 1c_exporter[2140480]: /home/runner/work/prometheus_1C_exporter/prometheus_1C_exporter/explorers/BaseExplorer.go:158 +0x135 Nov 10 05:53:16 1c-server-stage-ams3 1c_exporter[2140480]: created by main.main.func1 Nov 10 05:53:16 1c-server-stage-ams3 1c_exporter[2140480]: /home/runner/work/prometheus_1C_exporter/prometheus_1C_exporter/main.go:66 +0x139 Nov 10 05:53:16 1c-server-stage-ams3 systemd[1]: 1c_exporter.service: Main process exited, code=exited, status=2/INVALIDARGUMENT Nov 10 05:53:16 1c-server-stage-ams3 systemd[1]: 1c_exporter.service: Failed with result 'exit-code'.`

Настройки:

`Explorers:

http сервис который возвращает массив json с кредами к БД

нужно для метрики SheduleJob

пример json:

[

{

"Name": "hrmcorp-n17",

"UserName": "",

"UserPass": ""

}

]

DBCredentials: # Не обязательный параметр

URL: http://ca-fr-web-1/fresh/int/sm/hs/PTG_SysExchange/GetDatabase

User: ""

Password: ""

TLSSkipVerify: true # если true при обращении к сервису будут игнорироваться ошибки проверки сертификата

RAC:

Path: "C:\Program Files\1cv8\8.3.21.1644\bin\rac.exe"

Port: "1545" # Не обязательный параметр

Host: "localhost" # Не обязательный параметр

Login: "" # Не обязательный параметр

Pass: "" # Не обязательный параметр

LogDir: "/var/log/1cexporter/" LogLevel: 5`

Systemd Unit: `[Unit] Description=Prometheus 1C exporter After=local-fs.target network-online.target network.target Wants=local-fs.target network-online.target network.target

[Service] Type=simple ExecStart=/usr/local/bin/1c_exporter --settings=/opt/1cexporter/settings.yaml ExecReload=/bin/kill -s HUP $MAINPID

[Install] WantedBy=multi-user.target`

LazarenkoA commented 1 year ago

какую версию экспортера используете, приложите логи экспортера

mvbelik commented 1 year ago

Release v1.4.31 latest {"L":"DEBUG","T":"2023-11-10T05:53:16.373Z","N":"ClientLic","M":"Создание объекта"} {"L":"DEBUG","T":"2023-11-10T05:53:16.373Z","N":"AvailablePerformance","M":"Создание объекта"} {"L":"DEBUG","T":"2023-11-10T05:53:16.373Z","N":"SheduleJob","M":"Создание объекта"} {"L":"DEBUG","T":"2023-11-10T05:53:16.373Z","N":"Session","M":"Создание объекта"} {"L":"DEBUG","T":"2023-11-10T05:53:16.373Z","N":"Connect","M":"Создание объекта"} {"L":"DEBUG","T":"2023-11-10T05:53:16.373Z","N":"SessionsData","M":"Создание объекта"} {"L":"DEBUG","T":"2023-11-10T05:53:16.373Z","N":"ProcData","M":"Создание объекта"} {"L":"DEBUG","T":"2023-11-10T05:53:16.373Z","N":"CPU","M":"Создание объекта"} {"L":"DEBUG","T":"2023-11-10T05:53:16.373Z","N":"disk","M":"Создание объекта"} {"L":"INFO","T":"2023-11-10T05:53:16.373Z","M":"Сбор метрик: ClientLic,SheduleJob,Connect,ProcData,AvailablePerformance,CPU,disk,Session,SessionsData"} {"L":"DEBUG","T":"2023-11-10T05:53:16.373Z","M":"Start","delay":60} {"L":"DEBUG","T":"2023-11-10T05:53:16.373Z","M":"Старт итерации таймера"}

LazarenkoA commented 1 year ago

это точно весь лог?

mvbelik commented 1 year ago

Да, при запуске крашится, в systemctl status ошибки по go, в первом сообщении

LazarenkoA commented 1 year ago

а если запускать не как systemd юнит, а просто в консоли?

mvbelik commented 1 year ago

Если в консоли: ./1c_exporter --settings=/opt/1cexporter/settings.yaml port : 9091 panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x88f944]

goroutine 52 [running]: github.com/LazarenkoA/prometheus_1C_exporter/settings.(Settings).RAC_Host(0xc000312108?) /home/runner/work/prometheus_1C_exporter/prometheus_1C_exporter/settings/settings.go:103 +0x4 github.com/LazarenkoA/prometheus_1C_exporter/explorers.(ExplorerAvailablePerformance).readData(0xc00036a0b0) /home/runner/work/prometheus_1C_exporter/prometheus_1C_exporter/explorers/AvailablePerformance.go:171 +0x3f github.com/LazarenkoA/prometheus_1C_exporter/explorers.(ExplorerAvailablePerformance).getData(0xc00036a0b0) /home/runner/work/prometheus_1C_exporter/prometheus_1C_exporter/explorers/AvailablePerformance.go:90 +0x55 github.com/LazarenkoA/prometheus_1C_exporter/explorers.(ExplorerAvailablePerformance).StartExplore.func1(0xc00036a0b0) /home/runner/work/prometheus_1C_exporter/prometheus_1C_exporter/explorers/AvailablePerformance.go:63 +0xe7 github.com/LazarenkoA/prometheus_1C_exporter/explorers.(ExplorerAvailablePerformance).StartExplore(0xc00036a0b0) /home/runner/work/prometheus_1C_exporter/prometheus_1C_exporter/explorers/AvailablePerformance.go:76 +0x26b github.com/LazarenkoA/prometheus_1C_exporter/explorers.(BaseExplorer).Start(0xc00036a0b0, {0x7f9f7c0291d0, 0xc00036a0b0}) /home/runner/work/prometheus_1C_exporter/prometheus_1C_exporter/explorers/BaseExplorer.go:158 +0x135 created by main.main.func1 /home/runner/work/prometheus_1C_exporter/prometheus_1C_exporter/main.go:66 +0x139

LazarenkoA commented 1 year ago

так у вас блок RAC в настройках закомментирован. Приложите настройки файлом, а то форматирование поехало