Skip to content

Commit

Permalink
chore(release): v0.1.1
Browse files Browse the repository at this point in the history
build:
- add 7-zip
- add 1m delay to autorun
- import_autostart.cmd
- change build output folder

docs:
- add troubleshooting
- user scripts -> user_scripts
- cherry picked from commit 3b4d451

refactor: move files Zabbix Agent
  • Loading branch information
anklav24 committed Jan 17, 2022
1 parent 3b4d451 commit d3bb7c1
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 20 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ log.txt
venv/
*.spec

hwinfo_api_server/
instance/

.pytest_cache/
Expand Down Expand Up @@ -270,4 +271,7 @@ paket-files/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
*.pyc
!/Zabbix Agent/hwinfo_api_server/
!/Zabbix Agent/hwinfo_api_server.zip
/Zabbix Agent/hwinfo_api_server.zip
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,24 @@

## Installation

### Run HWiNFO API server
### Configure Zabbix-host

- [Download Latest Release](https://github.com/anklav24/remotehwinfo-zabbix-integration/releases/latest/download/hwinfo_api_server.zip)
- Rus as administrator: `.hwinfo_api_server.exe`
- Unzip and copy all files to `Zabbix Agent` folder.
- Run as administrator `task_scheduler/import_autostart.cmd`
- Restart `Zabbix Agent` service.

### Configure Zabbix-host
```
Zabbix Agent/
├── task_scheduler
├── user_scripts
├── user_templates
└── zabbix_agentd.conf.d
```

- Copy `zabbix_agentd.conf.d` to `Zabbix Agent` folder.
- Restart `Zabbix Agent` service.
### Run HWiNFO API server

- Run as administrator: `user_scripts/hwinfo_api_server/hwinfo_api_server.exe`

### Configure Zabbix-server

Expand All @@ -36,16 +45,21 @@

- [Postman with examples](https://www.postman.com/martian-trinity-608894/workspace/postman-examples-public/request/14292201-2ee88739-c654-47c0-99f3-e738500304a8)
- [Get docs: http://localhost:50000](http://localhost:50000)
![](docs/docs_screenshot.png)
![](docs/docs.png)
- ![](docs/zabbix_discovery.png)

## Other

### Troubleshooting:

- Check firewall if you can not access from LAN
- Check tests if you can not get results from API
- If `remotehwinfo.exe` shows and just disappear try to change ports
- run tests ` python -m pytest -v -s`
- Allowed Zabbix key parameters
- Check `Zabbix Agent/zabbix_agentd.log`
- Check log on zabbix-server `docker logs -n 100 -f zabbix-docker-zabbix-server-1`
- In zabbix keys replace `space -> %20` `comma -> %2C`
- Allowed Zabbix key parameters

```bash
Special characters "\, ', ", `, *, ?, [, ], {, }, ~, $, !, &, ;, (, ), <, >, |, #, @, 0x0a" are not allowed in the parameters.
Expand Down Expand Up @@ -76,3 +90,4 @@ Special characters "\, ', ", `, *, ?, [, ], {, }, ~, $, !, &, ;, (, ), <, >, |,
- add args for .exe
- debug
- ports
- add my contacts in the code
Binary file not shown.
4 changes: 4 additions & 0 deletions Zabbix Agent/task_scheduler/import_task_hwinfo_api_server.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@ECHO OFF
cd %~dp0
schtasks /Create /tn "HWiNFO API Server" /XML "Task HWiNFO API Server.xml" /F
timeout /t 5
2 changes: 1 addition & 1 deletion api/third_party/HWiNFO32.INI
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MinimalizeMainWnd=1
MinimalizeSensors=1
MinimalizeSensorsClose=1
ShowWelcomeAndProgress=0
Autorun=1
Autorun=0
OpenSystemSummary=0
AutoUpdateBetaDisable=1
AutoUpdate=0
Expand Down
25 changes: 14 additions & 11 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
taskkill /f /im remotehwinfo.exe
taskkill /f /im HWiNFO32.exe

rm -Recurse -Force .\dist\
rm -Recurse -Force "Zabbix Agent\user_scripts\hwinfo_api_server\"
rm -Recurse -Force "Zabbix Agent\hwinfo_api_server.zip"
rm -Recurse -Force .\build\

pyinstaller.exe --onefile hwinfo_api_server.py --add-data "api/templates;api/templates" --add-data "api/static;api/static" --add-data "api/third_party;api/third_party"
xcopy api\third_party\* dist\api\third_party\* /E/Y
xcopy zabbix_agentd.conf.d\* dist\zabbix_agentd.conf.d\* /E/Y
xcopy tests\* dist\tests\* /E/Y
cp .\README.md .\dist\
pyinstaller.exe --onefile hwinfo_api_server.py --distpath "Zabbix Agent\user_scripts\hwinfo_api_server" --add-data "api/templates;api/templates" --add-data "api/static;api/static" --add-data "api/third_party;api/third_party"
xcopy api\third_party\* "Zabbix Agent\user_scripts\hwinfo_api_server\api\third_party\*" /E/Y
xcopy tests\* "Zabbix Agent\user_scripts\hwinfo_api_server\tests\*" /E/Y

cp .\README.md "Zabbix Agent\user_scripts\hwinfo_api_server\README.md"

rm -Recurse -Force "Zabbix Agent\user_scripts\hwinfo_api_server\api\third_party\process_control.py"
rm -Recurse -Force .\build\
rm -Recurse -Force .\dist\api\third_party\process_control.py
rm -Recurse -Force hwinfo_api_server.spec
rm -Recurse -Force hwinfo_api_server.spec

# Install 7-ZIP and add to environment variables 7z
cd 'Zabbix Agent'
7z a -tzip 'hwinfo_api_server.zip'
cd ..
File renamed without changes
Binary file added docs/zabbix_discovery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d3bb7c1

Please sign in to comment.