parent
cec2e1ba38
commit
93958d0fb0
@ -0,0 +1,20 @@
|
||||
# Same as svn:eol-style=native
|
||||
* text=auto !eol
|
||||
|
||||
# binary is a shorthand for -text -diff
|
||||
*.dll binary
|
||||
*.lib binary
|
||||
*.exe binary
|
||||
*.png binary
|
||||
*.gif binary
|
||||
*.jpg binary
|
||||
*.svg binary
|
||||
*.ico binary
|
||||
*.jar binary
|
||||
*.wav binary
|
||||
*.ttf binary
|
||||
*.ai binary
|
||||
|
||||
/build-backend.xml -text
|
||||
database/elasticsearch/elasticsearch.map -text
|
||||
ui/tests/api_json/data/data_test.sql eol=lf
|
@ -0,0 +1,68 @@
|
||||
name: SonarCloud Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
- "release/*"
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
jobs:
|
||||
|
||||
SonarCloud:
|
||||
name: SonarCloud
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
SONAR_SCANNER_VERSION: 4.7.0.2747
|
||||
SONAR_SERVER_URL: "https://sonarcloud.io"
|
||||
BUILD_WRAPPER_OUT_DIR: $GITHUB_WORKSPACE/build_wrapper_output_directory # Directory where build-wrapper output will be placed
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
|
||||
- name: Download and set up sonar-scanner
|
||||
env:
|
||||
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
|
||||
run: |
|
||||
mkdir -p $HOME/.sonar
|
||||
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
|
||||
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
|
||||
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
|
||||
|
||||
|
||||
- name: Download and compile Zabbix
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libsnmp-dev snmp libopenipmi-dev libevent-dev libcurl4-openssl-dev
|
||||
cd $GITHUB_WORKSPACE
|
||||
sh bootstrap.sh
|
||||
./configure --enable-server --enable-agent --with-postgresql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --enable-proxy --enable-agent2 --enable-java --prefix=$(pwd) --with-openssl
|
||||
make
|
||||
make clean
|
||||
|
||||
- name: Download and set up build-wrapper
|
||||
env:
|
||||
BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip
|
||||
run: |
|
||||
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
|
||||
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
|
||||
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
|
||||
|
||||
- name: Run build-wrapper
|
||||
run: |
|
||||
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make clean all
|
||||
|
||||
- name: Run sonar-scanner
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
run: |
|
||||
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
|
@ -0,0 +1,277 @@
|
||||
!/build/win32/**/Makefile
|
||||
!/build/win64/**/Makefile
|
||||
!/src/modules/dummy/Makefile
|
||||
*.a
|
||||
*.o
|
||||
*.gcda
|
||||
*.gcno
|
||||
/tests_results
|
||||
.cproject
|
||||
.deps
|
||||
.dirstamp
|
||||
.vscode
|
||||
/.buildpath
|
||||
/.idea
|
||||
/.project
|
||||
/.settings
|
||||
/Debug/
|
||||
/GPATH
|
||||
/GRTAGS
|
||||
/GTAGS
|
||||
/aclocal.m4
|
||||
/autom4te.cache
|
||||
/compile
|
||||
/config.guess
|
||||
/config.log
|
||||
/config.status
|
||||
/config.sub
|
||||
/configure
|
||||
/cscope.*
|
||||
/depcomp
|
||||
/install-sh
|
||||
/missing
|
||||
/nbproject
|
||||
/tags
|
||||
/zabbix-*.tar.gz
|
||||
Makefile
|
||||
Makefile.in
|
||||
bin/agent
|
||||
bin/mock_server
|
||||
bin/win32
|
||||
bin/win64
|
||||
bin/zabbix_get
|
||||
bin/zabbix_js
|
||||
bin/zabbix_sender
|
||||
build/win32/examples/zabbix_sender/sender.exe
|
||||
build/win32/examples/zabbix_sender/sender.obj
|
||||
build/win32/project/*.idb
|
||||
build/win32/project/*.manifest
|
||||
build/win32/project/*.pdb
|
||||
build/win32/project/*.res
|
||||
build/win32/project/MSG00001.bin
|
||||
build/win32/project/messages.h
|
||||
build/win32/project/messages.rc
|
||||
build/win32/project/resource.res
|
||||
database/mysql/data.sql
|
||||
database/mysql/schema.sql
|
||||
database/mysql/history_pk_prepare.sql
|
||||
database/oracle/data.sql
|
||||
database/oracle/schema.sql
|
||||
database/oracle/history_pk_prepare.sql
|
||||
database/postgresql/data.sql
|
||||
database/postgresql/schema.sql
|
||||
database/postgresql/timescaledb.sql
|
||||
database/postgresql/history_pk_prepare.sql
|
||||
database/postgresql/tsdb_history_pk_upgrade_*
|
||||
database/sqlite3/data.sql
|
||||
database/sqlite3/schema.sql
|
||||
etc/agent.conf
|
||||
etc/zabbix_agent2.conf
|
||||
etc/zabbix_agentd.conf
|
||||
etc/zabbix_proxy.conf
|
||||
etc/zabbix_server.conf
|
||||
etc/zabbix_web_service.conf
|
||||
etc/zabbix_agent2.d/plugins.d/ceph.conf
|
||||
etc/zabbix_agent2.d/plugins.d/docker.conf
|
||||
etc/zabbix_agent2.d/plugins.d/memcached.conf
|
||||
etc/zabbix_agent2.d/plugins.d/mongodb.conf
|
||||
etc/zabbix_agent2.d/plugins.d/mysql.conf
|
||||
etc/zabbix_agent2.d/plugins.d/oracle.conf
|
||||
etc/zabbix_agent2.d/plugins.d/postgres.conf
|
||||
etc/zabbix_agent2.d/plugins.d/redis.conf
|
||||
etc/zabbix_agent2.d/plugins.d/smart.conf
|
||||
m4/conf_tests.m4
|
||||
frontend.mo
|
||||
include/common/config.h
|
||||
include/common/config.h.in
|
||||
include/common/stamp-h1
|
||||
include/stamp-h1
|
||||
misc/images/inkscape.log.txt
|
||||
misc/images/pngcrush.log.txt
|
||||
misc/images/pngcrushoutput.txt
|
||||
sass/.sass-cache
|
||||
sass/code_example_templates
|
||||
sass/doc_assets
|
||||
sass/filter-expanded2.html
|
||||
sass/forms_with_tables.html
|
||||
sass/hologram_config.yml
|
||||
sass/img/man.svg
|
||||
sass/img/reload.svg
|
||||
sass/img/tomato.png
|
||||
sass/img/tomato.svg
|
||||
sass/overlay-dialog.html
|
||||
sass/styleguide
|
||||
sass/stylesheets/*.css
|
||||
sass/stylesheets/*.map
|
||||
sass/stylesheets/sass/components.md
|
||||
sass/stylesheets/sass/index.md
|
||||
sass/stylesheets/sass/screen2.scss
|
||||
sass/stylesheets/themes
|
||||
sass/wide-table.html
|
||||
sbin/zabbix_agent2
|
||||
sbin/zabbix_agentd
|
||||
sbin/zabbix_web_service
|
||||
sbin/zabbix_java
|
||||
sbin/zabbix_proxy
|
||||
sbin/zabbix_server
|
||||
share/man/man1/zabbix_get.1
|
||||
share/man/man1/zabbix_sender.1
|
||||
share/man/man8/zabbix_agentd.8
|
||||
share/man/man8/zabbix_proxy.8
|
||||
share/man/man8/zabbix_server.8
|
||||
share/man/man8/zabbix_agent2.8
|
||||
share/man/man8/zabbix_web_service.8
|
||||
src/libs/zbxcunit/cu_modules.h
|
||||
src/libs/zbxdbschema/dbschema.c
|
||||
src/modules/dummy/dummy.so
|
||||
src/zabbix_agent/zabbix_agent
|
||||
src/zabbix_agent/zabbix_agentd
|
||||
src/zabbix_get/zabbix_get
|
||||
src/zabbix_java/bin/zabbix-java-gateway-*.jar
|
||||
src/zabbix_java/class
|
||||
src/zabbix_js/zabbix_js
|
||||
src/zabbix_proxy/zabbix_proxy
|
||||
src/zabbix_sender/zabbix_sender
|
||||
src/zabbix_server/zabbix_server
|
||||
tests/libs/zbxalgo/evaluate
|
||||
tests/libs/zbxalgo/evaluate_unknown
|
||||
tests/libs/zbxalgo/list
|
||||
tests/libs/zbxalgo/queue
|
||||
tests/libs/zbxcommon/calculate_item_nextcheck
|
||||
tests/libs/zbxcommon/calculate_item_nextcheck_unreachable
|
||||
tests/libs/zbxcommon/convert_to_utf8
|
||||
tests/libs/zbxcommon/is_double
|
||||
tests/libs/zbxcommon/is_double_suffix
|
||||
tests/libs/zbxcommon/parse_key
|
||||
tests/libs/zbxcommon/replace_key_params_dyn
|
||||
tests/libs/zbxcommon/zbx_dyn_escape_string
|
||||
tests/libs/zbxcommon/zbx_get_report_nextcheck
|
||||
tests/libs/zbxcommon/zbx_function_find
|
||||
tests/libs/zbxcommon/zbx_function_get_param_dyn
|
||||
tests/libs/zbxcommon/zbx_get_week_number
|
||||
tests/libs/zbxcommon/zbx_interval_preproc
|
||||
tests/libs/zbxcommon/zbx_iso8601_utc
|
||||
tests/libs/zbxcommon/zbx_json_to_xml
|
||||
tests/libs/zbxcommon/zbx_ltrim_utf8
|
||||
tests/libs/zbxcommon/zbx_rtrim_utf8
|
||||
tests/libs/zbxcommon/zbx_str_extract
|
||||
tests/libs/zbxcommon/zbx_token_find
|
||||
tests/libs/zbxcommon/zbx_trim_float
|
||||
tests/libs/zbxcommon/zbx_trim_integer
|
||||
tests/libs/zbxcommon/zbx_truncate_itemkey
|
||||
tests/libs/zbxcommon/zbx_truncate_value
|
||||
tests/libs/zbxcommon/zbx_user_macro_parse
|
||||
tests/libs/zbxcommon/zbx_validate_interval
|
||||
tests/libs/zbxcommon/zbx_variant_compare
|
||||
tests/libs/zbxcommon/zbx_xml_to_json
|
||||
tests/libs/zbxcomms/zbx_tcp_check_allowed_peers
|
||||
tests/libs/zbxcomms/zbx_tcp_check_allowed_peers_ipv4
|
||||
tests/libs/zbxcommshigh/zbx_tcp_recv_ext
|
||||
tests/libs/zbxcommshigh/zbx_tcp_recv_ext_zlib
|
||||
tests/libs/zbxcommshigh/zbx_tcp_recv_raw_ext
|
||||
tests/libs/zbxconf/parse_cfg_file
|
||||
tests/libs/zbxdbcache/dc_check_maintenance_period
|
||||
tests/libs/zbxdbcache/dc_expand_user_macros_in_func_params
|
||||
tests/libs/zbxdbcache/dc_item_poller_type_update
|
||||
tests/libs/zbxdbcache/dc_maintenance_match_tags
|
||||
tests/libs/zbxdbcache/is_item_processed_by_server
|
||||
tests/libs/zbxdbcache/um_cache_resolve
|
||||
tests/libs/zbxdbcache/um_cache_resolve_cont
|
||||
tests/libs/zbxdbcache/um_cache_sync
|
||||
tests/libs/zbxdbcache/zbx_vc_add_values
|
||||
tests/libs/zbxdbcache/zbx_vc_get_value
|
||||
tests/libs/zbxdbcache/zbx_vc_get_values
|
||||
tests/libs/zbxdbcache/dc_function_calculate_nextcheck
|
||||
tests/libs/zbxdbhigh/DBadd_condition_alloc
|
||||
tests/libs/zbxdbhigh/DBselect_uint64
|
||||
tests/libs/zbxdbhigh/zbx_add_tags
|
||||
tests/libs/zbxdbhigh/zbx_del_tags
|
||||
tests/libs/zbxdbhigh/zbx_merge_tags
|
||||
tests/libs/zbxeval/zbx_eval_compose_expression
|
||||
tests/libs/zbxeval/zbx_eval_execute
|
||||
tests/libs/zbxeval/zbx_eval_execute_ext
|
||||
tests/libs/zbxeval/zbx_eval_get_constant
|
||||
tests/libs/zbxeval/zbx_eval_get_group_filter
|
||||
tests/libs/zbxeval/zbx_eval_parse_expression
|
||||
tests/libs/zbxeval/zbx_eval_parse_query
|
||||
tests/libs/zbxeval/zbx_eval_prepare_filter
|
||||
tests/libs/zbxeval/zbx_eval_serialize
|
||||
tests/libs/zbxhistory/zbx_history_get_values
|
||||
tests/libs/zbxicmpping/get_interval_option
|
||||
tests/libs/zbxicmpping/line_process
|
||||
tests/libs/zbxjson/zbx_json_decodevalue
|
||||
tests/libs/zbxjson/zbx_json_decodevalue_dyn
|
||||
tests/libs/zbxjson/zbx_json_open_path
|
||||
tests/libs/zbxjson/zbx_jsonobj_query
|
||||
tests/libs/zbxjson/zbx_jsonpath_compile
|
||||
tests/libs/zbxprometheus/prometheus_filter_init
|
||||
tests/libs/zbxprometheus/prometheus_parse_row
|
||||
tests/libs/zbxprometheus/zbx_prometheus_pattern
|
||||
tests/libs/zbxprometheus/zbx_prometheus_to_json
|
||||
tests/libs/zbxregexp/wildcard_match
|
||||
tests/libs/zbxexpression/evaluate_function
|
||||
tests/libs/zbxexpression/evaluate_percentage_deviations_in_remainder
|
||||
tests/libs/zbxexpression/evaluate_stl
|
||||
tests/libs/zbxexpression/get_trigger_expression_constant
|
||||
tests/libs/zbxexpression/macro_fmttime
|
||||
tests/libs/zbxexpression/substitute_lld_macros
|
||||
tests/libs/zbxexpression/valuemaps
|
||||
tests/libs/zbxsysinfo/check_key_access_rules
|
||||
tests/libs/zbxsysinfo/zbx_execute_agent_check
|
||||
tests/libs/zbxsysinfo/zbx_execute_agent_check_http
|
||||
tests/libs/zbxsysinfo/check_get_fqdn
|
||||
tests/libs/zbxsysinfo/common/system_localtime
|
||||
tests/libs/zbxsysinfo/common/vfs_file_exists
|
||||
tests/libs/zbxsysinfo/common/web_page_get
|
||||
tests/libs/zbxsysinfo/linux/kernel_maxfiles
|
||||
tests/libs/zbxsysinfo/linux/kernel_maxproc
|
||||
tests/libs/zbxsysinfo/linux/net_if_discovery
|
||||
tests/libs/zbxsysinfo/linux/net_if_in
|
||||
tests/libs/zbxsysinfo/linux/net_if_out
|
||||
tests/libs/zbxsysinfo/linux/net_if_total
|
||||
tests/libs/zbxsysinfo/linux/system_boottime
|
||||
tests/libs/zbxsysinfo/linux/system_cpu_intr
|
||||
tests/libs/zbxsysinfo/linux/system_cpu_switches
|
||||
tests/libs/zbxsysinfo/linux/system_hw_chassis
|
||||
tests/libs/zbxsysinfo/linux/system_sw_packages_get
|
||||
tests/libs/zbxsysinfo/linux/system_sw_software
|
||||
tests/libs/zbxsysinfo/linux/vfs_fs_discovery
|
||||
tests/libs/zbxsysinfo/parse_item_key
|
||||
tests/libs/zbxsysinfo/process
|
||||
tests/libs/zbxsysinfo/check_service_test
|
||||
tests/libs/zbxcommon/zbx_tm_add
|
||||
tests/libs/zbxcommon/zbx_tm_sub
|
||||
tests/libs/zbxcommon/zbx_tm_round_up
|
||||
tests/libs/zbxcommon/zbx_tm_round_down
|
||||
tests/libs/zbxtagfilter/tagfilter_match_tags
|
||||
tests/libs/zbxtime/zbx_iso8601_utc
|
||||
tests/libs/zbxtrends/zbx_baseline_get_data
|
||||
tests/libs/zbxtrends/zbx_trends_parse_range
|
||||
tests/libs/zbxsysinfo/process_http
|
||||
tests/zabbix_server/pinger/zbx_pinger_test
|
||||
tests/zabbix_server/poller/zbx_poller_test
|
||||
tests/libs/zbxpreproc/item_preproc_csv_to_json
|
||||
tests/libs/zbxpreproc/item_preproc_xpath
|
||||
tests/libs/zbxpreproc/zbx_item_preproc
|
||||
tests/zabbix_server/service/service_get_rootcause_eventids
|
||||
tests/zabbix_server/service/service_get_main_status
|
||||
tests/zabbix_server/service/service_get_rule_status
|
||||
tests/zabbix_server/service/service_get_status
|
||||
tests/zabbix_server/trapper/zbx_trapper_preproc_test_run
|
||||
tests/libs/zbxmodules/server_module_load
|
||||
tests/libs/zbxmodules/proxy_module_load
|
||||
tests/libs/zbxmodules/agent_module_load
|
||||
ui/.buildpath
|
||||
ui/.htpasswd
|
||||
ui/.idea
|
||||
ui/.project
|
||||
ui/conf/zabbix.conf.php
|
||||
ui/images/general/*.db
|
||||
ui/images/general/tree/*.db
|
||||
ui/js/jsDump.js
|
||||
ui/local/conf/brand.conf.php
|
||||
ui/locale/POTFILES.in
|
||||
ui/locale/frontend.pot
|
||||
ui/tests/bootstrap.php
|
||||
ui/tests/composer.*
|
||||
ui/tests/vendor
|
@ -0,0 +1,5 @@
|
||||
Core developers
|
||||
===============
|
||||
|
||||
* Alexei Vladishev <alexei.vladishev@zabbix.com>
|
||||
Initial idea.
|
@ -0,0 +1,341 @@
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
@ -0,0 +1 @@
|
||||
A.F....... [ZBX-23240] fixed filtering by "action" and "action_userid" in event.get and problem.get not working (agriscenko)
|
@ -0,0 +1 @@
|
||||
.......PS. [ZBXNEXT-8620] added asynchronous DNS resolving for async SNMP and Zabbix agent pollers (vso)
|
@ -0,0 +1,25 @@
|
||||
Changelog entries are prefixed with a position-based identificator, that denotes
|
||||
components affected with that specific issue. Component one-letter codes are
|
||||
as follows:
|
||||
|
||||
* API (A)
|
||||
* Documentation (D)
|
||||
* Frontend (F)
|
||||
* Agent (G)
|
||||
* Installation (I)
|
||||
* Java gateway (J)
|
||||
* Appliance (L)
|
||||
* Proxy (P)
|
||||
* Server (S)
|
||||
* Templates (T)
|
||||
|
||||
A line, referencing all components would thus be ADFGIJLPST
|
||||
|
||||
API and frontend would be A.F.......
|
||||
Server and proxy would be .......PS.
|
||||
|
||||
Commit messages that do not actually change anything (for example, creation and
|
||||
deletion of branches) have all components unset - ..........
|
||||
|
||||
See https://zabbix.org/wiki/Docs/specs/development_guidelines#Components
|
||||
for more information
|
@ -0,0 +1 @@
|
||||
Please see http://www.zabbix.com/documentation.php for installation instructions.
|
@ -0,0 +1,234 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = \
|
||||
include \
|
||||
src \
|
||||
database \
|
||||
man \
|
||||
misc
|
||||
|
||||
EXTRA_DIST = \
|
||||
bin \
|
||||
build \
|
||||
ui \
|
||||
include \
|
||||
conf \
|
||||
sass
|
||||
|
||||
## "dist-hook" run after the distribution directory is filled, but before the actual tar (or shar) file is created.
|
||||
dist-hook:
|
||||
# File revision number must be numeric (Git commit hash cannot be used).
|
||||
# Therefore to make it numeric and meaningful it is artificially composed from:
|
||||
# - branch (development or release),
|
||||
# - type (alpha, beta, rc or release),
|
||||
# - number of alpha, beta or rc.
|
||||
# 'branch' expression tries to find out is it a development branch or release branch.
|
||||
# Result is encoded as: 1 - dev branch, release branch or error occurred, 2 - tag.
|
||||
# 'type_name' expression tries to find out what type of release it is.
|
||||
# Expected result is: "alpha", "beta", "rc" or "" (empty string).
|
||||
# 'type_num' expression encodes 'type_name' as numeric value:
|
||||
# 1 - alpha, 2 - beta, 3 - rc, 4 - release, 0 - unknown.
|
||||
# 'type_count' expression tries to find out number of "alpha", "beta" or "rc" (e.g. 1 from "rc1").
|
||||
@branch=`(git symbolic-ref -q HEAD > /dev/null && echo 1) || (git tag -l --points-at HEAD| grep "."| grep -q -v "-" && echo 2) || echo 1`; \
|
||||
type_name=`cat $(top_distdir)/include/version.h| sed -n -e '/ZABBIX_VERSION_RC/s/.*"\([a-z]*\)[0-9]*"/\1/p'`; \
|
||||
type_num=`(test "x$$type_name" = "xalpha" && echo "1") || echo ""`; \
|
||||
type_num=`(test -z $$type_num && test "x$$type_name" = "xbeta" && echo "2") || echo "$$type_num"`; \
|
||||
type_num=`(test -z $$type_num && test "x$$type_name" = "xrc" && echo "3") || echo "$$type_num"`; \
|
||||
type_num=`(test -z $$type_num && test -z $$type_name && echo "4") || echo "$$type_num"`; \
|
||||
type_num=`(test -z $$type_num && echo "0") || echo "$$type_num"`; \
|
||||
type_count=`cat $(top_distdir)/include/version.h|sed -n -e '/ZABBIX_VERSION_RC/s/.*"[a-z]*\([0-9]*\)"/\1/p'`; \
|
||||
type_count=`printf '%02d' $$type_count`; \
|
||||
zabbix_revision=`git rev-parse --short HEAD`; \
|
||||
cat $(top_distdir)/include/version.h|sed "s/{ZABBIX_RC_NUM}/$$branch$$type_num$$type_count/g"| \
|
||||
sed "s/{ZABBIX_REVISION}/$$zabbix_revision/g" > $(top_distdir)/include/version.h.new; \
|
||||
mv $(top_distdir)/include/version.h.new $(top_distdir)/include/version.h; \
|
||||
cat $(top_distdir)/src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java|sed "s/{ZABBIX_REVISION}/$$zabbix_revision/g" > \
|
||||
$(top_distdir)/src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java.new; \
|
||||
mv $(top_distdir)/src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java.new \
|
||||
$(top_distdir)/src/zabbix_java/src/com/zabbix/gateway/GeneralInformation.java; \
|
||||
cat $(top_distdir)/src/go/pkg/version/version.go|sed "s/{ZABBIX_RC_NUM}/$$branch$$type_num$$type_count/g"| \
|
||||
sed "s/{ZABBIX_REVISION}/$$zabbix_revision/g" > $(top_distdir)/src/go/pkg/version/version.go.new; \
|
||||
mv $(top_distdir)/src/go/pkg/version/version.go.new $(top_distdir)/src/go/pkg/version/version.go
|
||||
|
||||
rm -rf `find $(top_distdir) -name ".gitignore" -o -name ".gitattributes"`
|
||||
rm -f $(top_distdir)/include/common/config.h
|
||||
rm -f $(top_distdir)/include/common/config.h.in~
|
||||
rm -f $(top_distdir)/ui/conf/zabbix.conf.php
|
||||
rm -rf $(top_distdir)/ui/tests
|
||||
rm -rf $(top_distdir)/sass/img_source
|
||||
|
||||
if DBSCHEMA
|
||||
dbschema_mysql:
|
||||
cd database/mysql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) data.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) schema.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) history_pk_prepare.sql
|
||||
|
||||
dbschema_oracle:
|
||||
cd database/oracle && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) data.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) schema.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) history_pk_prepare.sql
|
||||
|
||||
export tsdb_wcompr_dir = tsdb_history_pk_upgrade_with_compression
|
||||
export tsdb_nocompr_dir = tsdb_history_pk_upgrade_no_compression
|
||||
|
||||
dbschema_postgresql:
|
||||
cd database/postgresql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) data.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) schema.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) timescaledb.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(tsdb_wcompr_dir)/history_pk.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(tsdb_wcompr_dir)/history_pk_uint.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(tsdb_wcompr_dir)/history_pk_log.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(tsdb_wcompr_dir)/history_pk_str.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(tsdb_wcompr_dir)/history_pk_text.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(tsdb_nocompr_dir)/history_pk.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(tsdb_nocompr_dir)/history_pk_uint.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(tsdb_nocompr_dir)/history_pk_log.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(tsdb_nocompr_dir)/history_pk_str.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(tsdb_nocompr_dir)/history_pk_text.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) history_pk_prepare.sql
|
||||
|
||||
dbschema_sqlite3:
|
||||
cd database/sqlite3 && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) data.sql && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) schema.sql
|
||||
|
||||
dbschema_c:
|
||||
cd src/libs/zbxdbschema && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) dbschema.c
|
||||
|
||||
dbschema: dbschema_mysql dbschema_oracle dbschema_postgresql dbschema_sqlite3 dbschema_c
|
||||
endif
|
||||
|
||||
gettext:
|
||||
ui/locale/make_mo.sh
|
||||
|
||||
css_theme_blue:
|
||||
sass --no-cache --sourcemap=none sass/stylesheets/sass/screen.scss ui/assets/styles/blue-theme.css
|
||||
|
||||
css_theme_dark:
|
||||
sass --no-cache --sourcemap=none sass/stylesheets/sass/dark-theme.scss ui/assets/styles/dark-theme.css
|
||||
|
||||
css_hc_light:
|
||||
sass --no-cache --sourcemap=none sass/stylesheets/sass/hc-light.scss ui/assets/styles/hc-light.css
|
||||
|
||||
css_hc_dark:
|
||||
sass --no-cache --sourcemap=none sass/stylesheets/sass/hc-dark.scss ui/assets/styles/hc-dark.css
|
||||
|
||||
css_images:
|
||||
cp sass/img/browser-sprite.png ui/assets/img/
|
||||
cp sass/apple-touch-icon-120x120-precomposed.png ui/assets/img/
|
||||
cp sass/apple-touch-icon-152x152-precomposed.png ui/assets/img/
|
||||
cp sass/apple-touch-icon-180x180-precomposed.png ui/assets/img/
|
||||
cp sass/apple-touch-icon-76x76-precomposed.png ui/assets/img/
|
||||
cp sass/ms-tile-144x144.png ui/assets/img/
|
||||
cp sass/touch-icon-192x192.png ui/assets/img/
|
||||
cp sass/favicon.ico ui/
|
||||
|
||||
icons_build:
|
||||
cd sass/icons
|
||||
npm run generate
|
||||
cp sass/icons/dist/_icons.scss sass/stylesheets/sass/base/
|
||||
cp sass/icons/dist/zabbix-icons.svg ui/assets/fonts/
|
||||
cp sass/icons/dist/zabbix-icons.ttf ui/assets/fonts/
|
||||
cp sass/icons/dist/zabbix-icons.woff ui/assets/fonts/
|
||||
cp sass/icons/dist/zabbix-icons.woff2 ui/assets/fonts/
|
||||
|
||||
icons_cleanup:
|
||||
cd sass/icons
|
||||
npm run cleanup
|
||||
|
||||
css: css_theme_blue css_theme_dark css_hc_light css_hc_dark css_images
|
||||
|
||||
icons: icons_build css icons_cleanup
|
||||
|
||||
|
||||
## list of modules which should be built with testing suite
|
||||
MODULES = \
|
||||
dummy
|
||||
|
||||
modules_build:
|
||||
-@for module in $(MODULES); do \
|
||||
$(MAKE) -C src/modules/$$module; \
|
||||
done
|
||||
|
||||
modules_clean:
|
||||
-@for module in $(MODULES); do \
|
||||
$(MAKE) -C src/modules/$$module; \
|
||||
done
|
||||
|
||||
## cmocka test support
|
||||
if TESTS
|
||||
WRAP_DB_FUNCS = \
|
||||
-Wl,--wrap=zbx_db_vselect \
|
||||
-Wl,--wrap=zbx_db_select_n_basic \
|
||||
-Wl,--wrap=zbx_db_fetch_basic \
|
||||
-Wl,--wrap=__zbx_db_execute \
|
||||
-Wl,--wrap=zbx_db_begin \
|
||||
-Wl,--wrap=zbx_db_commit \
|
||||
-Wl,--wrap=zbx_db_execute_multiple_query \
|
||||
-Wl,--wrap=zbx_db_free_result
|
||||
|
||||
WRAP_IO_FUNCS = \
|
||||
-Wl,--wrap=fopen \
|
||||
-Wl,--wrap=fclose \
|
||||
-Wl,--wrap=fgets \
|
||||
-Wl,--wrap=fstat \
|
||||
-Wl,--wrap=open
|
||||
|
||||
WRAP_FS_FUNCS = \
|
||||
-Wl,--wrap=opendir \
|
||||
-Wl,--wrap=readdir \
|
||||
-Wl,--wrap=__xstat \
|
||||
-Wl,--wrap=__fxstat \
|
||||
-Wl,--wrap=stat
|
||||
|
||||
WRAP_EXIT = \
|
||||
-Wl,--wrap=exit
|
||||
|
||||
WRAP_COMM_FUNCS = \
|
||||
-Wl,--wrap=read \
|
||||
-Wl,--wrap=connect \
|
||||
-Wl,--wrap=poll
|
||||
|
||||
COMMON_WRAP_FUNCS = \
|
||||
$(WRAP_DB_FUNCS) \
|
||||
$(WRAP_IO_FUNCS) \
|
||||
$(WRAP_FS_FUNCS) \
|
||||
$(WRAP_EXIT) \
|
||||
$(WRAP_COMM_FUNCS)
|
||||
|
||||
tests_build: modules_build
|
||||
$(MAKE) $(AM_MAKEFLAGS) && \
|
||||
cd tests && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) LDFLAGS="$(LDFLAGS) $(COMMON_WRAP_FUNCS)" LIBS="$(LIBS)"
|
||||
|
||||
tests: tests_build
|
||||
export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(CMOCKA_LIBRARY_PATH):$(YAML_LIBRARY_PATH); \
|
||||
tests/tests_run.pl
|
||||
|
||||
clean: clean-recursive modules_clean
|
||||
cd tests && $(MAKE) clean
|
||||
endif
|
||||
|
||||
sbom: sbom-ui
|
||||
|
||||
sbom-ui: ui/sbom.json
|
||||
|
||||
ui/sbom.json:
|
||||
(cd ${@D} && \
|
||||
composer CycloneDX:make-sbom --omit=dev --no-interaction \
|
||||
--spec-version=1.4 \
|
||||
--output-reproducible --output-format=JSON --output-file="${@F}")
|
||||
|
||||
ui/sbom.xml:
|
||||
(cd ${@D} && \
|
||||
composer CycloneDX:make-sbom --omit=dev --no-interaction \
|
||||
--spec-version=1.4 \
|
||||
--output-reproducible --output-format=XML --output-file="${@F}")
|
||||
|
||||
.PHONY: test tests clean modules_build modules_clean sbom sbom-ui
|
@ -0,0 +1,32 @@
|
||||
Zabbix is free software, released under the GNU General Public License
|
||||
(GPL) version 2.
|
||||
|
||||
You can redistribute it and/or modify it under the terms of the GNU GPL
|
||||
as published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The formal terms of the GPL can be found at
|
||||
http://www.fsf.org/licenses/ .
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
Exception for linking with OpenSSL
|
||||
|
||||
In addition, as a special exception, we give permission to link the code
|
||||
of Zabbix with the OpenSSL project OpenSSL library (or with modified
|
||||
versions of it that use the same license as the OpenSSL library), and
|
||||
distribute the linked executables.
|
||||
|
||||
Please see https://www.zabbix.com/ for detailed information about Zabbix.
|
||||
|
||||
On-line Zabbix documentation is available at
|
||||
https://www.zabbix.com/documentation/6.2/manual/ .
|
||||
|
||||
Zabbix installation instructions can be found at
|
||||
https://www.zabbix.com/documentation/6.2/manual/installation/ .
|
||||
|
||||
If you are installing Zabbix from packages the instructions can be found at
|
||||
https://www.zabbix.com/documentation/6.2/manual/installation/install_from_packages/ .
|
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Run this script to generate 'configure'
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "usage: $0 [tests]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
case $# in
|
||||
0)
|
||||
# disable tests
|
||||
rm -f m4/conf_tests.m4
|
||||
;;
|
||||
1)
|
||||
[ $1 = "tests" ] || usage
|
||||
|
||||
# enable tests
|
||||
cp -f tests/conf_tests.m4 m4/ || exit $?
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
aclocal -I m4
|
||||
autoconf
|
||||
autoheader
|
||||
automake -a
|
||||
automake
|
@ -0,0 +1,368 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Zabbix backend" default="build" basedir="." xmlns:if="ant:if" xmlns:unless="ant:unless">
|
||||
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
||||
|
||||
<!-- oracle oci library has functions declarations without arguments: f() instead of f(void), so it triggers -Wstrict-prototypes warning -->
|
||||
<property name="COMP_FLAGS_ORACLE" value="-g -std=gnu99 -pedantic -Wall -Wextra -Wunused -Wshadow -Wpointer-arith -Wno-maybe-uninitialized -Wformat -Wmissing-prototypes -Wunreachable-code -Wformat-extra-args -Wno-missing-field-initializers -Wno-missing-field-initializers -Wincompatible-pointer-types -Wnull-dereference -Wold-style-definition -Wmissing-declarations -Wunused-parameter -Winit-self -Wnested-externs -Wjump-misses-init -Wdangling-else -Wformat-signedness -Wfloat-conversion"/>
|
||||
<property name="COMP_FLAGS" value="-Wstrict-prototypes ${COMP_FLAGS_ORACLE}"/>
|
||||
<property name="ZBX_BASE_FLAGS" value="--enable-server --enable-agent --enable-proxy --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-libevent --with-ldap --with-libcurl"/>
|
||||
|
||||
<!-- Initialize database related options based on the database type -->
|
||||
<switch value="${DBTYPE}" caseinsensitive="true">
|
||||
<case value="POSTGRESQL">
|
||||
<property name="with.db" value="--with-postgresql"/>
|
||||
<property name="with.postgresql" value="true"/>
|
||||
</case>
|
||||
<case value="ORACLE">
|
||||
<property name="with.db" value="--with-oracle"/>
|
||||
<property name="with.oracle" value="true"/>
|
||||
</case>
|
||||
<default>
|
||||
<property name="with.db" value="--with-mysql"/>
|
||||
<property name="with.mysql" value="true"/>
|
||||
</default>
|
||||
</switch>
|
||||
|
||||
<!-- Zabbix various configuration parameters -->
|
||||
<target name="init-conf-options">
|
||||
<property name="conf1" value="--enable-agent"/>
|
||||
<property name="conf2" value="--enable-server ${with.db}"/>
|
||||
<property name="conf3" value="--enable-proxy ${with.db}"/>
|
||||
<property name="conf4" value="--enable-server --enable-agent --enable-proxy ${with.db}"/>
|
||||
<property name="conf6" value="${ZBX_BASE_FLAGS} ${with.db} --with-openipmi --with-openssl"/>
|
||||
<property name="conf7" value="${ZBX_BASE_FLAGS} ${with.db} --with-openipmi --with-gnutls"/>
|
||||
</target>
|
||||
|
||||
<!-- Additional Zabbix configuration parameters -->
|
||||
<target name="init-conf-options-2">
|
||||
<property name="conf8" value="--enable-agent2"/>
|
||||
<property name="conf9" value="--enable-server --enable-agent --enable-proxy ${with.db} --with-ssh"/>
|
||||
<property name="conf10" value="--enable-agent --with-libmodbus"/>
|
||||
</target>
|
||||
|
||||
<!-- Cppcheck static analyzer target -->
|
||||
<target name="cppcheck-static-analyzer">
|
||||
<exec executable="./bootstrap.sh" failonerror="on"/>
|
||||
<exec executable="scan-build" failonerror="on">
|
||||
<arg line="./configure"/>
|
||||
<arg line="--quiet"/>
|
||||
<arg line="${ZBX_BASE_FLAGS} --with-mysql"/>
|
||||
</exec>
|
||||
<exec executable="cppcheck" error="${SCANFILE}" failonerror="on">
|
||||
<arg line="--enable=all"/>
|
||||
<arg line="-j5"/>
|
||||
<arg line="-I/usr/include"/>
|
||||
<arg line="-I/usr/local/include"/>
|
||||
<arg line="-I./include/common"/>
|
||||
<arg line="-I./include"/>
|
||||
<!-- Exclude Duktape library from checking -->
|
||||
<arg line="-isrc/libs/zbxembed/duk_config.h"/>
|
||||
<arg line="-isrc/libs/zbxembed/duktape.c"/>
|
||||
<arg line="-isrc/libs/zbxembed/duktape.h"/>
|
||||
<arg line="--suppress=variableScope:*"/>
|
||||
<arg line="--suppress=ConfigurationNotChecked:*"/>
|
||||
<arg line="--inconclusive"/>
|
||||
<arg line="--force"/>
|
||||
<arg line="--xml"/>
|
||||
<arg line="--xml-version=2"/>
|
||||
<arg line="--cppcheck-build-dir=${CPPCHECK_BUILD_DIR}"/>
|
||||
<arg line="."/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<!-- Clang Static Analyzer target with various configuration parameters -->
|
||||
<target name="clang-static-analyzer" depends="init-conf-options">
|
||||
<delete dir="clang-scan-build-reports"/>
|
||||
<exec executable="./bootstrap.sh" failonerror="on"/>
|
||||
<propertyselector property="conf.list" delimiter="," match="conf(\d+)"/>
|
||||
<sortlist property="conf.list" delimiter="," value="${conf.list}" override="true"/>
|
||||
<for list="${conf.list}" param="name" delimiter=",">
|
||||
<sequential>
|
||||
<exec executable="scan-build" failonerror="on">
|
||||
<arg line="./configure"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="${@{name}}"/>
|
||||
</exec>
|
||||
<trycatch>
|
||||
<try>
|
||||
<exec executable="scan-build" failonerror="on">
|
||||
<arg line="-plist-html"/>
|
||||
<arg line="-o"/>
|
||||
<arg line="./clang-scan-build-reports"/>
|
||||
<arg line="make"/>
|
||||
<arg line="-s"/>
|
||||
<arg line="-j5"/>
|
||||
</exec>
|
||||
</try>
|
||||
<finally>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-s"/>
|
||||
<arg line="-j5"/>
|
||||
<arg line="clean"/>
|
||||
</exec>
|
||||
</finally>
|
||||
</trycatch>
|
||||
</sequential>
|
||||
</for>
|
||||
</target>
|
||||
|
||||
<macrodef name="make">
|
||||
<!-- Build Zabbix with the specified command line arguments -->
|
||||
<attribute name="args"/>
|
||||
<attribute name="cc" default="gcc"/>
|
||||
<attribute name="target" default=""/>
|
||||
<attribute name="post-action" default=""/>
|
||||
<sequential>
|
||||
<!-- initialize cflags depending on used compiler -->
|
||||
<local name="common.cflags"/>
|
||||
<local name="cc.cflags"/>
|
||||
<property name="common.cflags" value="-O2 -g"/>
|
||||
<switch value="@{cc}">
|
||||
<case value="gcc">
|
||||
<property name="cc.cflags" value="${COMP_FLAGS_ORACLE}"/>
|
||||
</case>
|
||||
<case value="clang">
|
||||
<property name="cc.cflags" value=""/>
|
||||
</case>
|
||||
<default>
|
||||
<fail>Unknown compiler type: @{cc}</fail>
|
||||
</default>
|
||||
</switch>
|
||||
|
||||
<!-- clean, configure and build -->
|
||||
<exec executable="./configure" failonerror="on">
|
||||
<env key="CC" value="@{cc}"/>
|
||||
<arg line="@{args}"/>
|
||||
<arg line="--prefix=$(pwd)/install"/>
|
||||
<arg line="CFLAGS="${common.cflags} ${cc.cflags}""/>
|
||||
</exec>
|
||||
<trycatch>
|
||||
<try>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-s"/>
|
||||
<arg line="-j5"/>
|
||||
<arg line="@{target}"/>
|
||||
</exec>
|
||||
<if>
|
||||
<not >
|
||||
<equals arg1="@{post-action}" arg2=""/>
|
||||
</not>
|
||||
<then>
|
||||
<antcall target="@{post-action}"/>
|
||||
</then>
|
||||
</if>
|
||||
</try>
|
||||
<finally>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-s"/>
|
||||
<arg line="-j5"/>
|
||||
<arg line="clean"/>
|
||||
</exec>
|
||||
</finally>
|
||||
</trycatch>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="make-db-mysql" unless="${with.mysql}">
|
||||
<!-- Build Zabbix with mysql database -->
|
||||
<sequential>
|
||||
<make args="${ZBX_BASE_FLAGS} --with-mysql --with-openipmi --with-openssl --enable-ipv6 --with-libmodbus"/>
|
||||
</sequential>
|
||||
</target>
|
||||
|
||||
<target name="make-db-postgresql" unless="${with.postgresql}">
|
||||
<!-- Build Zabbix with postgresql database -->
|
||||
<sequential>
|
||||
<make args="${ZBX_BASE_FLAGS} --with-postgresql --with-openipmi --with-openssl"/>
|
||||
</sequential>
|
||||
</target>
|
||||
|
||||
<target name="make-db-oracle" unless="${with.oracle}">
|
||||
<!-- Build Zabbix with oracle database -->
|
||||
<sequential>
|
||||
<make args="${ZBX_BASE_FLAGS} --with-oracle --with-openipmi --with-openssl --with-oracle-include=/usr/include/oracle/19.8/client64 --with-oracle-lib=/usr/lib/oracle/19.8/client64/lib"/>
|
||||
</sequential>
|
||||
</target>
|
||||
|
||||
<!-- Build Zabbix with all supported databases -->
|
||||
<target name="make-db" depends="make-db-mysql,make-db-postgresql,make-db-oracle"/>
|
||||
|
||||
<target name="clean-tests">
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-s"/>
|
||||
<arg line="-j5"/>
|
||||
<arg line="clean"/>
|
||||
</exec>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-s"/>
|
||||
<arg line="-j5"/>
|
||||
<arg line="-C"/>
|
||||
<arg line="tests"/>
|
||||
<arg line="clean"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<macrodef name="make-tests">
|
||||
<!-- Build Zabbix cmocka tests with the specified command line arguments -->
|
||||
<attribute name="conf"/>
|
||||
<attribute name="conf-name"/>
|
||||
<sequential>
|
||||
<!-- clean, configure and build -->
|
||||
<exec executable="./configure" failonerror="on">
|
||||
<arg line="@{conf}"/>
|
||||
</exec>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-s"/>
|
||||
<arg line="-j5"/>
|
||||
<arg line="tests_build"/>
|
||||
</exec>
|
||||
<mkdir dir="tests_results/@{conf-name}"/>
|
||||
<exec executable="tests/tests_run.pl" failonerror="off" output="tests_results/@{conf-name}/output.xml">
|
||||
<arg line="-x @{conf-name}"/>
|
||||
</exec>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="init-cmocka-test-conf-options">
|
||||
<!-- Zabbix various configuration parameters for cmocka tests -->
|
||||
<!-- Configuration option name must consist of prefix 'cmocka-', configuration order number
|
||||
and configuration title: cmocka-<number>-<title> -->
|
||||
<property name="cmocka-1-default" value="-q CFLAGS='${COMP_FLAGS}' ${ZBX_BASE_FLAGS} --enable-ipv6 --with-mysql --with-openipmi --with-openssl --with-iconv --with-libpcre"/>
|
||||
<property name="cmocka-2-agent-only" value="-q CFLAGS='${COMP_FLAGS}' --enable-agent"/>
|
||||
<property name="cmocka-3-server-only" value="-q CFLAGS='${COMP_FLAGS}' --enable-server --with-mysql"/>
|
||||
<property name="cmocka-4-proxy-only" value="-q CFLAGS='${COMP_FLAGS}' --enable-proxy --with-sqlite3"/>
|
||||
<property name="cmocka-5-sanitizer" value="CC=clang CFLAGS='${COMP_FLAGS} -Wenum-conversion -fsanitize=leak,address' LDFLAGS='-fsanitize=leak,address' -q ${ZBX_BASE_FLAGS} --with-openssl --with-openipmi --enable-ipv6 --with-mysql --with-iconv --with-libpcre"/>
|
||||
</target>
|
||||
|
||||
<target name="cmocka-tests" depends="init-cmocka-test-conf-options">
|
||||
<!-- Build Zabbix with cmocka tests -->
|
||||
<delete dir="tests_results"/>
|
||||
<mkdir dir="tests_results"/>
|
||||
<exec executable="./bootstrap.sh" failonerror="on">
|
||||
<arg line="tests"/>
|
||||
</exec>
|
||||
<propertyselector property="conf.list" delimiter="," match="cmocka-(.*)" select="\1"/>
|
||||
<sortlist property="conf.list" delimiter="," value="${conf.list}" override="true"/>
|
||||
<for list="${conf.list}" param="name" delimiter=",">
|
||||
<sequential>
|
||||
<make-tests conf="${cmocka-@{name}}" conf-name="@{name}"/>
|
||||
<antcall target="clean-tests"/>
|
||||
</sequential>
|
||||
</for>
|
||||
</target>
|
||||
|
||||
<target name="init-cmocka-ora-test-conf-options">
|
||||
<property name="ORA_INCLUDE" value="/usr/include/oracle/12.1/client64"/>
|
||||
<property name="ORA_LIB" value="/usr/lib/oracle/12.1/client64/lib"/>
|
||||
|
||||
<!-- Zabbix various configuration parameters for cmocka Oracle tests -->
|
||||
<!-- Configuration option name must consist of prefix 'cmocka-ora-', configuration order number
|
||||
and configuration title: cmocka-<number>-<title> -->
|
||||
<property name="cmocka-ora-1-default" value="-q CFLAGS='${COMP_FLAGS_ORACLE}' ${ZBX_BASE_FLAGS} --enable-ipv6 --with-openipmi --with-openssl --with-iconv --with-libpcre --with-oracle --with-oracle-include=${ORA_INCLUDE} --with-oracle-lib=${ORA_LIB}"/>
|
||||
<property name="cmocka-ora-2-server-only" value="-q CFLAGS='${COMP_FLAGS_ORACLE}' --enable-server --with-oracle --with-oracle-include=${ORA_INCLUDE} --with-oracle-lib=${ORA_LIB}"/>
|
||||
<property name="cmocka-ora-3-proxy-only" value="-q CFLAGS='${COMP_FLAGS_ORACLE}' --enable-proxy --with-oracle --with-oracle-include=${ORA_INCLUDE} --with-oracle-lib=${ORA_LIB}"/>
|
||||
<property name="cmocka-ora-4-sanitizer" value="CC=clang CFLAGS='${COMP_FLAGS_ORACLE} -Wenum-conversion -O2 -fsanitize=leak,address' LDFLAGS='-fsanitize=leak,address' -q ${ZBX_BASE_FLAGS} --enable-ipv6 --with-openipmi --with-openssl --with-iconv --with-libpcre --with-oracle --with-oracle-include=${ORA_INCLUDE} --with-oracle-lib=${ORA_LIB}"/>
|
||||
</target>
|
||||
|
||||
<target name="cmocka-ora-tests" depends="init-cmocka-ora-test-conf-options">
|
||||
<!-- Build Zabbix with cmocka Oracle tests -->
|
||||
<delete dir="tests_results"/>
|
||||
<mkdir dir="tests_results"/>
|
||||
<exec executable="./bootstrap.sh" failonerror="on"/>
|
||||
<propertyselector property="conf.list" delimiter="," match="cmocka-ora-(.*)" select="\1"/>
|
||||
<sortlist property="conf.list" delimiter="," value="${conf.list}" override="true"/>
|
||||
<for list="${conf.list}" param="name" delimiter=",">
|
||||
<sequential>
|
||||
<make-tests conf="${cmocka-ora-@{name}}" conf-name="@{name}"/>
|
||||
<antcall target="clean-tests"/>
|
||||
</sequential>
|
||||
</for>
|
||||
</target>
|
||||
|
||||
<target name="gen-test-coverage-report">
|
||||
<!-- Generate Zabbix cmocka tests coverage report-->
|
||||
<delete dir="tests_results"/>
|
||||
<mkdir dir="tests_results"/>
|
||||
<mkdir dir="tests_results/html"/>
|
||||
<exec executable="lcov" failonerror="on">
|
||||
<arg line="--directory"/>
|
||||
<arg line="src"/>
|
||||
<arg line="-zerocounters"/>
|
||||
</exec>
|
||||
<exec executable="./bootstrap.sh" failonerror="on">
|
||||
<arg line="tests"/>
|
||||
</exec>
|
||||
<make-tests conf="CFLAGS='--coverage' -q --enable-server --enable-agent --enable-proxy --enable-ipv6 --with-mysql" conf-name="gen-test-coverage-report"/>
|
||||
<exec executable="lcov" failonerror="on">
|
||||
<arg line="--directory"/>
|
||||
<arg line="src"/>
|
||||
<arg line="--capture"/>
|
||||
<arg line="--output-file"/>
|
||||
<arg line="tests_results/html/app.info"/>
|
||||
</exec>
|
||||
<exec executable="genhtml" failonerror="on">
|
||||
<arg line="-p"/>
|
||||
<arg line="${user.dir}"/>
|
||||
<arg line="-o"/>
|
||||
<arg line="tests_results/html"/>
|
||||
<arg line="tests_results/html/app.info"/>
|
||||
</exec>
|
||||
<antcall target="clean-tests"/>
|
||||
</target>
|
||||
|
||||
<target name="make-gcc" depends="init-conf-options,init-conf-options-2">
|
||||
<!-- Build Zabbix with various configuration parameters -->
|
||||
<propertyselector property="conf.list" delimiter="," match="conf(\d+)"/>
|
||||
<sortlist property="conf.list" delimiter="," value="${conf.list}" override="true"/>
|
||||
<for list="${conf.list}" param="name" delimiter=",">
|
||||
<sequential>
|
||||
<make args="${@{name}}"/>
|
||||
</sequential>
|
||||
</for>
|
||||
</target>
|
||||
|
||||
<target name="build-dist" depends="make-gcc,make-db"/>
|
||||
|
||||
<target name="make-dist">
|
||||
<!-- Create & build Zabbix distribution -->
|
||||
<exec executable="./bootstrap.sh" failonerror="on"/>
|
||||
<exec executable="./configure" failonerror="on">
|
||||
<arg line="--quiet"/>
|
||||
</exec>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-s"/>
|
||||
<arg line="-j5"/>
|
||||
<arg line="dbschema"/>
|
||||
</exec>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-s"/>
|
||||
<arg line="-j5"/>
|
||||
<arg line="dist"/>
|
||||
</exec>
|
||||
<apply executable="tar">
|
||||
<arg line="xzf"/>
|
||||
<fileset dir="." includes="zabbix-*.tar.gz"/>
|
||||
</apply>
|
||||
<move tofile="sources">
|
||||
<dirset dir="." includes="zabbix-*"/>
|
||||
</move>
|
||||
<ant antfile="../build-backend.xml" dir="sources" target="build-dist" inheritAll="true" inheritRefs="true"/>
|
||||
</target>
|
||||
|
||||
<target name="agent2-tests">
|
||||
<!-- Create, build & test agent2 -->
|
||||
<exec executable="./bootstrap.sh" failonerror="on"/>
|
||||
<exec executable="./configure" failonerror="on">
|
||||
<arg line="--quiet"/>
|
||||
<arg line="--enable-agent2"/>
|
||||
</exec>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-s"/>
|
||||
<arg line="-j5"/>
|
||||
<arg line="check"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="build" depends="make-dist"/>
|
||||
</project>
|
@ -0,0 +1,513 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Zabbix" default="build" basedir=".">
|
||||
<target name="init-common">
|
||||
<condition property="phpunit_filter" value=" --filter='${PHPUNIT_FILTER}'" else="">
|
||||
<and>
|
||||
<isset property="PHPUNIT_FILTER" />
|
||||
<length string="${PHPUNIT_FILTER}" when="greater" length="0"/>
|
||||
</and>
|
||||
</condition>
|
||||
|
||||
<!-- Cleanup from the previous run -->
|
||||
<delete dir="build/logs" failonerror="off"/>
|
||||
<mkdir dir="build/logs"/>
|
||||
<mkdir dir="runtime"/>
|
||||
</target>
|
||||
|
||||
<target name="create-frontend-configs">
|
||||
<property name="dbtype" value="${DBTYPE}"/>
|
||||
<property name="dbhost" value="${DBHOST}"/>
|
||||
<property name="dbport" value="${DBPORT}"/>
|
||||
<property name="dbname" value="${DBNAME}"/>
|
||||
<property name="dbuser" value="${DBUSER}"/>
|
||||
<property name="dbpassword" value="${DBPASSWORD}"/>
|
||||
<property name="phpunit_error_log" value="${PHPUNIT_ERROR_LOG}"/>
|
||||
<property name="phpunit_port_prefix" value="${PHPUNIT_PORT_PREFIX}"/>
|
||||
|
||||
<!-- Create PHP config file -->
|
||||
<copy overwrite="true" file="ui/tests/templates/zabbix.conf.php" tofile="ui/conf/zabbix.conf.php"/>
|
||||
<replace file="ui/conf/zabbix.conf.php" token="{DBTYPE}" value="${dbtype}"/>
|
||||
<replace file="ui/conf/zabbix.conf.php" token="{DBHOST}" value="${dbhost}"/>
|
||||
<replace file="ui/conf/zabbix.conf.php" token="'{DBPORT}'" value="${dbport}"/>
|
||||
<replace file="ui/conf/zabbix.conf.php" token="{DBNAME}" value="${dbname}"/>
|
||||
<replace file="ui/conf/zabbix.conf.php" token="{DBUSER}" value="${dbuser}"/>
|
||||
<replace file="ui/conf/zabbix.conf.php" token="{DBPASSWORD}" value="${dbpassword}"/>
|
||||
<replace file="ui/conf/zabbix.conf.php" token="{PHPUNIT_ERROR_LOG}" value="${phpunit_error_log}"/>
|
||||
<replace file="ui/conf/zabbix.conf.php" token="{SERVER_PORT}" value="${phpunit_port_prefix}51"/> <!-- 51 - CIntegrationTest::SERVER_PORT_SUFFIX -->
|
||||
<chmod file="ui/conf/zabbix.conf.php" perm="go+rw"/>
|
||||
</target>
|
||||
|
||||
<target name="create-configs" depends="init-common,create-frontend-configs">
|
||||
<property name="url" value="${URL}"/>
|
||||
<property name="screenshot_dir" value="${SCREENSHOT_DIR}"/>
|
||||
<property name="screenshot_url" value="${SCREENSHOT_URL}"/>
|
||||
<property name="phpunit_port_prefix" value="${PHPUNIT_PORT_PREFIX}"/>
|
||||
<property name="screenshot_references_dir" value="${SCREENSHOT_REFERENCES_DIR}"/>
|
||||
<condition property="phpunit_driver_address" value="${PHPUNIT_DRIVER_ADDRESS}" else="localhost">
|
||||
<and>
|
||||
<isset property="PHPUNIT_DRIVER_ADDRESS" />
|
||||
<length string="${PHPUNIT_DRIVER_ADDRESS}" when="greater" length="0"/>
|
||||
</and>
|
||||
</condition>
|
||||
<property environment="env"/>
|
||||
|
||||
<!-- Create bootstrap.php -->
|
||||
<copy overwrite="true" file="ui/tests/bootstrap.php.template" tofile="ui/tests/bootstrap.php"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{URL}" value="${url}"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{BASEDIR}" value="${basedir}"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{SCREENSHOT_DIR}" value="${screenshot_dir}"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{SCREENSHOT_URL}" value="${screenshot_url}"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{BINARY_DIR}" value="${basedir}/sbin/"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{CONFIG_SOURCE_DIR}" value="${basedir}/conf/"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{CONFIG_DIR}" value="${basedir}/etc/"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{COMPONENT_DIR}" value="${basedir}/runtime/"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{PORT_PREFIX}" value="${phpunit_port_prefix}"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{SCREENSHOT_REFERENCES_DIR}" value="${screenshot_references_dir}"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_DRIVER_ADDRESS}" value="${phpunit_driver_address}"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_DATA_SOURCES_DIR}" value="${basedir}/ui/tests/selenium/data/sources/"/>
|
||||
</target>
|
||||
|
||||
<target name="create-saml-configs">
|
||||
<property name="phpunit_simplesaml_baseurl" value="${PHPUNIT_SIMPLESAML_BASEURL}"/>
|
||||
<property name="phpunit_sp_entity_id" value="${PHPUNIT_SP_ENTITY_ID}"/>
|
||||
<property name="url" value="${URL}"/>
|
||||
|
||||
<!-- SAML settings -->
|
||||
<replace file="ui/tests/bootstrap.php" token="'PHPUNIT_SAML_TESTS_ENABLED', false" value="'PHPUNIT_SAML_TESTS_ENABLED', true"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_IDP_ENTITY_ID}" value="${phpunit_simplesaml_baseurl}/saml2/idp/metadata.php"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_SSO_SERVICE_URL}" value="${phpunit_simplesaml_baseurl}/saml2/idp/SSOService.php"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_SLO_SERVICE_URL}" value="${phpunit_simplesaml_baseurl}/saml2/idp/SingleLogoutService.php"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_SP_ENTITY_ID}" value="${phpunit_sp_entity_id}"/>
|
||||
<!-- Download SAML X509 certificates -->
|
||||
<get src="${phpunit_simplesaml_baseurl}/module.php/saml/idp/certs.php/idp.crt" dest="ui/conf/certs"/>
|
||||
|
||||
<copy overwrite="true" file="${SIMPLESAMLPHP_CFG_FILE}.template" tofile="${SIMPLESAMLPHP_CFG_FILE}"/>
|
||||
<replace file="${SIMPLESAMLPHP_CFG_FILE}" token="{ENTITY_ID}" value="${phpunit_sp_entity_id}"/>
|
||||
<replace file="${SIMPLESAMLPHP_CFG_FILE}" token="{ASSERTION_CONSUMER_SERVICE}" value="${url}index_sso.php?acs"/>
|
||||
<replace file="${SIMPLESAMLPHP_CFG_FILE}" token="{SINGLE_LOGOUT_SERVICE}" value="${url}index_sso.php?sls"/>
|
||||
<chmod file="${SIMPLESAMLPHP_CFG_FILE}" perm="go+r"/>
|
||||
</target>
|
||||
|
||||
<target name="create-ldap-configs">
|
||||
<property name="phpunit_ldap_host" value="${PHPUNIT_LDAP_HOST}"/>
|
||||
<property name="phpunit_ldap_bind_password" value="${PHPUNIT_LDAP_BIND_PASSWORD}"/>
|
||||
<property name="phpunit_ldap_username" value="${PHPUNIT_LDAP_USERNAME}"/>
|
||||
<property name="phpunit_ldap_user_password" value="${PHPUNIT_LDAP_USER_PASSWORD}"/>
|
||||
|
||||
<!-- LDAP settings -->
|
||||
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_LDAP_HOST}" value="${phpunit_ldap_host}"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_LDAP_BIND_PASSWORD}" value="${phpunit_ldap_bind_password}"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_LDAP_USERNAME}" value="${phpunit_ldap_username}"/>
|
||||
<replace file="ui/tests/bootstrap.php" token="{PHPUNIT_LDAP_USER_PASSWORD}" value="${phpunit_ldap_user_password}"/>
|
||||
</target>
|
||||
|
||||
<target name="init-integration">
|
||||
<exec executable="go" failonerror="on">
|
||||
<arg line="clean -cache"/>
|
||||
</exec>
|
||||
<!-- Copy agent2 configuration file -->
|
||||
<copy overwrite="true" file="src/go/conf/zabbix_agent2.conf" tofile="conf/zabbix_agent2.conf"/>
|
||||
</target>
|
||||
|
||||
<target name="init-frontend-modules">
|
||||
<!-- Copy modules directory for selenium tests -->
|
||||
<copy todir="ui/modules" overwrite="true">
|
||||
<fileset dir="ui/tests/selenium/modules"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="make-dbschema">
|
||||
<!-- Create database schema -->
|
||||
<exec executable="./bootstrap.sh" failonerror="on"/>
|
||||
<exec executable="./configure" failonerror="on">
|
||||
<arg line="--quiet"/>
|
||||
</exec>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-j4"/>
|
||||
<arg line="-s"/>
|
||||
<arg line="dbschema"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="make-gettext">
|
||||
<!-- Build translation strings -->
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-j4"/>
|
||||
<arg line="-s"/>
|
||||
<arg line="gettext"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="make-binaries-postgresql">
|
||||
<!-- Binaries for integration tests -->
|
||||
<exec executable="./bootstrap.sh" failonerror="on"/>
|
||||
<exec executable="./configure" failonerror="on">
|
||||
<arg line="--quiet"/>
|
||||
<arg line="--enable-server"/>
|
||||
<arg line="--enable-proxy"/>
|
||||
<arg line="--enable-agent"/>
|
||||
<arg line="--enable-agent2"/>
|
||||
<arg line="--with-postgresql"/>
|
||||
<arg line="--prefix=${basedir}"/>
|
||||
<arg line="--with-libcurl"/>
|
||||
<arg line="--with-stacksize=128"/>
|
||||
<arg line="--with-openssl"/>
|
||||
</exec>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-j4"/>
|
||||
<arg line="-s"/>
|
||||
<arg line="dbschema"/>
|
||||
</exec>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-j4"/>
|
||||
<arg line="-s"/>
|
||||
<arg line="install"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="create-db-postgresql" depends="drop-db-postgresql">
|
||||
<!-- Create PostgreSQL database -->
|
||||
<exec executable="psql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="-c 'create database ${dbname} ENCODING = UTF8 TEMPLATE = template0'"/>
|
||||
</exec>
|
||||
<exec executable="psql" input="database/postgresql/schema.sql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="-1"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
<exec executable="psql" input="database/postgresql/images.sql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="-1"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
<exec executable="psql" input="database/postgresql/data.sql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
<exec executable="psql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="${dbname}"/>
|
||||
<arg line="-c 'VACUUM ANALYZE'"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="drop-db-postgresql">
|
||||
<!-- Drop PostgreSQL database -->
|
||||
<exec executable="psql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="-c 'drop database if exists ${dbname}'"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="create-db-tsdb" depends="create-db-postgresql">
|
||||
<!-- Create PostgreSQL database with TimescaleDB extension-->
|
||||
<exec executable="psql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-d '${dbname}'"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="-c 'create extension if not exists timescaledb cascade;'"/>
|
||||
</exec>
|
||||
<exec executable="psql" input="database/postgresql/timescaledb.sql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="init-proxy-postgresql" depends="">
|
||||
<!-- Create PostgreSQL database -->
|
||||
<exec executable="psql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="-c 'drop database if exists ${dbname}_proxy'"/>
|
||||
</exec>
|
||||
<exec executable="psql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="-c 'create database ${dbname}_proxy ENCODING = UTF8 TEMPLATE = template0'"/>
|
||||
</exec>
|
||||
<exec executable="psql" input="database/postgresql/schema.sql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="-1"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="${dbname}_proxy"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="init-frontend-postgresql" depends="create-configs,create-saml-configs,create-ldap-configs,make-dbschema,make-gettext,create-db-postgresql,init-frontend-modules">
|
||||
<exec executable="psql" input="ui/tests/selenium/data/data_test.sql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="-1"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="init-api-postgresql" depends="create-configs,make-dbschema,create-db-postgresql">
|
||||
<exec executable="psql" input="ui/tests/api_json/data/data_test.sql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="-1"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="init-integration-postgresql" depends="create-configs,init-integration,make-binaries-postgresql,create-db-postgresql,init-proxy-postgresql">
|
||||
<exec executable="psql" input="ui/tests/integration/data/data_test.sql" failonerror="on">
|
||||
<env key="PGPASSWORD" value="${dbpassword}"/>
|
||||
<arg line="-q"/>
|
||||
<arg line="-h '${dbhost}'"/>
|
||||
<arg line="-p '${dbport}'"/>
|
||||
<arg line="-U '${dbuser}'"/>
|
||||
<arg line="-1"/>
|
||||
<arg line="--set ON_ERROR_STOP=1"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="init-integration-tsdb" depends="create-configs,init-integration,make-binaries-postgresql,create-db-tsdb,init-proxy-postgresql">
|
||||
</target>
|
||||
|
||||
<target name="init-dast-postgresql" depends="create-frontend-configs,make-dbschema,create-db-postgresql"/>
|
||||
|
||||
<target name="make-binaries-mysql">
|
||||
<!-- Binaries for integration tests -->
|
||||
<exec executable="./bootstrap.sh" failonerror="on"/>
|
||||
<exec executable="./configure" failonerror="on">
|
||||
<arg line="--quiet"/>
|
||||
<arg line="--enable-server"/>
|
||||
<arg line="--enable-proxy"/>
|
||||
<arg line="--enable-agent"/>
|
||||
<arg line="--enable-agent2"/>
|
||||
<arg line="--with-mysql"/>
|
||||
<arg line="--prefix=${basedir}"/>
|
||||
<arg line="--with-libcurl"/>
|
||||
<arg line="--with-stacksize=128"/>
|
||||
<arg line="--with-openssl"/>
|
||||
</exec>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-j4"/>
|
||||
<arg line="-s"/>
|
||||
<arg line="dbschema"/>
|
||||
</exec>
|
||||
<exec executable="make" failonerror="on">
|
||||
<arg line="-j4"/>
|
||||
<arg line="-s"/>
|
||||
<arg line="install"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="create-db-mysql" depends="drop-db-mysql">
|
||||
<!-- Create MySQL database -->
|
||||
<exec executable="mysql" failonerror="on">
|
||||
<env key="MYSQL_PWD" value="${dbpassword}"/>
|
||||
<arg line="--host=${dbhost}"/>
|
||||
<arg line="--port=${dbport}"/>
|
||||
<arg line="--user=${dbuser}"/>
|
||||
<arg line="--execute='create database ${dbname} character set utf8mb4 collate utf8mb4_bin'"/>
|
||||
</exec>
|
||||
<exec executable="mysql" input="database/mysql/schema.sql" failonerror="on">
|
||||
<env key="MYSQL_PWD" value="${dbpassword}"/>
|
||||
<arg line="--host=${dbhost}"/>
|
||||
<arg line="--port=${dbport}"/>
|
||||
<arg line="--user=${dbuser}"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
<exec executable="mysql" input="database/mysql/images.sql" failonerror="on">
|
||||
<env key="MYSQL_PWD" value="${dbpassword}"/>
|
||||
<arg line="--host=${dbhost}"/>
|
||||
<arg line="--port=${dbport}"/>
|
||||
<arg line="--user=${dbuser}"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
<exec executable="mysql" input="database/mysql/data.sql" failonerror="on">
|
||||
<env key="MYSQL_PWD" value="${dbpassword}"/>
|
||||
<arg line="--host=${dbhost}"/>
|
||||
<arg line="--port=${dbport}"/>
|
||||
<arg line="--user=${dbuser}"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="drop-db-mysql">
|
||||
<!-- Drop MySQL database -->
|
||||
<exec executable="mysql" failonerror="on">
|
||||
<env key="MYSQL_PWD" value="${dbpassword}"/>
|
||||
<arg line="--host=${dbhost}"/>
|
||||
<arg line="--port=${dbport}"/>
|
||||
<arg line="--user=${dbuser}"/>
|
||||
<arg line="--execute='drop database if exists ${dbname}'"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="init-proxy-mysql" depends="">
|
||||
<!-- Create MySQL database -->
|
||||
<exec executable="mysql" failonerror="on">
|
||||
<env key="MYSQL_PWD" value="${dbpassword}"/>
|
||||
<arg line="--host=${dbhost}"/>
|
||||
<arg line="--port=${dbport}"/>
|
||||
<arg line="--user=${dbuser}"/>
|
||||
<arg line="--execute='drop database if exists ${dbname}_proxy'"/>
|
||||
</exec>
|
||||
<exec executable="mysql" failonerror="on">
|
||||
<env key="MYSQL_PWD" value="${dbpassword}"/>
|
||||
<arg line="--host=${dbhost}"/>
|
||||
<arg line="--port=${dbport}"/>
|
||||
<arg line="--user=${dbuser}"/>
|
||||
<arg line="--execute='create database ${dbname}_proxy character set utf8mb4 collate utf8mb4_bin'"/>
|
||||
</exec>
|
||||
<exec executable="mysql" input="database/mysql/schema.sql" failonerror="on">
|
||||
<env key="MYSQL_PWD" value="${dbpassword}"/>
|
||||
<arg line="--host=${dbhost}"/>
|
||||
<arg line="--port=${dbport}"/>
|
||||
<arg line="--user=${dbuser}"/>
|
||||
<arg line="${dbname}_proxy"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="init-frontend-mysql" depends="create-configs,create-saml-configs,create-ldap-configs,make-dbschema,make-gettext,create-db-mysql,init-frontend-modules">
|
||||
<exec executable="mysql" input="ui/tests/selenium/data/data_test.sql" failonerror="on">
|
||||
<env key="MYSQL_PWD" value="${dbpassword}"/>
|
||||
<arg line="--host=${dbhost}"/>
|
||||
<arg line="--port=${dbport}"/>
|
||||
<arg line="--user=${dbuser}"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="init-api-mysql" depends="create-configs,make-dbschema,create-db-mysql">
|
||||
<exec executable="mysql" input="ui/tests/api_json/data/data_test.sql" failonerror="on">
|
||||
<env key="MYSQL_PWD" value="${dbpassword}"/>
|
||||
<arg line="--host=${dbhost}"/>
|
||||
<arg line="--port=${dbport}"/>
|
||||
<arg line="--user=${dbuser}"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="init-integration-mysql" depends="create-configs,init-integration,make-binaries-mysql,create-db-mysql,init-proxy-mysql">
|
||||
<exec executable="mysql" input="ui/tests/integration/data/data_test.sql" failonerror="on">
|
||||
<env key="MYSQL_PWD" value="${dbpassword}"/>
|
||||
<arg line="--host=${dbhost}"/>
|
||||
<arg line="--port=${dbport}"/>
|
||||
<arg line="--user=${dbuser}"/>
|
||||
<arg line="${dbname}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="init-dast-mysql" depends="create-frontend-configs,make-dbschema,create-db-mysql"/>
|
||||
|
||||
<target name="test-phpunit" depends="init-common">
|
||||
<exec executable="phpunit" dir="ui/tests/unit" failonerror="off">
|
||||
<arg line="--log-junit=${basedir}/build/logs/phpunit.xml"/>
|
||||
<arg line="--do-not-cache-result"/>
|
||||
<arg line="${phpunit_filter}"/>
|
||||
<arg line="include/"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="test-frontend">
|
||||
<exec executable="phpunit" dir="ui/tests" failonerror="off">
|
||||
<arg line="--log-junit=${basedir}/build/logs/phpunit.xml"/>
|
||||
<arg line="--bootstrap=bootstrap.php"/>
|
||||
<arg line="--do-not-cache-result"/>
|
||||
<arg line="--dont-report-useless-tests"/>
|
||||
<arg line="${phpunit_filter}"/>
|
||||
<arg line="frontend.php"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="test-api">
|
||||
<exec executable="phpunit" dir="ui/tests" failonerror="off">
|
||||
<arg line="--log-junit=${basedir}/build/logs/phpunit.xml"/>
|
||||
<arg line="--bootstrap=bootstrap.php"/>
|
||||
<arg line="--do-not-cache-result"/>
|
||||
<arg line="${phpunit_filter}"/>
|
||||
<arg line="api_json/ApiJsonTests.php"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="test-integration">
|
||||
<exec executable="phpunit" dir="ui/tests" failonerror="off">
|
||||
<arg line="--log-junit=${basedir}/build/logs/phpunit.xml"/>
|
||||
<arg line="--bootstrap=bootstrap.php"/>
|
||||
<arg line="--do-not-cache-result"/>
|
||||
<arg line="--dont-report-useless-tests"/>
|
||||
<arg line="${phpunit_filter}"/>
|
||||
<arg line="integration/IntegrationTests.php"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="build-phpunit" depends="test-phpunit"/>
|
||||
<target name="build-mysql" depends="init-frontend-mysql,test-frontend"/>
|
||||
<target name="build-postgresql" depends="init-frontend-postgresql,test-frontend"/>
|
||||
<target name="build-api-mysql" depends="init-api-mysql,test-api"/>
|
||||
<target name="build-api-postgresql" depends="init-api-postgresql,test-api"/>
|
||||
<target name="build-integration-mysql" depends="init-integration-mysql,test-integration"/>
|
||||
<target name="build-integration-postgresql" depends="init-integration-postgresql,test-integration"/>
|
||||
<target name="build-integration-tsdb" depends="init-integration-tsdb,test-integration"/>
|
||||
<target name="build-dast-mysql" depends="init-dast-mysql"/>
|
||||
<target name="build-dast-postgresql" depends="init-dast-postgresql"/>
|
||||
|
||||
<!-- Default target -->
|
||||
<target name="build" depends="build-phpunit,build-mysql,build-postgresql,build-integration-mysql,build-integration-postgresql,build-integration-tsdb"/>
|
||||
</project>
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_WINMETA_H
|
||||
#define ZABBIX_WINMETA_H
|
||||
|
||||
#define WINEVENT_LEVEL_LOG_ALWAYS 0x0
|
||||
#define WINEVENT_LEVEL_CRITICAL 0x1
|
||||
#define WINEVENT_LEVEL_ERROR 0x2
|
||||
#define WINEVENT_LEVEL_WARNING 0x3
|
||||
#define WINEVENT_LEVEL_INFO 0x4
|
||||
#define WINEVENT_LEVEL_VERBOSE 0x5
|
||||
|
||||
#define WINEVENT_KEYWORD_AUDIT_FAILURE 0x10000000000000
|
||||
#define WINEVENT_KEYWORD_AUDIT_SUCCESS 0x20000000000000
|
||||
|
||||
#endif
|
@ -0,0 +1,93 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <winsock.h>
|
||||
|
||||
#include "zabbix_sender.h"
|
||||
|
||||
/*
|
||||
* This is a simple Zabbix sender utility implemented with
|
||||
* Zabbix sender dynamic link library to illustrate the
|
||||
* library usage.
|
||||
*
|
||||
* See zabbix_sender.h header file for API specifications.
|
||||
*
|
||||
* This utility can be built in Microsoft Windows 32 bit build
|
||||
* environment with the following command: nmake /f Makefile
|
||||
*
|
||||
* To run this utility ensure that zabbix_sender.dll is
|
||||
* available (either in current directory or in windows/system
|
||||
* directories or in a directory defined in PATH variable)
|
||||
*/
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (5 == argc)
|
||||
{
|
||||
char *result = NULL;
|
||||
zabbix_sender_info_t info;
|
||||
zabbix_sender_value_t value = {argv[2], argv[3], argv[4]};
|
||||
int response;
|
||||
WSADATA sockInfo;
|
||||
|
||||
if (0 != WSAStartup(MAKEWORD(2, 2), &sockInfo))
|
||||
{
|
||||
printf("Cannot initialize Winsock DLL\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* send one value to the argv[1] IP address and the default trapper port 10051 */
|
||||
if (-1 == zabbix_sender_send_values(argv[1], 10051, NULL, &value, 1, &result))
|
||||
{
|
||||
printf("sending failed: %s\n", result);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("sending succeeded:\n");
|
||||
|
||||
/* parse the server response */
|
||||
if (0 == zabbix_sender_parse_result(result, &response, &info))
|
||||
{
|
||||
printf(" response: %s\n", 0 == response ? "success" : "failed");
|
||||
printf(" info from server: \"processed: %d; failed: %d; total: %d; seconds spent: %lf\"\n",
|
||||
info.total - info.failed, info.failed, info.total, info.time_spent);
|
||||
}
|
||||
else
|
||||
printf(" failed to parse server response\n");
|
||||
}
|
||||
|
||||
/* free the server response */
|
||||
zabbix_sender_free_result(result);
|
||||
while (0 == WSACleanup());
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Simple zabbix_sender implementation with zabbix_sender library\n\n");
|
||||
printf("usage: %s <server> <hostname> <key> <value>\n\n", argv[0]);
|
||||
printf("Options:\n");
|
||||
printf(" <server> Hostname or IP address of Zabbix server\n");
|
||||
printf(" <hostname> Host name\n");
|
||||
printf(" <key> Item key\n");
|
||||
printf(" <value> Item value\n");
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
/* Define to os name for code managing */
|
||||
#define ARCH "windows"
|
||||
|
||||
/* Define to 1 if you have the <windows.h> header file. */
|
||||
#define HAVE_WINDOWS_H 1
|
||||
|
||||
/* Define to 1 if you have the <winsock2.h> header file. */
|
||||
#define HAVE_WINSOCK2_H 1
|
||||
|
||||
/* Define to 1 if you have the <ws2tcpip.h> header file. */
|
||||
#define HAVE_WS2TCPIP_H 1
|
||||
|
||||
/* Define to 1 if you have the <wspiapi.h> header file. */
|
||||
#define HAVE_WSPIAPI_H 1
|
||||
|
||||
/* Define to 1 if you have the <conio.h> header file. */
|
||||
#define HAVE_CONIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <process.h> header file. */
|
||||
#define HAVE_PROCESS_H 1
|
||||
|
||||
/* Define to 1 if you have the <pdh.h> header file. */
|
||||
#define HAVE_PDH_H 1
|
||||
|
||||
/* Define to 1 if you have the <pdhmsg.h> header file. */
|
||||
#define HAVE_PDHMSG_H 1
|
||||
|
||||
/* Define to 1 if you have the <psapi.h> header file. */
|
||||
#define HAVE_PSAPI_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/timeb.h> header file. */
|
||||
#define HAVE_SYS_TIMEB_H 1
|
||||
|
||||
/* Define to 1 if you have the <Winldap.h> header file. */
|
||||
#define HAVE_WINLDAP_H 1
|
||||
|
||||
/* Define to 1 if you have the <Winber.h> header file. */
|
||||
#define HAVE_WINBER_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <math.h> header file. */
|
||||
#define HAVE_MATH_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <time.h> header file. */
|
||||
#define HAVE_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <assert.h> header file. */
|
||||
#define HAVE_ASSERT_H 1
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* Define to 1 if you have the <io.h> header file. */
|
||||
#define HAVE_IO_H 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <Iphlpapi.h> header file. */
|
||||
#define HAVE_IPHLPAPI_H 1
|
||||
|
||||
/* Define to 1 if you have the <Netioapi.h> header file. */
|
||||
#define HAVE_NETIOAPI_H 1
|
||||
|
||||
/* Define to 1 if 'sockaddr_storage.ss_family' exists. */
|
||||
#define HAVE_SOCKADDR_STORAGE_SS_FAMILY 1
|
||||
|
||||
/* define to 1 if you have the <errno.h> header file */
|
||||
#define HAVE_ERRNO_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
@ -0,0 +1,142 @@
|
||||
# detect target architecture
|
||||
!IF "$(CPU)" == ""
|
||||
CPU=$(PROCESSOR_ARCHITECTURE)
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CPU)" == "i386" || "$(CPU)" == "x86"
|
||||
TARGETDIR = ..\..\..\bin\win32
|
||||
ADD_LFLAGS = /MACHINE:X86
|
||||
|
||||
!ELSEIF "$(CPU)" == "AMD64"
|
||||
TARGETDIR = ..\..\..\bin\win64
|
||||
ADD_LFLAGS = /MACHINE:X64
|
||||
|
||||
!ELSE
|
||||
!ERROR Unsupported CPU architecture: $(CPU)
|
||||
!ENDIF
|
||||
|
||||
PROJECTNAME = zabbix_agent
|
||||
PROJECTDIR = ..\..\..\src\$(PROJECTNAME)
|
||||
TARGETNAME = zabbix_agentd
|
||||
TARGETEXT = exe
|
||||
PROGNAME = $(TARGETDIR)\$(TARGETNAME).$(TARGETEXT)
|
||||
|
||||
PDBS = $(TARGETDIR)\$(TARGETNAME).pdb $(TARGETNAME).$(TARGETEXT).pdb
|
||||
|
||||
ADD_CFLAGS = $(ADD_CFLAGS) /D WITH_AGENT_METRICS /D WITH_COMMON_METRICS \
|
||||
/D WITH_SPECIFIC_METRICS /D WITH_HOSTNAME_METRIC /D WITH_SIMPLE_METRICS /D WITH_HTTP_METRICS \
|
||||
/Zi /D DEFAULT_CONFIG_FILE="\"C:\\zabbix_agentd.conf\"" \
|
||||
/Fd$(TARGETNAME).$(TARGETEXT).pdb
|
||||
|
||||
ADD_LFLAGS = $(ADD_LFLAGS) /DEBUG /OPT:REF /DELAYLOAD:wevtapi.dll
|
||||
|
||||
ADD_RFLAGS = /d "ZABBIX_AGENT"
|
||||
|
||||
!INCLUDE Makefile_common.inc
|
||||
|
||||
OBJS = \
|
||||
..\..\..\src\libs\zbxalgo\algodefs.o \
|
||||
..\..\..\src\libs\zbxalgo\vector.o \
|
||||
..\..\..\src\libs\zbxalgo\hashset.o \
|
||||
..\..\..\src\libs\zbxcrypto\endian.o \
|
||||
..\..\..\src\libs\zbxcommon\setproctitle.o \
|
||||
..\..\..\src\libs\zbxcommon\common_log.o \
|
||||
..\..\..\src\libs\zbxip\ip.o \
|
||||
..\..\..\src\libs\zbxip\iprange.o \
|
||||
..\..\..\src\libs\zbxcommon\misc.o \
|
||||
..\..\..\src\libs\zbxnum\num.o \
|
||||
..\..\..\src\libs\zbxstr\str.o \
|
||||
..\..\..\src\libs\zbxcommon\common_str.o \
|
||||
..\..\..\src\libs\zbxfile\file.o \
|
||||
..\..\..\src\libs\zbxfile\win32\win32_file.o \
|
||||
..\..\..\src\libs\zbxparam\param.o \
|
||||
..\..\..\src\libs\zbxtime\time.o \
|
||||
..\..\..\src\libs\zbxexpr\expr.o \
|
||||
..\..\..\src\libs\zbxexpr\function.o \
|
||||
..\..\..\src\libs\zbxexpr\host.o \
|
||||
..\..\..\src\libs\zbxexpr\macro.o \
|
||||
..\..\..\src\libs\zbxexpr\token.o \
|
||||
..\..\..\src\libs\zbxcommon\components_strings_representations.o \
|
||||
..\..\..\src\libs\zbxcommon\libc_wrappers.o \
|
||||
..\..\..\src\libs\zbxcommshigh\commshigh.o \
|
||||
..\..\..\src\libs\zbxcomms\comms.o \
|
||||
..\..\..\src\libs\zbxcomms\telnet.o \
|
||||
..\..\..\src\libs\zbxcompress\compress.o \
|
||||
..\..\..\src\libs\zbxconf\cfg.o \
|
||||
..\..\..\src\libs\zbxcrypto\base64.o \
|
||||
..\..\..\src\libs\zbxgetopt\getopt.o \
|
||||
..\..\..\src\libs\zbxhash\md5.o \
|
||||
..\..\..\src\libs\zbxhash\sha256crypt.o \
|
||||
..\..\..\src\libs\zbxcrypto\crypto.o \
|
||||
..\..\..\src\libs\zbxjson\json.o \
|
||||
..\..\..\src\libs\zbxjson\json_parser.o \
|
||||
..\..\..\src\libs\zbxjson\jsonpath.o \
|
||||
..\..\..\src\libs\zbxjson\jsonobj.o \
|
||||
..\..\..\src\libs\zbxlog\log.o \
|
||||
..\..\..\src\libs\zbxmutexs\mutexs.o \
|
||||
..\..\..\src\libs\zbxthreads\threads.o \
|
||||
..\..\..\src\libs\zbxexec\execute.o \
|
||||
..\..\..\src\libs\zbxhash\zbxhash.o \
|
||||
..\..\..\src\libs\zbxhttp\http.o \
|
||||
..\..\..\src\libs\zbxhttp\punycode.o \
|
||||
..\..\..\src\libs\zbxhttp\urlencode.o \
|
||||
..\..\..\src\libs\zbxsysinfo\agent\agent.o \
|
||||
..\..\..\src\libs\zbxsysinfo\agent\modbus.o \
|
||||
..\..\..\src\libs\zbxsysinfo\common\zbxsysinfo_common.o \
|
||||
..\..\..\src\libs\zbxsysinfo\common\cpu.o \
|
||||
..\..\..\src\libs\zbxsysinfo\common\cpustat.o \
|
||||
..\..\..\src\libs\zbxsysinfo\common\dir.o \
|
||||
..\..\..\src\libs\zbxsysinfo\common\vfs_file.o \
|
||||
..\..\..\src\libs\zbxsysinfo\common\http.o \
|
||||
..\..\..\src\libs\zbxsysinfo\common\http_metrics.o \
|
||||
..\..\..\src\libs\zbxsysinfo\common\net.o \
|
||||
..\..\..\src\libs\zbxsysinfo\common\dns.o \
|
||||
..\..\..\src\libs\zbxsysinfo\common\system.o \
|
||||
..\..\..\src\libs\zbxsysinfo\common\zabbix_stats.o \
|
||||
..\..\..\src\libs\zbxsysinfo\common\stats.o \
|
||||
..\..\..\src\libs\zbxsysinfo\simple\ntp.o \
|
||||
..\..\..\src\libs\zbxsysinfo\simple\simple.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\perfstat\perfstat.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\cpu.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\diskio.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\diskspace.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\memory.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\net.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\pdhmon.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\registry.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\proc.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\services.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\swap.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\uptime.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\win32.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\wmi.o \
|
||||
..\..\..\src\libs\zbxsysinfo\sysinfo.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\software.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\system.o \
|
||||
..\..\..\src\libs\zbxsysinfo\win32\hostname.o \
|
||||
..\..\..\src\libs\zbxsysinfo\alias\alias.o \
|
||||
..\..\..\src\libs\zbxvariant\variant.o \
|
||||
..\..\..\src\libs\zbxversion\version.o \
|
||||
..\..\..\src\libs\zbxwin32\perfmon.o \
|
||||
..\..\..\src\libs\zbxwinservice\service.o \
|
||||
..\..\..\src\zabbix_agent\active_checks\active_checks.o \
|
||||
..\..\..\src\zabbix_agent\eventlog\eventlog.o \
|
||||
..\..\..\src\zabbix_agent\eventlog\process_eventslog.o \
|
||||
..\..\..\src\zabbix_agent\eventlog\process_eventslog6.o \
|
||||
..\..\..\src\zabbix_agent\listener\listener.o \
|
||||
..\..\..\src\zabbix_agent\logfiles\persistent_state.o \
|
||||
..\..\..\src\zabbix_agent\logfiles\logfiles.o \
|
||||
..\..\..\src\zabbix_agent\zabbix_agentd.o \
|
||||
..\..\..\src\zabbix_agent\agent_conf\agent_conf.o \
|
||||
..\..\..\src\libs\zbxregexp\zbxregexp.o \
|
||||
..\..\..\src\libs\zbxxml\xml.o \
|
||||
..\..\..\src\libs\zbxwin32\fatal.o \
|
||||
..\..\..\src\libs\zbxwin32\disk.o \
|
||||
..\..\..\src\libs\zbxwin32\symbols.o
|
||||
|
||||
LIBS = ws2_32.lib psapi.lib pdh.lib Wldap32.lib advapi32.lib uuid.lib Iphlpapi.lib delayimp.lib wevtapi.lib shlwapi.lib $(LIBS)
|
||||
|
||||
!INCLUDE Makefile_pcre.inc
|
||||
!INCLUDE Makefile_tls.inc
|
||||
!INCLUDE Makefile_modbus.inc
|
||||
!INCLUDE Makefile_targets.inc
|
@ -0,0 +1,39 @@
|
||||
CC = cl.exe
|
||||
LINKER = link.exe
|
||||
MC = mc.exe
|
||||
MT = mt.exe
|
||||
RC = rc.exe
|
||||
|
||||
MESSAGES_H = messages.h
|
||||
RESOURCE_H = resource.h
|
||||
RESOURCE_RC = resource.rc
|
||||
DESC_H = $(PROJECTNAME)_desc.h
|
||||
RESOURCE_RES = $(PROJECTNAME).res
|
||||
|
||||
INCS = /I $(PROJECTDIR) /I .\ /I ..\include /I ..\include\common /I ..\..\..\include /I ..\..\..\include\common
|
||||
|
||||
!IF "$(CPU)" == "i386" || "$(CPU)" == "x86"
|
||||
COMMON_FLAGS = /D _WIN32_WINNT=0x0502
|
||||
ADD_LFLAGS = $(ADD_LFLAGS) /SUBSYSTEM:"CONSOLE,5.01"
|
||||
!ELSEIF "$(CPU)" == "AMD64"
|
||||
COMMON_FLAGS = /D _WIN32_WINNT=0x0502
|
||||
ADD_LFLAGS = $(ADD_LFLAGS) /SUBSYSTEM:"CONSOLE,5.02"
|
||||
!ENDIF
|
||||
|
||||
!IF "$(DEBUG)" != ""
|
||||
OPTS = /Ob0
|
||||
!ELSE
|
||||
OPTS = /O2
|
||||
!ENDIF
|
||||
|
||||
COMMON_FLAGS = $(COMMON_FLAGS) /nologo $(OPTS) /GF /FD /EHsc /MT /Gy /W3 /c /D _WINDOWS /D _CONSOLE /D UNICODE \
|
||||
/D _UNICODE /D HAVE_WINLDAP_H /D HAVE_ASSERT_H /D ZABBIX_SERVICE /D "_VC80_UPGRADE=0x0600" /D HAVE_IPV6
|
||||
|
||||
CFLAGS = $(CFLAGS) $(INCS) $(ADD_CFLAGS) $(COMMON_FLAGS) /TC
|
||||
|
||||
CPPFLAGS = $(INCS) $(ADD_CFLAGS) $(COMMON_FLAGS) /TP
|
||||
|
||||
LFLAGS = /NOLOGO $(ADD_LFLAGS) /INCREMENTAL:NO /MANIFEST /MANIFESTFILE:"$(TARGETNAME).$(TARGETEXT).manifest" \
|
||||
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DYNAMICBASE:NO /PDB:$(TARGETDIR)\$(TARGETNAME).pdb
|
||||
|
||||
RFLAGS = $(RFLAGS) $(ADD_RFLAGS) /d _WINDOWS
|
@ -0,0 +1,77 @@
|
||||
# detect target architecture
|
||||
!IF "$(CPU)" == ""
|
||||
CPU=$(PROCESSOR_ARCHITECTURE)
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CPU)" == "i386" || "$(CPU)" == "x86"
|
||||
TARGETDIR = ..\..\..\bin\win32
|
||||
ADD_LFLAGS = /MACHINE:X86
|
||||
|
||||
!ELSEIF "$(CPU)" == "AMD64"
|
||||
TARGETDIR = ..\..\..\bin\win64
|
||||
ADD_LFLAGS = /MACHINE:X64
|
||||
|
||||
!ELSE
|
||||
!ERROR Unsupported CPU architecture: $(CPU)
|
||||
!ENDIF
|
||||
|
||||
PROJECTNAME = zabbix_get
|
||||
PROJECTDIR = ..\..\..\src\$(PROJECTNAME)
|
||||
TARGETNAME = zabbix_get
|
||||
TARGETEXT = exe
|
||||
PROGNAME = $(TARGETDIR)\$(TARGETNAME).$(TARGETEXT)
|
||||
|
||||
ADD_CFLAGS = $(ADD_CFLAGS) /D NDEBUG /Fd$(TARGETNAME).$(TARGETEXT).pdb
|
||||
ADD_RFLAGS = /d "ZABBIX_GET"
|
||||
|
||||
!INCLUDE Makefile_common.inc
|
||||
|
||||
OBJS = \
|
||||
..\..\..\src\libs\zbxalgo\algodefs.o \
|
||||
..\..\..\src\libs\zbxalgo\vector.o \
|
||||
..\..\..\src\libs\zbxalgo\hashset.o \
|
||||
..\..\..\src\libs\zbxcrypto\endian.o \
|
||||
..\..\..\src\libs\zbxip\ip.o \
|
||||
..\..\..\src\libs\zbxip\iprange.o \
|
||||
..\..\..\src\libs\zbxcommon\misc.o \
|
||||
..\..\..\src\libs\zbxcommon\common_log.o \
|
||||
..\..\..\src\libs\zbxstr\str.o \
|
||||
..\..\..\src\libs\zbxnum\num.o \
|
||||
..\..\..\src\libs\zbxcommon\common_str.o \
|
||||
..\..\..\src\libs\zbxparam\param.o \
|
||||
..\..\..\src\libs\zbxtime\time.o \
|
||||
..\..\..\src\libs\zbxexpr\expr.o \
|
||||
..\..\..\src\libs\zbxexpr\function.o \
|
||||
..\..\..\src\libs\zbxexpr\host.o \
|
||||
..\..\..\src\libs\zbxexpr\macro.o \
|
||||
..\..\..\src\libs\zbxexpr\token.o \
|
||||
..\..\..\src\libs\zbxcommon\components_strings_representations.o \
|
||||
..\..\..\src\libs\zbxcommon\libc_wrappers.o \
|
||||
..\..\..\src\libs\zbxcommshigh\commshigh.o \
|
||||
..\..\..\src\libs\zbxcomms\comms.o \
|
||||
..\..\..\src\libs\zbxcompress\compress.o \
|
||||
..\..\..\src\libs\zbxconf\cfg.o \
|
||||
..\..\..\src\libs\zbxcrypto\base64.o \
|
||||
..\..\..\src\libs\zbxcrypto\crypto.o \
|
||||
..\..\..\src\libs\zbxgetopt\getopt.o \
|
||||
..\..\..\src\libs\zbxhash\md5.o \
|
||||
..\..\..\src\libs\zbxhash\zbxhash.o \
|
||||
..\..\..\src\libs\zbxjson\json.o \
|
||||
..\..\..\src\libs\zbxjson\json_parser.o \
|
||||
..\..\..\src\libs\zbxjson\jsonpath.o \
|
||||
..\..\..\src\libs\zbxjson\jsonobj.o \
|
||||
..\..\..\src\libs\zbxlog\log.o \
|
||||
..\..\..\src\libs\zbxmutexs\mutexs.o \
|
||||
..\..\..\src\libs\zbxvariant\variant.o \
|
||||
..\..\..\src\libs\zbxversion\version.o \
|
||||
..\..\..\src\libs\zbxthreads\threads.o \
|
||||
..\..\..\src\zabbix_get\zabbix_get.o \
|
||||
..\..\..\src\libs\zbxregexp\zbxregexp.o \
|
||||
..\..\..\src\libs\zbxxml\xml.o \
|
||||
..\..\..\src\libs\zbxwin32\fatal.o
|
||||
|
||||
LIBS = ws2_32.lib psapi.lib pdh.lib Wldap32.lib advapi32.lib uuid.lib Iphlpapi.lib user32.lib shlwapi.lib $(LIBS)
|
||||
|
||||
!INCLUDE Makefile_pcre.inc
|
||||
!INCLUDE Makefile_tls.inc
|
||||
!INCLUDE Makefile_targets.inc
|
@ -0,0 +1,6 @@
|
||||
!IF "$(MODBINCDIR)" != "" && "$(MODBLIBDIR)" != ""
|
||||
CFLAGS = $(CFLAGS) /DHAVE_LIBMODBUS /DHAVE_LIBMODBUS_3_1
|
||||
MODBLIB = $(MODBLIBDIR)\modbus.lib
|
||||
LIBS = $(LIBS) "$(MODBLIB)"
|
||||
INCS = $(INCS) /I "$(MODBINCDIR)"
|
||||
!ENDIF
|
@ -0,0 +1,48 @@
|
||||
! IF "$(PCREINCDIR)" == "" && "$(PCRE2INCDIR)" == ""
|
||||
! ERROR Please specify directory containing PCRE or PCRE2 header files (e. g. PCREINCDIR=\somepath\include or PCRE2INCDIR=\somepath\include).
|
||||
! ENDIF
|
||||
|
||||
! IF "$(PCRELIBDIR)" == "" && "$(PCRE2LIBDIR)" == ""
|
||||
! ERROR Please specify either PCRELIBDIR or PCRE2LIBDIR (e. g. PCRELIBDIR=\somepath\lib or PCRE2LIBDIR=\somepath\lib).
|
||||
! ENDIF
|
||||
|
||||
! IF ("$(PCREINCDIR)" != "" && "$(PCRE2INCDIR)" != "") || ("$(PCRELIBDIR)" != "" && "$(PCRE2LIBDIR)" != "")
|
||||
! ERROR Cannot use both PCRE and PCRE2 at the same time!
|
||||
! ENDIF
|
||||
|
||||
! IF "$(PCREINCDIR)" != ""
|
||||
! IF EXISTS("$(PCREINCDIR)\pcre.h")
|
||||
CFLAGS = $(CFLAGS) /DPCRE_STATIC /DHAVE_PCRE_H
|
||||
INCS = $(INCS) /I "$(PCREINCDIR)"
|
||||
! ELSE
|
||||
! ERROR PCREINCDIR "$(PCREINCDIR)" cannot find "$(PCREINCDIR)\pcre.h"
|
||||
! ENDIF
|
||||
! ENDIF
|
||||
|
||||
! IF "$(PCRE2INCDIR)" != ""
|
||||
! IF EXISTS("$(PCRE2INCDIR)\pcre2.h")
|
||||
CFLAGS = $(CFLAGS) /DPCRE2_STATIC /DHAVE_PCRE2_H
|
||||
INCS = $(INCS) /I "$(PCRE2INCDIR)"
|
||||
! ELSE
|
||||
! ERROR PCRE2INCDIR "$(PCRE2INCDIR)" cannot find "$(PCRE2INCDIR)\pcre2.h"
|
||||
! ENDIF
|
||||
! ENDIF
|
||||
|
||||
! IF "$(PCRELIBDIR)" != ""
|
||||
! IF EXISTS("$(PCRELIBDIR)\pcre.lib")
|
||||
LIBS = $(LIBS) "$(PCRELIBDIR)\pcre.lib"
|
||||
! ELSE
|
||||
! ERROR PCRELIBDIR "$(PCRELIBDIR)" cannot find "$(PCRELIBDIR)\pcre.lib"
|
||||
! ENDIF
|
||||
! ENDIF
|
||||
|
||||
! IF "$(PCRE2LIBDIR)" != ""
|
||||
! IF EXISTS("$(PCRE2LIBDIR)\pcre2-8-static.lib")
|
||||
LIBS = $(LIBS) "$(PCRE2LIBDIR)\pcre2-8-static.lib"
|
||||
! ELSEIF EXISTS("$(PCRE2LIBDIR)\pcre2-8-staticd.lib")
|
||||
LIBS = $(LIBS) "$(PCRE2LIBDIR)\pcre2-8-staticd.lib"
|
||||
! ELSE
|
||||
! ERROR PCRE2LIBDIR "$(PCRE2LIBDIR)" cannot find neither "$(PCRE2LIBDIR)\pcre2-8-static.lib" nor "$(PCRE2LIBDIR)\pcre2-8-staticd.lib"
|
||||
! ENDIF
|
||||
! ENDIF
|
||||
|
@ -0,0 +1,79 @@
|
||||
# detect target architecture
|
||||
!IF "$(CPU)" == ""
|
||||
CPU=$(PROCESSOR_ARCHITECTURE)
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CPU)" == "i386" || "$(CPU)" == "x86"
|
||||
TARGETDIR = ..\..\..\bin\win32
|
||||
ADD_LFLAGS = /MACHINE:X86
|
||||
|
||||
!ELSEIF "$(CPU)" == "AMD64"
|
||||
TARGETDIR = ..\..\..\bin\win64
|
||||
ADD_LFLAGS = /MACHINE:X64
|
||||
|
||||
!ELSE
|
||||
!ERROR Unsupported CPU architecture: $(CPU)
|
||||
!ENDIF
|
||||
|
||||
PROJECTNAME = zabbix_sender
|
||||
PROJECTDIR = ..\..\..\src\$(PROJECTNAME)
|
||||
TARGETNAME = zabbix_sender
|
||||
TARGETEXT = exe
|
||||
PROGNAME = $(TARGETDIR)\$(TARGETNAME).$(TARGETEXT)
|
||||
|
||||
ADD_CFLAGS = $(ADD_CFLAGS) /D NDEBUG /Fd$(TARGETNAME).$(TARGETEXT).pdb
|
||||
ADD_RFLAGS = /d "ZABBIX_SENDER"
|
||||
|
||||
!INCLUDE Makefile_common.inc
|
||||
|
||||
# the main object file must be already added in master Makefile
|
||||
OBJS = \
|
||||
..\..\..\src\libs\zbxnum\num.o \
|
||||
..\..\..\src\libs\zbxparam\param.o \
|
||||
..\..\..\src\libs\zbxcrypto\endian.o \
|
||||
..\..\..\src\libs\zbxip\ip.o \
|
||||
..\..\..\src\libs\zbxip\iprange.o \
|
||||
..\..\..\src\libs\zbxcommon\misc.o \
|
||||
..\..\..\src\libs\zbxstr\str.o \
|
||||
..\..\..\src\libs\zbxcommon\common_str.o \
|
||||
..\..\..\src\libs\zbxcommon\common_log.o \
|
||||
..\..\..\src\libs\zbxparam\param.o \
|
||||
..\..\..\src\libs\zbxtime\time.o \
|
||||
..\..\..\src\libs\zbxexpr\expr.o \
|
||||
..\..\..\src\libs\zbxexpr\function.o \
|
||||
..\..\..\src\libs\zbxexpr\host.o \
|
||||
..\..\..\src\libs\zbxexpr\macro.o \
|
||||
..\..\..\src\libs\zbxexpr\token.o \
|
||||
..\..\..\src\libs\zbxcommon\components_strings_representations.o \
|
||||
..\..\..\src\libs\zbxcommon\libc_wrappers.o \
|
||||
..\..\..\src\libs\zbxcommshigh\commshigh.o \
|
||||
..\..\..\src\libs\zbxcomms\comms.o \
|
||||
..\..\..\src\libs\zbxcompress\compress.o \
|
||||
..\..\..\src\libs\zbxconf\cfg.o \
|
||||
..\..\..\src\libs\zbxcrypto\base64.o \
|
||||
..\..\..\src\libs\zbxcrypto\crypto.o \
|
||||
..\..\..\src\libs\zbxgetopt\getopt.o \
|
||||
..\..\..\src\libs\zbxhash\md5.o \
|
||||
..\..\..\src\libs\zbxhash\zbxhash.o \
|
||||
..\..\..\src\libs\zbxjson\json.o \
|
||||
..\..\..\src\libs\zbxjson\json_parser.o \
|
||||
..\..\..\src\libs\zbxjson\jsonpath.o \
|
||||
..\..\..\src\libs\zbxjson\jsonobj.o \
|
||||
..\..\..\src\libs\zbxlog\log.o \
|
||||
..\..\..\src\libs\zbxmutexs\mutexs.o \
|
||||
..\..\..\src\libs\zbxthreads\threads.o \
|
||||
..\..\..\src\libs\zbxvariant\variant.o \
|
||||
..\..\..\src\libs\zbxwin32\fatal.o \
|
||||
..\..\..\src\libs\zbxalgo\algodefs.o \
|
||||
..\..\..\src\libs\zbxalgo\vector.o \
|
||||
..\..\..\src\libs\zbxalgo\hashset.o \
|
||||
..\..\..\src\libs\zbxregexp\zbxregexp.o \
|
||||
..\..\..\src\libs\zbxversion\version.o \
|
||||
..\..\..\src\libs\zbxxml\xml.o \
|
||||
..\..\..\src\zabbix_sender\zabbix_sender.o
|
||||
|
||||
LIBS = ws2_32.lib psapi.lib pdh.lib Wldap32.lib advapi32.lib uuid.lib Iphlpapi.lib user32.lib shlwapi.lib $(LIBS)
|
||||
|
||||
!INCLUDE Makefile_pcre.inc
|
||||
!INCLUDE Makefile_tls.inc
|
||||
!INCLUDE Makefile_targets.inc
|
@ -0,0 +1,102 @@
|
||||
# detect target architecture
|
||||
!IF "$(CPU)" == ""
|
||||
CPU=$(PROCESSOR_ARCHITECTURE)
|
||||
!ENDIF
|
||||
|
||||
!IF "$(CPU)" == "i386" || "$(CPU)" == "x86"
|
||||
TARGETDIR = ..\..\..\bin\win32\dev
|
||||
ADD_LFLAGS = /MACHINE:X86
|
||||
|
||||
!ELSEIF "$(CPU)" == "AMD64"
|
||||
TARGETDIR = ..\..\..\bin\win64\dev
|
||||
ADD_LFLAGS = /MACHINE:X64
|
||||
|
||||
!ELSE
|
||||
!ERROR Unsupported CPU architecture: $(CPU)
|
||||
!ENDIF
|
||||
|
||||
PROJECTNAME = zabbix_sender
|
||||
PROJECTDIR = ..\..\..\src\$(PROJECTNAME)
|
||||
TARGETNAME = zabbix_sender
|
||||
TARGETEXT = dll
|
||||
PROGNAME = $(TARGETDIR)\$(TARGETNAME).$(TARGETEXT)
|
||||
ADD_CFLAGS = $(ADD_CFLAGS) /D NDEBUG /D ZBX_EXPORT /Fd$(TARGETNAME).$(TARGETEXT).pdb
|
||||
ADD_LFLAGS = $(ADD_LFLAGS) /DLL
|
||||
|
||||
PREBUILD = pre-build
|
||||
POSTBUILD = post-build
|
||||
POSTCLEAN = post-clean
|
||||
|
||||
ADD_CFLAGS = $(ADD_CFLAGS) /D NDEBUG
|
||||
ADD_RFLAGS = /d "ZABBIX_SENDER"
|
||||
|
||||
!INCLUDE Makefile_common.inc
|
||||
|
||||
# the main object file must be already added in master Makefile
|
||||
OBJS = \
|
||||
..\..\..\src\libs\zbxnum\num.o \
|
||||
..\..\..\src\libs\zbxcrypto\endian.o \
|
||||
..\..\..\src\libs\zbxip\ip.o \
|
||||
..\..\..\src\libs\zbxip\iprange.o \
|
||||
..\..\..\src\libs\zbxcommon\misc.o \
|
||||
..\..\..\src\libs\zbxstr\str.o \
|
||||
..\..\..\src\libs\zbxcommon\common_str.o \
|
||||
..\..\..\src\libs\zbxcommon\common_log.o \
|
||||
..\..\..\src\libs\zbxparam\param.o \
|
||||
..\..\..\src\libs\zbxcommon\components_strings_representations.o \
|
||||
..\..\..\src\libs\zbxcommon\libc_wrappers.o \
|
||||
..\..\..\src\libs\zbxtime\time.o \
|
||||
..\..\..\src\libs\zbxexpr\expr.o \
|
||||
..\..\..\src\libs\zbxexpr\function.o \
|
||||
..\..\..\src\libs\zbxexpr\host.o \
|
||||
..\..\..\src\libs\zbxexpr\macro.o \
|
||||
..\..\..\src\libs\zbxexpr\token.o \
|
||||
..\..\..\src\libs\zbxcommshigh\commshigh.o \
|
||||
..\..\..\src\libs\zbxcomms\comms.o \
|
||||
..\..\..\src\libs\zbxcompress\compress.o \
|
||||
..\..\..\src\libs\zbxconf\cfg.o \
|
||||
..\..\..\src\libs\zbxcrypto\base64.o \
|
||||
..\..\..\src\libs\zbxgetopt\getopt.o \
|
||||
..\..\..\src\libs\zbxhash\md5.o \
|
||||
..\..\..\src\libs\zbxhash\zbxhash.o \
|
||||
..\..\..\src\libs\zbxjson\json.o \
|
||||
..\..\..\src\libs\zbxjson\json_parser.o \
|
||||
..\..\..\src\libs\zbxjson\jsonpath.o \
|
||||
..\..\..\src\libs\zbxjson\jsonobj.o \
|
||||
..\..\..\src\libs\zbxlog\log.o \
|
||||
..\..\..\src\libs\zbxmutexs\mutexs.o \
|
||||
..\..\..\src\libs\zbxthreads\threads.o \
|
||||
..\..\..\src\libs\zbxvariant\variant.o \
|
||||
..\..\..\src\libs\zbxwin32\fatal.o \
|
||||
..\..\..\src\libs\zbxalgo\algodefs.o \
|
||||
..\..\..\src\libs\zbxalgo\vector.o \
|
||||
..\..\..\src\libs\zbxalgo\hashset.o \
|
||||
..\..\..\src\libs\zbxregexp\zbxregexp.o \
|
||||
..\..\..\src\libs\zbxversion\version.o \
|
||||
..\..\..\src\libs\zbxxml\xml.o \
|
||||
..\..\..\src\zabbix_sender\win32\zabbix_sender.o
|
||||
|
||||
LIBS = ws2_32.lib psapi.lib pdh.lib Wldap32.lib advapi32.lib uuid.lib Iphlpapi.lib shlwapi.lib
|
||||
|
||||
!INCLUDE Makefile_pcre.inc
|
||||
!INCLUDE Makefile_targets.inc
|
||||
|
||||
# zabbix_sender dynamic link library support
|
||||
{$(PROJECTDIR)/win32}.c{$(PROJECTDIR)/win32}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
$(TARGETDIR)\zabbix_sender.h: $(PROJECTDIR)\win32\zabbix_sender.h
|
||||
@copy /Y $(PROJECTDIR)\win32\zabbix_sender.h $(TARGETDIR)\
|
||||
|
||||
pre-build:
|
||||
!IF "$(TLS)" != ""
|
||||
@echo Cannot build zabbix_sender.dll with TLS support.
|
||||
@exit /b 9
|
||||
!ENDIF
|
||||
|
||||
post-build: $(TARGETDIR)\zabbix_sender.h
|
||||
@del /Q $(TARGETDIR)\zabbix_sender.exp 2>NUL
|
||||
|
||||
post-clean:
|
||||
@del /Q $(TARGETDIR)\zabbix_sender.h 2>NUL
|
||||
@del /Q $(TARGETDIR)\zabbix_sender.lib 2>NUL
|
@ -0,0 +1,148 @@
|
||||
all: $(PREBUILD) $(PROGNAME) $(POSTBUILD)
|
||||
|
||||
clean: $(POSTCLEAN)
|
||||
# break this down because del has limit for command-line args length (NMAKE : fatal error U1077: 'del' : return code '0x1')
|
||||
@<<zbx_del_obj.bat
|
||||
del $(OBJS)
|
||||
<<
|
||||
del $(RESOURCE_RES) $(MESSAGES_H) $(PROGNAME) messages.rc 2>NUL
|
||||
del MSG00001.bin $(TARGETNAME).$(TARGETEXT).manifest $(PDBS) $(TARGETNAME).$(TARGETEXT).idb 2>NUL
|
||||
|
||||
$(PROGNAME): $(MESSAGES_H) $(OBJS) $(RESOURCE_RES)
|
||||
$(LINKER) $(OBJS) $(RESOURCE_RES) $(LFLAGS) /OUT:$(PROGNAME) $(LIBS)
|
||||
$(MT) /outputresource:"$(PROGNAME);#1" /manifest $(TARGETNAME).$(TARGETEXT).manifest /nologo
|
||||
|
||||
$(MESSAGES_H): messages.mc
|
||||
$(MC) -U -h ".\\" -r ".\\" messages.mc
|
||||
|
||||
$(RESOURCE_RES): $(RESOURCE_RC) $(RESOURCE_H) $(DESC_H)
|
||||
$(RC) $(RFLAGS) /d "NDEBUG" /d "_VC80_UPGRADE=0x0600" /l 0x419 /fo"$(RESOURCE_RES)" $(RESOURCE_RC)
|
||||
|
||||
{..\..\..\src\libs\zbxalgo}.c{..\..\..\src\libs\zbxalgo}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxcommon}.c{..\..\..\src\libs\zbxcommon}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxnum}.c{..\..\..\src\libs\zbxnum}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxstr}.c{..\..\..\src\libs\zbxstr}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxfile}.c{..\..\..\src\libs\zbxfile}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxfile\win32}.c{..\..\..\src\libs\zbxfile\win32}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxparam}.c{..\..\..\src\libs\zbxparam}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxexpr}.c{..\..\..\src\libs\zbxexpr}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxip}.c{..\..\..\src\libs\zbxip}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxtime}.c{..\..\..\src\libs\zbxtime}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxcommshigh}.c{..\..\..\src\libs\zbxcommshigh}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxcomms}.c{..\..\..\src\libs\zbxcomms}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxcompress}.c{..\..\..\src\libs\zbxcompress}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxconf}.c{..\..\..\src\libs\zbxconf}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxcrypto}.c{..\..\..\src\libs\zbxcrypto}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxgetopt}.c{..\..\..\src\libs\zbxgetopt}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxhash}.c{..\..\..\src\libs\zbxhash}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxjson}.c{..\..\..\src\libs\zbxjson}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxlog}.c{..\..\..\src\libs\zbxlog}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxxml}.c{..\..\..\src\libs\zbxxml}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxregexp}.c{..\..\..\src\libs\zbxregexp}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxthreads}.c{..\..\..\src\libs\zbxthreads}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxmutexs}.c{..\..\..\src\libs\zbxmutexs}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxexec}.c{..\..\..\src\libs\zbxexec}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxhttp}.c{..\..\..\src\libs\zbxhttp}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxsysinfo}.c{..\..\..\src\libs\zbxsysinfo}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxsysinfo\agent}.c{..\..\..\src\libs\zbxsysinfo\agent}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxsysinfo\simple}.c{..\..\..\src\libs\zbxsysinfo\simple}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxsysinfo\common}.c{..\..\..\src\libs\zbxsysinfo\common}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxsysinfo\win32}.c{..\..\..\src\libs\zbxsysinfo\win32}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxsysinfo\win32\perfstat}.c{..\..\..\src\libs\zbxsysinfo\win32\perfstat}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxsysinfo\win32}.cpp{..\..\..\src\libs\zbxsysinfo\win32}.o:
|
||||
$(CC) $? /Fo"$@" $(CPPFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxsysinfo\alias}.c{..\..\..\src\libs\zbxsysinfo\alias}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxvariant}.c{..\..\..\src\libs\zbxvariant}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxversion}.c{..\..\..\src\libs\zbxversion}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxwin32}.c{..\..\..\src\libs\zbxwin32}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\libs\zbxwinservice}.c{..\..\..\src\libs\zbxwinservice}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\zabbix_agent\active_checks}.c{..\..\..\src\zabbix_agent\active_checks}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\zabbix_agent\eventlog}.c{..\..\..\src\zabbix_agent\eventlog}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\zabbix_agent\listener}.c{..\..\..\src\zabbix_agent\listener}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\zabbix_agent\agent_conf}.c{..\..\..\src\zabbix_agent\agent_conf}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{..\..\..\src\zabbix_agent\logfiles}.c{..\..\..\src\zabbix_agent\logfiles}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
||||
|
||||
{$(PROJECTDIR)}.c{$(PROJECTDIR)}.o:
|
||||
$(CC) $? /Fo"$@" $(CFLAGS)
|
@ -0,0 +1,76 @@
|
||||
!IF "$(TLS)" != ""
|
||||
|
||||
! IF "$(TLS)" != "gnutls" && "$(TLS)" != "openssl"
|
||||
! ERROR Specified TLS target "$(TLS)" is not supported (supported: gnutls, openssl).
|
||||
! ENDIF
|
||||
|
||||
! IF "$(TLSINCDIR)" == ""
|
||||
! ERROR Please specify directory containing TLS header files (e. g. TLSINCDIR="\somepath\include").
|
||||
! ENDIF
|
||||
|
||||
! IF !EXISTS("$(TLSINCDIR)")
|
||||
! ERROR Specified directory "$(TLSINCDIR)" does not exist.
|
||||
! ENDIF
|
||||
|
||||
! IF "$(TLS)" == "openssl"
|
||||
! IF ("$(TLSLIBDIR)" != "" && "$(TLSLIB2)" != "") || ("$(TLSLIB)" != "" && "$(TLSLIB2)" == "") || ("$(TLSLIB)" == "" && "$(TLSLIB2)" != "")
|
||||
! ERROR Please specify either TLSLIBDIR or both TLSLIB and TLSLIB2 (e. g. TLSLIBDIR="\somepath\lib" or TLSLIB="\somepath\libeay32.lib" TLSLIB2="\somepath\ssleay32.lib").
|
||||
! ENDIF
|
||||
! ELSEIF "$(TLS)" == "gnutls"
|
||||
! IF "$(TLSLIB)" == ""
|
||||
! ERROR Please specify full path to static GnuTLS library (e. g. TLSLIB="\somepath\some.lib").
|
||||
! ENDIF
|
||||
! ELSE
|
||||
! IF ("$(TLSLIBDIR)" == "" && "$(TLSLIB)" == "") || ("$(TLSLIBDIR)" != "" && "$(TLSLIB)" != "")
|
||||
! ERROR Please specify only one of TLSLIBDIR or TLSLIB (e. g. TLSLIBDIR="\somepath\lib" or TLSLIB="\somepath\lib\some.lib").
|
||||
! ENDIF
|
||||
! ENDIF
|
||||
|
||||
! IF "$(TLSLIBDIR)" != "" && !EXISTS("$(TLSLIBDIR)")
|
||||
! ERROR Specified directory "$(TLSLIBDIR)" does not exist.
|
||||
! ENDIF
|
||||
|
||||
! IF "$(TLSLIBDIR)" != ""
|
||||
! IF "$(TLS)" == "openssl"
|
||||
ADDMSG = For OpenSSL 1.0.x you may specify path to libraries using TLSLIB="\somepath\libeay32.lib" TLSLIB2="\somepath\ssleay32.lib", for OpenSSL 1.1.x: TLSLIB="\somepath\libcrypto.lib" TLSLIB2="\somepath\libssl.lib"
|
||||
! ELSE
|
||||
ADDMSG = You may specify path to library using TLSLIB="\somepath\lib\some.lib"
|
||||
! ENDIF
|
||||
! ENDIF
|
||||
|
||||
### GnuTLS ###
|
||||
! IF "$(TLS)" == "gnutls"
|
||||
CFLAGS = $(CFLAGS) /DHAVE_GNUTLS
|
||||
### OpenSSL ###
|
||||
! ELSEIF "$(TLS)" == "openssl"
|
||||
! IF "$(TLSLIBDIR)" != ""
|
||||
! IF !EXISTS("$(TLSLIBDIR)\libcrypto.lib") && !EXISTS("$(TLSLIBDIR)\libssl.lib")
|
||||
TLSLIB = $(TLSLIBDIR)\libeay32.lib
|
||||
TLSLIB2 = $(TLSLIBDIR)\ssleay32.lib
|
||||
! ELSEIF !EXISTS("$(TLSLIBDIR)\libeay32.lib") && !EXISTS("$(TLSLIBDIR)\ssleay32.lib")
|
||||
TLSLIB = $(TLSLIBDIR)\libcrypto.lib
|
||||
TLSLIB2 = $(TLSLIBDIR)\libssl.lib
|
||||
! ELSE
|
||||
! ERROR TLSLIBDIR "$(TLSLIBDIR)" contains libraries from OpenSSL 1.0.x (libeay32.lib, ssleay32.lib) and 1.1.x (libcrypto.lib, libssl.lib). TLSLIBDIR cannot be used in this case. Use TLSLIB="$(TLSLIBDIR)\libeay32.lib" TLSLIB2="$(TLSLIBDIR)\ssleay32.lib" for OpenSSL 1.0.x or TLSLIB="$(TLSLIBDIR)\libcrypto.lib" TLSLIB2="$(TLSLIBDIR)\libssl.lib" for OpenSSL 1.1.x.
|
||||
! ENDIF
|
||||
! ENDIF
|
||||
CFLAGS = $(CFLAGS) /DHAVE_OPENSSL /DHAVE_OPENSSL_WITH_PSK
|
||||
! ENDIF
|
||||
|
||||
! IF !EXISTS("$(TLSLIB)")
|
||||
! ERROR TLS library "$(TLSLIB)" not found. $(ADDMSG)
|
||||
! ENDIF
|
||||
|
||||
! IF "$(TLS)" == "openssl"
|
||||
! IF !EXISTS("$(TLSLIB2)")
|
||||
! ERROR TLS library "$(TLSLIB2)" not found. $(ADDMSG)
|
||||
! ENDIF
|
||||
LIBS = $(LIBS) "$(TLSLIB)" "$(TLSLIB2)"
|
||||
! ELSE
|
||||
LIBS = $(LIBS) "$(TLSLIB)"
|
||||
! ENDIF
|
||||
|
||||
INCS = $(INCS) /I "$(TLSINCDIR)"
|
||||
OBJS = $(OBJS) ..\..\..\src\libs\zbxcomms\tls.o ..\..\..\src\libs\zbxcomms\tls_version.o ..\..\..\src\libs\zbxcomms\tls_validate.o
|
||||
|
||||
!ENDIF
|
@ -0,0 +1,17 @@
|
||||
;/****************************************************************************
|
||||
; Messages for ZABBIX Win32 Agent
|
||||
;****************************************************************************/
|
||||
;
|
||||
;#ifndef _messages_h_
|
||||
;#define _messages_h_
|
||||
;
|
||||
|
||||
MessageIdTypedef=DWORD
|
||||
|
||||
MessageId=1
|
||||
SymbolicName=MSG_ZABBIX_MESSAGE
|
||||
Language=English
|
||||
%1 %2
|
||||
.
|
||||
|
||||
;#endif
|
@ -0,0 +1,41 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by resource.rc
|
||||
//
|
||||
#ifndef _RESOURCE_H_
|
||||
#define _RESOURCE_H_
|
||||
|
||||
#include "..\..\..\include\version.h"
|
||||
|
||||
#if defined(ZABBIX_AGENT)
|
||||
# include "zabbix_agent_desc.h"
|
||||
#elif defined(ZABBIX_GET)
|
||||
# include "zabbix_get_desc.h"
|
||||
#elif defined(ZABBIX_SENDER)
|
||||
# include "zabbix_sender_desc.h"
|
||||
#elif defined(ZABBIX_AGENT2)
|
||||
# include "zabbix_agent2_desc.h"
|
||||
#endif
|
||||
|
||||
#define VER_FILEVERSION ZABBIX_VERSION_MAJOR,ZABBIX_VERSION_MINOR,ZABBIX_VERSION_PATCH,ZABBIX_VERSION_RC_NUM
|
||||
#define VER_FILEVERSION_STR ZBX_STR(ZABBIX_VERSION_MAJOR) "." ZBX_STR(ZABBIX_VERSION_MINOR) "." \
|
||||
ZBX_STR(ZABBIX_VERSION_PATCH) "." ZBX_STR(ZABBIX_VERSION_REVISION) "\0"
|
||||
#define VER_PRODUCTVERSION ZABBIX_VERSION_MAJOR,ZABBIX_VERSION_MINOR,ZABBIX_VERSION_PATCH
|
||||
#define VER_PRODUCTVERSION_STR ZBX_STR(ZABBIX_VERSION_MAJOR) "." ZBX_STR(ZABBIX_VERSION_MINOR) "." \
|
||||
ZBX_STR(ZABBIX_VERSION_PATCH) ZABBIX_VERSION_RC "\0"
|
||||
#define VER_COMPANYNAME_STR "Zabbix SIA\0"
|
||||
#define VER_LEGALCOPYRIGHT_STR "Copyright (C) 2001-2023 " VER_COMPANYNAME_STR
|
||||
#define VER_PRODUCTNAME_STR "Zabbix\0"
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _RESOURCE_H_ */
|
@ -0,0 +1,103 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winresrc.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""winresrc.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifndef ZABBIX_AGENT2
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 11
|
||||
//
|
||||
|
||||
1 11 DISCARDABLE "MSG00001.bin"
|
||||
#endif // ZABBIX_AGENT2
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION VER_FILEVERSION
|
||||
PRODUCTVERSION VER_PRODUCTVERSION
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904E4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", VER_COMPANYNAME_STR
|
||||
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
||||
VALUE "FileVersion", VER_FILEVERSION_STR
|
||||
VALUE "InternalName", VER_PRODUCTNAME_STR
|
||||
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
|
||||
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
|
||||
VALUE "ProductName", VER_PRODUCTNAME_STR
|
||||
END
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
/* The following line should only be modified for localized versions. */
|
||||
/* It consists of any number of WORD,WORD pairs, with each pair */
|
||||
/* describing a language,codepage combination supported by the file. */
|
||||
/* */
|
||||
/* For example, a file might have values "0x409,1252" indicating that it */
|
||||
/* supports English language (0x409) in the Windows ANSI codepage (1252). */
|
||||
|
||||
VALUE "Translation", 0x409, 1252
|
||||
END
|
||||
END
|
@ -0,0 +1,6 @@
|
||||
#ifndef _ZABBIX_AGENT2_DESC_H_
|
||||
#define _ZABBIX_AGENT2_DESC_H_
|
||||
|
||||
#define VER_FILEDESCRIPTION_STR "zabbix_agent2.exe"
|
||||
|
||||
#endif
|
@ -0,0 +1,6 @@
|
||||
#ifndef _ZABBIX_AGENT_DESC_H_
|
||||
#define _ZABBIX_AGENT_DESC_H_
|
||||
|
||||
#define VER_FILEDESCRIPTION_STR "zabbix_agentd.exe"
|
||||
|
||||
#endif
|
@ -0,0 +1,6 @@
|
||||
#ifndef _ZABBIX_GET_DESC_H_
|
||||
#define _ZABBIX_GET_DESC_H_
|
||||
|
||||
#define VER_FILEDESCRIPTION_STR "zabbix_get.exe"
|
||||
|
||||
#endif
|
@ -0,0 +1,6 @@
|
||||
#ifndef _ZABBIX_SENDER_DESC_H_
|
||||
#define _ZABBIX_SENDER_DESC_H_
|
||||
|
||||
#define VER_FILEDESCRIPTION_STR "zabbix_sender.exe"
|
||||
|
||||
#endif
|
@ -0,0 +1 @@
|
||||
See win32.
|
@ -0,0 +1,547 @@
|
||||
# This is a configuration file for Zabbix agent daemon (Unix)
|
||||
# To get more information about Zabbix, visit http://www.zabbix.com
|
||||
|
||||
############ GENERAL PARAMETERS #################
|
||||
|
||||
### Option: PidFile
|
||||
# Name of PID file.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# PidFile=/tmp/zabbix_agentd.pid
|
||||
|
||||
### Option: LogType
|
||||
# Specifies where log messages are written to:
|
||||
# system - syslog
|
||||
# file - file specified with LogFile parameter
|
||||
# console - standard output
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# LogType=file
|
||||
|
||||
### Option: LogFile
|
||||
# Log file name for LogType 'file' parameter.
|
||||
#
|
||||
# Mandatory: yes, if LogType is set to file, otherwise no
|
||||
# Default:
|
||||
# LogFile=
|
||||
|
||||
LogFile=/tmp/zabbix_agentd.log
|
||||
|
||||
### Option: LogFileSize
|
||||
# Maximum size of log file in MB.
|
||||
# 0 - disable automatic log rotation.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-1024
|
||||
# Default:
|
||||
# LogFileSize=1
|
||||
|
||||
### Option: DebugLevel
|
||||
# Specifies debug level:
|
||||
# 0 - basic information about starting and stopping of Zabbix processes
|
||||
# 1 - critical information
|
||||
# 2 - error information
|
||||
# 3 - warnings
|
||||
# 4 - for debugging (produces lots of information)
|
||||
# 5 - extended debugging (produces even more information)
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-5
|
||||
# Default:
|
||||
# DebugLevel=3
|
||||
|
||||
### Option: SourceIP
|
||||
# Source IP address for outgoing connections.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# SourceIP=
|
||||
|
||||
### Option: AllowKey
|
||||
# Allow execution of item keys matching pattern.
|
||||
# Multiple keys matching rules may be defined in combination with DenyKey.
|
||||
# Key pattern is wildcard expression, which support "*" character to match any number of any characters in certain position. It might be used in both key name and key arguments.
|
||||
# Parameters are processed one by one according their appearance order.
|
||||
# If no AllowKey or DenyKey rules defined, all keys are allowed.
|
||||
#
|
||||
# Mandatory: no
|
||||
|
||||
### Option: DenyKey
|
||||
# Deny execution of items keys matching pattern.
|
||||
# Multiple keys matching rules may be defined in combination with AllowKey.
|
||||
# Key pattern is wildcard expression, which support "*" character to match any number of any characters in certain position. It might be used in both key name and key arguments.
|
||||
# Parameters are processed one by one according their appearance order.
|
||||
# If no AllowKey or DenyKey rules defined, all keys are allowed.
|
||||
# Unless another system.run[*] rule is specified DenyKey=system.run[*] is added by default.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# DenyKey=system.run[*]
|
||||
|
||||
### Option: EnableRemoteCommands - Deprecated, use AllowKey=system.run[*] or DenyKey=system.run[*] instead
|
||||
# Internal alias for AllowKey/DenyKey parameters depending on value:
|
||||
# 0 - DenyKey=system.run[*]
|
||||
# 1 - AllowKey=system.run[*]
|
||||
#
|
||||
# Mandatory: no
|
||||
|
||||
### Option: LogRemoteCommands
|
||||
# Enable logging of executed shell commands as warnings.
|
||||
# 0 - disabled
|
||||
# 1 - enabled
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# LogRemoteCommands=0
|
||||
|
||||
##### Passive checks related
|
||||
|
||||
### Option: Server
|
||||
# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies.
|
||||
# Incoming connections will be accepted only from the hosts listed here.
|
||||
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
|
||||
# and '::/0' will allow any IPv4 or IPv6 address.
|
||||
# '0.0.0.0/0' can be used to allow any IPv4 address.
|
||||
# Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
|
||||
#
|
||||
# Mandatory: yes, if StartAgents is not explicitly set to 0
|
||||
# Default:
|
||||
# Server=
|
||||
|
||||
Server=127.0.0.1
|
||||
|
||||
### Option: ListenPort
|
||||
# Agent will listen on this port for connections from the server.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 1024-32767
|
||||
# Default:
|
||||
# ListenPort=10050
|
||||
|
||||
### Option: ListenIP
|
||||
# List of comma delimited IP addresses that the agent should listen on.
|
||||
# First IP address is sent to Zabbix server if connecting to it to retrieve list of active checks.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# ListenIP=0.0.0.0
|
||||
|
||||
### Option: StartAgents
|
||||
# Number of pre-forked instances of zabbix_agentd that process passive checks.
|
||||
# If set to 0, disables passive checks and the agent will not listen on any TCP port.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-100
|
||||
# Default:
|
||||
# StartAgents=3
|
||||
|
||||
##### Active checks related
|
||||
|
||||
### Option: ServerActive
|
||||
# Zabbix server/proxy address or cluster configuration to get active checks from.
|
||||
# Server/proxy address is IP address or DNS name and optional port separated by colon.
|
||||
# Cluster configuration is one or more server addresses separated by semicolon.
|
||||
# Multiple Zabbix servers/clusters and Zabbix proxies can be specified, separated by comma.
|
||||
# More than one Zabbix proxy should not be specified from each Zabbix server/cluster.
|
||||
# If Zabbix proxy is specified then Zabbix server/cluster for that proxy should not be specified.
|
||||
# Multiple comma-delimited addresses can be provided to use several independent Zabbix servers in parallel. Spaces are allowed.
|
||||
# If port is not specified, default port is used.
|
||||
# IPv6 addresses must be enclosed in square brackets if port for that host is specified.
|
||||
# If port is not specified, square brackets for IPv6 addresses are optional.
|
||||
# If this parameter is not specified, active checks are disabled.
|
||||
# Example for Zabbix proxy:
|
||||
# ServerActive=127.0.0.1:10051
|
||||
# Example for multiple servers:
|
||||
# ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
|
||||
# Example for high availability:
|
||||
# ServerActive=zabbix.cluster.node1;zabbix.cluster.node2:20051;zabbix.cluster.node3
|
||||
# Example for high availability with two clusters and one server:
|
||||
# ServerActive=zabbix.cluster.node1;zabbix.cluster.node2:20051,zabbix.cluster2.node1;zabbix.cluster2.node2,zabbix.domain
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# ServerActive=
|
||||
|
||||
ServerActive=127.0.0.1
|
||||
|
||||
### Option: Hostname
|
||||
# List of comma delimited unique, case sensitive hostnames.
|
||||
# Required for active checks and must match hostnames as configured on the server.
|
||||
# Value is acquired from HostnameItem if undefined.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# Hostname=
|
||||
|
||||
Hostname=Zabbix server
|
||||
|
||||
### Option: HostnameItem
|
||||
# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
|
||||
# Does not support UserParameters or aliases.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# HostnameItem=system.hostname
|
||||
|
||||
### Option: HostMetadata
|
||||
# Optional parameter that defines host metadata.
|
||||
# Host metadata is used at host auto-registration process.
|
||||
# An agent will issue an error and not start if the value is over limit of 2034 bytes.
|
||||
# If not defined, value will be acquired from HostMetadataItem.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-2034 bytes
|
||||
# Default:
|
||||
# HostMetadata=
|
||||
|
||||
### Option: HostMetadataItem
|
||||
# Optional parameter that defines an item used for getting host metadata.
|
||||
# Host metadata is used at host auto-registration process.
|
||||
# During an auto-registration request an agent will log a warning message if
|
||||
# the value returned by specified item is over limit of 65535 characters.
|
||||
# This option is only used when HostMetadata is not defined.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# HostMetadataItem=
|
||||
|
||||
### Option: HostInterface
|
||||
# Optional parameter that defines host interface.
|
||||
# Host interface is used at host auto-registration process.
|
||||
# An agent will issue an error and not start if the value is over limit of 255 characters.
|
||||
# If not defined, value will be acquired from HostInterfaceItem.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-255 characters
|
||||
# Default:
|
||||
# HostInterface=
|
||||
|
||||
### Option: HostInterfaceItem
|
||||
# Optional parameter that defines an item used for getting host interface.
|
||||
# Host interface is used at host auto-registration process.
|
||||
# During an auto-registration request an agent will log a warning message if
|
||||
# the value returned by specified item is over limit of 255 characters.
|
||||
# This option is only used when HostInterface is not defined.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# HostInterfaceItem=
|
||||
|
||||
### Option: RefreshActiveChecks
|
||||
# How often list of active checks is refreshed, in seconds.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 1-86400
|
||||
# Default:
|
||||
# RefreshActiveChecks=5
|
||||
|
||||
### Option: BufferSend
|
||||
# Do not keep data longer than N seconds in buffer.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 1-3600
|
||||
# Default:
|
||||
# BufferSend=5
|
||||
|
||||
### Option: BufferSize
|
||||
# Maximum number of values in a memory buffer. The agent will send
|
||||
# all collected data to Zabbix Server or Proxy if the buffer is full.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 2-65535
|
||||
# Default:
|
||||
# BufferSize=100
|
||||
|
||||
### Option: MaxLinesPerSecond
|
||||
# Maximum number of new lines the agent will send per second to Zabbix Server
|
||||
# or Proxy processing 'log' and 'logrt' active checks.
|
||||
# The provided value will be overridden by the parameter 'maxlines',
|
||||
# provided in 'log' or 'logrt' item keys.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 1-1000
|
||||
# Default:
|
||||
# MaxLinesPerSecond=20
|
||||
|
||||
### Option: HeartbeatFrequency
|
||||
# Frequency of heartbeat messages in seconds.
|
||||
# Used for monitoring availability of active checks.
|
||||
# 0 - heartbeat messages disabled.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-3600
|
||||
# Default: 60
|
||||
# HeartbeatFrequency=
|
||||
|
||||
############ ADVANCED PARAMETERS #################
|
||||
|
||||
### Option: Alias
|
||||
# Sets an alias for an item key. It can be used to substitute long and complex item key with a smaller and simpler one.
|
||||
# Multiple Alias parameters may be present. Multiple parameters with the same Alias key are not allowed.
|
||||
# Different Alias keys may reference the same item key.
|
||||
# For example, to retrieve the ID of user 'zabbix':
|
||||
# Alias=zabbix.userid:vfs.file.regexp[/etc/passwd,^zabbix:.:([0-9]+),,,,\1]
|
||||
# Now shorthand key zabbix.userid may be used to retrieve data.
|
||||
# Aliases can be used in HostMetadataItem but not in HostnameItem parameters.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range:
|
||||
# Default:
|
||||
|
||||
### Option: Timeout
|
||||
# Spend no more than Timeout seconds on processing
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 1-30
|
||||
# Default:
|
||||
# Timeout=3
|
||||
|
||||
### Option: AllowRoot
|
||||
# Allow the agent to run as 'root'. If disabled and the agent is started by 'root', the agent
|
||||
# will try to switch to the user specified by the User configuration option instead.
|
||||
# Has no effect if started under a regular user.
|
||||
# 0 - do not allow
|
||||
# 1 - allow
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# AllowRoot=0
|
||||
|
||||
### Option: User
|
||||
# Drop privileges to a specific, existing user on the system.
|
||||
# Only has effect if run as 'root' and AllowRoot is disabled.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# User=zabbix
|
||||
|
||||
### Option: Include
|
||||
# You may include individual files or all files in a directory in the configuration file.
|
||||
# Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# Include=
|
||||
|
||||
# Include=/usr/local/etc/zabbix_agentd.userparams.conf
|
||||
# Include=/usr/local/etc/zabbix_agentd.conf.d/
|
||||
# Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf
|
||||
|
||||
####### USER-DEFINED MONITORED PARAMETERS #######
|
||||
|
||||
### Option: UnsafeUserParameters
|
||||
# Allow all characters to be passed in arguments to user-defined parameters.
|
||||
# The following characters are not allowed:
|
||||
# \ ' " ` * ? [ ] { } ~ $ ! & ; ( ) < > | # @
|
||||
# Additionally, newline characters are not allowed.
|
||||
# 0 - do not allow
|
||||
# 1 - allow
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-1
|
||||
# Default:
|
||||
# UnsafeUserParameters=0
|
||||
|
||||
### Option: UserParameter
|
||||
# User-defined parameter to monitor. There can be several user-defined parameters.
|
||||
# Format: UserParameter=<key>,<shell command>
|
||||
# See 'zabbix_agentd' directory for examples.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# UserParameter=
|
||||
|
||||
### Option: UserParameterDir
|
||||
# Directory to execute UserParameter commands from. Only one entry is allowed.
|
||||
# When executing UserParameter commands the agent will change the working directory to the one
|
||||
# specified in the UserParameterDir option.
|
||||
# This way UserParameter commands can be specified using the relative ./ prefix.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# UserParameterDir=
|
||||
|
||||
####### LOADABLE MODULES #######
|
||||
|
||||
### Option: LoadModulePath
|
||||
# Full path to location of agent modules.
|
||||
# Default depends on compilation options.
|
||||
# To see the default path run command "zabbix_agentd --help".
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# LoadModulePath=${libdir}/modules
|
||||
|
||||
### Option: LoadModule
|
||||
# Module to load at agent startup. Modules are used to extend functionality of the agent.
|
||||
# Formats:
|
||||
# LoadModule=<module.so>
|
||||
# LoadModule=<path/module.so>
|
||||
# LoadModule=</abs_path/module.so>
|
||||
# Either the module must be located in directory specified by LoadModulePath or the path must precede the module name.
|
||||
# If the preceding path is absolute (starts with '/') then LoadModulePath is ignored.
|
||||
# It is allowed to include multiple LoadModule parameters.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# LoadModule=
|
||||
|
||||
####### TLS-RELATED PARAMETERS #######
|
||||
|
||||
### Option: TLSConnect
|
||||
# How the agent should connect to server or proxy. Used for active checks.
|
||||
# Only one value can be specified:
|
||||
# unencrypted - connect without encryption
|
||||
# psk - connect using TLS and a pre-shared key
|
||||
# cert - connect using TLS and a certificate
|
||||
#
|
||||
# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection)
|
||||
# Default:
|
||||
# TLSConnect=unencrypted
|
||||
|
||||
### Option: TLSAccept
|
||||
# What incoming connections to accept.
|
||||
# Multiple values can be specified, separated by comma:
|
||||
# unencrypted - accept connections without encryption
|
||||
# psk - accept connections secured with TLS and a pre-shared key
|
||||
# cert - accept connections secured with TLS and a certificate
|
||||
#
|
||||
# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection)
|
||||
# Default:
|
||||
# TLSAccept=unencrypted
|
||||
|
||||
### Option: TLSCAFile
|
||||
# Full pathname of a file containing the top-level CA(s) certificates for
|
||||
# peer certificate verification.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCAFile=
|
||||
|
||||
### Option: TLSCRLFile
|
||||
# Full pathname of a file containing revoked certificates.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCRLFile=
|
||||
|
||||
### Option: TLSServerCertIssuer
|
||||
# Allowed server certificate issuer.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSServerCertIssuer=
|
||||
|
||||
### Option: TLSServerCertSubject
|
||||
# Allowed server certificate subject.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSServerCertSubject=
|
||||
|
||||
### Option: TLSCertFile
|
||||
# Full pathname of a file containing the agent certificate or certificate chain.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCertFile=
|
||||
|
||||
### Option: TLSKeyFile
|
||||
# Full pathname of a file containing the agent private key.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSKeyFile=
|
||||
|
||||
### Option: TLSPSKIdentity
|
||||
# Unique, case sensitive string used to identify the pre-shared key.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSPSKIdentity=
|
||||
|
||||
### Option: TLSPSKFile
|
||||
# Full pathname of a file containing the pre-shared key.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSPSKFile=
|
||||
|
||||
####### For advanced users - TLS ciphersuite selection criteria #######
|
||||
|
||||
### Option: TLSCipherCert13
|
||||
# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3.
|
||||
# Override the default ciphersuite selection criteria for certificate-based encryption.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCipherCert13=
|
||||
|
||||
### Option: TLSCipherCert
|
||||
# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string.
|
||||
# Override the default ciphersuite selection criteria for certificate-based encryption.
|
||||
# Example for GnuTLS:
|
||||
# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509
|
||||
# Example for OpenSSL:
|
||||
# EECDH+aRSA+AES128:RSA+aRSA+AES128
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCipherCert=
|
||||
|
||||
### Option: TLSCipherPSK13
|
||||
# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3.
|
||||
# Override the default ciphersuite selection criteria for PSK-based encryption.
|
||||
# Example:
|
||||
# TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCipherPSK13=
|
||||
|
||||
### Option: TLSCipherPSK
|
||||
# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string.
|
||||
# Override the default ciphersuite selection criteria for PSK-based encryption.
|
||||
# Example for GnuTLS:
|
||||
# NONE:+VERS-TLS1.2:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL
|
||||
# Example for OpenSSL:
|
||||
# kECDHEPSK+AES128:kPSK+AES128
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCipherPSK=
|
||||
|
||||
### Option: TLSCipherAll13
|
||||
# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3.
|
||||
# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption.
|
||||
# Example:
|
||||
# TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCipherAll13=
|
||||
|
||||
### Option: TLSCipherAll
|
||||
# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string.
|
||||
# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption.
|
||||
# Example for GnuTLS:
|
||||
# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509
|
||||
# Example for OpenSSL:
|
||||
# EECDH+aRSA+AES128:RSA+aRSA+AES128:kECDHEPSK+AES128:kPSK+AES128
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCipherAll=
|
||||
|
||||
####### For advanced users - TCP-related fine-tuning parameters #######
|
||||
|
||||
## Option: ListenBacklog
|
||||
# The maximum number of pending connections in the queue. This parameter is passed to
|
||||
# listen() function as argument 'backlog' (see "man listen").
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0 - INT_MAX (depends on system, too large values may be silently truncated to implementation-specified maximum)
|
||||
# Default: SOMAXCONN (hard-coded constant, depends on system)
|
||||
# ListenBacklog=
|
@ -0,0 +1,506 @@
|
||||
# This is a configuration file for Zabbix agent service (Windows)
|
||||
# To get more information about Zabbix, visit http://www.zabbix.com
|
||||
|
||||
############ GENERAL PARAMETERS #################
|
||||
|
||||
### Option: LogType
|
||||
# Specifies where log messages are written to:
|
||||
# system - Windows event log
|
||||
# file - file specified with LogFile parameter
|
||||
# console - standard output
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# LogType=file
|
||||
|
||||
### Option: LogFile
|
||||
# Log file name for LogType 'file' parameter.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# LogFile=
|
||||
|
||||
LogFile=c:\zabbix_agentd.log
|
||||
|
||||
### Option: LogFileSize
|
||||
# Maximum size of log file in MB.
|
||||
# 0 - disable automatic log rotation.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-1024
|
||||
# Default:
|
||||
# LogFileSize=1
|
||||
|
||||
### Option: DebugLevel
|
||||
# Specifies debug level:
|
||||
# 0 - basic information about starting and stopping of Zabbix processes
|
||||
# 1 - critical information
|
||||
# 2 - error information
|
||||
# 3 - warnings
|
||||
# 4 - for debugging (produces lots of information)
|
||||
# 5 - extended debugging (produces even more information)
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-5
|
||||
# Default:
|
||||
# DebugLevel=3
|
||||
|
||||
### Option: SourceIP
|
||||
# Source IP address for outgoing connections.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# SourceIP=
|
||||
|
||||
### Option: AllowKey
|
||||
# Allow execution of item keys matching pattern.
|
||||
# Multiple keys matching rules may be defined in combination with DenyKey.
|
||||
# Key pattern is wildcard expression, which support "*" character to match any number of any characters in certain position. It might be used in both key name and key arguments.
|
||||
# Parameters are processed one by one according their appearance order.
|
||||
# If no AllowKey or DenyKey rules defined, all keys are allowed.
|
||||
#
|
||||
# Mandatory: no
|
||||
|
||||
### Option: DenyKey
|
||||
# Deny execution of items keys matching pattern.
|
||||
# Multiple keys matching rules may be defined in combination with AllowKey.
|
||||
# Key pattern is wildcard expression, which support "*" character to match any number of any characters in certain position. It might be used in both key name and key arguments.
|
||||
# Parameters are processed one by one according their appearance order.
|
||||
# If no AllowKey or DenyKey rules defined, all keys are allowed.
|
||||
# Unless another system.run[*] rule is specified DenyKey=system.run[*] is added by default.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# DenyKey=system.run[*]
|
||||
|
||||
### Option: EnableRemoteCommands - Deprecated, use AllowKey=system.run[*] or DenyKey=system.run[*] instead
|
||||
# Internal alias for AllowKey/DenyKey parameters depending on value:
|
||||
# 0 - DenyKey=system.run[*]
|
||||
# 1 - AllowKey=system.run[*]
|
||||
#
|
||||
# Mandatory: no
|
||||
|
||||
### Option: LogRemoteCommands
|
||||
# Enable logging of executed shell commands as warnings.
|
||||
# 0 - disabled
|
||||
# 1 - enabled
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# LogRemoteCommands=0
|
||||
|
||||
##### Passive checks related
|
||||
|
||||
### Option: Server
|
||||
# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies.
|
||||
# Incoming connections will be accepted only from the hosts listed here.
|
||||
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally and '::/0' will allow any IPv4 or IPv6 address.
|
||||
# '0.0.0.0/0' can be used to allow any IPv4 address.
|
||||
# Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.domain
|
||||
#
|
||||
# Mandatory: yes, if StartAgents is not explicitly set to 0
|
||||
# Default:
|
||||
# Server=
|
||||
|
||||
Server=127.0.0.1
|
||||
|
||||
### Option: ListenPort
|
||||
# Agent will listen on this port for connections from the server.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 1024-32767
|
||||
# Default:
|
||||
# ListenPort=10050
|
||||
|
||||
### Option: ListenIP
|
||||
# List of comma delimited IP addresses that the agent should listen on.
|
||||
# First IP address is sent to Zabbix server if connecting to it to retrieve list of active checks.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# ListenIP=0.0.0.0
|
||||
|
||||
### Option: StartAgents
|
||||
# Number of pre-forked instances of zabbix_agentd that process passive checks.
|
||||
# If set to 0, disables passive checks and the agent will not listen on any TCP port.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-100
|
||||
# Default:
|
||||
# StartAgents=3
|
||||
|
||||
##### Active checks related
|
||||
|
||||
### Option: ServerActive
|
||||
# Zabbix server/proxy address or cluster configuration to get active checks from.
|
||||
# Server/proxy address is IP address or DNS name and optional port separated by colon.
|
||||
# Cluster configuration is one or more server addresses separated by semicolon.
|
||||
# Multiple Zabbix servers/clusters and Zabbix proxies can be specified, separated by comma.
|
||||
# More than one Zabbix proxy should not be specified from each Zabbix server/cluster.
|
||||
# If Zabbix proxy is specified then Zabbix server/cluster for that proxy should not be specified.
|
||||
# Multiple comma-delimited addresses can be provided to use several independent Zabbix servers in parallel. Spaces are allowed.
|
||||
# If port is not specified, default port is used.
|
||||
# IPv6 addresses must be enclosed in square brackets if port for that host is specified.
|
||||
# If port is not specified, square brackets for IPv6 addresses are optional.
|
||||
# If this parameter is not specified, active checks are disabled.
|
||||
# Example for Zabbix proxy:
|
||||
# ServerActive=127.0.0.1:10051
|
||||
# Example for multiple servers:
|
||||
# ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
|
||||
# Example for high availability:
|
||||
# ServerActive=zabbix.cluster.node1;zabbix.cluster.node2:20051;zabbix.cluster.node3
|
||||
# Example for high availability with two clusters and one server:
|
||||
# ServerActive=zabbix.cluster.node1;zabbix.cluster.node2:20051,zabbix.cluster2.node1;zabbix.cluster2.node2,zabbix.domain
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# ServerActive=
|
||||
|
||||
ServerActive=127.0.0.1
|
||||
|
||||
### Option: Hostname
|
||||
# List of comma delimited unique, case sensitive hostnames.
|
||||
# Required for active checks and must match hostnames as configured on the server.
|
||||
# Value is acquired from HostnameItem if undefined.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# Hostname=
|
||||
|
||||
Hostname=Windows host
|
||||
|
||||
### Option: HostnameItem
|
||||
# Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
|
||||
# Does not support UserParameters or aliases.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# HostnameItem=system.hostname
|
||||
|
||||
### Option: HostMetadata
|
||||
# Optional parameter that defines host metadata.
|
||||
# Host metadata is used at host auto-registration process.
|
||||
# An agent will issue an error and not start if the value is over limit of 2034 bytes.
|
||||
# If not defined, value will be acquired from HostMetadataItem.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-2034 bytes
|
||||
# Default:
|
||||
# HostMetadata=
|
||||
|
||||
### Option: HostMetadataItem
|
||||
# Optional parameter that defines an item used for getting host metadata.
|
||||
# Host metadata is used at host auto-registration process.
|
||||
# During an auto-registration request an agent will log a warning message if
|
||||
# the value returned by specified item is over limit of 65535 characters.
|
||||
# This option is only used when HostMetadata is not defined.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# HostMetadataItem=
|
||||
|
||||
### Option: HostInterface
|
||||
# Optional parameter that defines host interface.
|
||||
# Host interface is used at host auto-registration process.
|
||||
# An agent will issue an error and not start if the value is over limit of 255 characters.
|
||||
# If not defined, value will be acquired from HostInterfaceItem.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-255 characters
|
||||
# Default:
|
||||
# HostInterface=
|
||||
|
||||
### Option: HostInterfaceItem
|
||||
# Optional parameter that defines an item used for getting host interface.
|
||||
# Host interface is used at host auto-registration process.
|
||||
# During an auto-registration request an agent will log a warning message if
|
||||
# the value returned by specified item is over limit of 255 characters.
|
||||
# This option is only used when HostInterface is not defined.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# HostInterfaceItem=
|
||||
|
||||
### Option: RefreshActiveChecks
|
||||
# How often list of active checks is refreshed, in seconds.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 1-86400
|
||||
# Default:
|
||||
# RefreshActiveChecks=5
|
||||
|
||||
### Option: BufferSend
|
||||
# Do not keep data longer than N seconds in buffer.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 1-3600
|
||||
# Default:
|
||||
# BufferSend=5
|
||||
|
||||
### Option: BufferSize
|
||||
# Maximum number of values in a memory buffer. The agent will send
|
||||
# all collected data to Zabbix server or Proxy if the buffer is full.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 2-65535
|
||||
# Default:
|
||||
# BufferSize=100
|
||||
|
||||
### Option: MaxLinesPerSecond
|
||||
# Maximum number of new lines the agent will send per second to Zabbix Server
|
||||
# or Proxy processing 'log', 'logrt' and 'eventlog' active checks.
|
||||
# The provided value will be overridden by the parameter 'maxlines',
|
||||
# provided in 'log', 'logrt' or 'eventlog' item keys.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 1-1000
|
||||
# Default:
|
||||
# MaxLinesPerSecond=20
|
||||
|
||||
### Option: HeartbeatFrequency
|
||||
# Frequency of heartbeat messages in seconds.
|
||||
# Used for monitoring availability of active checks.
|
||||
# 0 - heartbeat messages disabled.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-3600
|
||||
# Default: 60
|
||||
# HeartbeatFrequency=
|
||||
|
||||
############ ADVANCED PARAMETERS #################
|
||||
|
||||
### Option: Alias
|
||||
# Sets an alias for an item key. It can be used to substitute long and complex item key with a smaller and simpler one.
|
||||
# Multiple Alias parameters may be present. Multiple parameters with the same Alias key are not allowed.
|
||||
# Different Alias keys may reference the same item key.
|
||||
# For example, to retrieve paging file usage in percents from the server:
|
||||
# Alias=pg_usage:perf_counter[\Paging File(_Total)\% Usage]
|
||||
# Now shorthand key pg_usage may be used to retrieve data.
|
||||
# Aliases can be used in HostMetadataItem but not in HostnameItem or PerfCounter parameters.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range:
|
||||
# Default:
|
||||
|
||||
### Option: Timeout
|
||||
# Spend no more than Timeout seconds on processing.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 1-30
|
||||
# Default:
|
||||
# Timeout=3
|
||||
|
||||
### Option: PerfCounter
|
||||
# Syntax: <parameter_name>,"<perf_counter_path>",<period>
|
||||
# Defines new parameter <parameter_name> which is an average value for system performance counter <perf_counter_path> for the specified time period <period> (in seconds).
|
||||
# For example, if you wish to receive average number of processor interrupts per second for last minute, you can define new parameter "interrupts" as following:
|
||||
# PerfCounter = interrupts,"\Processor(0)\Interrupts/sec",60
|
||||
# Please note double quotes around performance counter path.
|
||||
# Samples for calculating average value will be taken every second.
|
||||
# You may run "typeperf -qx" to get list of all performance counters available in Windows.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range:
|
||||
# Default:
|
||||
|
||||
### Option: Include
|
||||
# You may include individual files in the configuration file.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# Include=
|
||||
|
||||
# Include=c:\zabbix\zabbix_agentd.userparams.conf
|
||||
# Include=c:\zabbix\zabbix_agentd.conf.d\
|
||||
# Include=c:\zabbix\zabbix_agentd.conf.d\*.conf
|
||||
|
||||
####### USER-DEFINED MONITORED PARAMETERS #######
|
||||
|
||||
### Option: UnsafeUserParameters
|
||||
# Allow all characters to be passed in arguments to user-defined parameters.
|
||||
# The following characters are not allowed:
|
||||
# \ ' " ` * ? [ ] { } ~ $ ! & ; ( ) < > | # @
|
||||
# Additionally, newline characters are not allowed.
|
||||
# 0 - do not allow
|
||||
# 1 - allow
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0-1
|
||||
# Default:
|
||||
# UnsafeUserParameters=0
|
||||
|
||||
### Option: UserParameter
|
||||
# User-defined parameter to monitor. There can be several user-defined parameters.
|
||||
# Format: UserParameter=<key>,<shell command>
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# UserParameter=
|
||||
|
||||
### Option: UserParameterDir
|
||||
# Directory to execute UserParameter commands from. Only one entry is allowed.
|
||||
# When executing UserParameter commands the agent will change the working directory to the one
|
||||
# specified in the UserParameterDir option.
|
||||
# This way UserParameter commands can be specified using the relative ./ prefix.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# UserParameterDir=
|
||||
|
||||
####### TLS-RELATED PARAMETERS #######
|
||||
|
||||
### Option: TLSConnect
|
||||
# How the agent should connect to server or proxy. Used for active checks.
|
||||
# Only one value can be specified:
|
||||
# unencrypted - connect without encryption
|
||||
# psk - connect using TLS and a pre-shared key
|
||||
# cert - connect using TLS and a certificate
|
||||
#
|
||||
# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection)
|
||||
# Default:
|
||||
# TLSConnect=unencrypted
|
||||
|
||||
### Option: TLSAccept
|
||||
# What incoming connections to accept.
|
||||
# Multiple values can be specified, separated by comma:
|
||||
# unencrypted - accept connections without encryption
|
||||
# psk - accept connections secured with TLS and a pre-shared key
|
||||
# cert - accept connections secured with TLS and a certificate
|
||||
#
|
||||
# Mandatory: yes, if TLS certificate or PSK parameters are defined (even for 'unencrypted' connection)
|
||||
# Default:
|
||||
# TLSAccept=unencrypted
|
||||
|
||||
### Option: TLSCAFile
|
||||
# Full pathname of a file containing the top-level CA(s) certificates for
|
||||
# peer certificate verification.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCAFile=
|
||||
|
||||
### Option: TLSCRLFile
|
||||
# Full pathname of a file containing revoked certificates.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCRLFile=
|
||||
|
||||
### Option: TLSServerCertIssuer
|
||||
# Allowed server certificate issuer.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSServerCertIssuer=
|
||||
|
||||
### Option: TLSServerCertSubject
|
||||
# Allowed server certificate subject.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSServerCertSubject=
|
||||
|
||||
### Option: TLSCertFile
|
||||
# Full pathname of a file containing the agent certificate or certificate chain.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCertFile=
|
||||
|
||||
### Option: TLSKeyFile
|
||||
# Full pathname of a file containing the agent private key.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSKeyFile=
|
||||
|
||||
### Option: TLSPSKIdentity
|
||||
# Unique, case sensitive string used to identify the pre-shared key.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSPSKIdentity=
|
||||
|
||||
### Option: TLSPSKFile
|
||||
# Full pathname of a file containing the pre-shared key.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSPSKFile=
|
||||
|
||||
####### For advanced users - TLS ciphersuite selection criteria #######
|
||||
|
||||
### Option: TLSCipherCert13
|
||||
# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3.
|
||||
# Override the default ciphersuite selection criteria for certificate-based encryption.
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCipherCert13=
|
||||
|
||||
### Option: TLSCipherCert
|
||||
# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string.
|
||||
# Override the default ciphersuite selection criteria for certificate-based encryption.
|
||||
# Example for GnuTLS:
|
||||
# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509
|
||||
# Example for OpenSSL:
|
||||
# EECDH+aRSA+AES128:RSA+aRSA+AES128
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCipherCert=
|
||||
|
||||
### Option: TLSCipherPSK13
|
||||
# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3.
|
||||
# Override the default ciphersuite selection criteria for PSK-based encryption.
|
||||
# Example:
|
||||
# TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCipherPSK13=
|
||||
|
||||
### Option: TLSCipherPSK
|
||||
# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string.
|
||||
# Override the default ciphersuite selection criteria for PSK-based encryption.
|
||||
# Example for GnuTLS:
|
||||
# NONE:+VERS-TLS1.2:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL
|
||||
# Example for OpenSSL:
|
||||
# kECDHEPSK+AES128:kPSK+AES128
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCipherPSK=
|
||||
|
||||
### Option: TLSCipherAll13
|
||||
# Cipher string for OpenSSL 1.1.1 or newer in TLS 1.3.
|
||||
# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption.
|
||||
# Example:
|
||||
# TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCipherAll13=
|
||||
|
||||
### Option: TLSCipherAll
|
||||
# GnuTLS priority string or OpenSSL (TLS 1.2) cipher string.
|
||||
# Override the default ciphersuite selection criteria for certificate- and PSK-based encryption.
|
||||
# Example for GnuTLS:
|
||||
# NONE:+VERS-TLS1.2:+ECDHE-RSA:+RSA:+ECDHE-PSK:+PSK:+AES-128-GCM:+AES-128-CBC:+AEAD:+SHA256:+SHA1:+CURVE-ALL:+COMP-NULL:+SIGN-ALL:+CTYPE-X.509
|
||||
# Example for OpenSSL:
|
||||
# EECDH+aRSA+AES128:RSA+aRSA+AES128:kECDHEPSK+AES128:kPSK+AES128
|
||||
#
|
||||
# Mandatory: no
|
||||
# Default:
|
||||
# TLSCipherAll=
|
||||
|
||||
####### For advanced users - TCP-related fine-tuning parameters #######
|
||||
|
||||
## Option: ListenBacklog
|
||||
# The maximum number of pending connections in the queue. This parameter is passed to
|
||||
# listen() function as argument 'backlog' (see "man listen").
|
||||
#
|
||||
# Mandatory: no
|
||||
# Range: 0 - INT_MAX (depends on system, too large values may be silently truncated to implementation-specified maximum)
|
||||
# Default: SOMAXCONN (hard-coded constant, depends on system)
|
||||
# ListenBacklog=
|
@ -0,0 +1,27 @@
|
||||
# Emulating built-in agent parameter 'system.users.num'
|
||||
UserParameter=system.test,who | wc -l
|
||||
|
||||
# Get size of a directory
|
||||
# Defaults to /tmp
|
||||
UserParameter=vfs.dir.size[*],dir="$1"; du -s -B 1 "${dir:-/tmp}" | cut -f1
|
||||
|
||||
# Total CPU utilisation by all processes with a given name.
|
||||
# Returns empty value if no such processes are present, numeric items will turn unsupported
|
||||
# Defaults to zabbix_agentd
|
||||
UserParameter=proc.cpu[*],proc="$1"; ps -o pcpu= -C "${proc:-zabbix_agentd}" | awk '{sum += $$1} END {print sum}'
|
||||
|
||||
# Mail queue length from mailq
|
||||
UserParameter=unix_mail.queue,mailq | grep -v "Mail queue is empty" | grep -c '^[0-9A-Z]'
|
||||
|
||||
# Partition discovery on Linux
|
||||
UserParameter=vfs.partitions.discovery.linux,for partition in $(awk 'NR > 2 {print $4}' /proc/partitions); do partitionlist="$partitionlist,"'{"{#PARTITION}":"'$partition'"}'; done; echo '{"data":['${partitionlist#,}']}'
|
||||
|
||||
# Partition discovery on Solaris (using iostat output)
|
||||
# On Solaris bash usually is not the one linked from /bin/sh, so a wrapper script is suggested
|
||||
UserParameter=vfs.partitions.discovery.solaris,/somewhere/solaris_partitions.sh
|
||||
# Wrapper script (solaris_partitions.sh) contents:
|
||||
##!/bin/bash
|
||||
#for partition in $(iostat -x | tail +3 | awk '{print $1}'); do
|
||||
# partitionlist="$partitionlist,"'{"{#PARTITION}":"'$partition'"}'
|
||||
#done
|
||||
#echo '{"data":['${partitionlist#,}']}'
|
@ -0,0 +1,15 @@
|
||||
#template_db_mysql.conf created by Zabbix for "Template DB MySQL" and Zabbix 4.2
|
||||
#For OS Linux: You need create .my.cnf in zabbix-agent home directory (/var/lib/zabbix by default)
|
||||
#For OS Windows: You need add PATH to mysql and mysqladmin and create my.cnf in %WINDIR%\my.cnf,C:\my.cnf,BASEDIR\my.cnf https://dev.mysql.com/doc/refman/5.7/en/option-files.html
|
||||
#The file must have three strings:
|
||||
#[client]
|
||||
#user=zbx_monitor
|
||||
#password=<password>
|
||||
#
|
||||
UserParameter=mysql.ping[*], mysqladmin -h"$1" -P"$2" ping
|
||||
UserParameter=mysql.get_status_variables[*], mysql -h"$1" -P"$2" -sNX -e "show global status"
|
||||
UserParameter=mysql.version[*], mysqladmin -s -h"$1" -P"$2" version
|
||||
UserParameter=mysql.db.discovery[*], mysql -h"$1" -P"$2" -sN -e "show databases"
|
||||
UserParameter=mysql.dbsize[*], mysql -h"$1" -P"$2" -sN -e "SELECT SUM(DATA_LENGTH + INDEX_LENGTH) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='$3'"
|
||||
UserParameter=mysql.replication.discovery[*], mysql -h"$1" -P"$2" -sNX -e "show slave status"
|
||||
UserParameter=mysql.slave_status[*], mysql -h"$1" -P"$2" -sNX -e "show slave status"
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,150 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ] || [ -z "$5" ] || [ -z "$6" ]; then
|
||||
echo "Usage:
|
||||
./export_data.sh -hhost -Pport -uroot -p<password> <DB name> ZBX_DATA > ../src/data.tmpl
|
||||
./export_data.sh -hhost -Pport -uroot -p<password> <DB name> ZBX_TEMPLATE > ../src/templates.tmpl
|
||||
./export_data.sh -hhost -Pport -uroot -p<password> <DB name> ZBX_DASHBOARD > ../src/dashboards.tmpl
|
||||
The script generates data file out of existing MySQL database." && exit 1
|
||||
fi
|
||||
mysql_cmd="mysql $1 $2 $3 $4 $5"
|
||||
dbflag=$6
|
||||
basedir=`dirname "$0"`
|
||||
schema=$basedir/../src/schema.tmpl
|
||||
|
||||
echo "--
|
||||
-- Zabbix
|
||||
-- Copyright (C) 2001-2023 Zabbix SIA
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
--
|
||||
"
|
||||
|
||||
IFS=$'\n'
|
||||
for tbl_line in `grep "^TABLE.*${dbflag}" "${schema}"`; do
|
||||
tbl_line=${tbl_line#*|}
|
||||
table=${tbl_line%%|*}
|
||||
tbl_line=${tbl_line#*|}
|
||||
primary_key=${tbl_line%%|*}
|
||||
|
||||
total_count=`echo "select count(*) from ${table}" | eval ${mysql_cmd} | tail -1`
|
||||
|
||||
fields=''
|
||||
delim=''
|
||||
|
||||
refs=()
|
||||
depth=()
|
||||
|
||||
for fld_line in `sed -n "/^TABLE|${table}|/,/^$/ p" "${schema}" | grep "^FIELD" | sed 's/[ \t]//g'`; do
|
||||
fld_line=${fld_line#*|} # FIELD
|
||||
field=${fld_line%%|*}
|
||||
fld_line=${fld_line#*|} # <field_name>
|
||||
field_type=${fld_line%%|*}
|
||||
fld_line=${fld_line#*|} # <field_type>
|
||||
default_val=${fld_line%%|*}
|
||||
fld_line=${fld_line#*|} # <default>
|
||||
fld_line=${fld_line#*|} # <not_null>
|
||||
flags=${fld_line%%|*}
|
||||
fld_line=${fld_line#*|} # <flags>
|
||||
fld_line=${fld_line#*|} # <index #>
|
||||
ref_table=${fld_line%%|*}
|
||||
fld_line=${fld_line#*|} # <ref_table>
|
||||
ref_field=${fld_line%%|*}
|
||||
|
||||
if [[ "$flags" =~ ZBX_NODATA ]]; then
|
||||
if [[ "$field_type" =~ ^t_(shorttext|text|longtext)$ ]]; then
|
||||
[[ -n "$default_val" ]] || default_val="''"
|
||||
|
||||
fields="${fields}${delim} $default_val as ${field}"
|
||||
else
|
||||
continue
|
||||
fi
|
||||
else
|
||||
fields="${fields}${delim}replace(replace(replace(${field},'|','&pipe;'),'\r\n','&eol;'),'\n','&bsn;') as ${field}"
|
||||
fi
|
||||
delim=','
|
||||
|
||||
if [[ ${ref_table} == ${table} ]]; then
|
||||
refs+=("${field}:${ref_field}")
|
||||
depth+=(0)
|
||||
fi
|
||||
done
|
||||
|
||||
while true; do
|
||||
where=' '
|
||||
|
||||
if [[ ${#refs[@]} -ne 0 ]]; then
|
||||
delim='where '
|
||||
|
||||
for i in ${!refs[@]}; do
|
||||
field="${refs[$i]%:*}"
|
||||
ref_field="${refs[$i]#*:}"
|
||||
|
||||
condition="${field} is null"
|
||||
for (( d = 0; d < ${depth[$i]}; d++ )); do
|
||||
condition="${field} in (select ${ref_field} from ${table} where ${condition})"
|
||||
done
|
||||
|
||||
where="${where}${delim}${condition}"
|
||||
delim=' and '
|
||||
done
|
||||
where="${where} "
|
||||
fi
|
||||
|
||||
count=`echo "select count(*) from ${table}${where}" | eval ${mysql_cmd} | tail -1`
|
||||
(( total_count -= count ))
|
||||
|
||||
if [[ ${count} -eq 0 ]]; then
|
||||
if [[ ${#refs[@]} -ne 0 ]]; then
|
||||
inc=0
|
||||
|
||||
for (( i = ${#depth[@]} - 1; i >= 0; i-- )); do
|
||||
if [[ $inc -ne 0 ]]; then
|
||||
(( depth[$i]++ ))
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ $i -eq 0 ]]; then
|
||||
break 2
|
||||
fi
|
||||
|
||||
if [[ ${depth[$i]} -ne 0 ]]; then
|
||||
depth[$i]=0
|
||||
inc=1
|
||||
fi
|
||||
done
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
break
|
||||
fi
|
||||
|
||||
echo "TABLE |$table"
|
||||
echo "select ${fields} from ${table}${where}order by ${table}.${primary_key}" | eval "${mysql_cmd} -t" | grep -v '^+' | sed -e 's/ | /|/g' -e '1,1s/^| /FIELDS|/g' -e '2,$s/^| /ROW |/g' -e 's/ |$/|/g'
|
||||
echo ""
|
||||
|
||||
if [[ ${#refs[@]} -ne 0 ]]; then
|
||||
(( depth[${#depth[@]} - 1]++ ))
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${total_count} -ne 0 ]]; then
|
||||
echo "The total number of records in table \"${table}\" is not equal to the fetched records." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
@ -0,0 +1,305 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# Zabbix
|
||||
# Copyright (C) 2001-2023 Zabbix SIA
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
use strict;
|
||||
use File::Basename;
|
||||
|
||||
my (%output, $insert_into, $fields);
|
||||
|
||||
my %mysql = (
|
||||
"database" => "mysql",
|
||||
"before" => "START TRANSACTION;\n",
|
||||
"after" => "COMMIT;\n",
|
||||
"exec_cmd" => ";\n"
|
||||
);
|
||||
|
||||
my %oracle = (
|
||||
"database" => "oracle",
|
||||
"before" => "SET DEFINE OFF\n",
|
||||
"after" => "",
|
||||
"exec_cmd" => "\n/\n\n"
|
||||
);
|
||||
|
||||
my %postgresql = (
|
||||
"database" => "postgresql",
|
||||
"before" => "START TRANSACTION;\n",
|
||||
"after" => "COMMIT;\n",
|
||||
"exec_cmd" => ";\n"
|
||||
);
|
||||
|
||||
my %sqlite3 = (
|
||||
"database" => "sqlite3",
|
||||
"before" => "BEGIN TRANSACTION;\n",
|
||||
"after" => "COMMIT;\n",
|
||||
"exec_cmd" => ";\n"
|
||||
);
|
||||
|
||||
# Maximum line length that SQL*Plus can read from .sql file is 2499 characters.
|
||||
# Splitting long entries in 'media_type' table have to happen before SQL*Plus limit has been reached and end-of-lien
|
||||
# character has to stay intact in one line.
|
||||
my $oracle_field_limit = 2048;
|
||||
|
||||
sub process_table
|
||||
{
|
||||
my $line = $_[0];
|
||||
|
||||
$line = "`$line`" if ($output{'database'} eq 'mysql');
|
||||
|
||||
$insert_into = "INSERT INTO $line";
|
||||
}
|
||||
|
||||
sub process_fields
|
||||
{
|
||||
my $line = $_[0];
|
||||
|
||||
my @array = split(/\|/, $line);
|
||||
|
||||
my $first = 1;
|
||||
$fields = "(";
|
||||
|
||||
if ($output{'database'} eq 'mysql')
|
||||
{
|
||||
foreach (@array)
|
||||
{
|
||||
$fields = "$fields," if ($first == 0);
|
||||
$first = 0;
|
||||
|
||||
$_ =~ s/\s+$//; # remove trailing spaces
|
||||
|
||||
$fields = "$fields`$_`";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (@array)
|
||||
{
|
||||
$fields = "$fields," if ($first == 0);
|
||||
$first = 0;
|
||||
|
||||
$_ =~ s/\s+$//; # remove trailing spaces
|
||||
|
||||
$fields = "$fields$_";
|
||||
}
|
||||
}
|
||||
|
||||
$fields = "$fields)";
|
||||
}
|
||||
|
||||
sub process_row
|
||||
{
|
||||
my $line = $_[0];
|
||||
|
||||
my @array = split(/\|/, $line);
|
||||
|
||||
my $first = 1;
|
||||
my $values = "(";
|
||||
my $split_script_field = 0;
|
||||
|
||||
foreach (@array)
|
||||
{
|
||||
$values = "$values," if ($first == 0);
|
||||
$first = 0;
|
||||
|
||||
# remove leading and trailing spaces
|
||||
$_ =~ s/^\s+//;
|
||||
$_ =~ s/\s+$//;
|
||||
|
||||
if ($_ eq 'NULL')
|
||||
{
|
||||
$values = "$values$_";
|
||||
}
|
||||
else
|
||||
{
|
||||
my $modifier = '';
|
||||
|
||||
# escape backslashes
|
||||
if (/\\/)
|
||||
{
|
||||
if ($output{'database'} eq 'postgresql')
|
||||
{
|
||||
$_ =~ s/\\/\\\\/g;
|
||||
$modifier = 'E';
|
||||
}
|
||||
elsif ($output{'database'} eq 'mysql')
|
||||
{
|
||||
$_ =~ s/\\/\\\\/g;
|
||||
}
|
||||
}
|
||||
|
||||
# escape single quotes
|
||||
if (/'/)
|
||||
{
|
||||
if ($output{'database'} eq 'mysql')
|
||||
{
|
||||
$_ =~ s/'/\\'/g;
|
||||
}
|
||||
else
|
||||
{
|
||||
$_ =~ s/'/''/g;
|
||||
}
|
||||
}
|
||||
|
||||
$_ =~ s/&pipe;/|/g;
|
||||
|
||||
if ($output{'database'} eq 'mysql')
|
||||
{
|
||||
$_ =~ s/&eol;/\\r\\n/g;
|
||||
$_ =~ s/&bsn;/\\n/g;
|
||||
}
|
||||
elsif ($output{'database'} eq 'oracle')
|
||||
{
|
||||
$_ =~ s/&eol;/' || chr(13) || chr(10) || '/g;
|
||||
$_ =~ s/&bsn;/' || chr(10) || '/g;
|
||||
|
||||
if (length($_) > $oracle_field_limit)
|
||||
{
|
||||
my @sections = unpack("(a$oracle_field_limit)*", $_);
|
||||
my $move_to_next;
|
||||
my $first_part = 1;
|
||||
my $script;
|
||||
|
||||
$split_script_field = 1;
|
||||
|
||||
foreach (@sections)
|
||||
{
|
||||
# split after 'end of line' character and move what is left to the next line
|
||||
if (/(.*' \|\| (?:chr\(13\) \|\| )?chr\(10\) \|\| ')(.*)/)
|
||||
{
|
||||
if ($first_part == 1)
|
||||
{
|
||||
$script = "TO_NCLOB('$1')";
|
||||
$first_part = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$script = "${script}||\nTO_NCLOB('$move_to_next$1')";
|
||||
}
|
||||
|
||||
$move_to_next = $2;
|
||||
}
|
||||
else
|
||||
{
|
||||
$move_to_next = "$move_to_next$_";
|
||||
}
|
||||
}
|
||||
|
||||
if (length($move_to_next) > 0)
|
||||
{
|
||||
if (length($script) + length($move_to_next) < $oracle_field_limit)
|
||||
{
|
||||
substr($script, length($script) - 2, 2, "$move_to_next')");
|
||||
}
|
||||
else
|
||||
{
|
||||
substr($script, length($script), 0, "||\nTO_NCLOB('$move_to_next')");
|
||||
}
|
||||
}
|
||||
|
||||
$_ = $script;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_ =~ s/&eol;/\x0D\x0A/g;
|
||||
$_ =~ s/&bsn;/\x0A/g;
|
||||
}
|
||||
|
||||
# can be set to 1 only if Oracle DB is used
|
||||
if ($split_script_field == 1)
|
||||
{
|
||||
$values = "$values$modifier$_";
|
||||
$split_script_field = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$values = "$values$modifier'$_'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$values = "$values)";
|
||||
|
||||
if ($output{'database'} eq 'oracle')
|
||||
{
|
||||
print "$insert_into $fields\nvalues $values$output{'exec_cmd'}";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "$insert_into $fields values $values$output{'exec_cmd'}";
|
||||
}
|
||||
}
|
||||
|
||||
sub usage
|
||||
{
|
||||
print "Usage: $0 [mysql|oracle|postgresql|sqlite3]\n";
|
||||
print "The script generates Zabbix SQL data files for different database engines.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub main
|
||||
{
|
||||
if ($#ARGV != 0)
|
||||
{
|
||||
usage();
|
||||
}
|
||||
|
||||
open(INFO, dirname($0)."/../src/data.tmpl");
|
||||
my @lines = <INFO>;
|
||||
close(INFO);
|
||||
|
||||
open(INFO, dirname($0)."/../src/templates.tmpl");
|
||||
push(@lines, <INFO>);
|
||||
close(INFO);
|
||||
|
||||
open(INFO, dirname($0)."/../src/dashboards.tmpl");
|
||||
push(@lines, <INFO>);
|
||||
close(INFO);
|
||||
|
||||
if ($ARGV[0] eq 'mysql') { %output = %mysql; }
|
||||
elsif ($ARGV[0] eq 'oracle') { %output = %oracle; }
|
||||
elsif ($ARGV[0] eq 'postgresql') { %output = %postgresql; }
|
||||
elsif ($ARGV[0] eq 'sqlite3') { %output = %sqlite3; }
|
||||
else { usage(); }
|
||||
|
||||
print $output{"before"};
|
||||
|
||||
my ($line, $type);
|
||||
foreach $line (@lines)
|
||||
{
|
||||
$line =~ tr/\t//d;
|
||||
chop($line);
|
||||
|
||||
($type, $line) = split(/\|/, $line, 2);
|
||||
|
||||
if ($type)
|
||||
{
|
||||
$type =~ s/\s+$//; # remove trailing spaces
|
||||
|
||||
if ($type eq 'FIELDS') { process_fields($line); }
|
||||
elsif ($type eq 'TABLE') { process_table($line); }
|
||||
elsif ($type eq 'ROW') { process_row($line); }
|
||||
}
|
||||
}
|
||||
|
||||
print "DELETE FROM changelog$output{'exec_cmd'}";
|
||||
|
||||
print $output{"after"};
|
||||
}
|
||||
|
||||
main();
|
@ -0,0 +1,309 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my ($db, $table, $tsdb_compression) = @ARGV;
|
||||
|
||||
my @dbs = ('mysql', 'oracle', 'postgresql', 'timescaledb');
|
||||
my @tables = ('history', 'history_uint', 'history_str', 'history_log', 'history_text');
|
||||
|
||||
my %mysql = (
|
||||
'alter_table' => 'RENAME TABLE %TBL TO %TBL_old;',
|
||||
'create_table_begin' => 'CREATE TABLE `%TBL` (',
|
||||
'create_table_end' => ') ENGINE=InnoDB;',
|
||||
'pk_constraint' => "\t" . 'PRIMARY KEY (itemid,clock,ns)',
|
||||
'history' => <<'HEREDOC'
|
||||
`itemid` bigint unsigned NOT NULL,
|
||||
`clock` integer DEFAULT '0' NOT NULL,
|
||||
`value` DOUBLE PRECISION DEFAULT '0.0000' NOT NULL,
|
||||
`ns` integer DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
, 'history_uint' => <<'HEREDOC'
|
||||
`itemid` bigint unsigned NOT NULL,
|
||||
`clock` integer DEFAULT '0' NOT NULL,
|
||||
`value` bigint unsigned DEFAULT '0' NOT NULL,
|
||||
`ns` integer DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
, 'history_str' => <<'HEREDOC'
|
||||
`itemid` bigint unsigned NOT NULL,
|
||||
`clock` integer DEFAULT '0' NOT NULL,
|
||||
`value` varchar(255) DEFAULT '' NOT NULL,
|
||||
`ns` integer DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
, 'history_log' => <<'HEREDOC'
|
||||
`itemid` bigint unsigned NOT NULL,
|
||||
`clock` integer DEFAULT '0' NOT NULL,
|
||||
`timestamp` integer DEFAULT '0' NOT NULL,
|
||||
`source` varchar(64) DEFAULT '' NOT NULL,
|
||||
`severity` integer DEFAULT '0' NOT NULL,
|
||||
`value` text NOT NULL,
|
||||
`logeventid` integer DEFAULT '0' NOT NULL,
|
||||
`ns` integer DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
, 'history_text' => <<'HEREDOC'
|
||||
`itemid` bigint unsigned NOT NULL,
|
||||
`clock` integer DEFAULT '0' NOT NULL,
|
||||
`value` text NOT NULL,
|
||||
`ns` integer DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
);
|
||||
|
||||
my %oracle = (
|
||||
'alter_table' => 'RENAME %TBL TO %TBL_old;',
|
||||
'create_table_begin' => 'CREATE TABLE %TBL (',
|
||||
'create_table_end' => ');',
|
||||
'pk_constraint' => "\t" . 'CONSTRAINT PK_%UTBL PRIMARY KEY (itemid,clock,ns)',
|
||||
'history' => <<'HEREDOC'
|
||||
itemid number(20) NOT NULL,
|
||||
clock number(10) DEFAULT '0' NOT NULL,
|
||||
value BINARY_DOUBLE DEFAULT '0.0000' NOT NULL,
|
||||
ns number(10) DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
, 'history_uint' => <<'HEREDOC'
|
||||
itemid number(20) NOT NULL,
|
||||
clock number(10) DEFAULT '0' NOT NULL,
|
||||
value number(20) DEFAULT '0' NOT NULL,
|
||||
ns number(10) DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
, 'history_str' => <<'HEREDOC'
|
||||
itemid number(20) NOT NULL,
|
||||
clock number(10) DEFAULT '0' NOT NULL,
|
||||
value nvarchar2(255) DEFAULT '' ,
|
||||
ns number(10) DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
, 'history_log' => <<'HEREDOC'
|
||||
itemid number(20) NOT NULL,
|
||||
clock number(10) DEFAULT '0' NOT NULL,
|
||||
timestamp number(10) DEFAULT '0' NOT NULL,
|
||||
source nvarchar2(64) DEFAULT '' ,
|
||||
severity number(10) DEFAULT '0' NOT NULL,
|
||||
value nclob DEFAULT '' ,
|
||||
logeventid number(10) DEFAULT '0' NOT NULL,
|
||||
ns number(10) DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
, 'history_text' => <<'HEREDOC'
|
||||
itemid number(20) NOT NULL,
|
||||
clock number(10) DEFAULT '0' NOT NULL,
|
||||
value nclob DEFAULT '' ,
|
||||
ns number(10) DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
);
|
||||
|
||||
my %postgresql = (
|
||||
'alter_table' => 'ALTER TABLE %TBL RENAME TO %TBL_old;',
|
||||
'create_table_begin' => 'CREATE TABLE %TBL (',
|
||||
'create_table_end' => ');',
|
||||
'pk_constraint' => "\t" . 'PRIMARY KEY (itemid,clock,ns)',
|
||||
'history' => <<'HEREDOC'
|
||||
itemid bigint NOT NULL,
|
||||
clock integer DEFAULT '0' NOT NULL,
|
||||
value DOUBLE PRECISION DEFAULT '0.0000' NOT NULL,
|
||||
ns integer DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
, 'history_uint' => <<'HEREDOC'
|
||||
itemid bigint NOT NULL,
|
||||
clock integer DEFAULT '0' NOT NULL,
|
||||
value numeric(20) DEFAULT '0' NOT NULL,
|
||||
ns integer DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
, 'history_str' => <<'HEREDOC'
|
||||
itemid bigint NOT NULL,
|
||||
clock integer DEFAULT '0' NOT NULL,
|
||||
value varchar(255) DEFAULT '' NOT NULL,
|
||||
ns integer DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
, 'history_log' => <<'HEREDOC'
|
||||
itemid bigint NOT NULL,
|
||||
clock integer DEFAULT '0' NOT NULL,
|
||||
timestamp integer DEFAULT '0' NOT NULL,
|
||||
source varchar(64) DEFAULT '' NOT NULL,
|
||||
severity integer DEFAULT '0' NOT NULL,
|
||||
value text DEFAULT '' NOT NULL,
|
||||
logeventid integer DEFAULT '0' NOT NULL,
|
||||
ns integer DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
, 'history_text' => <<'HEREDOC'
|
||||
itemid bigint NOT NULL,
|
||||
clock integer DEFAULT '0' NOT NULL,
|
||||
value text DEFAULT '' NOT NULL,
|
||||
ns integer DEFAULT '0' NOT NULL,
|
||||
HEREDOC
|
||||
);
|
||||
|
||||
my $tsdb_compress_sql = <<'HEREDOC'
|
||||
PERFORM set_integer_now_func('%HISTTBL', 'zbx_ts_unix_now', true);
|
||||
|
||||
ALTER TABLE %HISTTBL
|
||||
SET (timescaledb.compress,timescaledb.compress_segmentby='itemid',timescaledb.compress_orderby='clock,ns');
|
||||
|
||||
IF (tsdb_version_major < 2)
|
||||
THEN
|
||||
PERFORM add_compress_chunks_policy('%HISTTBL', (
|
||||
SELECT (p.older_than).integer_interval
|
||||
FROM _timescaledb_config.bgw_policy_compress_chunks p
|
||||
INNER JOIN _timescaledb_catalog.hypertable h ON (h.id=p.hypertable_id)
|
||||
WHERE h.table_name='%HISTTBL_old'
|
||||
)::integer
|
||||
);
|
||||
ELSE
|
||||
SELECT add_compression_policy('%HISTTBL', (
|
||||
SELECT extract(epoch FROM (config::json->>'compress_after')::interval)
|
||||
FROM timescaledb_information.jobs
|
||||
WHERE application_name LIKE 'Compression%%' AND hypertable_schema='public'
|
||||
AND hypertable_name='%HISTTBL_old'
|
||||
)::integer
|
||||
) INTO jobid;
|
||||
|
||||
IF jobid IS NULL
|
||||
THEN
|
||||
RAISE EXCEPTION 'Failed to add compression policy';
|
||||
END IF;
|
||||
|
||||
PERFORM alter_job(jobid, scheduled => true, next_start => now());
|
||||
END IF;
|
||||
HEREDOC
|
||||
;
|
||||
|
||||
my $tsdb = <<'HEREDOC'
|
||||
\set ON_ERROR_STOP on
|
||||
|
||||
\copy (select * from %HISTTBL_old) TO '/tmp/%HISTTBL.csv' DELIMITER ',' CSV;
|
||||
|
||||
CREATE TEMP TABLE temp_%HISTTBL (
|
||||
%TEMPTBLDDL
|
||||
);
|
||||
|
||||
\copy temp_%HISTTBL FROM '/tmp/%HISTTBL.csv' DELIMITER ',' CSV
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
tsdb_version_major INTEGER;
|
||||
chunk_tm_interval INTEGER;
|
||||
jobid INTEGER;
|
||||
BEGIN
|
||||
SELECT substring(extversion, '^\d+') INTO tsdb_version_major FROM pg_extension WHERE extname='timescaledb';
|
||||
|
||||
IF (tsdb_version_major < 2)
|
||||
THEN
|
||||
SELECT (upper(ranges[1]) - lower(ranges[1])) INTO chunk_tm_interval FROM chunk_relation_size('%HISTTBL')
|
||||
ORDER BY ranges DESC LIMIT 1;
|
||||
|
||||
IF NOT FOUND THEN
|
||||
chunk_tm_interval = 86400;
|
||||
END IF;
|
||||
|
||||
PERFORM create_hypertable('%HISTTBL', 'clock', chunk_time_interval => chunk_tm_interval, migrate_data => true);
|
||||
ELSE
|
||||
PERFORM create_hypertable('%HISTTBL', 'clock', chunk_time_interval => (
|
||||
SELECT integer_interval FROM timescaledb_information.dimensions WHERE hypertable_name='%HISTTBL_old'
|
||||
), migrate_data => true);
|
||||
END IF;
|
||||
|
||||
INSERT INTO %HISTTBL SELECT * FROM temp_%HISTTBL ON CONFLICT (itemid,clock,ns) DO NOTHING;
|
||||
|
||||
%COMPRESS
|
||||
END $$;
|
||||
|
||||
%CONFIG_COMPR
|
||||
HEREDOC
|
||||
;
|
||||
|
||||
sub output_table {
|
||||
my ($db, $tbl, $pk_substitute_tbl) = @_;
|
||||
my $alter_table = @$db{'alter_table'};
|
||||
|
||||
$alter_table =~ s/%TBL/$tbl/g;
|
||||
|
||||
my $create_table = @$db{'create_table_begin'};
|
||||
$create_table =~ s/%TBL/$tbl/g;
|
||||
|
||||
my $pk_constraint = @$db{'pk_constraint'};
|
||||
if ($pk_substitute_tbl == 1)
|
||||
{
|
||||
my $utbl = uc($tbl);
|
||||
$pk_constraint =~ s/%UTBL/$utbl/g;
|
||||
}
|
||||
|
||||
my $create_table_end = @$db{'create_table_end'};
|
||||
|
||||
print $alter_table . "\n";
|
||||
print $create_table . "\n";
|
||||
print @$db{$tbl};
|
||||
print $pk_constraint . "\n";
|
||||
print $create_table_end . "\n\n";
|
||||
}
|
||||
|
||||
sub output_tsdb {
|
||||
my ($tbl) = @_;
|
||||
|
||||
my $tsdb_out = $tsdb;
|
||||
|
||||
if (not(defined $tsdb_compression))
|
||||
{
|
||||
$tsdb_out =~ s/%COMPRESS//g;
|
||||
$tsdb_out =~ s/%CONFIG_COMPR/UPDATE config SET compression_status=0;/g;
|
||||
}
|
||||
elsif ($tsdb_compression eq 'with_compression')
|
||||
{
|
||||
$tsdb_out =~ s/%COMPRESS/$tsdb_compress_sql/g;
|
||||
$tsdb_out =~ s/%CONFIG_COMPR/UPDATE config SET compression_status=1;/g;
|
||||
}
|
||||
|
||||
my $temp_ddl = $postgresql{$tbl};
|
||||
chomp($temp_ddl);
|
||||
$temp_ddl =~ s/,$//;
|
||||
$tsdb_out =~ s/%TEMPTBLDDL/$temp_ddl/g;
|
||||
$tsdb_out =~ s/%HISTTBL/$tbl/g;
|
||||
print $tsdb_out;
|
||||
}
|
||||
|
||||
sub validate_args {
|
||||
die 'No arguments were provided' if (!$db);
|
||||
die 'Wrong database was provided' if (! grep { $_ eq $db } @dbs);
|
||||
|
||||
if ($db eq 'timescaledb')
|
||||
{
|
||||
die 'Table name should be provided to generate timescaledb per-table migration script' if (!$table);
|
||||
die 'Non-existent table name was provided' if (! grep { $_ eq $table } @tables);
|
||||
}
|
||||
}
|
||||
|
||||
validate_args();
|
||||
|
||||
if ($db eq 'timescaledb')
|
||||
{
|
||||
output_tsdb($table);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($db eq 'mysql')
|
||||
{
|
||||
foreach my $tbl (@tables)
|
||||
{
|
||||
output_table(\%mysql, $tbl, 0);
|
||||
}
|
||||
}
|
||||
elsif ($db eq 'oracle')
|
||||
{
|
||||
foreach my $tbl (@tables)
|
||||
{
|
||||
output_table(\%oracle, $tbl, 1);
|
||||
}
|
||||
}
|
||||
elsif ($db eq 'postgresql')
|
||||
{
|
||||
foreach my $tbl (@tables)
|
||||
{
|
||||
output_table(\%postgresql, $tbl, 0);
|
||||
}
|
||||
}
|
||||
elsif ($db eq 'timescaledb')
|
||||
{
|
||||
foreach my $tbl (@tables)
|
||||
{
|
||||
output_tsdb($tbl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
define('DEFAULT_SRC_FILE', dirname(__FILE__).'/../src/schema.tmpl');
|
||||
define('DEFAULT_DEST_FILE', dirname(__FILE__).'/../src/schema.inc.php');
|
||||
|
||||
function parse_schema($path) {
|
||||
$schema = [];
|
||||
$lines = file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
|
||||
foreach ($lines as $line) {
|
||||
$str = explode('|', $line, 2);
|
||||
$part = trim($str[0]);
|
||||
$rest_line = isset($str[1]) ? $str[1] : '';
|
||||
|
||||
switch (trim($part)) {
|
||||
case 'TABLE':
|
||||
$str = explode('|', $rest_line);
|
||||
$table = trim($str[0]);
|
||||
$key = trim($str[1]);
|
||||
$schema[$table] = ['key' => $key, 'fields' => []];
|
||||
break;
|
||||
case 'FIELD':
|
||||
$str = explode('|', $rest_line);
|
||||
|
||||
$field = trim($str[0]);
|
||||
$type = trim($str[1]);
|
||||
$default = trim($str[2]);
|
||||
$null = trim($str[3]);
|
||||
$ref_table = isset($str[6]) ? trim($str[6]) : null;
|
||||
$ref_field = isset($str[7]) ? trim($str[7]) : null;
|
||||
|
||||
preg_match('/(?<type>[a-z_]+)(?:\((?<length>[0-9]+)\))?/', $type, $type_data);
|
||||
switch ($type_data['type']) {
|
||||
case 't_integer':
|
||||
case 't_nanosec':
|
||||
case 't_time':
|
||||
$type = 'DB::FIELD_TYPE_INT';
|
||||
$length = 10;
|
||||
break;
|
||||
case 't_id':
|
||||
$type = 'DB::FIELD_TYPE_ID';
|
||||
$length = 20;
|
||||
break;
|
||||
case 't_bigint':
|
||||
case 't_serial':
|
||||
$type = 'DB::FIELD_TYPE_UINT';
|
||||
$length = 20;
|
||||
break;
|
||||
case 't_double':
|
||||
$type = 'DB::FIELD_TYPE_FLOAT';
|
||||
$length = false;
|
||||
break;
|
||||
case 't_varchar':
|
||||
$type = 'DB::FIELD_TYPE_CHAR';
|
||||
$length = $type_data['length'];
|
||||
break;
|
||||
case 't_text':
|
||||
case 't_longtext':
|
||||
$type = 'DB::FIELD_TYPE_NCLOB';
|
||||
$length = false;
|
||||
break;
|
||||
case 't_shorttext':
|
||||
$type = 'DB::FIELD_TYPE_TEXT';
|
||||
$length = false;
|
||||
break;
|
||||
case 't_image':
|
||||
$type = 'DB::FIELD_TYPE_BLOB';
|
||||
$length = 2048;
|
||||
break;
|
||||
case 't_bin':
|
||||
$type = 'DB::FIELD_TYPE_BLOB';
|
||||
$length = 2048;
|
||||
break;
|
||||
case 't_cuid':
|
||||
$type = 'DB::FIELD_TYPE_CUID';
|
||||
$length = 25;
|
||||
break;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'null' => ($null == 'NULL' ? 'true' : 'false'),
|
||||
'type' => $type
|
||||
];
|
||||
|
||||
if ($length) {
|
||||
$data['length'] = $length;
|
||||
}
|
||||
|
||||
if (!empty($default)) {
|
||||
$data['default'] = $default;
|
||||
}
|
||||
|
||||
if ($ref_table) {
|
||||
$data['ref_table'] = "'".$ref_table."'";
|
||||
$data['ref_field'] = "'".(!empty($ref_field) ? $ref_field : $field)."'";
|
||||
}
|
||||
|
||||
$schema[$table]['fields'][$field] = $data;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$str = "<?php\n";
|
||||
|
||||
$str .= 'return ['."\n";
|
||||
foreach ($schema as $table => $data) {
|
||||
$str .= "\t'$table' => [\n";
|
||||
$str .= "\t\t'key' => '{$data['key']}',\n";
|
||||
$str .= "\t\t'fields' => [\n";
|
||||
foreach ($data['fields'] as $field => $fieldata) {
|
||||
$str .= "\t\t\t'$field' => [\n";
|
||||
foreach ($fieldata as $name => $val) {
|
||||
$str .= "\t\t\t\t'$name' => $val,\n";
|
||||
}
|
||||
$str = substr($str, 0, -2)."\n\t\t\t],\n";
|
||||
}
|
||||
$str = substr($str, 0, -2)."\n\t\t]\n";
|
||||
$str .= "\t],\n";
|
||||
}
|
||||
$str = substr($str, 0, -2)."\n];\n";
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
$path_src = isset($argv[1]) ? $argv[1] : DEFAULT_SRC_FILE;
|
||||
if (!is_file($path_src)) {
|
||||
fwrite(STDERR, 'File does not exist: "'.$path_src.'"'."\n");
|
||||
exit(1);
|
||||
}
|
||||
$schema_text = parse_schema($path_src);
|
||||
fwrite(STDOUT, 'File parsed: "'.$path_src.'"'."\n");
|
||||
|
||||
$path_dest = isset($argv[2]) ? $argv[2] : DEFAULT_DEST_FILE;
|
||||
$result = file_put_contents($path_dest, $schema_text);
|
||||
if ($result) {
|
||||
fwrite(STDOUT, 'File written: "'.$path_dest.'"'."\n");
|
||||
exit(0);
|
||||
}
|
||||
else {
|
||||
fwrite(STDERR, 'Cannot write file: "'.$path_dest.'"'."\n");
|
||||
exit(1);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
|
||||
define('DEST_FILENAME', __DIR__.'/top_passwords.txt');
|
||||
|
||||
$files = [];
|
||||
for ($i = 1; $argc > $i; $i++) {
|
||||
if (!is_readable($argv[$i]) || !is_file($argv[$i])) {
|
||||
fwrite(STDERR, 'The file "'.$argv[$i].'" does not exist or is not readable.'."\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$files[$argv[$i]] = true;
|
||||
}
|
||||
|
||||
if (!$files) {
|
||||
fwrite(STDERR, 'No input file specified.'."\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Make a list of unique passwords from all source files.
|
||||
$passwords = [];
|
||||
foreach (array_keys($files) as $filename) {
|
||||
$passwords += array_flip(file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES));
|
||||
}
|
||||
$passwords = array_keys($passwords);
|
||||
|
||||
// Remove passwords containing non-printable characters.
|
||||
$passwords = array_filter($passwords, function ($password) {
|
||||
return !preg_match('/[^\x20-\x7e]/', $password);
|
||||
});
|
||||
|
||||
// Base64-encode each password and add quotes around it.
|
||||
$passwords = array_map('base64_encode', $passwords);
|
||||
|
||||
// Generate file.
|
||||
$source = "#\n".
|
||||
"# This file is meant to strengthen password validation for internal users. Passwords included in the list are considered\n".
|
||||
"# weak due to their common use and are not allowed to be chosen by Zabbix internal users for security reasons. The file \n".
|
||||
"# is generated automatically from the list of NCSC \"Top 100k passwords\", the list of SecLists \"Top 1M passwords\" and the\n".
|
||||
"# list of Zabbix context-specific passwords.\n".
|
||||
"#\n".
|
||||
"# The list of passwords is used to check for commonly used passwords according to the password policy. Passwords are\n".
|
||||
"# stored as base64-encoded strings. There must be two newlines before passwords.\n".
|
||||
"#\n".
|
||||
"\n".
|
||||
"\n".
|
||||
implode("\n", $passwords).
|
||||
"\n";
|
||||
|
||||
if (file_put_contents(DEST_FILENAME, $source)) {
|
||||
fwrite(STDOUT, 'File written: "'.DEST_FILENAME.'"'."\n");
|
||||
exit(0);
|
||||
}
|
||||
else {
|
||||
fwrite(STDERR, 'Cannot write file: "'.DEST_FILENAME.'"'."\n");
|
||||
exit(1);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,10 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = \
|
||||
mysql \
|
||||
oracle \
|
||||
postgresql \
|
||||
sqlite3
|
||||
|
||||
EXTRA_DIST = \
|
||||
elasticsearch
|
@ -0,0 +1,154 @@
|
||||
# uint mapping
|
||||
|
||||
{
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_replicas": 1,
|
||||
"number_of_shards": 5
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"itemid": {
|
||||
"type": "long"
|
||||
},
|
||||
"clock": {
|
||||
"format": "epoch_second",
|
||||
"type": "date"
|
||||
},
|
||||
"value": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# dbl mapping
|
||||
|
||||
{
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_replicas": 1,
|
||||
"number_of_shards": 5
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"itemid": {
|
||||
"type": "long"
|
||||
},
|
||||
"clock": {
|
||||
"format": "epoch_second",
|
||||
"type": "date"
|
||||
},
|
||||
"value": {
|
||||
"type": "double"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# str mapping
|
||||
|
||||
{
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_replicas": 1,
|
||||
"number_of_shards": 5
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"itemid": {
|
||||
"type": "long"
|
||||
},
|
||||
"clock": {
|
||||
"format": "epoch_second",
|
||||
"type": "date"
|
||||
},
|
||||
"value": {
|
||||
"fields": {
|
||||
"analyzed": {
|
||||
"index": true,
|
||||
"type": "text",
|
||||
"analyzer": "standard"
|
||||
}
|
||||
},
|
||||
"index": false,
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# text mapping
|
||||
|
||||
{
|
||||
"settings" : {
|
||||
"index" : {
|
||||
"number_of_replicas" : 1,
|
||||
"number_of_shards" : 5
|
||||
}
|
||||
},
|
||||
"mappings" : {
|
||||
"properties" : {
|
||||
"itemid" : {
|
||||
"type" : "long"
|
||||
},
|
||||
"clock" : {
|
||||
"format" : "epoch_second",
|
||||
"type" : "date"
|
||||
},
|
||||
"value" : {
|
||||
"fields" : {
|
||||
"analyzed" : {
|
||||
"index" : true,
|
||||
"type" : "text",
|
||||
"analyzer" : "standard"
|
||||
}
|
||||
},
|
||||
"index" : false,
|
||||
"type" : "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# log mapping
|
||||
|
||||
{
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_replicas": 1,
|
||||
"number_of_shards": 5
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"itemid": {
|
||||
"type": "long"
|
||||
},
|
||||
"clock": {
|
||||
"format": "epoch_second",
|
||||
"type": "date"
|
||||
},
|
||||
"value": {
|
||||
"fields": {
|
||||
"analyzed": {
|
||||
"index": true,
|
||||
"type": "text",
|
||||
"analyzer": "standard"
|
||||
}
|
||||
},
|
||||
"index": false,
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
if DBSCHEMA
|
||||
DATABASE = mysql
|
||||
|
||||
data.sql: $(top_srcdir)/create/src/data.tmpl $(top_srcdir)/create/src/templates.tmpl $(top_srcdir)/create/src/dashboards.tmpl $(top_srcdir)/create/bin/gen_data.pl
|
||||
$(top_srcdir)/create/bin/gen_data.pl $(DATABASE) > data.sql
|
||||
|
||||
schema.sql: $(top_srcdir)/create/src/schema.tmpl $(top_srcdir)/create/bin/gen_schema.pl
|
||||
$(top_srcdir)/create/bin/gen_schema.pl $(DATABASE) > schema.sql || (rm -rf schema.sql && exit 1)
|
||||
|
||||
history_pk_prepare.sql: $(top_srcdir)/create/bin/gen_history_pk.pl
|
||||
$(top_srcdir)/create/bin/gen_history_pk.pl $(DATABASE) > history_pk_prepare.sql
|
||||
|
||||
clean:
|
||||
rm -f schema.sql data.sql history_pk_prepare.sql
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
data.sql \
|
||||
images.sql \
|
||||
schema.sql \
|
||||
history_pk_prepare.sql
|
||||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,21 @@
|
||||
if DBSCHEMA
|
||||
DATABASE = oracle
|
||||
|
||||
data.sql: $(top_srcdir)/create/src/data.tmpl $(top_srcdir)/create/src/templates.tmpl $(top_srcdir)/create/src/dashboards.tmpl $(top_srcdir)/create/bin/gen_data.pl
|
||||
$(top_srcdir)/create/bin/gen_data.pl $(DATABASE) > data.sql
|
||||
|
||||
schema.sql: $(top_srcdir)/create/src/schema.tmpl $(top_srcdir)/create/bin/gen_data.pl
|
||||
$(top_srcdir)/create/bin/gen_schema.pl $(DATABASE) > schema.sql || (rm -rf schema.sql && exit 1)
|
||||
|
||||
history_pk_prepare.sql: $(top_srcdir)/create/bin/gen_history_pk.pl
|
||||
$(top_srcdir)/create/bin/gen_history_pk.pl $(DATABASE) > history_pk_prepare.sql
|
||||
|
||||
clean:
|
||||
rm -f schema.sql data.sql history_pk_prepare.sql
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
data.sql \
|
||||
images.sql \
|
||||
schema.sql \
|
||||
history_pk_prepare.sql
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,29 @@
|
||||
-- nclob can be slow with high number of items and items preprocessing, to improve performance it can be converted to nvarchar2(4000)
|
||||
-- Following select queries should be executed to find out templates that must be removed before converting nclob to nvarchar2(4000):
|
||||
-- select h.name,i.name from item_preproc pp,items i,hosts h where pp.itemid=i.itemid and i.hostid=h.hostid and length(pp.params) > 4000;
|
||||
-- select h.name,i.name from items i,hosts h where i.hostid=h.hostid and length(i.params) > 4000;
|
||||
-- Alternatively if MAX_STRING_SIZE is set then it's possible to change nvarchar2(4000) to nvarchar2(32767) in following queries
|
||||
ALTER TABLE items RENAME COLUMN params TO zbx_old_tmp;
|
||||
ALTER TABLE items ADD params nvarchar2(4000) DEFAULT '';
|
||||
UPDATE items SET params=zbx_old_tmp;
|
||||
ALTER TABLE items DROP COLUMN zbx_old_tmp;
|
||||
|
||||
ALTER TABLE items RENAME COLUMN description TO zbx_old_tmp;
|
||||
ALTER TABLE items ADD description nvarchar2(4000) DEFAULT '';
|
||||
UPDATE items SET description=zbx_old_tmp;
|
||||
ALTER TABLE items DROP COLUMN zbx_old_tmp;
|
||||
|
||||
ALTER TABLE items RENAME COLUMN posts TO zbx_old_tmp;
|
||||
ALTER TABLE items ADD posts nvarchar2(4000) DEFAULT '';
|
||||
UPDATE items SET posts=zbx_old_tmp;
|
||||
ALTER TABLE items DROP COLUMN zbx_old_tmp;
|
||||
|
||||
ALTER TABLE items RENAME COLUMN headers TO zbx_old_tmp;
|
||||
ALTER TABLE items ADD headers nvarchar2(4000) DEFAULT '';
|
||||
UPDATE items SET headers=zbx_old_tmp;
|
||||
ALTER TABLE items DROP COLUMN zbx_old_tmp;
|
||||
|
||||
ALTER TABLE item_preproc RENAME COLUMN params TO zbx_old_tmp;
|
||||
ALTER TABLE item_preproc ADD params nvarchar2(4000) DEFAULT '';
|
||||
UPDATE item_preproc SET params=zbx_old_tmp;
|
||||
ALTER TABLE item_preproc DROP COLUMN zbx_old_tmp;
|
@ -0,0 +1,78 @@
|
||||
if DBSCHEMA
|
||||
DATABASE = postgresql
|
||||
DB_EXTENSION = timescaledb
|
||||
|
||||
data.sql: $(top_srcdir)/create/src/data.tmpl $(top_srcdir)/create/src/templates.tmpl $(top_srcdir)/create/src/dashboards.tmpl $(top_srcdir)/create/bin/gen_data.pl
|
||||
$(top_srcdir)/create/bin/gen_data.pl $(DATABASE) > data.sql
|
||||
|
||||
schema.sql: $(top_srcdir)/create/src/schema.tmpl $(top_srcdir)/create/bin/gen_schema.pl
|
||||
$(top_srcdir)/create/bin/gen_schema.pl $(DATABASE) > schema.sql || (rm -rf schema.sql && exit 1)
|
||||
|
||||
$(DB_EXTENSION).sql: $(top_srcdir)/create/bin/gen_schema.pl
|
||||
$(top_srcdir)/create/bin/gen_schema.pl $(DB_EXTENSION) > $(DB_EXTENSION).sql
|
||||
|
||||
gen_history_pk = $(top_srcdir)/create/bin/gen_history_pk.pl
|
||||
history_pk_prepare.sql: $(gen_history_pk)
|
||||
$(gen_history_pk) $(DATABASE) > history_pk_prepare.sql
|
||||
|
||||
$(tsdb_wcompr_dir)/history_pk.sql:
|
||||
mkdir -p $(tsdb_wcompr_dir) && \
|
||||
$(gen_history_pk) timescaledb history with_compression > $(tsdb_wcompr_dir)/history_pk.sql
|
||||
|
||||
$(tsdb_wcompr_dir)/history_pk_log.sql:
|
||||
mkdir -p $(tsdb_wcompr_dir) && \
|
||||
$(gen_history_pk) timescaledb history_log with_compression > $(tsdb_wcompr_dir)/history_pk_log.sql
|
||||
|
||||
$(tsdb_wcompr_dir)/history_pk_str.sql:
|
||||
mkdir -p $(tsdb_wcompr_dir) && \
|
||||
$(gen_history_pk) timescaledb history_str with_compression > $(tsdb_wcompr_dir)/history_pk_str.sql
|
||||
|
||||
$(tsdb_wcompr_dir)/history_pk_text.sql:
|
||||
mkdir -p $(tsdb_wcompr_dir) && \
|
||||
$(gen_history_pk) timescaledb history_text with_compression > $(tsdb_wcompr_dir)/history_pk_text.sql
|
||||
|
||||
$(tsdb_wcompr_dir)/history_pk_uint.sql:
|
||||
mkdir -p $(tsdb_wcompr_dir) && \
|
||||
$(gen_history_pk) timescaledb history_uint with_compression > $(tsdb_wcompr_dir)/history_pk_uint.sql
|
||||
|
||||
$(tsdb_nocompr_dir)/history_pk.sql:
|
||||
mkdir -p $(tsdb_nocompr_dir) && \
|
||||
$(gen_history_pk) timescaledb history > $(tsdb_nocompr_dir)/history_pk.sql
|
||||
|
||||
$(tsdb_nocompr_dir)/history_pk_log.sql:
|
||||
mkdir -p $(tsdb_nocompr_dir) && \
|
||||
$(gen_history_pk) timescaledb history_log > $(tsdb_nocompr_dir)/history_pk_log.sql
|
||||
|
||||
$(tsdb_nocompr_dir)/history_pk_str.sql:
|
||||
mkdir -p $(tsdb_nocompr_dir) && \
|
||||
$(gen_history_pk) timescaledb history_str > $(tsdb_nocompr_dir)/history_pk_str.sql
|
||||
|
||||
$(tsdb_nocompr_dir)/history_pk_text.sql:
|
||||
mkdir -p $(tsdb_nocompr_dir) && \
|
||||
$(gen_history_pk) timescaledb history_text > $(tsdb_nocompr_dir)/history_pk_text.sql
|
||||
|
||||
$(tsdb_nocompr_dir)/history_pk_uint.sql:
|
||||
mkdir -p $(tsdb_nocompr_dir) && \
|
||||
$(gen_history_pk) timescaledb history_uint > $(tsdb_nocompr_dir)/history_pk_uint.sql
|
||||
|
||||
clean:
|
||||
rm -f schema.sql data.sql timescaledb.sql history_pk_prepare.sql
|
||||
rm -rf tsdb_history_pk_upgrade_with_compression tsdb_history_pk_upgrade_no_compression
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
data.sql \
|
||||
images.sql \
|
||||
schema.sql \
|
||||
$(DB_EXTENSION).sql \
|
||||
history_pk_prepare.sql \
|
||||
$(tsdb_wcompr_dir)/history_pk.sql \
|
||||
$(tsdb_wcompr_dir)/history_pk_log.sql \
|
||||
$(tsdb_wcompr_dir)/history_pk_str.sql \
|
||||
$(tsdb_wcompr_dir)/history_pk_text.sql \
|
||||
$(tsdb_wcompr_dir)/history_pk_uint.sql \
|
||||
$(tsdb_nocompr_dir)/history_pk.sql \
|
||||
$(tsdb_nocompr_dir)/history_pk_log.sql \
|
||||
$(tsdb_nocompr_dir)/history_pk_str.sql \
|
||||
$(tsdb_nocompr_dir)/history_pk_text.sql \
|
||||
$(tsdb_nocompr_dir)/history_pk_uint.sql
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,18 @@
|
||||
if DBSCHEMA
|
||||
DATABASE = sqlite3
|
||||
|
||||
data.sql: $(top_srcdir)/create/src/data.tmpl $(top_srcdir)/create/src/templates.tmpl $(top_srcdir)/create/src/dashboards.tmpl
|
||||
$(top_srcdir)/create/bin/gen_data.pl $(DATABASE) > data.sql
|
||||
|
||||
schema.sql: $(top_srcdir)/create/src/schema.tmpl
|
||||
$(top_srcdir)/create/bin/gen_schema.pl $(DATABASE) > schema.sql || (rm -rf schema.sql && exit 1)
|
||||
|
||||
clean:
|
||||
rm -f schema.sql data.sql
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
data.sql \
|
||||
images.sql \
|
||||
schema.sql
|
||||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@
|
||||
## config.h used to exist in include directory, remove it at some point in the future
|
||||
clean:
|
||||
rm -f config.h*
|
||||
.PHONY: clean
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_ZBXAUDIT_H
|
||||
#define ZABBIX_ZBXAUDIT_H
|
||||
|
||||
#include "zbxtypes.h"
|
||||
|
||||
/* audit logging mode */
|
||||
#define ZBX_AUDITLOG_DISABLED 0
|
||||
#define ZBX_AUDITLOG_ENABLED 1
|
||||
|
||||
#define AUDIT_HOST_ID 1
|
||||
#define AUDIT_HOSTGRP_ID 2
|
||||
#define AUDIT_ITEM_ID 3
|
||||
#define AUDIT_TRIGGER_ID 4
|
||||
#define AUDIT_GRAPH_ID 5
|
||||
#define AUDIT_HTTPTEST_ID 6
|
||||
#define AUDIT_HA_NODE_ID 7
|
||||
#define AUDIT_CONFIG_ID 8
|
||||
|
||||
#define ZBX_AUDIT_ACTION_ADD 0
|
||||
#define ZBX_AUDIT_ACTION_UPDATE 1
|
||||
#define ZBX_AUDIT_ACTION_DELETE 2
|
||||
#define ZBX_AUDIT_ACTION_EXECUTE 7
|
||||
#define ZBX_AUDIT_ACTION_PUSH 12
|
||||
|
||||
#define AUDIT_DETAILS_ACTION_ADD "add"
|
||||
#define AUDIT_DETAILS_ACTION_UPDATE "update"
|
||||
#define AUDIT_DETAILS_ACTION_DELETE "delete"
|
||||
|
||||
#define RETURN_IF_AUDIT_OFF() \
|
||||
if (ZBX_AUDITLOG_ENABLED != zbx_get_audit_mode()) \
|
||||
return \
|
||||
|
||||
int zbx_get_audit_mode(void);
|
||||
|
||||
int zbx_auditlog_global_script(unsigned char script_type, unsigned char script_execute_on,
|
||||
const char *script_command_orig, zbx_uint64_t hostid, const char *hostname, zbx_uint64_t eventid,
|
||||
zbx_uint64_t proxyid, zbx_uint64_t userid, const char *username, const char *clientip,
|
||||
const char *output, const char *error);
|
||||
|
||||
void zbx_audit_init(int audit_mode_set);
|
||||
void zbx_audit_prepare(void);
|
||||
void zbx_audit_clean(void);
|
||||
void zbx_audit_flush(void);
|
||||
int zbx_audit_flush_once(void);
|
||||
|
||||
void zbx_audit_update_json_append_uint64(const zbx_uint64_t id, const int id_table, const char *audit_op,
|
||||
const char *key, uint64_t value, const char *table, const char *field);
|
||||
void zbx_audit_update_json_append_string(const zbx_uint64_t id, const int id_table, const char *audit_op,
|
||||
const char *key, const char *value, const char *table, const char *field);
|
||||
void zbx_audit_update_json_append_string_secret(const zbx_uint64_t id, const int id_table, const char *audit_op,
|
||||
const char *key, const char *value, const char *table, const char *field);
|
||||
|
||||
int zbx_auditlog_history_push(zbx_uint64_t userid, const char *username, const char *clientip, int processed_num,
|
||||
int failed_num, double time_spent);
|
||||
|
||||
#endif /* ZABBIX_ZBXAUDIT_H */
|
@ -0,0 +1,77 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_AUDIT_GRAPH_H
|
||||
#define ZABBIX_AUDIT_GRAPH_H
|
||||
|
||||
#include "zbxalgo.h"
|
||||
|
||||
void zbx_audit_graph_create_entry(int audit_action, zbx_uint64_t graphid, const char *name, int flags);
|
||||
|
||||
void zbx_audit_graph_update_json_add_data(zbx_uint64_t graphid, const char *name, int width, int height,
|
||||
double yaxismin, double yaxismax, zbx_uint64_t templateid, int show_work_period, int show_triggers,
|
||||
int graphtype, int show_legend, int show_3d, double percent_left, double percent_right, int ymin_type,
|
||||
int ymax_type, zbx_uint64_t ymin_itemid, zbx_uint64_t ymax_itemid, int flags, int discover);
|
||||
|
||||
void zbx_audit_graph_update_json_add_gitems(zbx_uint64_t graphid, int flags, zbx_uint64_t gitemid, int drawtype,
|
||||
int sortorder, const char *color, int yaxisside, int calc_fnc, int type, zbx_uint64_t itemid);
|
||||
|
||||
#define PREPARE_AUDIT_GRAPH_UPDATE(resource, type1) \
|
||||
void zbx_audit_graph_update_json_update_##resource(zbx_uint64_t graphid, int flags, \
|
||||
type1 resource##_old, type1 resource##_new); \
|
||||
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(name, const char*)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(width, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(height, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(yaxismin, double)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(yaxismax, double)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(show_work_period, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(show_triggers, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(graphtype, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(show_legend, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(show_3d, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(percent_left, double)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(percent_right, double)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(ymin_type, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(ymax_type, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(ymin_itemid, zbx_uint64_t)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(ymax_itemid, zbx_uint64_t)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(discover, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(templateid, zbx_uint64_t)
|
||||
#undef PREPARE_AUDIT_GRAPH_UPDATE
|
||||
|
||||
void zbx_audit_graph_update_json_update_gitem_create_entry(zbx_uint64_t graphid, int flags, zbx_uint64_t gitemid);
|
||||
|
||||
#define PREPARE_AUDIT_GRAPH_UPDATE(resource, type1) \
|
||||
void zbx_audit_graph_update_json_update_gitem_update_##resource(zbx_uint64_t graphid, int flags, \
|
||||
zbx_uint64_t gitemid, type1 resource##_old, type1 resource##_new);
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(itemid, zbx_uint64_t)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(drawtype, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(sortorder, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(color, const char*)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(yaxisside, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(calc_fnc, int)
|
||||
PREPARE_AUDIT_GRAPH_UPDATE(type, int)
|
||||
#undef PREPARE_AUDIT_GRAPH_UPDATE
|
||||
|
||||
void zbx_audit_graph_update_json_delete_gitems(zbx_uint64_t graphid, int flags, zbx_uint64_t gitemid);
|
||||
|
||||
void zbx_audit_DBselect_delete_for_graph(const char *sql, zbx_vector_uint64_t *ids);
|
||||
|
||||
#endif /* ZABBIX_AUDIT_GRAPH_H */
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_AUDIT_HA_H
|
||||
#define ZABBIX_AUDIT_HA_H
|
||||
|
||||
#define ZBX_AUDIT_HA_NODE "hanode"
|
||||
#define ZBX_AUDIT_HA_NODEID ZBX_AUDIT_HA_NODE ".ha_nodeid"
|
||||
#define ZBX_AUDIT_HA_NAME ZBX_AUDIT_HA_NODE ".name"
|
||||
#define ZBX_AUDIT_HA_STATUS ZBX_AUDIT_HA_NODE ".status"
|
||||
#define ZBX_AUDIT_HA_STATUS_CHANGE_REASON_TO_ACTIVE ZBX_AUDIT_HA_NODE ".status_change_reason"
|
||||
#define ZBX_AUDIT_HA_ADDRESS ZBX_AUDIT_HA_NODE ".address"
|
||||
#define ZBX_AUDIT_HA_PORT ZBX_AUDIT_HA_NODE ".port"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ZBX_AUDIT_HA_ST_CH_REASON_UNKNOWN = 0,
|
||||
ZBX_AUDIT_HA_ST_CH_REASON_NO_ACTIVE_NODES,
|
||||
ZBX_AUDIT_HA_ST_CH_REASON_DB_CONNECTION_LOSS
|
||||
}
|
||||
zbx_audit_ha_status_change_reason_to_active_type_t;
|
||||
|
||||
void zbx_audit_ha_create_entry(int audit_action, const char *nodeid, const char *name);
|
||||
void zbx_audit_ha_add_create_fields(const char *nodeid, const char *name, int status);
|
||||
void zbx_audit_ha_update_field_string(const char *nodeid, const char *key, const char *old_value,
|
||||
const char *new_value);
|
||||
void zbx_audit_ha_update_field_int(const char *nodeid, const char *key, int old_value, int new_value);
|
||||
void zbx_audit_ha_add_field_int(const char *nodeid, const char *key, int value);
|
||||
|
||||
#endif
|
@ -0,0 +1,211 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_AUDIT_HOST_H
|
||||
#define ZABBIX_AUDIT_HOST_H
|
||||
|
||||
#include "zbxtypes.h"
|
||||
#include "zbxalgo.h"
|
||||
|
||||
#define PREPARE_AUDIT_SNMP_INTERFACE_H(funcname) \
|
||||
void zbx_audit_##funcname##_update_json_add_snmp_interface(zbx_uint64_t hostid, zbx_uint64_t version, \
|
||||
zbx_uint64_t bulk, const char *community, const char *securityname, zbx_uint64_t securitylevel, \
|
||||
const char *authpassphrase, const char *privpassphrase, zbx_uint64_t authprotocol, \
|
||||
zbx_uint64_t privprotocol, const char *contextname, zbx_uint64_t interfaceid); \
|
||||
void zbx_audit_##funcname##_update_json_update_snmp_interface(zbx_uint64_t hostid, zbx_uint64_t version_old, \
|
||||
zbx_uint64_t version_new, zbx_uint64_t bulk_old, zbx_uint64_t bulk_new, \
|
||||
const char *community_old, const char *community_new, const char *securityname_old, \
|
||||
const char *securityname_new, zbx_uint64_t securitylevel_old, zbx_uint64_t securitylevel_new, \
|
||||
const char *authpassphrase_old, const char *authpassphrase_new, const char *privpassphrase_old, \
|
||||
const char *privpassphrase_new, zbx_uint64_t authprotocol_old, zbx_uint64_t authprotocol_new, \
|
||||
zbx_uint64_t privprotocol_old, zbx_uint64_t privprotocol_new, const char *contextname_old, \
|
||||
const char *contextname_new, zbx_uint64_t interfaceid); \
|
||||
|
||||
PREPARE_AUDIT_SNMP_INTERFACE_H(host)
|
||||
PREPARE_AUDIT_SNMP_INTERFACE_H(host_prototype)
|
||||
|
||||
void zbx_audit_host_update_json_add_proxyid_and_hostname_and_inventory_mode(zbx_uint64_t hostid,
|
||||
zbx_uint64_t proxyid, const char *hostname, int inventory_mode);
|
||||
void zbx_audit_host_update_json_add_tls_and_psk(zbx_uint64_t hostid, int tls_connect, int tls_accept,
|
||||
const char *tls_psk_identity, const char *tls_psk);
|
||||
void zbx_audit_host_update_json_add_inventory_mode(zbx_uint64_t hostid, int inventory_mode);
|
||||
void zbx_audit_host_update_json_update_inventory_mode(zbx_uint64_t hostid, int inventory_mode_old,
|
||||
int inventory_mode_new);
|
||||
void zbx_audit_host_update_json_update_host_status(zbx_uint64_t hostid, int host_status_old,
|
||||
int host_status_new);
|
||||
|
||||
#define PREPARE_AUDIT_HOST_INTERFACE_H(funcname, interface_resource, type1) \
|
||||
void zbx_audit_##funcname##_update_json_update_interface_##interface_resource(zbx_uint64_t hostid, \
|
||||
zbx_uint64_t interfaceid, type1 interface_resource##_old, type1 interface_resource##_new); \
|
||||
|
||||
#define PREPARE_AUDIT_HOST_H(funcname, audit_resource_flag) \
|
||||
void zbx_audit_##funcname##_create_entry(int audit_action, zbx_uint64_t hostid, const char *name); \
|
||||
void zbx_audit_##funcname##_update_json_add_interfaces(zbx_uint64_t hostid, zbx_uint64_t interfaceid, \
|
||||
zbx_uint64_t main_, zbx_uint64_t type, zbx_uint64_t useip, const char *ip, const char *dns, \
|
||||
int port); \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, useip, zbx_uint64_t) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, main, zbx_uint64_t) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, type, zbx_uint64_t) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, ip, const char*) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, dns, const char*) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, port, int) \
|
||||
/* snmp */ \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, version, zbx_uint64_t) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, bulk, zbx_uint64_t) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, community, const char*) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, securityname, const char*) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, securitylevel, int) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, authpassphrase, const char*) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, privpassphrase, const char*) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, authprotocol, zbx_uint64_t) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, privprotocol, zbx_uint64_t) \
|
||||
PREPARE_AUDIT_HOST_INTERFACE_H(funcname, contextname, const char*) \
|
||||
|
||||
PREPARE_AUDIT_HOST_H(host, AUDIT_RESOURCE_HOST)
|
||||
PREPARE_AUDIT_HOST_H(host_prototype, AUDIT_RESOURCE_HOST_PROTOTYPE)
|
||||
|
||||
#define PREPARE_AUDIT_HOST_UPDATE_H(resource, type1) \
|
||||
void zbx_audit_host_update_json_update_##resource(zbx_uint64_t hostid, type1 old_##resource, \
|
||||
type1 new_##resource); \
|
||||
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(host, const char*)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(name, const char*)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(proxyid, zbx_uint64_t)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(ipmi_authtype, int)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(ipmi_privilege, int)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(ipmi_username, const char*)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(ipmi_password, const char*)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(tls_connect, int)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(tls_accept, int)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(tls_issuer, const char*)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(tls_subject, const char*)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(tls_psk_identity, const char*)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(tls_psk, const char*)
|
||||
PREPARE_AUDIT_HOST_UPDATE_H(custom_interfaces, int)
|
||||
#undef PREPARE_AUDIT_HOST_UPDATE_H
|
||||
|
||||
void zbx_audit_host_update_json_delete_interface(zbx_uint64_t hostid, zbx_uint64_t interfaceid);
|
||||
void zbx_audit_host_update_json_add_hostmacro(zbx_uint64_t hostid, zbx_uint64_t macroid,
|
||||
const char *macro, const char *value, const char *description, int type, int automatic);
|
||||
|
||||
#define PREPARE_AUDIT_HOST_UPDATE_HOSTMACRO_H(resource, type1) \
|
||||
void zbx_audit_host_update_json_update_hostmacro_##resource(zbx_uint64_t hostid, \
|
||||
zbx_uint64_t hostmacroid, type1 old_##resource, type1 new_##resource);
|
||||
PREPARE_AUDIT_HOST_UPDATE_HOSTMACRO_H(value, const char*)
|
||||
PREPARE_AUDIT_HOST_UPDATE_HOSTMACRO_H(description, const char*)
|
||||
PREPARE_AUDIT_HOST_UPDATE_HOSTMACRO_H(type, int)
|
||||
|
||||
void zbx_audit_host_update_json_delete_hostmacro(zbx_uint64_t hostid, zbx_uint64_t hostmacroid);
|
||||
|
||||
void zbx_audit_host_update_json_add_tag(zbx_uint64_t hostid, zbx_uint64_t tagid, const char* tag, const char* value,
|
||||
int automatic);
|
||||
|
||||
void zbx_audit_host_update_json_update_tag_tag(zbx_uint64_t hostid, zbx_uint64_t tagid,
|
||||
const char* tag_old, const char *tag_new);
|
||||
void zbx_audit_host_update_json_update_tag_value(zbx_uint64_t hostid, zbx_uint64_t tagid,
|
||||
const char* value_old, const char *value_new);
|
||||
void zbx_audit_host_update_json_update_tag_type(zbx_uint64_t hostid, zbx_uint64_t tagid,
|
||||
int automatic_old, int automatic_new);
|
||||
|
||||
void zbx_audit_host_update_json_delete_tag(zbx_uint64_t hostid, zbx_uint64_t tagid);
|
||||
|
||||
void zbx_audit_hostgroup_update_json_add_group(zbx_uint64_t hostid, zbx_uint64_t hostgroupid, zbx_uint64_t groupid);
|
||||
void zbx_audit_hostgroup_update_json_delete_group(zbx_uint64_t hostid, zbx_uint64_t hostgroupid,
|
||||
zbx_uint64_t groupid);
|
||||
void zbx_audit_host_hostgroup_delete(zbx_uint64_t hostid, const char* hostname, zbx_vector_uint64_t *hostgroupids,
|
||||
zbx_vector_uint64_t *groupids);
|
||||
void zbx_audit_host_del(zbx_uint64_t hostid, const char *hostname);
|
||||
void zbx_audit_host_update_json_add_details(zbx_uint64_t hostid, const char *host, zbx_uint64_t proxyid,
|
||||
int ipmi_authtype, int ipmi_privilege, const char *ipmi_username, const char *ipmi_password,
|
||||
int status, int flags, int tls_connect, int tls_accept, const char *tls_issuer, const char *tls_subject,
|
||||
const char *tls_psk_identity, const char *tls_psk, int custom_interfaces, int inventory_mode);
|
||||
void zbx_audit_host_prototype_del(zbx_uint64_t hostid, const char *hostname);
|
||||
void zbx_audit_host_prototype_update_json_add_details(zbx_uint64_t hostid, zbx_uint64_t templateid, const char *name,
|
||||
int status, int discover, int custom_interfaces, int inventory_mode);
|
||||
void zbx_audit_host_prototype_update_json_update_templateid(zbx_uint64_t hostid, zbx_uint64_t templateid_orig,
|
||||
zbx_uint64_t templateid);
|
||||
|
||||
#define PREPARE_AUDIT_HOST_PROTOTYPE_UPDATE_H(resource, type1) \
|
||||
void zbx_audit_host_prototype_update_json_update_##resource(zbx_uint64_t hostid, type1 old_##resource, \
|
||||
type1 new_##resource); \
|
||||
|
||||
PREPARE_AUDIT_HOST_PROTOTYPE_UPDATE_H(name, const char*)
|
||||
PREPARE_AUDIT_HOST_PROTOTYPE_UPDATE_H(status, int)
|
||||
PREPARE_AUDIT_HOST_PROTOTYPE_UPDATE_H(discover, int)
|
||||
PREPARE_AUDIT_HOST_PROTOTYPE_UPDATE_H(custom_interfaces, int)
|
||||
PREPARE_AUDIT_HOST_PROTOTYPE_UPDATE_H(inventory_mode, int)
|
||||
|
||||
void zbx_audit_host_prototype_update_json_add_group_details(zbx_uint64_t hostid, zbx_uint64_t group_prototypeid,
|
||||
const char* name, zbx_uint64_t groupid, zbx_uint64_t templateid);
|
||||
|
||||
void zbx_audit_host_prototype_update_json_update_group_details(zbx_uint64_t hostid, zbx_uint64_t group_prototypeid,
|
||||
const char* name, zbx_uint64_t groupid, zbx_uint64_t templateid_old, zbx_uint64_t templateid_new);
|
||||
|
||||
#define PREPARE_AUDIT_TEMPLATE_ADD_H(funcname) \
|
||||
void zbx_audit_##funcname##_update_json_add_parent_template(zbx_uint64_t hostid, \
|
||||
zbx_uint64_t hosttemplateid, zbx_uint64_t templateid, int link_type);
|
||||
#define PREPARE_AUDIT_TEMPLATE_DELETE_H(funcname) \
|
||||
void zbx_audit_##funcname##_update_json_delete_parent_template(zbx_uint64_t hostid, \
|
||||
zbx_uint64_t hosttemplateid);
|
||||
PREPARE_AUDIT_TEMPLATE_ADD_H(host)
|
||||
PREPARE_AUDIT_TEMPLATE_DELETE_H(host)
|
||||
PREPARE_AUDIT_TEMPLATE_ADD_H(host_prototype)
|
||||
PREPARE_AUDIT_TEMPLATE_DELETE_H(host_prototype)
|
||||
|
||||
void zbx_audit_host_prototype_update_json_delete_interface(zbx_uint64_t hostid, zbx_uint64_t interfaceid);
|
||||
|
||||
void zbx_audit_host_prototype_update_json_add_hostmacro(zbx_uint64_t hostid, zbx_uint64_t macroid,
|
||||
const char *macro, const char *value, const char *description, int type, int automatic);
|
||||
void zbx_audit_host_update_json_update_hostmacro_create_entry(zbx_uint64_t hostid,
|
||||
zbx_uint64_t hostmacroid);
|
||||
void zbx_audit_host_prototype_update_json_update_hostmacro_create_entry(zbx_uint64_t hostid,
|
||||
zbx_uint64_t hostmacroid);
|
||||
#define PREPARE_AUDIT_HOST_PROTOTYPE_UPDATE_HOSTMACRO_H(resource, type1) \
|
||||
void zbx_audit_host_prototype_update_json_update_hostmacro_##resource(zbx_uint64_t hostid, \
|
||||
zbx_uint64_t hostmacroid, type1 old_##resource, type1 new_##resource);
|
||||
PREPARE_AUDIT_HOST_PROTOTYPE_UPDATE_HOSTMACRO_H(value, const char*)
|
||||
PREPARE_AUDIT_HOST_PROTOTYPE_UPDATE_HOSTMACRO_H(description, const char*)
|
||||
PREPARE_AUDIT_HOST_PROTOTYPE_UPDATE_HOSTMACRO_H(type, int)
|
||||
|
||||
void zbx_audit_host_prototype_update_json_delete_hostmacro(zbx_uint64_t hostid, zbx_uint64_t hostmacroid);
|
||||
|
||||
void zbx_audit_host_prototype_update_json_add_tag(zbx_uint64_t hostid, zbx_uint64_t tagid, const char* tag,
|
||||
const char* value, int automatic);
|
||||
void zbx_audit_host_prototype_update_json_update_tag_create_entry(zbx_uint64_t hostid, zbx_uint64_t tagid);
|
||||
void zbx_audit_host_update_json_update_tag_create_entry(zbx_uint64_t hostid, zbx_uint64_t tagid);
|
||||
void zbx_audit_host_prototype_update_json_update_tag_tag(zbx_uint64_t hostid, zbx_uint64_t tagid,
|
||||
const char* tag_old, const char *tag_new);
|
||||
void zbx_audit_host_prototype_update_json_update_tag_value(zbx_uint64_t hostid, zbx_uint64_t tagid,
|
||||
const char* value_old, const char *value_new);
|
||||
|
||||
void zbx_audit_host_prototype_update_json_delete_tag(zbx_uint64_t hostid, zbx_uint64_t tagid);
|
||||
|
||||
void zbx_audit_host_group_create_entry(int audit_action, zbx_uint64_t groupid, const char *name);
|
||||
void zbx_audit_host_group_del(zbx_uint64_t groupid, const char *name);
|
||||
void zbx_audit_host_group_update_json_add_details(zbx_uint64_t groupid, const char *name, int flags);
|
||||
|
||||
#define PREPARE_AUDIT_HOST_GROUP_UPDATE_H(resource, type1) \
|
||||
void zbx_audit_host_group_update_json_update_##resource(zbx_uint64_t groupid, type1 old_##resource, \
|
||||
type1 new_##resource); \
|
||||
|
||||
PREPARE_AUDIT_HOST_GROUP_UPDATE_H(name, const char*)
|
||||
#undef PREPARE_AUDIT_HOST_UPDATE_H
|
||||
|
||||
void zbx_audit_host_update_json_add_proxyid(zbx_uint64_t hostid, zbx_uint64_t proxyid);
|
||||
#endif /* ZABBIX_AUDIT_HOST_H */
|
@ -0,0 +1,87 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_AUDIT_HTTPTEST_H
|
||||
#define ZABBIX_AUDIT_HTTPTEST_H
|
||||
|
||||
#include "zbxalgo.h"
|
||||
|
||||
void zbx_audit_httptest_create_entry(int audit_action, zbx_uint64_t httptestid, const char *name);
|
||||
|
||||
void zbx_audit_httptest_update_json_add_data(zbx_uint64_t httptestid, zbx_uint64_t templateid, const char *name,
|
||||
const char *delay, unsigned char status, const char *agent, unsigned char authentication,
|
||||
const char *httpuser, const char *httppassword, const char *http_proxy, int retries,
|
||||
const char *ssl_cert_file, const char *ssl_key_file, const char *ssl_key_password, int verify_peer,
|
||||
int verify_host, zbx_uint64_t hostid);
|
||||
|
||||
#define PREPARE_AUDIT_HTTPTEST_UPDATE_H(resource, type1) \
|
||||
void zbx_audit_httptest_update_json_update_##resource(zbx_uint64_t httptestid, type1 resource##_old, \
|
||||
type1 resource##_new);
|
||||
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(templateid, zbx_uint64_t)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(delay, const char*)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(agent, const char*)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(http_user, const char*)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(http_password, const char*)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(http_proxy, const char*)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(retries, int)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(status, int)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(authentication, int)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(ssl_cert_file, const char*)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(ssl_key_file, const char*)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(ssl_key_password, const char*)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(verify_peer, int)
|
||||
PREPARE_AUDIT_HTTPTEST_UPDATE_H(verify_host, int)
|
||||
|
||||
int zbx_audit_DBselect_delete_for_httptest(const char *sql, zbx_vector_uint64_t *ids);
|
||||
|
||||
void zbx_audit_httptest_update_json_add_httptest_tag(zbx_uint64_t httptestid, zbx_uint64_t tagid, const char *tag,
|
||||
const char *value);
|
||||
|
||||
void zbx_audit_httptest_update_json_delete_tags(zbx_uint64_t httptestid, zbx_uint64_t tagid);
|
||||
|
||||
void zbx_audit_httptest_update_json_add_httptest_httpstep(zbx_uint64_t httptestid, zbx_uint64_t httpstepid,
|
||||
const char *name, int no, const char *url, const char *timeout, const char *posts, const char *required,
|
||||
const char *status_codes, int follow_redirects, int retrieve_mode, int post_type);
|
||||
|
||||
#define PREPARE_AUDIT_HTTPSTEP_UPDATE_H(resource, type1) \
|
||||
void zbx_audit_httptest_update_json_httpstep_update_##resource(zbx_uint64_t httptestid, \
|
||||
zbx_uint64_t httpstepid, type1 resource##_old, type1 resource##_new);
|
||||
|
||||
PREPARE_AUDIT_HTTPSTEP_UPDATE_H(url, const char*)
|
||||
PREPARE_AUDIT_HTTPSTEP_UPDATE_H(posts, const char*)
|
||||
PREPARE_AUDIT_HTTPSTEP_UPDATE_H(required, const char*)
|
||||
PREPARE_AUDIT_HTTPSTEP_UPDATE_H(status_codes, const char*)
|
||||
PREPARE_AUDIT_HTTPSTEP_UPDATE_H(timeout, const char*)
|
||||
PREPARE_AUDIT_HTTPSTEP_UPDATE_H(follow_redirects, int)
|
||||
PREPARE_AUDIT_HTTPSTEP_UPDATE_H(retrieve_mode, int)
|
||||
PREPARE_AUDIT_HTTPSTEP_UPDATE_H(post_type, int)
|
||||
|
||||
void zbx_audit_httptest_update_json_add_httptest_field(zbx_uint64_t httptestid, zbx_uint64_t httptestfieldid,
|
||||
int type, const char *name, const char *value);
|
||||
|
||||
void zbx_audit_httptest_update_json_delete_httptest_field(zbx_uint64_t httptestid, zbx_uint64_t fieldid, int type);
|
||||
|
||||
void zbx_audit_httptest_update_json_add_httpstep_field(zbx_uint64_t httptestid, zbx_uint64_t httpstepid,
|
||||
zbx_uint64_t httpstepfieldid, int type, const char *name, const char *value);
|
||||
|
||||
void zbx_audit_httptest_update_json_delete_httpstep_field(zbx_uint64_t httptestid, zbx_uint64_t httpstepid,
|
||||
zbx_uint64_t fieldid, int type);
|
||||
|
||||
#endif /* ZABBIX_AUDIT_HTTPTEST_H */
|
@ -0,0 +1,201 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_AUDIT_ITEM_H
|
||||
#define ZABBIX_AUDIT_ITEM_H
|
||||
|
||||
#include "zbxalgo.h"
|
||||
|
||||
int zbx_audit_item_resource_is_only_item(int resource_type);
|
||||
int zbx_audit_item_resource_is_only_item_prototype(int resource_type);
|
||||
int zbx_audit_item_resource_is_only_item_and_item_prototype(int resource_type);
|
||||
int zbx_audit_item_resource_is_only_lld_rule(int resource_type);
|
||||
|
||||
int zbx_audit_item_flag_to_resource_type(int flag);
|
||||
|
||||
#define ZBX_AUDIT_IT_OR_ITP_OR_DR(s) zbx_audit_item_resource_is_only_item(resource_type) ? "item."#s : \
|
||||
(zbx_audit_item_resource_is_only_item_prototype(resource_type) ? "itemprototype."#s : \
|
||||
"discoveryrule."#s)
|
||||
|
||||
void zbx_audit_item_create_entry(int audit_action, zbx_uint64_t itemid, const char *name, int flags);
|
||||
|
||||
#define PREPARE_AUDIT_ITEM_UPDATE_H(resource, type1) \
|
||||
void zbx_audit_item_update_json_update_##resource(zbx_uint64_t itemid, int flags, \
|
||||
type1 resource##_old, type1 resource##_new);
|
||||
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(interfaceid, zbx_uint64_t)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(templateid, zbx_uint64_t)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(name, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(type, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(value_type, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(delay, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(history, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(trends, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(status, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(trapper_hosts, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(units, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(formula, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(logtimefmt, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(valuemapid, zbx_uint64_t)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(params, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(ipmi_sensor, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(snmp_oid, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(authtype, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(username, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(password, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(publickey, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(privatekey, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(flags, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(description, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(inventory_link, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(lifetime, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(evaltype, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(jmx_endpoint, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(master_itemid, zbx_uint64_t)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(timeout, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(url, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(query_fields, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(posts, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(status_codes, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(follow_redirects, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(redirects, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(post_type, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(http_proxy, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(headers, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(retrieve_mode, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(request_method, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(output_format, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(ssl_cert_file, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(ssl_key_file, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(ssl_key_password, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(verify_peer, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(verify_host, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(allow_traps, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(discover, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_H(key, const char*)
|
||||
|
||||
void zbx_audit_item_create_entry_for_delete(zbx_uint64_t id, const char *name, int flag);
|
||||
int zbx_audit_DBselect_delete_for_item(const char *sql, zbx_vector_uint64_t *ids);
|
||||
|
||||
void zbx_audit_discovery_rule_update_json_add_filter_conditions(zbx_uint64_t itemid, zbx_uint64_t rule_conditionid,
|
||||
zbx_uint64_t op, const char *macro, const char *value);
|
||||
void zbx_audit_discovery_rule_update_json_update_filter_conditions_create_entry(zbx_uint64_t itemid,
|
||||
zbx_uint64_t item_conditionid);
|
||||
|
||||
#define PREPARE_AUDIT_DISCOVERY_RULE_UPDATE_H(resource, type1) \
|
||||
void zbx_audit_discovery_rule_update_json_update_filter_conditions_##resource(zbx_uint64_t itemid, \
|
||||
zbx_uint64_t item_conditionid, type1 resource##_old, type1 resource##_new);
|
||||
PREPARE_AUDIT_DISCOVERY_RULE_UPDATE_H(operator, int)
|
||||
PREPARE_AUDIT_DISCOVERY_RULE_UPDATE_H(macro, const char*)
|
||||
PREPARE_AUDIT_DISCOVERY_RULE_UPDATE_H(value, const char*)
|
||||
|
||||
void zbx_audit_discovery_rule_update_json_delete_filter_conditions(zbx_uint64_t itemid,
|
||||
zbx_uint64_t item_conditionid);
|
||||
|
||||
void zbx_audit_item_update_json_add_item_preproc(zbx_uint64_t itemid, zbx_uint64_t preprocid, int item_flags,
|
||||
int step, int type, const char *params, int error_handler, const char *error_handler_params);
|
||||
|
||||
void zbx_audit_item_update_json_update_item_preproc_create_entry(zbx_uint64_t itemid, int item_flags,
|
||||
zbx_uint64_t preprocid);
|
||||
|
||||
#define PREPARE_AUDIT_ITEM_UPDATE_PREPROC_H(resource, type1) \
|
||||
void zbx_audit_item_update_json_update_item_preproc_##resource(zbx_uint64_t itemid, int item_flags, \
|
||||
zbx_uint64_t preprocid, type1 resource##_old, type1 resource##_new);
|
||||
|
||||
PREPARE_AUDIT_ITEM_UPDATE_PREPROC_H(type, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_PREPROC_H(params, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_PREPROC_H(error_handler, int)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_PREPROC_H(error_handler_params, const char*)
|
||||
|
||||
void zbx_audit_item_delete_preproc(zbx_uint64_t itemid, int item_flags, zbx_uint64_t preprocid);
|
||||
|
||||
void zbx_audit_item_update_json_add_item_tag(zbx_uint64_t itemid, zbx_uint64_t tagid, int item_flags,
|
||||
const char *tag, const char *value);
|
||||
|
||||
void zbx_audit_item_update_json_update_item_tag_create_entry(zbx_uint64_t itemid, int item_flags,
|
||||
zbx_uint64_t tagid);
|
||||
|
||||
#define PREPARE_AUDIT_ITEM_UPDATE_TAG_H(resource, type1) \
|
||||
void zbx_audit_item_update_json_update_item_tag_##resource(zbx_uint64_t itemid, int item_flags, \
|
||||
zbx_uint64_t tagid, type1 resource##_old, type1 resource##_new);
|
||||
|
||||
PREPARE_AUDIT_ITEM_UPDATE_TAG_H(tag, const char*)
|
||||
PREPARE_AUDIT_ITEM_UPDATE_TAG_H(value, const char*)
|
||||
|
||||
void zbx_audit_item_delete_tag(zbx_uint64_t itemid, int item_flags, zbx_uint64_t tagid);
|
||||
|
||||
void zbx_audit_item_update_json_add_params(zbx_uint64_t itemid, int item_flags, zbx_uint64_t item_parameter_id,
|
||||
const char *name, const char *value);
|
||||
|
||||
void zbx_audit_item_update_json_update_params_create_entry(zbx_uint64_t itemid, int item_flags, zbx_uint64_t
|
||||
item_parameter_id);
|
||||
|
||||
#define PREPARE_AUDIT_ITEM_PARAMS_UPDATE_H(resource) \
|
||||
void zbx_audit_item_update_json_update_params_##resource(zbx_uint64_t itemid, int item_flags, \
|
||||
zbx_uint64_t item_parameter_id, const char *resource##_orig, const char *resource);
|
||||
|
||||
PREPARE_AUDIT_ITEM_PARAMS_UPDATE_H(name)
|
||||
PREPARE_AUDIT_ITEM_PARAMS_UPDATE_H(value)
|
||||
|
||||
void zbx_audit_item_delete_params(zbx_uint64_t itemid, int item_flags, zbx_uint64_t item_parameter_id);
|
||||
|
||||
void zbx_audit_discovery_rule_update_json_add_lld_macro_path(zbx_uint64_t itemid,
|
||||
zbx_uint64_t lld_macro_pathid, const char *lld_macro, const char *path);
|
||||
|
||||
void zbx_audit_discovery_rule_update_json_lld_macro_path_create_update_entry(zbx_uint64_t itemid,
|
||||
zbx_uint64_t lld_macro_pathid);
|
||||
|
||||
#define PREPARE_AUDIT_DISCOVERY_RULE_UPDATE_LLD_MACRO_PATH_H(resource) \
|
||||
void zbx_audit_discovery_rule_update_json_update_lld_macro_path_##resource(zbx_uint64_t itemid, \
|
||||
zbx_uint64_t lld_macro_pathid, const char *resource##_old, const char *resource##_new);
|
||||
PREPARE_AUDIT_DISCOVERY_RULE_UPDATE_LLD_MACRO_PATH_H(lld_macro)
|
||||
PREPARE_AUDIT_DISCOVERY_RULE_UPDATE_LLD_MACRO_PATH_H(path)
|
||||
void zbx_audit_discovery_rule_update_json_delete_lld_macro_path(zbx_uint64_t itemid,
|
||||
zbx_uint64_t lld_macro_pathid);
|
||||
|
||||
void zbx_audit_discovery_rule_update_json_add_lld_override(zbx_uint64_t itemid, zbx_uint64_t overrideid,
|
||||
const char *name, int step, int stop);
|
||||
void zbx_audit_discovery_rule_update_json_delete_lld_override(zbx_uint64_t itemid, zbx_uint64_t overrideid);
|
||||
void zbx_audit_discovery_rule_update_json_add_lld_override_filter(zbx_uint64_t itemid, zbx_uint64_t overrideid,
|
||||
int evaltype, const char *formula);
|
||||
|
||||
void zbx_audit_discovery_rule_update_json_add_lld_override_condition(zbx_uint64_t itemid, zbx_uint64_t overrideid,
|
||||
zbx_uint64_t override_conditionid, int condition_operator, const char *macro, const char *value);
|
||||
|
||||
void zbx_audit_discovery_rule_update_json_add_lld_override_operation(zbx_uint64_t itemid, zbx_uint64_t overrideid,
|
||||
zbx_uint64_t override_operationid, int condition_operator, const char *value);
|
||||
|
||||
#define PREPARE_AUDIT_DISCOVERY_RULE_OVERRIDE_ADD_H(resource, type) \
|
||||
void zbx_audit_discovery_rule_update_json_add_lld_override_##resource(zbx_uint64_t itemid, \
|
||||
zbx_uint64_t overrideid, zbx_uint64_t resource##_id, type resource);
|
||||
|
||||
PREPARE_AUDIT_DISCOVERY_RULE_OVERRIDE_ADD_H(opstatus, int)
|
||||
PREPARE_AUDIT_DISCOVERY_RULE_OVERRIDE_ADD_H(opdiscover, int)
|
||||
PREPARE_AUDIT_DISCOVERY_RULE_OVERRIDE_ADD_H(opperiod, const char*)
|
||||
PREPARE_AUDIT_DISCOVERY_RULE_OVERRIDE_ADD_H(optrends, const char*)
|
||||
PREPARE_AUDIT_DISCOVERY_RULE_OVERRIDE_ADD_H(ophistory, const char*)
|
||||
PREPARE_AUDIT_DISCOVERY_RULE_OVERRIDE_ADD_H(opseverity, int)
|
||||
PREPARE_AUDIT_DISCOVERY_RULE_OVERRIDE_ADD_H(opinventory, int)
|
||||
|
||||
void zbx_audit_discovery_rule_update_json_add_lld_override_optag(zbx_uint64_t itemid, zbx_uint64_t overrideid,
|
||||
zbx_uint64_t lld_override_optagid, const char *tag, const char *value);
|
||||
|
||||
void zbx_audit_discovery_rule_update_json_add_lld_override_optemplate(zbx_uint64_t itemid, zbx_uint64_t overrideid,
|
||||
zbx_uint64_t lld_override_optemplateid, zbx_uint64_t templateid);
|
||||
#endif /* ZABBIX_AUDIT_ITEM_H */
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_AUDIT_PROXY_H
|
||||
#define ZABBIX_AUDIT_PROXY_H
|
||||
|
||||
#include "zbxtypes.h"
|
||||
|
||||
void zbx_audit_proxy_config_reload(zbx_uint64_t proxyid, const char *name);
|
||||
|
||||
#endif
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_AUDIT_SETTINGS_H
|
||||
#define ZABBIX_AUDIT_SETTINGS_H
|
||||
|
||||
#include "zbxtypes.h"
|
||||
|
||||
void zbx_audit_settings_create_entry(int audit_action, zbx_uint64_t configid);
|
||||
void zbx_audit_settings_update_field_int(zbx_uint64_t configid, const char *key, int old_value, int new_value);
|
||||
|
||||
#endif
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_AUDIT_TRIGGER_H
|
||||
#define ZABBIX_AUDIT_TRIGGER_H
|
||||
|
||||
#include "zbxalgo.h"
|
||||
|
||||
void zbx_audit_trigger_create_entry(int audit_action, zbx_uint64_t triggerid, const char *name, int flags);
|
||||
|
||||
void zbx_audit_trigger_update_json_add_data(zbx_uint64_t triggerid, zbx_uint64_t templateid,
|
||||
unsigned char recovery_mode, unsigned char status, unsigned char type, zbx_uint64_t value,
|
||||
zbx_uint64_t state, unsigned char priority, const char *comments, const char *url,
|
||||
const char *url_name, int flags, unsigned char correlation_mode, const char *correlation_tag,
|
||||
unsigned char manual_close, const char *opdata, unsigned char discover, const char *event_name);
|
||||
|
||||
void zbx_audit_trigger_update_json_add_expr(zbx_uint64_t triggerid, int flags, const char *expression);
|
||||
void zbx_audit_trigger_update_json_add_rexpr(zbx_uint64_t triggerid, int flags, const char *recovery_expression);
|
||||
|
||||
#define PREPARE_AUDIT_TRIGGER_UPDATE_H(resource, type1) \
|
||||
void zbx_audit_trigger_update_json_update_##resource(zbx_uint64_t triggerid, int flags, \
|
||||
type1 resource##_old, type1 resource##_new);
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(flags, int)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(recovery_mode, int)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(correlation_mode, int)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(correlation_tag, const char*)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(manual_close, int)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(opdata, const char*)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(discover, int)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(event_name, const char*)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(priority, int)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(comments, const char*)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(url, const char*)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(url_name, const char*)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(type, int)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(status, int)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(templateid, zbx_uint64_t)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(description, const char*)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(expression, const char*)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_H(recovery_expression, const char*)
|
||||
|
||||
void zbx_audit_DBselect_delete_for_trigger(const char *sql, zbx_vector_uint64_t *ids);
|
||||
void zbx_audit_trigger_update_json_add_dependency(int flags, zbx_uint64_t triggerdepid,
|
||||
zbx_uint64_t triggerid, zbx_uint64_t triggerid_up);
|
||||
void zbx_audit_trigger_update_json_remove_dependency(int flags, zbx_uint64_t triggerdepid, zbx_uint64_t triggerid);
|
||||
void zbx_audit_trigger_update_json_add_tags_and_values(zbx_uint64_t triggerid, int flags, zbx_uint64_t triggertagid,
|
||||
const char *tag, const char *value);
|
||||
void zbx_audit_trigger_update_json_delete_tags(zbx_uint64_t triggerid, int flags, zbx_uint64_t triggertagid);
|
||||
void zbx_audit_trigger_update_json_update_trigger_tag_create_entry(zbx_uint64_t triggerid, int trigger_flags,
|
||||
zbx_uint64_t triggertagid);
|
||||
|
||||
#define PREPARE_AUDIT_TRIGGER_UPDATE_TAG_H(resource, type1) \
|
||||
void zbx_audit_trigger_update_json_update_tag_##resource(zbx_uint64_t triggerid, int trigger_flags, \
|
||||
zbx_uint64_t triggertagid, type1 resource##_old, type1 resource##_new);
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_TAG_H(tag, const char*)
|
||||
PREPARE_AUDIT_TRIGGER_UPDATE_TAG_H(value, const char*)
|
||||
|
||||
#endif /* ZABBIX_AUDIT_TRIGGER_H */
|
@ -0,0 +1,86 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_CFG_H
|
||||
#define ZABBIX_CFG_H
|
||||
|
||||
#include "zbxalgo.h"
|
||||
|
||||
#define TYPE_INT 0
|
||||
#define TYPE_STRING 1
|
||||
#define TYPE_MULTISTRING 2
|
||||
#define TYPE_UINT64 3
|
||||
#define TYPE_STRING_LIST 4
|
||||
#define TYPE_CUSTOM 5
|
||||
|
||||
#define PARM_OPT 0
|
||||
#define PARM_MAND 1
|
||||
|
||||
/* config file parsing options */
|
||||
#define ZBX_CFG_FILE_REQUIRED 0
|
||||
#define ZBX_CFG_FILE_OPTIONAL 1
|
||||
|
||||
#define ZBX_CFG_NOT_STRICT 0
|
||||
#define ZBX_CFG_STRICT 1
|
||||
|
||||
#define ZBX_CFG_EXIT_FAILURE 0
|
||||
#define ZBX_CFG_NO_EXIT_FAILURE 1
|
||||
|
||||
#define ZBX_PROXY_HEARTBEAT_FREQUENCY_MAX SEC_PER_HOUR
|
||||
#define ZBX_PROXY_LASTACCESS_UPDATE_FREQUENCY 5
|
||||
|
||||
struct cfg_line
|
||||
{
|
||||
const char *parameter;
|
||||
void *variable;
|
||||
int type;
|
||||
int mandatory;
|
||||
zbx_uint64_t min;
|
||||
zbx_uint64_t max;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *ip;
|
||||
unsigned short port;
|
||||
}
|
||||
zbx_addr_t;
|
||||
|
||||
ZBX_PTR_VECTOR_DECL(addr_ptr, zbx_addr_t *)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int (*cfg_custom_parameter_parser_func)(const char *value, const struct cfg_line *cfg);
|
||||
} cfg_custom_parameter_parser_t;
|
||||
|
||||
void zbx_addr_copy(zbx_vector_addr_ptr_t *addr_to, const zbx_vector_addr_ptr_t *addr_from);
|
||||
void zbx_addr_free(zbx_addr_t *addr);
|
||||
|
||||
void zbx_init_library_cfg(unsigned char program_type, const char *cfg_file);
|
||||
|
||||
int parse_cfg_file(const char *cfg_file, struct cfg_line *cfg, int optional, int strict, int noexit);
|
||||
|
||||
int check_cfg_feature_int(const char *parameter, int value, const char *feature);
|
||||
int check_cfg_feature_str(const char *parameter, const char *value, const char *feature);
|
||||
|
||||
typedef int (*add_serveractive_host_f)(const zbx_vector_addr_ptr_t *addrs, zbx_vector_str_t *hostnames, void *data);
|
||||
int zbx_set_data_destination_hosts(const char *str, unsigned short port, const char *name,
|
||||
add_serveractive_host_f cb, zbx_vector_str_t *hostnames, void *data, char **error);
|
||||
|
||||
#endif
|
@ -0,0 +1,465 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_SYSINC_H
|
||||
#define ZABBIX_SYSINC_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ASSERT_H
|
||||
# include <assert.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ERRNO_H
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINSOCK2_H
|
||||
# include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WSPIAPI_H
|
||||
# include "Wspiapi.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IPHLPAPI_H
|
||||
# include <Iphlpapi.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETIOAPI_H
|
||||
# include <Netioapi.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINDOWS_H
|
||||
/* to speed build process and reduce size of the Win32 header files */
|
||||
# define WIN32_LEAN_AND_MEAN 1
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PROCESS_H
|
||||
# include <process.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONIO_H
|
||||
# include <conio.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PDH_H
|
||||
# include <pdh.h>
|
||||
# ifndef PDH_MAX_COUNTER_NAME
|
||||
# define PDH_MAX_COUNTER_NAME 1024 /* maximum counter name length */
|
||||
# endif
|
||||
# ifndef PDH_MAX_COUNTER_PATH
|
||||
# define PDH_MAX_COUNTER_PATH 2048 /* maximum full counter path length */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PDHMSG_H
|
||||
# include <pdhmsg.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSAPI_H
|
||||
# include <psapi.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDARG_H
|
||||
# include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CTYPE_H
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GRP_H
|
||||
# include <grp.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SYSTEMCFG_H
|
||||
# include <sys/systemcfg.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TIMES_H
|
||||
# include <sys/times.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LINUX_KERNEL_H
|
||||
# include <linux/kernel.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARPA_NAMESER_H
|
||||
# ifdef MAC_OS_X
|
||||
# define BIND_8_COMPAT 1
|
||||
# endif
|
||||
# include <arpa/nameser.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_DKSTAT_H
|
||||
# include <sys/dkstat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DEVSTAT_H
|
||||
# include <devstat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_KNLIST_H
|
||||
# include <knlist.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_KSTAT_H
|
||||
# include <kstat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINLDAP_H
|
||||
# undef SEC_I_INCOMPLETE_CREDENTIALS
|
||||
# undef SEC_E_INCOMPLETE_CREDENTIALS
|
||||
# undef SEC_I_RENEGOTIATE
|
||||
# include <Winldap.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_WINBER_H
|
||||
# include <Winber.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MACH_HOST_INFO_H
|
||||
# include <mach/host_info.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MACH_MACH_HOST_H
|
||||
# include <mach/mach_host.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MTENT_H
|
||||
# include <mtent.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETDB_H
|
||||
#if defined(_AIX) /* AIX 5.1 needs this to get hstrerror() declaration */
|
||||
#define _USE_IRS
|
||||
#endif
|
||||
# include <netdb.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
# include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PWD_H
|
||||
# include <pwd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
# include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_LOADAVG_H
|
||||
# include <sys/loadavg.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_PROC_H
|
||||
# include <sys/proc.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_PSTAT_H
|
||||
# include <sys/pstat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_DK_H
|
||||
# include <sys/dk.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RESOLV_H
|
||||
# include <resolv.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_DISK_H
|
||||
# include <sys/disk.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STATVFS_H
|
||||
# include <sys/statvfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SWAP_H
|
||||
# include <sys/swap.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SYSCALL_H
|
||||
# include <sys/syscall.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SYSCTL_H
|
||||
# include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SYSINFO_H
|
||||
# include <sys/sysinfo.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SYSMACROS_H
|
||||
# include <sys/sysmacros.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_VAR_H
|
||||
# include <sys/var.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_VFS_H
|
||||
# include <sys/vfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_VMMETER_H
|
||||
# include <sys/vmmeter.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBPERFSTAT
|
||||
# ifdef HAVE_SYS_PROTOSW_H
|
||||
# include <sys/protosw.h> /* workaround for /usr/include/netinet/in6_var.h bug, see ZBX-6565 */
|
||||
# endif
|
||||
# include <libperfstat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NLIST_H
|
||||
# include <nlist.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NET_IF_H
|
||||
# include <net/if.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NET_IF_MIB_H
|
||||
# include <net/if_mib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_USER_H
|
||||
# include <sys/user.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_KVM_H
|
||||
# include <kvm.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
# include <syslog.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TIME_H
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_IPC_H
|
||||
# include <sys/ipc.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SEM_H
|
||||
# include <sys/sem.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SHM_H
|
||||
# include <sys/shm.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
# include <sys/file.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MATH_H
|
||||
# include <math.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PCRE_H
|
||||
# include <pcre.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PCRE2_H
|
||||
# define PCRE2_CODE_UNIT_WIDTH 8
|
||||
# include <pcre2.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VM_VM_PARAM_H
|
||||
# include <vm/vm_param.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_MOUNT_H
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TIMEB_H
|
||||
# include <sys/timeb.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
# include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PROCINFO_H
|
||||
# undef T_NULL /* to solve definition conflict */
|
||||
# include <procinfo.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBCURL
|
||||
# include <curl/curl.h>
|
||||
# if !defined(HAVE_FUNCTION_CURL_EASY_ESCAPE)
|
||||
# define curl_easy_escape(handle, string, length) curl_escape(string, length)
|
||||
# endif
|
||||
# if 0x071004 >= LIBCURL_VERSION_NUM /* version 7.16.4 */
|
||||
# define CURLOPT_KEYPASSWD CURLOPT_SSLKEYPASSWD
|
||||
# endif
|
||||
# if 0x071400 <= LIBCURL_VERSION_NUM /* version 7.20.0 */
|
||||
# define HAVE_SMTP_AUTHENTICATION 1
|
||||
# endif
|
||||
# if 0x071501 <= LIBCURL_VERSION_NUM /* version 7.21.6 */
|
||||
# define ZBX_CURLOPT_ACCEPT_ENCODING CURLOPT_ACCEPT_ENCODING
|
||||
# else
|
||||
# define ZBX_CURLOPT_ACCEPT_ENCODING CURLOPT_ENCODING
|
||||
# endif
|
||||
# if 0x073700 <= LIBCURL_VERSION_NUM /* version 7.55.0 */
|
||||
# define ZBX_CURLINFO_SPEED_DOWNLOAD CURLINFO_SPEED_DOWNLOAD_T
|
||||
# define ZBX_CURLINFO_SPEED_DOWNLOAD_TYPE curl_off_t
|
||||
# define ZBX_CURLINFO_SPEED_DOWNLOAD_FMT "%" CURL_FORMAT_CURL_OFF_T
|
||||
# else
|
||||
# define ZBX_CURLINFO_SPEED_DOWNLOAD CURLINFO_SPEED_DOWNLOAD
|
||||
# define ZBX_CURLINFO_SPEED_DOWNLOAD_TYPE double
|
||||
# define ZBX_CURLINFO_SPEED_DOWNLOAD_FMT ZBX_FS_DBL
|
||||
# endif
|
||||
# define ZBX_CURLOPT_MAXREDIRS 10L
|
||||
#endif
|
||||
|
||||
/* Required for advanced sigaction */
|
||||
#ifdef HAVE_SYS_UCONTEXT_H
|
||||
# include <sys/ucontext.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IO_H
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_MNTTAB_H
|
||||
# include <sys/mnttab.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MNTENT_H
|
||||
# include <mntent.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ZONE_H
|
||||
# include <zone.h>
|
||||
# include <utmpx.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDDEF_H
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FLOAT_H
|
||||
# include <float.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_UTSNAME_H
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_POLL_H
|
||||
# include <poll.h>
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,221 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_TYPES_H
|
||||
#define ZABBIX_TYPES_H
|
||||
|
||||
#include "zbxsysinc.h"
|
||||
|
||||
#if defined(_WINDOWS)
|
||||
# define ZBX_THREAD_LOCAL __declspec(thread)
|
||||
#else
|
||||
# if defined(HAVE_THREAD_LOCAL) && (defined(__GNUC__) || defined(__clang__) || defined(__MINGW32__))
|
||||
# define ZBX_THREAD_LOCAL __thread
|
||||
# else
|
||||
# error "C compiler is not compatible with agent2 assembly"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(_WINDOWS)
|
||||
# include <strsafe.h>
|
||||
|
||||
# ifndef __UINT64_C
|
||||
# define __UINT64_C(x) x
|
||||
# endif
|
||||
|
||||
# ifndef __INT64_C
|
||||
# define __INT64_C(x) x
|
||||
# endif
|
||||
|
||||
# define zbx_uint64_t unsigned __int64
|
||||
# define ZBX_FS_UI64 "%I64u"
|
||||
# define ZBX_FS_UO64 "%I64o"
|
||||
# define ZBX_FS_UX64 "%I64x"
|
||||
|
||||
# define zbx_int64_t __int64
|
||||
# define ZBX_FS_I64 "%I64d"
|
||||
# define ZBX_FS_O64 "%I64o"
|
||||
# define ZBX_FS_X64 "%I64x"
|
||||
|
||||
# define snprintf _snprintf
|
||||
|
||||
# define alloca _alloca
|
||||
|
||||
# ifndef uint32_t
|
||||
typedef unsigned __int32 zbx_uint32_t;
|
||||
# else
|
||||
typedef uint32_t zbx_uint32_t;
|
||||
# endif
|
||||
|
||||
# define strcasecmp lstrcmpiA
|
||||
|
||||
# if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
|
||||
typedef int ssize_t;
|
||||
# else
|
||||
typedef long ssize_t;
|
||||
# endif
|
||||
|
||||
typedef DWORD zbx_syserror_t;
|
||||
#else /* _WINDOWS */
|
||||
# ifndef __UINT64_C
|
||||
# ifdef UINT64_C
|
||||
# define __UINT64_C(c) (UINT64_C(c))
|
||||
# else
|
||||
# define __UINT64_C(c) (c ## ULL)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef __INT64_C
|
||||
# ifdef INT64_C
|
||||
# define __INT64_C(c) (INT64_C(c))
|
||||
# else
|
||||
# define __INT64_C(c) (c ## LL)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# define zbx_uint64_t uint64_t
|
||||
# if __WORDSIZE == 64 || defined(__64BIT__)
|
||||
# if defined(__APPLE__) && defined(__MACH__) /* OS X */
|
||||
# define ZBX_FS_UI64 "%llu"
|
||||
# define ZBX_FS_UO64 "%llo"
|
||||
# define ZBX_FS_UX64 "%llx"
|
||||
# else
|
||||
# define ZBX_FS_UI64 "%lu"
|
||||
# define ZBX_FS_UO64 "%lo"
|
||||
# define ZBX_FS_UX64 "%lx"
|
||||
# endif
|
||||
# else
|
||||
# ifdef HAVE_LONG_LONG_QU
|
||||
# define ZBX_FS_UI64 "%qu"
|
||||
# define ZBX_FS_UO64 "%qo"
|
||||
# define ZBX_FS_UX64 "%qx"
|
||||
# else
|
||||
# define ZBX_FS_UI64 "%llu"
|
||||
# define ZBX_FS_UO64 "%llo"
|
||||
# define ZBX_FS_UX64 "%llx"
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# define zbx_int64_t int64_t
|
||||
# if __WORDSIZE == 64 || defined(__64BIT__)
|
||||
# if defined(__APPLE__) && defined(__MACH__) /* OS X */
|
||||
# define ZBX_FS_I64 "%lld"
|
||||
# define ZBX_FS_O64 "%llo"
|
||||
# define ZBX_FS_X64 "%llx"
|
||||
# else
|
||||
# define ZBX_FS_I64 "%ld"
|
||||
# define ZBX_FS_O64 "%lo"
|
||||
# define ZBX_FS_X64 "%lx"
|
||||
# endif
|
||||
# else
|
||||
# ifdef HAVE_LONG_LONG_QU
|
||||
# define ZBX_FS_I64 "%qd"
|
||||
# define ZBX_FS_O64 "%qo"
|
||||
# define ZBX_FS_X64 "%qx"
|
||||
# else
|
||||
# define ZBX_FS_I64 "%lld"
|
||||
# define ZBX_FS_O64 "%llo"
|
||||
# define ZBX_FS_X64 "%llx"
|
||||
# endif
|
||||
# endif
|
||||
|
||||
typedef uint32_t zbx_uint32_t;
|
||||
|
||||
typedef int zbx_syserror_t;
|
||||
|
||||
#endif /* _WINDOWS */
|
||||
|
||||
#if defined(_WINDOWS)
|
||||
# define zbx_stat(path, buf) __zbx_stat(path, buf)
|
||||
# define zbx_fstat(fd, buf) _fstat64(fd, buf)
|
||||
|
||||
typedef __int64 zbx_offset_t;
|
||||
# define zbx_lseek(fd, offset, whence) _lseeki64(fd, (zbx_offset_t)(offset), whence)
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define zbx_stat(path, buf) __zbx_stat(path, buf)
|
||||
# define zbx_fstat(fd, buf) _fstat64(fd, buf)
|
||||
|
||||
typedef off64_t zbx_offset_t;
|
||||
# define zbx_lseek(fd, offset, whence) lseek64(fd, (zbx_offset_t)(offset), whence)
|
||||
|
||||
#else
|
||||
# define zbx_stat(path, buf) stat(path, buf)
|
||||
# define zbx_fstat(fd, buf) fstat(fd, buf)
|
||||
|
||||
typedef off_t zbx_offset_t;
|
||||
# define zbx_lseek(fd, offset, whence) lseek(fd, (zbx_offset_t)(offset), whence)
|
||||
|
||||
#endif
|
||||
|
||||
#define ZBX_FS_DBL "%lf"
|
||||
#define ZBX_FS_DBL_EXT(p) "%." #p "lf"
|
||||
#define ZBX_FS_DBL64 "%.17G"
|
||||
|
||||
#ifdef HAVE_ORACLE
|
||||
# define ZBX_FS_DBL64_SQL ZBX_FS_DBL64 "d"
|
||||
#else
|
||||
# define ZBX_FS_DBL64_SQL ZBX_FS_DBL64
|
||||
#endif
|
||||
|
||||
#define ZBX_PTR_SIZE sizeof(void *)
|
||||
#define ZBX_FS_SIZE_T ZBX_FS_UI64
|
||||
#define ZBX_FS_SSIZE_T ZBX_FS_I64
|
||||
#define ZBX_FS_TIME_T ZBX_FS_I64
|
||||
#define zbx_fs_size_t zbx_uint64_t /* use this type only in calls to printf() for formatting size_t */
|
||||
#define zbx_fs_ssize_t zbx_int64_t /* use this type only in calls to printf() for formatting ssize_t */
|
||||
#define zbx_fs_time_t zbx_int64_t /* use this type only in calls to printf() for formatting time_t */
|
||||
|
||||
#ifndef S_ISREG
|
||||
# define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISDIR
|
||||
# define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t lo;
|
||||
zbx_uint64_t hi;
|
||||
}
|
||||
zbx_uint128_t;
|
||||
|
||||
#define ZBX_SIZE_T_ALIGN8(size) (((size) + 7) & ~(size_t)7)
|
||||
|
||||
/* macro to test if a signed value has been assigned to unsigned type (char, short, int, long long) */
|
||||
#define ZBX_IS_TOP_BIT_SET(x) (0 != ((__UINT64_C(1) << ((sizeof(x) << 3) - 1)) & (x)))
|
||||
|
||||
#if defined(_WINDOWS) || defined(__MINGW32__)
|
||||
#define localtime_r(x, y) localtime_s(y, x)
|
||||
#endif
|
||||
|
||||
typedef struct zbx_variant zbx_variant_t;
|
||||
|
||||
#define SUCCEED 0
|
||||
#define FAIL -1
|
||||
#define NOTSUPPORTED -2
|
||||
#define NETWORK_ERROR -3
|
||||
#define TIMEOUT_ERROR -4
|
||||
#define AGENT_ERROR -5
|
||||
#define GATEWAY_ERROR -6
|
||||
#define CONFIG_ERROR -7
|
||||
#define SIG_ERROR -8
|
||||
|
||||
#endif
|
@ -0,0 +1,362 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_MODULE_H
|
||||
#define ZABBIX_MODULE_H
|
||||
|
||||
#include "zbxtypes.h"
|
||||
|
||||
#define ZBX_MODULE_OK 0
|
||||
#define ZBX_MODULE_FAIL -1
|
||||
|
||||
/* zbx_module_api_version() MUST return this constant */
|
||||
#define ZBX_MODULE_API_VERSION 2
|
||||
|
||||
/* old name alias is kept for source compatibility only, SHOULD NOT be used */
|
||||
#define ZBX_MODULE_API_VERSION_ONE ZBX_MODULE_API_VERSION
|
||||
|
||||
/* HINT: For conditional compilation with different module.h versions modules can use: */
|
||||
/* #if ZBX_MODULE_API_VERSION == X */
|
||||
/* ... */
|
||||
/* #endif */
|
||||
|
||||
#define get_rkey(request) (request)->key
|
||||
#define get_rparams_num(request) (request)->nparam
|
||||
#define get_rparam(request, num) ((request)->nparam > num ? (request)->params[num] : NULL)
|
||||
#define get_rparam_type(request, num) ((request)->nparam > num ? (request)->types[num] : \
|
||||
REQUEST_PARAMETER_TYPE_UNDEFINED)
|
||||
|
||||
/* flags for command */
|
||||
#define CF_HAVEPARAMS 0x01 /* item accepts either optional or mandatory parameters */
|
||||
#define CF_MODULE 0x02 /* item is defined in a loadable module */
|
||||
#define CF_USERPARAMETER 0x04 /* item is defined as user parameter */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
REQUEST_PARAMETER_TYPE_UNDEFINED = 0,
|
||||
REQUEST_PARAMETER_TYPE_STRING,
|
||||
REQUEST_PARAMETER_TYPE_ARRAY
|
||||
}
|
||||
zbx_request_parameter_type_t;
|
||||
|
||||
/* agent request structure */
|
||||
typedef struct
|
||||
{
|
||||
char *key;
|
||||
int nparam;
|
||||
char **params;
|
||||
zbx_uint64_t lastlogsize;
|
||||
int mtime;
|
||||
zbx_request_parameter_type_t *types;
|
||||
}
|
||||
AGENT_REQUEST;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *value;
|
||||
char *source;
|
||||
int timestamp;
|
||||
int severity;
|
||||
int logeventid;
|
||||
}
|
||||
zbx_log_t;
|
||||
|
||||
/* agent result types */
|
||||
#define AR_UINT64 0x01
|
||||
#define AR_DOUBLE 0x02
|
||||
#define AR_STRING 0x04
|
||||
#define AR_TEXT 0x08
|
||||
#define AR_LOG 0x10
|
||||
#define AR_MESSAGE 0x20
|
||||
#define AR_META 0x40
|
||||
#define AR_BIN 0x80
|
||||
|
||||
/* agent return structure */
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t lastlogsize; /* meta information */
|
||||
zbx_uint64_t ui64;
|
||||
double dbl;
|
||||
char *str;
|
||||
char *text;
|
||||
char *msg; /* possible error message */
|
||||
zbx_log_t *log;
|
||||
char *bin;
|
||||
int type; /* flags: see AR_* above */
|
||||
int mtime; /* meta information */
|
||||
}
|
||||
AGENT_RESULT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *key;
|
||||
unsigned flags;
|
||||
int (*function)(AGENT_REQUEST *request, AGENT_RESULT *result);
|
||||
char *test_param; /* item test parameters; user parameter items keep command here */
|
||||
}
|
||||
zbx_metric_t;
|
||||
|
||||
/* for backward-compatibility */
|
||||
#define ZBX_METRIC zbx_metric_t
|
||||
|
||||
/* SET RESULT */
|
||||
|
||||
#define SET_UI64_RESULT(res, val) \
|
||||
( \
|
||||
(res)->type |= AR_UINT64, \
|
||||
(res)->ui64 = (zbx_uint64_t)(val) \
|
||||
)
|
||||
|
||||
#define SET_DBL_RESULT(res, val) \
|
||||
( \
|
||||
(res)->type |= AR_DOUBLE, \
|
||||
(res)->dbl = (double)(val) \
|
||||
)
|
||||
|
||||
/* NOTE: always allocate new memory for val! DON'T USE STATIC OR STACK MEMORY!!! */
|
||||
#define SET_STR_RESULT(res, val) \
|
||||
( \
|
||||
(res)->type |= AR_STRING, \
|
||||
(res)->str = (char *)(val) \
|
||||
)
|
||||
|
||||
/* NOTE: always allocate new memory for val! DON'T USE STATIC OR STACK MEMORY!!! */
|
||||
#define SET_TEXT_RESULT(res, val) \
|
||||
( \
|
||||
(res)->type |= AR_TEXT, \
|
||||
(res)->text = (char *)(val) \
|
||||
)
|
||||
|
||||
/* NOTE: always allocate new memory for val! DON'T USE STATIC OR STACK MEMORY!!! */
|
||||
#define SET_LOG_RESULT(res, val) \
|
||||
( \
|
||||
(res)->type |= AR_LOG, \
|
||||
(res)->log = (zbx_log_t *)(val) \
|
||||
)
|
||||
|
||||
/* NOTE: always allocate new memory for val! DON'T USE STATIC OR STACK MEMORY!!! */
|
||||
#define SET_MSG_RESULT(res, val) \
|
||||
( \
|
||||
(res)->type |= AR_MESSAGE, \
|
||||
(res)->msg = (char *)(val) \
|
||||
)
|
||||
|
||||
/* CHECK RESULT */
|
||||
|
||||
#define ZBX_ISSET_UI64(res) ((res)->type & AR_UINT64)
|
||||
#define ZBX_ISSET_DBL(res) ((res)->type & AR_DOUBLE)
|
||||
#define ZBX_ISSET_STR(res) ((res)->type & AR_STRING)
|
||||
#define ZBX_ISSET_TEXT(res) ((res)->type & AR_TEXT)
|
||||
#define ZBX_ISSET_BIN(res) ((res)->type & AR_BIN)
|
||||
#define ZBX_ISSET_LOG(res) ((res)->type & AR_LOG)
|
||||
#define ZBX_ISSET_MSG(res) ((res)->type & AR_MESSAGE)
|
||||
#define ZBX_ISSET_META(res) ((res)->type & AR_META)
|
||||
|
||||
#define ZBX_ISSET_VALUE(res) ((res)->type & (AR_UINT64 | AR_DOUBLE | AR_STRING | AR_TEXT | AR_LOG))
|
||||
|
||||
/* UNSET RESULT */
|
||||
|
||||
#define ZBX_UNSET_UI64_RESULT(res) \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
(res)->type &= ~AR_UINT64; \
|
||||
(res)->ui64 = (zbx_uint64_t)0; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define ZBX_UNSET_DBL_RESULT(res) \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
(res)->type &= ~AR_DOUBLE; \
|
||||
(res)->dbl = (double)0; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define ZBX_UNSET_STR_RESULT(res) \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
if ((res)->type & AR_STRING) \
|
||||
{ \
|
||||
zbx_free((res)->str); \
|
||||
(res)->type &= ~AR_STRING; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define ZBX_UNSET_TEXT_RESULT(res) \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
if ((res)->type & AR_TEXT) \
|
||||
{ \
|
||||
zbx_free((res)->text); \
|
||||
(res)->type &= ~AR_TEXT; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define ZBX_UNSET_BIN_RESULT(res) \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
if ((res)->type & AR_BIN) \
|
||||
{ \
|
||||
zbx_free((res)->bin); \
|
||||
(res)->type &= ~AR_BIN ; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define ZBX_UNSET_LOG_RESULT(res) \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
if ((res)->type & AR_LOG) \
|
||||
{ \
|
||||
zbx_free((res)->log->source); \
|
||||
zbx_free((res)->log->value); \
|
||||
zbx_free((res)->log); \
|
||||
(res)->type &= ~AR_LOG; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define ZBX_UNSET_MSG_RESULT(res) \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
if ((res)->type & AR_MESSAGE) \
|
||||
{ \
|
||||
zbx_free((res)->msg); \
|
||||
(res)->type &= ~AR_MESSAGE; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* AR_META is always excluded */
|
||||
#define ZBX_UNSET_RESULT_EXCLUDING(res, exc_type) \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
if (!(exc_type & AR_UINT64)) ZBX_UNSET_UI64_RESULT(res); \
|
||||
if (!(exc_type & AR_DOUBLE)) ZBX_UNSET_DBL_RESULT(res); \
|
||||
if (!(exc_type & AR_STRING)) ZBX_UNSET_STR_RESULT(res); \
|
||||
if (!(exc_type & AR_TEXT)) ZBX_UNSET_TEXT_RESULT(res); \
|
||||
if (!(exc_type & AR_BIN)) ZBX_UNSET_BIN_RESULT(res); \
|
||||
if (!(exc_type & AR_LOG)) ZBX_UNSET_LOG_RESULT(res); \
|
||||
if (!(exc_type & AR_MESSAGE)) ZBX_UNSET_MSG_RESULT(res); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define zbx_init_agent_result(result) {memset((result), 0, sizeof(AGENT_RESULT));}
|
||||
|
||||
#define zbx_free_agent_result(result) \
|
||||
{ \
|
||||
ZBX_UNSET_UI64_RESULT((result)); \
|
||||
ZBX_UNSET_DBL_RESULT((result)); \
|
||||
ZBX_UNSET_STR_RESULT((result)); \
|
||||
ZBX_UNSET_TEXT_RESULT((result)); \
|
||||
ZBX_UNSET_BIN_RESULT(result); \
|
||||
ZBX_UNSET_LOG_RESULT((result)); \
|
||||
ZBX_UNSET_MSG_RESULT((result)); \
|
||||
}
|
||||
|
||||
#define SYSINFO_RET_OK 0
|
||||
#define SYSINFO_RET_FAIL 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t itemid;
|
||||
int clock;
|
||||
int ns;
|
||||
double value;
|
||||
}
|
||||
ZBX_HISTORY_FLOAT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t itemid;
|
||||
int clock;
|
||||
int ns;
|
||||
zbx_uint64_t value;
|
||||
}
|
||||
ZBX_HISTORY_INTEGER;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t itemid;
|
||||
int clock;
|
||||
int ns;
|
||||
const char *value;
|
||||
}
|
||||
ZBX_HISTORY_STRING;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t itemid;
|
||||
int clock;
|
||||
int ns;
|
||||
const char *value;
|
||||
}
|
||||
ZBX_HISTORY_TEXT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t itemid;
|
||||
int clock;
|
||||
int ns;
|
||||
const char *value;
|
||||
}
|
||||
ZBX_HISTORY_BIN;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t itemid;
|
||||
int clock;
|
||||
int ns;
|
||||
const char *value;
|
||||
const char *source;
|
||||
int timestamp;
|
||||
int logeventid;
|
||||
int severity;
|
||||
}
|
||||
ZBX_HISTORY_LOG;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void (*history_float_cb)(const ZBX_HISTORY_FLOAT *history, int history_num);
|
||||
void (*history_integer_cb)(const ZBX_HISTORY_INTEGER *history, int history_num);
|
||||
void (*history_string_cb)(const ZBX_HISTORY_STRING *history, int history_num);
|
||||
void (*history_text_cb)(const ZBX_HISTORY_TEXT *history, int history_num);
|
||||
void (*history_log_cb)(const ZBX_HISTORY_LOG *history, int history_num);
|
||||
void (*history_bin_cb)(const ZBX_HISTORY_BIN *history, int history_num);
|
||||
}
|
||||
ZBX_HISTORY_WRITE_CBS;
|
||||
|
||||
int zbx_module_api_version(void);
|
||||
int zbx_module_init(void);
|
||||
int zbx_module_uninit(void);
|
||||
void zbx_module_item_timeout(int timeout);
|
||||
ZBX_METRIC *zbx_module_item_list(void);
|
||||
ZBX_HISTORY_WRITE_CBS zbx_module_history_write_cbs(void);
|
||||
|
||||
#endif
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_VERSION_H
|
||||
#define ZABBIX_VERSION_H
|
||||
|
||||
#define ZBX_STR2(str) #str
|
||||
#define ZBX_STR(str) ZBX_STR2(str)
|
||||
|
||||
#define APPLICATION_NAME "Zabbix Agent"
|
||||
#define ZABBIX_REVDATE "26 July 2023"
|
||||
#define ZABBIX_VERSION_MAJOR 7
|
||||
#define ZABBIX_VERSION_MINOR 0
|
||||
#define ZABBIX_VERSION_PATCH 0
|
||||
#ifndef ZABBIX_VERSION_REVISION
|
||||
# define ZABBIX_VERSION_REVISION {ZABBIX_REVISION}
|
||||
#endif
|
||||
#ifdef _WINDOWS
|
||||
# ifndef ZABBIX_VERSION_RC_NUM
|
||||
# define ZABBIX_VERSION_RC_NUM {ZABBIX_RC_NUM}
|
||||
# endif
|
||||
#endif
|
||||
#define ZABBIX_VERSION_RC "alpha4"
|
||||
#define ZABBIX_VERSION ZBX_STR(ZABBIX_VERSION_MAJOR) "." ZBX_STR(ZABBIX_VERSION_MINOR) "." \
|
||||
ZBX_STR(ZABBIX_VERSION_PATCH) ZABBIX_VERSION_RC
|
||||
#define ZABBIX_REVISION ZBX_STR(ZABBIX_VERSION_REVISION)
|
||||
|
||||
#endif /* ZABBIX_VERSION_H */
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_ZBX_AVAILABILITY_CONSTANTS_H
|
||||
#define ZABBIX_ZBX_AVAILABILITY_CONSTANTS_H
|
||||
|
||||
/* interface availability */
|
||||
#define ZBX_INTERFACE_AVAILABLE_UNKNOWN 0
|
||||
#define ZBX_INTERFACE_AVAILABLE_TRUE 1
|
||||
#define ZBX_INTERFACE_AVAILABLE_FALSE 2
|
||||
|
||||
#define ZBX_IPC_SERVICE_AVAILABILITY "availability"
|
||||
#define ZBX_IPC_AVAILABILITY_REQUEST 1
|
||||
#define ZBX_IPC_AVAILMAN_ACTIVE_HB 2
|
||||
#define ZBX_IPC_AVAILMAN_ACTIVE_HOSTDATA 3
|
||||
#define ZBX_IPC_AVAILMAN_ACTIVE_STATUS 4
|
||||
#define ZBX_IPC_AVAILMAN_CONFSYNC_DIFF 5
|
||||
#define ZBX_IPC_AVAILMAN_PROCESS_PROXY_HOSTDATA 6
|
||||
#define ZBX_IPC_AVAILMAN_ACTIVE_PROXY_HB_UPDATE 7
|
||||
|
||||
#endif
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_ZBX_DBVERSION_CONSTANTS_H
|
||||
#define ZABBIX_ZBX_DBVERSION_CONSTANTS_H
|
||||
|
||||
#define ZBX_DBVERSION_UNDEFINED 0
|
||||
|
||||
/* ZBX_*_MIN_VERSION - hard limit */
|
||||
/* ZBX_*_MIN_SUPPORTED_VERSION - soft limit */
|
||||
/* ZBX_*_MAX_VERSION - soft limit */
|
||||
|
||||
#define ZBX_MYSQL_MIN_VERSION 50728
|
||||
#define ZBX_MYSQL_MIN_VERSION_STR "5.07.28"
|
||||
#define ZBX_MYSQL_MIN_SUPPORTED_VERSION 80030
|
||||
#define ZBX_MYSQL_MIN_SUPPORTED_VERSION_STR "8.00.30"
|
||||
#define ZBX_MYSQL_MAX_VERSION 80199
|
||||
#define ZBX_MYSQL_MAX_VERSION_STR "8.01.x"
|
||||
|
||||
#define ZBX_MARIADB_MIN_VERSION 100200
|
||||
#define ZBX_MARIADB_MIN_VERSION_STR "10.02.00"
|
||||
#define ZBX_MARIADB_MIN_SUPPORTED_VERSION 100500
|
||||
#define ZBX_MARIADB_MIN_SUPPORTED_VERSION_STR "10.05.00"
|
||||
#define ZBX_MARIADB_MAX_VERSION 110099
|
||||
#define ZBX_MARIADB_MAX_VERSION_STR "11.00.xx"
|
||||
|
||||
#define ZBX_POSTGRESQL_MIN_VERSION 100009
|
||||
#define ZBX_POSTGRESQL_MIN_VERSION_STR "10.9"
|
||||
#define ZBX_POSTGRESQL_MIN_SUPPORTED_VERSION 130000
|
||||
#define ZBX_POSTGRESQL_MIN_SUPPORTED_VERSION_STR "13.0"
|
||||
#define ZBX_POSTGRESQL_MAX_VERSION 159999
|
||||
#define ZBX_POSTGRESQL_MAX_VERSION_STR "15.x"
|
||||
|
||||
#define ZBX_ORACLE_MIN_VERSION 1201000200
|
||||
#define ZBX_ORACLE_MIN_VERSION_STR "Database 12c Release 12.01.00.02.x"
|
||||
#define ZBX_ORACLE_MIN_SUPPORTED_VERSION 1900000000
|
||||
#define ZBX_ORACLE_MIN_SUPPORTED_VERSION_STR "Database 19c Release 19.x.x"
|
||||
#define ZBX_ORACLE_MAX_VERSION 2199000000
|
||||
#define ZBX_ORACLE_MAX_VERSION_STR "Database 21c Release 21.x.x"
|
||||
|
||||
#define ZBX_ELASTIC_MIN_VERSION 70000
|
||||
#define ZBX_ELASTIC_MIN_VERSION_STR "7.x"
|
||||
#define ZBX_ELASTIC_MAX_VERSION 79999
|
||||
#define ZBX_ELASTIC_MAX_VERSION_STR ZBX_ELASTIC_MIN_VERSION_STR
|
||||
|
||||
#define ZBX_POSTGRESQL_MIN_VERSION_WITH_TIMESCALEDB ZBX_POSTGRESQL_MIN_VERSION
|
||||
#define ZBX_POSTGRESQL_MIN_VERSION_WITH_TIMESCALEDB_STR ZBX_POSTGRESQL_MIN_VERSION_STR
|
||||
#define ZBX_TIMESCALE_MIN_VERSION 10500
|
||||
#define ZBX_TIMESCALE_MIN_VERSION_STR "1.5.0"
|
||||
#define ZBX_TIMESCALE_MIN_SUPPORTED_VERSION 20001
|
||||
#define ZBX_TIMESCALE_MIN_SUPPORTED_VERSION_STR "2.0.1"
|
||||
#define ZBX_TIMESCALE_MIN_VERSION_WITH_LICENSE_PARAM_SUPPORT 20000
|
||||
#define ZBX_TIMESCALE_MAX_VERSION 21199
|
||||
#define ZBX_TIMESCALE_MAX_VERSION_STR "2.11"
|
||||
#define ZBX_TIMESCALE_LICENSE_APACHE_STR "TimescaleDB Apache 2 Edition"
|
||||
#define ZBX_TIMESCALE_LICENSE_COMMUNITY "timescale"
|
||||
#define ZBX_TIMESCALE_LICENSE_COMMUNITY_STR "TimescaleDB Community Edition"
|
||||
|
||||
#endif /*ZABBIX_ZBX_DBVERSION_CONSTANTS_H*/
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_ZBX_DISCOVERER_CONSTANTS_H
|
||||
#define ZABBIX_ZBX_DISCOVERER_CONSTANTS_H
|
||||
|
||||
/* service supported by discoverer */
|
||||
typedef enum
|
||||
{
|
||||
SVC_SSH = 0,
|
||||
SVC_LDAP,
|
||||
SVC_SMTP,
|
||||
SVC_FTP,
|
||||
SVC_HTTP,
|
||||
SVC_POP,
|
||||
SVC_NNTP,
|
||||
SVC_IMAP,
|
||||
SVC_TCP,
|
||||
SVC_AGENT,
|
||||
SVC_SNMPv1,
|
||||
SVC_SNMPv2c,
|
||||
SVC_ICMPPING,
|
||||
SVC_SNMPv3,
|
||||
SVC_HTTPS,
|
||||
SVC_TELNET
|
||||
}
|
||||
zbx_dservice_type_t;
|
||||
|
||||
#endif
|
@ -0,0 +1,284 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_ZBX_MACRO_CONSTANTS_H
|
||||
#define ZABBIX_ZBX_MACRO_CONSTANTS_H
|
||||
|
||||
#define MVAR_ACTION "{ACTION." /* a prefix for all action macros */
|
||||
#define MVAR_ACTION_ID MVAR_ACTION "ID}"
|
||||
#define MVAR_ACTION_NAME MVAR_ACTION "NAME}"
|
||||
#define MVAR_DATE "{DATE}"
|
||||
#define MVAR_EVENT "{EVENT." /* a prefix for all event macros */
|
||||
#define MVAR_EVENT_ACK_HISTORY MVAR_EVENT "ACK.HISTORY}" /* deprecated */
|
||||
#define MVAR_EVENT_ACK_STATUS MVAR_EVENT "ACK.STATUS}"
|
||||
#define MVAR_EVENT_AGE MVAR_EVENT "AGE}"
|
||||
#define MVAR_EVENT_DATE MVAR_EVENT "DATE}"
|
||||
#define MVAR_EVENT_DURATION MVAR_EVENT "DURATION}"
|
||||
#define MVAR_EVENT_ID MVAR_EVENT "ID}"
|
||||
#define MVAR_EVENT_NAME MVAR_EVENT "NAME}"
|
||||
#define MVAR_EVENT_STATUS MVAR_EVENT "STATUS}"
|
||||
#define MVAR_EVENT_TAGS MVAR_EVENT "TAGS}"
|
||||
#define MVAR_EVENT_TAGSJSON MVAR_EVENT "TAGSJSON}"
|
||||
#define MVAR_EVENT_TAGS_PREFIX MVAR_EVENT "TAGS."
|
||||
#define MVAR_EVENT_TIME MVAR_EVENT "TIME}"
|
||||
#define MVAR_EVENT_VALUE MVAR_EVENT "VALUE}"
|
||||
#define MVAR_EVENT_SEVERITY MVAR_EVENT "SEVERITY}"
|
||||
#define MVAR_EVENT_NSEVERITY MVAR_EVENT "NSEVERITY}"
|
||||
#define MVAR_EVENT_OBJECT MVAR_EVENT "OBJECT}"
|
||||
#define MVAR_EVENT_SOURCE MVAR_EVENT "SOURCE}"
|
||||
#define MVAR_EVENT_OPDATA MVAR_EVENT "OPDATA}"
|
||||
#define MVAR_EVENT_RECOVERY MVAR_EVENT "RECOVERY." /* a prefix for all recovery event macros */
|
||||
#define MVAR_EVENT_RECOVERY_DATE MVAR_EVENT_RECOVERY "DATE}"
|
||||
#define MVAR_EVENT_RECOVERY_ID MVAR_EVENT_RECOVERY "ID}"
|
||||
#define MVAR_EVENT_RECOVERY_STATUS MVAR_EVENT_RECOVERY "STATUS}" /* deprecated */
|
||||
#define MVAR_EVENT_RECOVERY_TAGS MVAR_EVENT_RECOVERY "TAGS}"
|
||||
#define MVAR_EVENT_RECOVERY_TAGSJSON MVAR_EVENT_RECOVERY "TAGSJSON}"
|
||||
#define MVAR_EVENT_RECOVERY_TIME MVAR_EVENT_RECOVERY "TIME}"
|
||||
#define MVAR_EVENT_RECOVERY_VALUE MVAR_EVENT_RECOVERY "VALUE}" /* deprecated */
|
||||
#define MVAR_EVENT_RECOVERY_NAME MVAR_EVENT_RECOVERY "NAME}"
|
||||
#define MVAR_EVENT_UPDATE MVAR_EVENT "UPDATE."
|
||||
#define MVAR_EVENT_UPDATE_ACTION MVAR_EVENT_UPDATE "ACTION}"
|
||||
#define MVAR_EVENT_UPDATE_DATE MVAR_EVENT_UPDATE "DATE}"
|
||||
#define MVAR_EVENT_UPDATE_HISTORY MVAR_EVENT_UPDATE "HISTORY}"
|
||||
#define MVAR_EVENT_UPDATE_MESSAGE MVAR_EVENT_UPDATE "MESSAGE}"
|
||||
#define MVAR_EVENT_UPDATE_TIME MVAR_EVENT_UPDATE "TIME}"
|
||||
#define MVAR_EVENT_UPDATE_STATUS MVAR_EVENT_UPDATE "STATUS}"
|
||||
#define MVAR_EVENT_UPDATE_NSEVERITY MVAR_EVENT_UPDATE "NSEVERITY}"
|
||||
#define MVAR_EVENT_UPDATE_SEVERITY MVAR_EVENT_UPDATE "SEVERITY}"
|
||||
#define MVAR_EVENT_CAUSE MVAR_EVENT "CAUSE." /* a prefix for all event cause macros */
|
||||
#define MVAR_EVENT_CAUSE_ACK_STATUS MVAR_EVENT_CAUSE "ACK.STATUS}"
|
||||
#define MVAR_EVENT_CAUSE_AGE MVAR_EVENT_CAUSE "AGE}"
|
||||
#define MVAR_EVENT_CAUSE_DATE MVAR_EVENT_CAUSE "DATE}"
|
||||
#define MVAR_EVENT_CAUSE_DURATION MVAR_EVENT_CAUSE "DURATION}"
|
||||
#define MVAR_EVENT_CAUSE_ID MVAR_EVENT_CAUSE "ID}"
|
||||
#define MVAR_EVENT_CAUSE_NAME MVAR_EVENT_CAUSE "NAME}"
|
||||
#define MVAR_EVENT_CAUSE_STATUS MVAR_EVENT_CAUSE "STATUS}"
|
||||
#define MVAR_EVENT_CAUSE_TAGS MVAR_EVENT_CAUSE "TAGS}"
|
||||
#define MVAR_EVENT_CAUSE_TAGSJSON MVAR_EVENT_CAUSE "TAGSJSON}"
|
||||
#define MVAR_EVENT_CAUSE_TAGS_PREFIX MVAR_EVENT_CAUSE "TAGS."
|
||||
#define MVAR_EVENT_CAUSE_TIME MVAR_EVENT_CAUSE "TIME}"
|
||||
#define MVAR_EVENT_CAUSE_VALUE MVAR_EVENT_CAUSE "VALUE}"
|
||||
#define MVAR_EVENT_CAUSE_SEVERITY MVAR_EVENT_CAUSE "SEVERITY}"
|
||||
#define MVAR_EVENT_CAUSE_NSEVERITY MVAR_EVENT_CAUSE "NSEVERITY}"
|
||||
#define MVAR_EVENT_CAUSE_OBJECT MVAR_EVENT_CAUSE "OBJECT}"
|
||||
#define MVAR_EVENT_CAUSE_SOURCE MVAR_EVENT_CAUSE "SOURCE}"
|
||||
#define MVAR_EVENT_CAUSE_OPDATA MVAR_EVENT_CAUSE "OPDATA}"
|
||||
#define MVAR_EVENT_CAUSE_UPDATE MVAR_EVENT_CAUSE "UPDATE."
|
||||
#define MVAR_EVENT_CAUSE_UPDATE_HISTORY MVAR_EVENT_CAUSE_UPDATE "HISTORY}"
|
||||
#define MVAR_EVENT_SYMPTOMS MVAR_EVENT "SYMPTOMS}"
|
||||
|
||||
#define MVAR_ESC_HISTORY "{ESC.HISTORY}"
|
||||
#define MVAR_PROXY_NAME "{PROXY.NAME}"
|
||||
#define MVAR_PROXY_DESCRIPTION "{PROXY.DESCRIPTION}"
|
||||
#define MVAR_HOST_DNS "{HOST.DNS}"
|
||||
#define MVAR_HOST_CONN "{HOST.CONN}"
|
||||
#define MVAR_HOST_HOST "{HOST.HOST}"
|
||||
#define MVAR_HOST_ID "{HOST.ID}"
|
||||
#define MVAR_HOST_IP "{HOST.IP}"
|
||||
#define MVAR_IPADDRESS "{IPADDRESS}" /* deprecated */
|
||||
#define MVAR_HOST_METADATA "{HOST.METADATA}"
|
||||
#define MVAR_HOST_NAME "{HOST.NAME}"
|
||||
#define MVAR_HOSTNAME "{HOSTNAME}" /* deprecated */
|
||||
#define MVAR_HOST_DESCRIPTION "{HOST.DESCRIPTION}"
|
||||
#define MVAR_HOST_PORT "{HOST.PORT}"
|
||||
#define MVAR_HOST_TARGET_DNS "{HOST.TARGET.DNS}"
|
||||
#define MVAR_HOST_TARGET_CONN "{HOST.TARGET.CONN}"
|
||||
#define MVAR_HOST_TARGET_HOST "{HOST.TARGET.HOST}"
|
||||
#define MVAR_HOST_TARGET_IP "{HOST.TARGET.IP}"
|
||||
#define MVAR_HOST_TARGET_NAME "{HOST.TARGET.NAME}"
|
||||
#define MVAR_TIME "{TIME}"
|
||||
#define MVAR_ITEM_LASTVALUE "{ITEM.LASTVALUE}"
|
||||
#define MVAR_ITEM_VALUE "{ITEM.VALUE}"
|
||||
#define MVAR_ITEM_VALUETYPE "{ITEM.VALUETYPE}"
|
||||
#define MVAR_ITEM_ID "{ITEM.ID}"
|
||||
#define MVAR_ITEM_NAME "{ITEM.NAME}"
|
||||
#define MVAR_ITEM_NAME_ORIG "{ITEM.NAME.ORIG}"
|
||||
#define MVAR_ITEM_KEY "{ITEM.KEY}"
|
||||
#define MVAR_ITEM_KEY_ORIG "{ITEM.KEY.ORIG}"
|
||||
#define MVAR_ITEM_STATE "{ITEM.STATE}"
|
||||
#define MVAR_TRIGGER_KEY "{TRIGGER.KEY}" /* deprecated */
|
||||
#define MVAR_ITEM_DESCRIPTION "{ITEM.DESCRIPTION}"
|
||||
#define MVAR_ITEM_DESCRIPTION_ORIG "{ITEM.DESCRIPTION.ORIG}"
|
||||
#define MVAR_ITEM_LOG "{ITEM.LOG."
|
||||
#define MVAR_ITEM_LOG_DATE MVAR_ITEM_LOG "DATE}"
|
||||
#define MVAR_ITEM_LOG_TIME MVAR_ITEM_LOG "TIME}"
|
||||
#define MVAR_ITEM_LOG_AGE MVAR_ITEM_LOG "AGE}"
|
||||
#define MVAR_ITEM_LOG_SOURCE MVAR_ITEM_LOG "SOURCE}"
|
||||
#define MVAR_ITEM_LOG_SEVERITY MVAR_ITEM_LOG "SEVERITY}"
|
||||
#define MVAR_ITEM_LOG_NSEVERITY MVAR_ITEM_LOG "NSEVERITY}"
|
||||
#define MVAR_ITEM_LOG_EVENTID MVAR_ITEM_LOG "EVENTID}"
|
||||
#define MVAR_ITEM_STATE_ERROR "{ITEM.STATE.ERROR}"
|
||||
|
||||
#define MVAR_SERVICE "{SERVICE."
|
||||
#define MVAR_SERVICE_NAME MVAR_SERVICE "NAME}"
|
||||
#define MVAR_SERVICE_DESCRIPTION MVAR_SERVICE "DESCRIPTION}"
|
||||
#define MVAR_SERVICE_ROOTCAUSE MVAR_SERVICE "ROOTCAUSE}"
|
||||
#define MVAR_SERVICE_TAGS MVAR_SERVICE "TAGS}"
|
||||
#define MVAR_SERVICE_TAGSJSON MVAR_SERVICE "TAGSJSON}"
|
||||
#define MVAR_SERVICE_TAGS_PREFIX MVAR_SERVICE "TAGS."
|
||||
|
||||
#define MVAR_TRIGGER_DESCRIPTION "{TRIGGER.DESCRIPTION}"
|
||||
#define MVAR_TRIGGER_COMMENT "{TRIGGER.COMMENT}" /* deprecated */
|
||||
#define MVAR_TRIGGER_ID "{TRIGGER.ID}"
|
||||
#define MVAR_TRIGGER_NAME "{TRIGGER.NAME}"
|
||||
#define MVAR_TRIGGER_NAME_ORIG "{TRIGGER.NAME.ORIG}"
|
||||
#define MVAR_TRIGGER_EXPRESSION "{TRIGGER.EXPRESSION}"
|
||||
#define MVAR_TRIGGER_EXPRESSION_RECOVERY "{TRIGGER.EXPRESSION.RECOVERY}"
|
||||
#define MVAR_TRIGGER_SEVERITY "{TRIGGER.SEVERITY}"
|
||||
#define MVAR_TRIGGER_NSEVERITY "{TRIGGER.NSEVERITY}"
|
||||
#define MVAR_TRIGGER_STATUS "{TRIGGER.STATUS}"
|
||||
#define MVAR_TRIGGER_STATE "{TRIGGER.STATE}"
|
||||
#define MVAR_TRIGGER_TEMPLATE_NAME "{TRIGGER.TEMPLATE.NAME}"
|
||||
#define MVAR_TRIGGER_HOSTGROUP_NAME "{TRIGGER.HOSTGROUP.NAME}"
|
||||
#define MVAR_FUNCTION_VALUE "{FUNCTION.VALUE}"
|
||||
#define MVAR_FUNCTION_RECOVERY_VALUE "{FUNCTION.RECOVERY.VALUE}"
|
||||
#define MVAR_TRIGGER_EXPRESSION_EXPLAIN "{TRIGGER.EXPRESSION.EXPLAIN}"
|
||||
#define MVAR_TRIGGER_EXPRESSION_RECOVERY_EXPLAIN "{TRIGGER.EXPRESSION.RECOVERY.EXPLAIN}"
|
||||
|
||||
#define MVAR_STATUS "{STATUS}" /* deprecated */
|
||||
#define MVAR_TRIGGER_VALUE "{TRIGGER.VALUE}"
|
||||
#define MVAR_TRIGGER_URL "{TRIGGER.URL}"
|
||||
#define MVAR_TRIGGER_URL_NAME "{TRIGGER.URL.NAME}"
|
||||
|
||||
#define MVAR_TRIGGER_EVENTS_ACK "{TRIGGER.EVENTS.ACK}"
|
||||
#define MVAR_TRIGGER_EVENTS_UNACK "{TRIGGER.EVENTS.UNACK}"
|
||||
#define MVAR_TRIGGER_EVENTS_PROBLEM_ACK "{TRIGGER.EVENTS.PROBLEM.ACK}"
|
||||
#define MVAR_TRIGGER_EVENTS_PROBLEM_UNACK "{TRIGGER.EVENTS.PROBLEM.UNACK}"
|
||||
#define MVAR_TRIGGER_STATE_ERROR "{TRIGGER.STATE.ERROR}"
|
||||
|
||||
#define MVAR_LLDRULE_DESCRIPTION "{LLDRULE.DESCRIPTION}"
|
||||
#define MVAR_LLDRULE_DESCRIPTION_ORIG "{LLDRULE.DESCRIPTION.ORIG}"
|
||||
#define MVAR_LLDRULE_ID "{LLDRULE.ID}"
|
||||
#define MVAR_LLDRULE_KEY "{LLDRULE.KEY}"
|
||||
#define MVAR_LLDRULE_KEY_ORIG "{LLDRULE.KEY.ORIG}"
|
||||
#define MVAR_LLDRULE_NAME "{LLDRULE.NAME}"
|
||||
#define MVAR_LLDRULE_NAME_ORIG "{LLDRULE.NAME.ORIG}"
|
||||
#define MVAR_LLDRULE_STATE "{LLDRULE.STATE}"
|
||||
#define MVAR_LLDRULE_STATE_ERROR "{LLDRULE.STATE.ERROR}"
|
||||
|
||||
#define MVAR_INVENTORY "{INVENTORY." /* a prefix for all inventory macros */
|
||||
#define MVAR_INVENTORY_TYPE MVAR_INVENTORY "TYPE}"
|
||||
#define MVAR_INVENTORY_TYPE_FULL MVAR_INVENTORY "TYPE.FULL}"
|
||||
#define MVAR_INVENTORY_NAME MVAR_INVENTORY "NAME}"
|
||||
#define MVAR_INVENTORY_ALIAS MVAR_INVENTORY "ALIAS}"
|
||||
#define MVAR_INVENTORY_OS MVAR_INVENTORY "OS}"
|
||||
#define MVAR_INVENTORY_OS_FULL MVAR_INVENTORY "OS.FULL}"
|
||||
#define MVAR_INVENTORY_OS_SHORT MVAR_INVENTORY "OS.SHORT}"
|
||||
#define MVAR_INVENTORY_SERIALNO_A MVAR_INVENTORY "SERIALNO.A}"
|
||||
#define MVAR_INVENTORY_SERIALNO_B MVAR_INVENTORY "SERIALNO.B}"
|
||||
#define MVAR_INVENTORY_TAG MVAR_INVENTORY "TAG}"
|
||||
#define MVAR_INVENTORY_ASSET_TAG MVAR_INVENTORY "ASSET.TAG}"
|
||||
#define MVAR_INVENTORY_MACADDRESS_A MVAR_INVENTORY "MACADDRESS.A}"
|
||||
#define MVAR_INVENTORY_MACADDRESS_B MVAR_INVENTORY "MACADDRESS.B}"
|
||||
#define MVAR_INVENTORY_HARDWARE MVAR_INVENTORY "HARDWARE}"
|
||||
#define MVAR_INVENTORY_HARDWARE_FULL MVAR_INVENTORY "HARDWARE.FULL}"
|
||||
#define MVAR_INVENTORY_SOFTWARE MVAR_INVENTORY "SOFTWARE}"
|
||||
#define MVAR_INVENTORY_SOFTWARE_FULL MVAR_INVENTORY "SOFTWARE.FULL}"
|
||||
#define MVAR_INVENTORY_SOFTWARE_APP_A MVAR_INVENTORY "SOFTWARE.APP.A}"
|
||||
#define MVAR_INVENTORY_SOFTWARE_APP_B MVAR_INVENTORY "SOFTWARE.APP.B}"
|
||||
#define MVAR_INVENTORY_SOFTWARE_APP_C MVAR_INVENTORY "SOFTWARE.APP.C}"
|
||||
#define MVAR_INVENTORY_SOFTWARE_APP_D MVAR_INVENTORY "SOFTWARE.APP.D}"
|
||||
#define MVAR_INVENTORY_SOFTWARE_APP_E MVAR_INVENTORY "SOFTWARE.APP.E}"
|
||||
#define MVAR_INVENTORY_CONTACT MVAR_INVENTORY "CONTACT}"
|
||||
#define MVAR_INVENTORY_LOCATION MVAR_INVENTORY "LOCATION}"
|
||||
#define MVAR_INVENTORY_LOCATION_LAT MVAR_INVENTORY "LOCATION.LAT}"
|
||||
#define MVAR_INVENTORY_LOCATION_LON MVAR_INVENTORY "LOCATION.LON}"
|
||||
#define MVAR_INVENTORY_NOTES MVAR_INVENTORY "NOTES}"
|
||||
#define MVAR_INVENTORY_CHASSIS MVAR_INVENTORY "CHASSIS}"
|
||||
#define MVAR_INVENTORY_MODEL MVAR_INVENTORY "MODEL}"
|
||||
#define MVAR_INVENTORY_HW_ARCH MVAR_INVENTORY "HW.ARCH}"
|
||||
#define MVAR_INVENTORY_VENDOR MVAR_INVENTORY "VENDOR}"
|
||||
#define MVAR_INVENTORY_CONTRACT_NUMBER MVAR_INVENTORY "CONTRACT.NUMBER}"
|
||||
#define MVAR_INVENTORY_INSTALLER_NAME MVAR_INVENTORY "INSTALLER.NAME}"
|
||||
#define MVAR_INVENTORY_DEPLOYMENT_STATUS MVAR_INVENTORY "DEPLOYMENT.STATUS}"
|
||||
#define MVAR_INVENTORY_URL_A MVAR_INVENTORY "URL.A}"
|
||||
#define MVAR_INVENTORY_URL_B MVAR_INVENTORY "URL.B}"
|
||||
#define MVAR_INVENTORY_URL_C MVAR_INVENTORY "URL.C}"
|
||||
#define MVAR_INVENTORY_HOST_NETWORKS MVAR_INVENTORY "HOST.NETWORKS}"
|
||||
#define MVAR_INVENTORY_HOST_NETMASK MVAR_INVENTORY "HOST.NETMASK}"
|
||||
#define MVAR_INVENTORY_HOST_ROUTER MVAR_INVENTORY "HOST.ROUTER}"
|
||||
#define MVAR_INVENTORY_OOB_IP MVAR_INVENTORY "OOB.IP}"
|
||||
#define MVAR_INVENTORY_OOB_NETMASK MVAR_INVENTORY "OOB.NETMASK}"
|
||||
#define MVAR_INVENTORY_OOB_ROUTER MVAR_INVENTORY "OOB.ROUTER}"
|
||||
#define MVAR_INVENTORY_HW_DATE_PURCHASE MVAR_INVENTORY "HW.DATE.PURCHASE}"
|
||||
#define MVAR_INVENTORY_HW_DATE_INSTALL MVAR_INVENTORY "HW.DATE.INSTALL}"
|
||||
#define MVAR_INVENTORY_HW_DATE_EXPIRY MVAR_INVENTORY "HW.DATE.EXPIRY}"
|
||||
#define MVAR_INVENTORY_HW_DATE_DECOMM MVAR_INVENTORY "HW.DATE.DECOMM}"
|
||||
#define MVAR_INVENTORY_SITE_ADDRESS_A MVAR_INVENTORY "SITE.ADDRESS.A}"
|
||||
#define MVAR_INVENTORY_SITE_ADDRESS_B MVAR_INVENTORY "SITE.ADDRESS.B}"
|
||||
#define MVAR_INVENTORY_SITE_ADDRESS_C MVAR_INVENTORY "SITE.ADDRESS.C}"
|
||||
#define MVAR_INVENTORY_SITE_CITY MVAR_INVENTORY "SITE.CITY}"
|
||||
#define MVAR_INVENTORY_SITE_STATE MVAR_INVENTORY "SITE.STATE}"
|
||||
#define MVAR_INVENTORY_SITE_COUNTRY MVAR_INVENTORY "SITE.COUNTRY}"
|
||||
#define MVAR_INVENTORY_SITE_ZIP MVAR_INVENTORY "SITE.ZIP}"
|
||||
#define MVAR_INVENTORY_SITE_RACK MVAR_INVENTORY "SITE.RACK}"
|
||||
#define MVAR_INVENTORY_SITE_NOTES MVAR_INVENTORY "SITE.NOTES}"
|
||||
#define MVAR_INVENTORY_POC_PRIMARY_NAME MVAR_INVENTORY "POC.PRIMARY.NAME}"
|
||||
#define MVAR_INVENTORY_POC_PRIMARY_EMAIL MVAR_INVENTORY "POC.PRIMARY.EMAIL}"
|
||||
#define MVAR_INVENTORY_POC_PRIMARY_PHONE_A MVAR_INVENTORY "POC.PRIMARY.PHONE.A}"
|
||||
#define MVAR_INVENTORY_POC_PRIMARY_PHONE_B MVAR_INVENTORY "POC.PRIMARY.PHONE.B}"
|
||||
#define MVAR_INVENTORY_POC_PRIMARY_CELL MVAR_INVENTORY "POC.PRIMARY.CELL}"
|
||||
#define MVAR_INVENTORY_POC_PRIMARY_SCREEN MVAR_INVENTORY "POC.PRIMARY.SCREEN}"
|
||||
#define MVAR_INVENTORY_POC_PRIMARY_NOTES MVAR_INVENTORY "POC.PRIMARY.NOTES}"
|
||||
#define MVAR_INVENTORY_POC_SECONDARY_NAME MVAR_INVENTORY "POC.SECONDARY.NAME}"
|
||||
#define MVAR_INVENTORY_POC_SECONDARY_EMAIL MVAR_INVENTORY "POC.SECONDARY.EMAIL}"
|
||||
#define MVAR_INVENTORY_POC_SECONDARY_PHONE_A MVAR_INVENTORY "POC.SECONDARY.PHONE.A}"
|
||||
#define MVAR_INVENTORY_POC_SECONDARY_PHONE_B MVAR_INVENTORY "POC.SECONDARY.PHONE.B}"
|
||||
#define MVAR_INVENTORY_POC_SECONDARY_CELL MVAR_INVENTORY "POC.SECONDARY.CELL}"
|
||||
#define MVAR_INVENTORY_POC_SECONDARY_SCREEN MVAR_INVENTORY "POC.SECONDARY.SCREEN}"
|
||||
#define MVAR_INVENTORY_POC_SECONDARY_NOTES MVAR_INVENTORY "POC.SECONDARY.NOTES}"
|
||||
|
||||
/* PROFILE.* is deprecated, use INVENTORY.* instead */
|
||||
#define MVAR_PROFILE "{PROFILE." /* prefix for profile macros */
|
||||
#define MVAR_PROFILE_DEVICETYPE MVAR_PROFILE "DEVICETYPE}"
|
||||
#define MVAR_PROFILE_NAME MVAR_PROFILE "NAME}"
|
||||
#define MVAR_PROFILE_OS MVAR_PROFILE "OS}"
|
||||
#define MVAR_PROFILE_SERIALNO MVAR_PROFILE "SERIALNO}"
|
||||
#define MVAR_PROFILE_TAG MVAR_PROFILE "TAG}"
|
||||
#define MVAR_PROFILE_MACADDRESS MVAR_PROFILE "MACADDRESS}"
|
||||
#define MVAR_PROFILE_HARDWARE MVAR_PROFILE "HARDWARE}"
|
||||
#define MVAR_PROFILE_SOFTWARE MVAR_PROFILE "SOFTWARE}"
|
||||
#define MVAR_PROFILE_CONTACT MVAR_PROFILE "CONTACT}"
|
||||
#define MVAR_PROFILE_LOCATION MVAR_PROFILE "LOCATION}"
|
||||
#define MVAR_PROFILE_NOTES MVAR_PROFILE "NOTES}"
|
||||
|
||||
#define MVAR_DISCOVERY_RULE_NAME "{DISCOVERY.RULE.NAME}"
|
||||
#define MVAR_DISCOVERY_SERVICE_NAME "{DISCOVERY.SERVICE.NAME}"
|
||||
#define MVAR_DISCOVERY_SERVICE_PORT "{DISCOVERY.SERVICE.PORT}"
|
||||
#define MVAR_DISCOVERY_SERVICE_STATUS "{DISCOVERY.SERVICE.STATUS}"
|
||||
#define MVAR_DISCOVERY_SERVICE_UPTIME "{DISCOVERY.SERVICE.UPTIME}"
|
||||
#define MVAR_DISCOVERY_DEVICE_IPADDRESS "{DISCOVERY.DEVICE.IPADDRESS}"
|
||||
#define MVAR_DISCOVERY_DEVICE_DNS "{DISCOVERY.DEVICE.DNS}"
|
||||
#define MVAR_DISCOVERY_DEVICE_STATUS "{DISCOVERY.DEVICE.STATUS}"
|
||||
#define MVAR_DISCOVERY_DEVICE_UPTIME "{DISCOVERY.DEVICE.UPTIME}"
|
||||
|
||||
#define MVAR_ALERT_SENDTO "{ALERT.SENDTO}"
|
||||
#define MVAR_ALERT_SUBJECT "{ALERT.SUBJECT}"
|
||||
#define MVAR_ALERT_MESSAGE "{ALERT.MESSAGE}"
|
||||
|
||||
#define MVAR_ACK_MESSAGE "{ACK.MESSAGE}" /* deprecated */
|
||||
#define MVAR_ACK_TIME "{ACK.TIME}" /* deprecated */
|
||||
#define MVAR_ACK_DATE "{ACK.DATE}" /* deprecated */
|
||||
#define MVAR_USER_ALIAS "{USER.ALIAS}" /* deprecated */
|
||||
#define MVAR_USER_USERNAME "{USER.USERNAME}"
|
||||
#define MVAR_USER_NAME "{USER.NAME}"
|
||||
#define MVAR_USER_SURNAME "{USER.SURNAME}"
|
||||
#define MVAR_USER_FULLNAME "{USER.FULLNAME}"
|
||||
|
||||
#endif
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_ZBX_HOST_CONSTANTS_H
|
||||
#define ZABBIX_ZBX_HOST_CONSTANTS_H
|
||||
|
||||
/* host statuses */
|
||||
#define HOST_STATUS_MONITORED 0
|
||||
#define HOST_STATUS_NOT_MONITORED 1
|
||||
/*#define HOST_STATUS_UNREACHABLE 2*/
|
||||
#define HOST_STATUS_TEMPLATE 3
|
||||
/*#define HOST_STATUS_DELETED 4*/
|
||||
|
||||
/* host group types */
|
||||
#define HOSTGROUP_TYPE_HOST 0
|
||||
#define HOSTGROUP_TYPE_TEMPLATE 1
|
||||
|
||||
/* host maintenance status */
|
||||
#define HOST_MAINTENANCE_STATUS_OFF 0
|
||||
#define HOST_MAINTENANCE_STATUS_ON 1
|
||||
|
||||
/* host inventory mode */
|
||||
#define HOST_INVENTORY_DISABLED -1 /* the host has no record in host_inventory */
|
||||
|
||||
/* only in server code, never in DB */
|
||||
#define HOST_INVENTORY_MANUAL 0
|
||||
#define HOST_INVENTORY_AUTOMATIC 1
|
||||
#define HOST_INVENTORY_COUNT 2
|
||||
|
||||
#define HOST_INVENTORY_FIELD_COUNT 70
|
||||
|
||||
#endif /*ZABBIX_ZBX_HOST_CONSTANTS_H*/
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_ZBX_ITEM_CONSTANTS_H
|
||||
#define ZABBIX_ZBX_ITEM_CONSTANTS_H
|
||||
|
||||
/* item statuses */
|
||||
#define ITEM_STATUS_ACTIVE 0
|
||||
#define ITEM_STATUS_DISABLED 1
|
||||
|
||||
/* item states */
|
||||
#define ITEM_STATE_NORMAL 0
|
||||
#define ITEM_STATE_NOTSUPPORTED 1
|
||||
|
||||
#define ZBX_HC_ITEM_STATUS_NORMAL 0
|
||||
#define ZBX_HC_ITEM_STATUS_BUSY 1
|
||||
|
||||
/* discovery rule */
|
||||
#define DRULE_STATUS_MONITORED 0
|
||||
#define DRULE_STATUS_NOT_MONITORED 1
|
||||
|
||||
#define ITEM_LOGTYPE_INFORMATION 1
|
||||
#define ITEM_LOGTYPE_WARNING 2
|
||||
#define ITEM_LOGTYPE_ERROR 4
|
||||
#define ITEM_LOGTYPE_FAILURE_AUDIT 7
|
||||
#define ITEM_LOGTYPE_SUCCESS_AUDIT 8
|
||||
#define ITEM_LOGTYPE_CRITICAL 9
|
||||
#define ITEM_LOGTYPE_VERBOSE 10
|
||||
|
||||
#define HTTPTEST_STATUS_MONITORED 0
|
||||
#define HTTPTEST_STATUS_NOT_MONITORED 1
|
||||
|
||||
#endif /*ZABBIX_ZBX_ITEM_CONSTANTS_H*/
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_ZBX_RTC_CONSTANTS_H
|
||||
#define ZABBIX_ZBX_RTC_CONSTANTS_H
|
||||
|
||||
/* runtime control commands */
|
||||
#define ZBX_RTC_UNKNOWN 0
|
||||
#define ZBX_RTC_LOG_LEVEL_INCREASE 1
|
||||
#define ZBX_RTC_LOG_LEVEL_DECREASE 2
|
||||
#define ZBX_RTC_HOUSEKEEPER_EXECUTE 3
|
||||
#define ZBX_RTC_CONFIG_CACHE_RELOAD 8
|
||||
#define ZBX_RTC_SNMP_CACHE_RELOAD 9
|
||||
#define ZBX_RTC_DIAGINFO 10
|
||||
#define ZBX_RTC_SECRETS_RELOAD 11
|
||||
#define ZBX_RTC_SERVICE_CACHE_RELOAD 12
|
||||
#define ZBX_RTC_TRIGGER_HOUSEKEEPER_EXECUTE 13
|
||||
#define ZBX_RTC_HA_STATUS 14
|
||||
#define ZBX_RTC_HA_REMOVE_NODE 15
|
||||
#define ZBX_RTC_HA_SET_FAILOVER_DELAY 16
|
||||
#define ZBX_RTC_USER_PARAMETERS_RELOAD 17
|
||||
#define ZBX_RTC_PROXY_CONFIG_CACHE_RELOAD 18
|
||||
#define ZBX_RTC_PROXYPOLLER_PROCESS 19
|
||||
#define ZBX_RTC_PROF_ENABLE 20
|
||||
#define ZBX_RTC_PROF_DISABLE 21
|
||||
|
||||
/* internal rtc messages */
|
||||
#define ZBX_RTC_SUBSCRIBE 100
|
||||
#define ZBX_RTC_SHUTDOWN 101
|
||||
#define ZBX_RTC_CONFIG_CACHE_RELOAD_WAIT 102
|
||||
#define ZBX_RTC_SUBSCRIBE_SERVICE 103
|
||||
|
||||
/* runtime control notifications, must be less than 10000 */
|
||||
#define ZBX_RTC_CONFIG_SYNC_NOTIFY 9999
|
||||
|
||||
#define ZBX_IPC_RTC_MAX 9999
|
||||
|
||||
/* runtime control options */
|
||||
#define ZBX_CONFIG_CACHE_RELOAD "config_cache_reload"
|
||||
#define ZBX_SERVICE_CACHE_RELOAD "service_cache_reload"
|
||||
#define ZBX_SECRETS_RELOAD "secrets_reload"
|
||||
#define ZBX_HOUSEKEEPER_EXECUTE "housekeeper_execute"
|
||||
#define ZBX_LOG_LEVEL_INCREASE "log_level_increase"
|
||||
#define ZBX_LOG_LEVEL_DECREASE "log_level_decrease"
|
||||
#define ZBX_SNMP_CACHE_RELOAD "snmp_cache_reload"
|
||||
#define ZBX_DIAGINFO "diaginfo"
|
||||
#define ZBX_TRIGGER_HOUSEKEEPER_EXECUTE "trigger_housekeeper_execute"
|
||||
#define ZBX_HA_STATUS "ha_status"
|
||||
#define ZBX_HA_REMOVE_NODE "ha_remove_node"
|
||||
#define ZBX_HA_SET_FAILOVER_DELAY "ha_set_failover_delay"
|
||||
#define ZBX_USER_PARAMETERS_RELOAD "userparameter_reload"
|
||||
#define ZBX_PROXY_CONFIG_CACHE_RELOAD "proxy_config_cache_reload"
|
||||
#define ZBX_PROF_ENABLE "prof_enable"
|
||||
#define ZBX_PROF_DISABLE "prof_disable"
|
||||
|
||||
#endif
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_ZBX_TRIGGER_CONSTANTS_H
|
||||
#define ZABBIX_ZBX_TRIGGER_CONSTANTS_H
|
||||
|
||||
#define ZBX_DC_TRIGGER_PROBLEM_EXPRESSION 0x1 /* this flag shows that trigger value recalculation is */
|
||||
/* initiated by a time-based function or a new value of */
|
||||
/* an item in problem expression */
|
||||
|
||||
#define ZBX_TRIGGER_GET_ITEMIDS 0x0001
|
||||
|
||||
#define ZBX_TRIGGER_GET_DEFAULT (~(unsigned int)ZBX_TRIGGER_GET_ITEMIDS)
|
||||
#define ZBX_TRIGGER_GET_ALL (~(unsigned int)0)
|
||||
|
||||
#define ZBX_TRIGGER_DEPENDENCY_LEVELS_MAX 32
|
||||
|
||||
#define ZBX_TRIGGER_DEPENDENCY_FAIL 1
|
||||
#define ZBX_TRIGGER_DEPENDENCY_UNRESOLVED 2
|
||||
|
||||
/* trigger statuses */
|
||||
#define TRIGGER_STATUS_ENABLED 0
|
||||
#define TRIGGER_STATUS_DISABLED 1
|
||||
|
||||
/* trigger types */
|
||||
#define TRIGGER_TYPE_NORMAL 0
|
||||
#define TRIGGER_TYPE_MULTIPLE_TRUE 1
|
||||
|
||||
/* trigger values */
|
||||
#define TRIGGER_VALUE_OK 0
|
||||
#define TRIGGER_VALUE_PROBLEM 1
|
||||
#define TRIGGER_VALUE_UNKNOWN 2 /* only in server code, never in DB */
|
||||
#define TRIGGER_VALUE_NONE 3 /* only in server code, never in DB */
|
||||
|
||||
/* trigger states */
|
||||
#define TRIGGER_STATE_NORMAL 0
|
||||
#define TRIGGER_STATE_UNKNOWN 1
|
||||
|
||||
/* trigger severity */
|
||||
#define TRIGGER_SEVERITY_NOT_CLASSIFIED 0
|
||||
#define TRIGGER_SEVERITY_INFORMATION 1
|
||||
#define TRIGGER_SEVERITY_WARNING 2
|
||||
#define TRIGGER_SEVERITY_AVERAGE 3
|
||||
#define TRIGGER_SEVERITY_HIGH 4
|
||||
#define TRIGGER_SEVERITY_DISASTER 5
|
||||
#define TRIGGER_SEVERITY_COUNT 6 /* number of trigger severities */
|
||||
|
||||
/* trigger recovery mode */
|
||||
#define TRIGGER_RECOVERY_MODE_EXPRESSION 0
|
||||
#define TRIGGER_RECOVERY_MODE_RECOVERY_EXPRESSION 1
|
||||
#define TRIGGER_RECOVERY_MODE_NONE 2
|
||||
|
||||
/* trigger correlation modes */
|
||||
#define ZBX_TRIGGER_CORRELATION_NONE 0
|
||||
#define ZBX_TRIGGER_CORRELATION_TAG 1
|
||||
|
||||
#endif /*ZABBIX_ZBX_TRIGGER_CONSTANTS_H*/
|
@ -0,0 +1,765 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_ZBXALGO_H
|
||||
#define ZABBIX_ZBXALGO_H
|
||||
|
||||
#include "zbxnum.h"
|
||||
|
||||
/* generic */
|
||||
|
||||
typedef zbx_uint32_t zbx_hash_t;
|
||||
|
||||
zbx_hash_t zbx_hash_modfnv(const void *data, size_t len, zbx_hash_t seed);
|
||||
zbx_hash_t zbx_hash_splittable64(const void *data);
|
||||
|
||||
#define ZBX_DEFAULT_HASH_ALGO zbx_hash_modfnv
|
||||
#define ZBX_DEFAULT_PTR_HASH_ALGO zbx_hash_modfnv
|
||||
#define ZBX_DEFAULT_UINT64_HASH_ALGO zbx_hash_modfnv
|
||||
#define ZBX_DEFAULT_STRING_HASH_ALGO zbx_hash_modfnv
|
||||
|
||||
typedef zbx_hash_t (*zbx_hash_func_t)(const void *data);
|
||||
|
||||
zbx_hash_t zbx_default_ptr_hash_func(const void *data);
|
||||
zbx_hash_t zbx_default_string_hash_func(const void *data);
|
||||
zbx_hash_t zbx_default_uint64_pair_hash_func(const void *data);
|
||||
|
||||
#define ZBX_DEFAULT_HASH_SEED 0
|
||||
|
||||
#define ZBX_DEFAULT_PTR_HASH_FUNC zbx_default_ptr_hash_func
|
||||
#define ZBX_DEFAULT_UINT64_HASH_FUNC zbx_hash_splittable64
|
||||
#define ZBX_DEFAULT_STRING_HASH_FUNC zbx_default_string_hash_func
|
||||
#define ZBX_DEFAULT_UINT64_PAIR_HASH_FUNC zbx_default_uint64_pair_hash_func
|
||||
|
||||
typedef int (*zbx_compare_func_t)(const void *d1, const void *d2);
|
||||
|
||||
int zbx_default_int_compare_func(const void *d1, const void *d2);
|
||||
int zbx_default_uint64_compare_func(const void *d1, const void *d2);
|
||||
int zbx_default_uint64_ptr_compare_func(const void *d1, const void *d2);
|
||||
int zbx_default_str_compare_func(const void *d1, const void *d2);
|
||||
int zbx_default_str_ptr_compare_func(const void *d1, const void *d2);
|
||||
int zbx_natural_str_compare_func(const void *d1, const void *d2);
|
||||
int zbx_default_ptr_compare_func(const void *d1, const void *d2);
|
||||
int zbx_default_uint64_pair_compare_func(const void *d1, const void *d2);
|
||||
int zbx_default_dbl_compare_func(const void *d1, const void *d2);
|
||||
|
||||
#define ZBX_DEFAULT_INT_COMPARE_FUNC zbx_default_int_compare_func
|
||||
#define ZBX_DEFAULT_UINT64_COMPARE_FUNC zbx_default_uint64_compare_func
|
||||
#define ZBX_DEFAULT_UINT64_PTR_COMPARE_FUNC zbx_default_uint64_ptr_compare_func
|
||||
#define ZBX_DEFAULT_STR_COMPARE_FUNC zbx_default_str_compare_func
|
||||
#define ZBX_DEFAULT_STR_PTR_COMPARE_FUNC zbx_default_str_ptr_compare_func
|
||||
#define ZBX_DEFAULT_PTR_COMPARE_FUNC zbx_default_ptr_compare_func
|
||||
#define ZBX_DEFAULT_UINT64_PAIR_COMPARE_FUNC zbx_default_uint64_pair_compare_func
|
||||
#define ZBX_DEFAULT_DBL_COMPARE_FUNC zbx_default_dbl_compare_func
|
||||
|
||||
typedef void *(*zbx_mem_malloc_func_t)(void *old, size_t size);
|
||||
typedef void *(*zbx_mem_realloc_func_t)(void *old, size_t size);
|
||||
typedef void (*zbx_mem_free_func_t)(void *ptr);
|
||||
|
||||
void *zbx_default_mem_malloc_func(void *old, size_t size);
|
||||
void *zbx_default_mem_realloc_func(void *old, size_t size);
|
||||
void zbx_default_mem_free_func(void *ptr);
|
||||
|
||||
#define ZBX_DEFAULT_MEM_MALLOC_FUNC zbx_default_mem_malloc_func
|
||||
#define ZBX_DEFAULT_MEM_REALLOC_FUNC zbx_default_mem_realloc_func
|
||||
#define ZBX_DEFAULT_MEM_FREE_FUNC zbx_default_mem_free_func
|
||||
|
||||
typedef void (*zbx_clean_func_t)(void *data);
|
||||
|
||||
#define ZBX_RETURN_IF_NOT_EQUAL(a, b) \
|
||||
\
|
||||
if ((a) < (b)) \
|
||||
return -1; \
|
||||
if ((a) > (b)) \
|
||||
return +1
|
||||
|
||||
#define ZBX_RETURN_IF_DBL_NOT_EQUAL(a, b) \
|
||||
do \
|
||||
{ \
|
||||
if (FAIL == zbx_double_compare(a, b)) \
|
||||
{ \
|
||||
if ((a) < (b)) \
|
||||
return -1; \
|
||||
else \
|
||||
return +1; \
|
||||
} \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
/* pair */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *first;
|
||||
void *second;
|
||||
}
|
||||
zbx_ptr_pair_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t first;
|
||||
zbx_uint64_t second;
|
||||
}
|
||||
zbx_uint64_pair_t;
|
||||
|
||||
/* hashset */
|
||||
|
||||
#define ZBX_HASHSET_ENTRY_T struct zbx_hashset_entry_s
|
||||
|
||||
ZBX_HASHSET_ENTRY_T
|
||||
{
|
||||
ZBX_HASHSET_ENTRY_T *next;
|
||||
zbx_hash_t hash;
|
||||
#if SIZEOF_VOID_P > 4
|
||||
/* the data member must be properly aligned on 64-bit architectures that require aligned memory access */
|
||||
char padding[sizeof(void *) - sizeof(zbx_hash_t)];
|
||||
#endif
|
||||
char data[1];
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ZBX_HASHSET_ENTRY_T **slots;
|
||||
int num_slots;
|
||||
int num_data;
|
||||
zbx_hash_func_t hash_func;
|
||||
zbx_compare_func_t compare_func;
|
||||
zbx_clean_func_t clean_func;
|
||||
zbx_mem_malloc_func_t mem_malloc_func;
|
||||
zbx_mem_realloc_func_t mem_realloc_func;
|
||||
zbx_mem_free_func_t mem_free_func;
|
||||
}
|
||||
zbx_hashset_t;
|
||||
|
||||
#define ZBX_HASHSET_ENTRY_OFFSET offsetof(ZBX_HASHSET_ENTRY_T, data)
|
||||
|
||||
void zbx_hashset_create(zbx_hashset_t *hs, size_t init_size,
|
||||
zbx_hash_func_t hash_func,
|
||||
zbx_compare_func_t compare_func);
|
||||
void zbx_hashset_create_ext(zbx_hashset_t *hs, size_t init_size,
|
||||
zbx_hash_func_t hash_func,
|
||||
zbx_compare_func_t compare_func,
|
||||
zbx_clean_func_t clean_func,
|
||||
zbx_mem_malloc_func_t mem_malloc_func,
|
||||
zbx_mem_realloc_func_t mem_realloc_func,
|
||||
zbx_mem_free_func_t mem_free_func);
|
||||
void zbx_hashset_destroy(zbx_hashset_t *hs);
|
||||
|
||||
int zbx_hashset_reserve(zbx_hashset_t *hs, int num_slots_req);
|
||||
void *zbx_hashset_insert(zbx_hashset_t *hs, const void *data, size_t size);
|
||||
void *zbx_hashset_insert_ext(zbx_hashset_t *hs, const void *data, size_t size, size_t offset);
|
||||
void *zbx_hashset_search(const zbx_hashset_t *hs, const void *data);
|
||||
void zbx_hashset_remove(zbx_hashset_t *hs, const void *data);
|
||||
void zbx_hashset_remove_direct(zbx_hashset_t *hs, void *data);
|
||||
|
||||
void zbx_hashset_clear(zbx_hashset_t *hs);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_hashset_t *hashset;
|
||||
int slot;
|
||||
ZBX_HASHSET_ENTRY_T *entry;
|
||||
}
|
||||
zbx_hashset_iter_t;
|
||||
|
||||
void zbx_hashset_iter_reset(zbx_hashset_t *hs, zbx_hashset_iter_t *iter);
|
||||
void *zbx_hashset_iter_next(zbx_hashset_iter_t *iter);
|
||||
void zbx_hashset_iter_remove(zbx_hashset_iter_t *iter);
|
||||
void zbx_hashset_copy(zbx_hashset_t *dst, const zbx_hashset_t *src, size_t size);
|
||||
|
||||
/* hashmap */
|
||||
|
||||
/* currently, we only have a very specialized hashmap */
|
||||
/* that maps zbx_uint64_t keys into non-negative ints */
|
||||
|
||||
#define ZBX_HASHMAP_ENTRY_T struct zbx_hashmap_entry_s
|
||||
#define ZBX_HASHMAP_SLOT_T struct zbx_hashmap_slot_s
|
||||
|
||||
ZBX_HASHMAP_ENTRY_T
|
||||
{
|
||||
zbx_uint64_t key;
|
||||
int value;
|
||||
};
|
||||
|
||||
ZBX_HASHMAP_SLOT_T
|
||||
{
|
||||
ZBX_HASHMAP_ENTRY_T *entries;
|
||||
int entries_num;
|
||||
int entries_alloc;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ZBX_HASHMAP_SLOT_T *slots;
|
||||
int num_slots;
|
||||
int num_data;
|
||||
zbx_hash_func_t hash_func;
|
||||
zbx_compare_func_t compare_func;
|
||||
zbx_mem_malloc_func_t mem_malloc_func;
|
||||
zbx_mem_realloc_func_t mem_realloc_func;
|
||||
zbx_mem_free_func_t mem_free_func;
|
||||
}
|
||||
zbx_hashmap_t;
|
||||
|
||||
void zbx_hashmap_create(zbx_hashmap_t *hm, size_t init_size);
|
||||
void zbx_hashmap_create_ext(zbx_hashmap_t *hm, size_t init_size,
|
||||
zbx_hash_func_t hash_func,
|
||||
zbx_compare_func_t compare_func,
|
||||
zbx_mem_malloc_func_t mem_malloc_func,
|
||||
zbx_mem_realloc_func_t mem_realloc_func,
|
||||
zbx_mem_free_func_t mem_free_func);
|
||||
void zbx_hashmap_destroy(zbx_hashmap_t *hm);
|
||||
|
||||
int zbx_hashmap_get(zbx_hashmap_t *hm, zbx_uint64_t key);
|
||||
void zbx_hashmap_set(zbx_hashmap_t *hm, zbx_uint64_t key, int value);
|
||||
void zbx_hashmap_remove(zbx_hashmap_t *hm, zbx_uint64_t key);
|
||||
|
||||
void zbx_hashmap_clear(zbx_hashmap_t *hm);
|
||||
|
||||
/* binary heap (min-heap) */
|
||||
|
||||
/* currently, we only have a very specialized binary heap that can */
|
||||
/* store zbx_uint64_t keys with arbitrary auxiliary information */
|
||||
|
||||
#define ZBX_BINARY_HEAP_OPTION_EMPTY 0
|
||||
#define ZBX_BINARY_HEAP_OPTION_DIRECT (1<<0) /* support for direct update() and remove() operations */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t key;
|
||||
void *data;
|
||||
}
|
||||
zbx_binary_heap_elem_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_binary_heap_elem_t *elems;
|
||||
int elems_num;
|
||||
int elems_alloc;
|
||||
int options;
|
||||
zbx_compare_func_t compare_func;
|
||||
zbx_hashmap_t *key_index;
|
||||
|
||||
/* The binary heap is designed to work correctly only with memory allocation functions */
|
||||
/* that return pointer to the allocated memory or quit. Functions that can return NULL */
|
||||
/* are not supported (process will exit() if NULL return value is encountered). If */
|
||||
/* using zbx_shmem_info_t and the associated memory functions then ensure that */
|
||||
/* allow_oom is always set to 0. */
|
||||
zbx_mem_malloc_func_t mem_malloc_func;
|
||||
zbx_mem_realloc_func_t mem_realloc_func;
|
||||
zbx_mem_free_func_t mem_free_func;
|
||||
}
|
||||
zbx_binary_heap_t;
|
||||
|
||||
void zbx_binary_heap_create(zbx_binary_heap_t *heap, zbx_compare_func_t compare_func, int options);
|
||||
void zbx_binary_heap_create_ext(zbx_binary_heap_t *heap, zbx_compare_func_t compare_func,
|
||||
int options, zbx_mem_malloc_func_t mem_malloc_func,
|
||||
zbx_mem_realloc_func_t mem_realloc_func,
|
||||
zbx_mem_free_func_t mem_free_func);
|
||||
void zbx_binary_heap_destroy(zbx_binary_heap_t *heap);
|
||||
|
||||
int zbx_binary_heap_empty(const zbx_binary_heap_t *heap);
|
||||
zbx_binary_heap_elem_t *zbx_binary_heap_find_min(const zbx_binary_heap_t *heap);
|
||||
void zbx_binary_heap_insert(zbx_binary_heap_t *heap, zbx_binary_heap_elem_t *elem);
|
||||
void zbx_binary_heap_update_direct(zbx_binary_heap_t *heap, zbx_binary_heap_elem_t *elem);
|
||||
void zbx_binary_heap_remove_min(zbx_binary_heap_t *heap);
|
||||
void zbx_binary_heap_remove_direct(zbx_binary_heap_t *heap, zbx_uint64_t key);
|
||||
|
||||
void zbx_binary_heap_clear(zbx_binary_heap_t *heap);
|
||||
|
||||
/* vector implementation start */
|
||||
|
||||
#define ZBX_VECTOR_STRUCT_DECL(__id, __type) \
|
||||
\
|
||||
typedef struct zbx_vector_ ## __id ## _s \
|
||||
{ \
|
||||
__type *values; \
|
||||
int values_num; \
|
||||
int values_alloc; \
|
||||
zbx_mem_malloc_func_t mem_malloc_func; \
|
||||
zbx_mem_realloc_func_t mem_realloc_func; \
|
||||
zbx_mem_free_func_t mem_free_func; \
|
||||
} \
|
||||
zbx_vector_ ## __id ## _t;
|
||||
|
||||
#define ZBX_VECTOR_FUNC_DECL(__id, __type) \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _create(zbx_vector_ ## __id ## _t *vector); \
|
||||
void zbx_vector_ ## __id ## _create_ext(zbx_vector_ ## __id ## _t *vector, \
|
||||
zbx_mem_malloc_func_t mem_malloc_func, \
|
||||
zbx_mem_realloc_func_t mem_realloc_func, \
|
||||
zbx_mem_free_func_t mem_free_func); \
|
||||
void zbx_vector_ ## __id ## _destroy(zbx_vector_ ## __id ## _t *vector); \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _append(zbx_vector_ ## __id ## _t *vector, __type value); \
|
||||
void zbx_vector_ ## __id ## _insert(zbx_vector_ ## __id ## _t *vector, __type value, int before_index); \
|
||||
void zbx_vector_ ## __id ## _append_ptr(zbx_vector_ ## __id ## _t *vector, __type *value); \
|
||||
void zbx_vector_ ## __id ## _append_array(zbx_vector_ ## __id ## _t *vector, __type const *values, \
|
||||
int values_num); \
|
||||
void zbx_vector_ ## __id ## _remove_noorder(zbx_vector_ ## __id ## _t *vector, int index); \
|
||||
void zbx_vector_ ## __id ## _remove(zbx_vector_ ## __id ## _t *vector, int index); \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _sort(zbx_vector_ ## __id ## _t *vector, zbx_compare_func_t compare_func); \
|
||||
void zbx_vector_ ## __id ## _uniq(zbx_vector_ ## __id ## _t *vector, zbx_compare_func_t compare_func); \
|
||||
\
|
||||
int zbx_vector_ ## __id ## _nearestindex(const zbx_vector_ ## __id ## _t *vector, const __type value, \
|
||||
zbx_compare_func_t compare_func); \
|
||||
int zbx_vector_ ## __id ## _bsearch(const zbx_vector_ ## __id ## _t *vector, const __type value, \
|
||||
zbx_compare_func_t compare_func); \
|
||||
int zbx_vector_ ## __id ## _lsearch(const zbx_vector_ ## __id ## _t *vector, const __type value, int *index,\
|
||||
zbx_compare_func_t compare_func); \
|
||||
int zbx_vector_ ## __id ## _search(const zbx_vector_ ## __id ## _t *vector, const __type value, \
|
||||
zbx_compare_func_t compare_func); \
|
||||
void zbx_vector_ ## __id ## _setdiff(zbx_vector_ ## __id ## _t *left, const zbx_vector_ ## __id ## _t *right,\
|
||||
zbx_compare_func_t compare_func); \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _reserve(zbx_vector_ ## __id ## _t *vector, size_t size); \
|
||||
void zbx_vector_ ## __id ## _clear(zbx_vector_ ## __id ## _t *vector);
|
||||
|
||||
#define ZBX_VECTOR_DECL(__id, __type) ZBX_VECTOR_STRUCT_DECL(__id, __type) \
|
||||
ZBX_VECTOR_FUNC_DECL(__id, __type)
|
||||
|
||||
#define ZBX_PTR_VECTOR_FUNC_DECL(__id, __type) \
|
||||
\
|
||||
ZBX_VECTOR_FUNC_DECL(__id, __type) \
|
||||
\
|
||||
typedef void (*zbx_ ## __id ## _free_func_t)(__type data); \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _clear_ext(zbx_vector_ ## __id ## _t *vector, zbx_ ## __id ## _free_func_t free_func);
|
||||
|
||||
#define ZBX_PTR_VECTOR_DECL(__id, __type) ZBX_VECTOR_STRUCT_DECL(__id, __type) \
|
||||
ZBX_PTR_VECTOR_FUNC_DECL(__id, __type)
|
||||
|
||||
ZBX_VECTOR_DECL(uint64, zbx_uint64_t)
|
||||
ZBX_VECTOR_DECL(uint32, zbx_uint32_t)
|
||||
ZBX_VECTOR_DECL(int32, int)
|
||||
ZBX_PTR_VECTOR_DECL(str, char *)
|
||||
ZBX_PTR_VECTOR_DECL(ptr, void *)
|
||||
ZBX_VECTOR_DECL(ptr_pair, zbx_ptr_pair_t)
|
||||
ZBX_VECTOR_DECL(uint64_pair, zbx_uint64_pair_t)
|
||||
ZBX_VECTOR_DECL(dbl, double)
|
||||
|
||||
ZBX_PTR_VECTOR_DECL(tags, zbx_tag_t*)
|
||||
|
||||
#define ZBX_VECTOR_ARRAY_GROWTH_FACTOR 3/2
|
||||
|
||||
#define ZBX_VECTOR_IMPL(__id, __type) \
|
||||
\
|
||||
static void __vector_ ## __id ## _ensure_free_space(zbx_vector_ ## __id ## _t *vector) \
|
||||
{ \
|
||||
if (NULL == vector->values) \
|
||||
{ \
|
||||
vector->values_num = 0; \
|
||||
vector->values_alloc = 32; \
|
||||
vector->values = (__type *)vector->mem_malloc_func(NULL, (size_t)vector->values_alloc * \
|
||||
sizeof(__type)); \
|
||||
} \
|
||||
else if (vector->values_num == vector->values_alloc) \
|
||||
{ \
|
||||
vector->values_alloc = MAX(vector->values_alloc + 1, vector->values_alloc * \
|
||||
ZBX_VECTOR_ARRAY_GROWTH_FACTOR); \
|
||||
vector->values = (__type *)vector->mem_realloc_func(vector->values, \
|
||||
(size_t)vector->values_alloc * sizeof(__type)); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _create(zbx_vector_ ## __id ## _t *vector) \
|
||||
{ \
|
||||
zbx_vector_ ## __id ## _create_ext(vector, \
|
||||
ZBX_DEFAULT_MEM_MALLOC_FUNC, \
|
||||
ZBX_DEFAULT_MEM_REALLOC_FUNC, \
|
||||
ZBX_DEFAULT_MEM_FREE_FUNC); \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _create_ext(zbx_vector_ ## __id ## _t *vector, \
|
||||
zbx_mem_malloc_func_t mem_malloc_func, \
|
||||
zbx_mem_realloc_func_t mem_realloc_func, \
|
||||
zbx_mem_free_func_t mem_free_func) \
|
||||
{ \
|
||||
vector->values = NULL; \
|
||||
vector->values_num = 0; \
|
||||
vector->values_alloc = 0; \
|
||||
\
|
||||
vector->mem_malloc_func = mem_malloc_func; \
|
||||
vector->mem_realloc_func = mem_realloc_func; \
|
||||
vector->mem_free_func = mem_free_func; \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _destroy(zbx_vector_ ## __id ## _t *vector) \
|
||||
{ \
|
||||
if (NULL != vector->values) \
|
||||
{ \
|
||||
vector->mem_free_func(vector->values); \
|
||||
vector->values = NULL; \
|
||||
vector->values_num = 0; \
|
||||
vector->values_alloc = 0; \
|
||||
} \
|
||||
\
|
||||
vector->mem_malloc_func = NULL; \
|
||||
vector->mem_realloc_func = NULL; \
|
||||
vector->mem_free_func = NULL; \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _append(zbx_vector_ ## __id ## _t *vector, __type value) \
|
||||
{ \
|
||||
__vector_ ## __id ## _ensure_free_space(vector); \
|
||||
vector->values[vector->values_num++] = value; \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _insert(zbx_vector_ ## __id ## _t *vector, __type value, int before_index) \
|
||||
{ \
|
||||
__vector_ ## __id ## _ensure_free_space(vector); \
|
||||
\
|
||||
if (0 < vector->values_num - before_index) \
|
||||
{ \
|
||||
memmove(vector->values + before_index + 1, vector->values + before_index, \
|
||||
(vector->values_num - before_index) * sizeof(__type)); \
|
||||
} \
|
||||
\
|
||||
vector->values_num++; \
|
||||
vector->values[before_index] = value; \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _append_ptr(zbx_vector_ ## __id ## _t *vector, __type *value) \
|
||||
{ \
|
||||
__vector_ ## __id ## _ensure_free_space(vector); \
|
||||
vector->values[vector->values_num++] = *value; \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _append_array(zbx_vector_ ## __id ## _t *vector, __type const *values, \
|
||||
int values_num) \
|
||||
{ \
|
||||
zbx_vector_ ## __id ## _reserve(vector, (size_t)(vector->values_num + values_num)); \
|
||||
memcpy(vector->values + vector->values_num, values, (size_t)values_num * sizeof(__type)); \
|
||||
vector->values_num = vector->values_num + values_num; \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _remove_noorder(zbx_vector_ ## __id ## _t *vector, int index) \
|
||||
{ \
|
||||
if (!(0 <= index && index < vector->values_num)) \
|
||||
{ \
|
||||
zabbix_log(LOG_LEVEL_CRIT, "removing a non-existent element at index %d", index); \
|
||||
exit(EXIT_FAILURE); \
|
||||
} \
|
||||
\
|
||||
vector->values[index] = vector->values[--vector->values_num]; \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _remove(zbx_vector_ ## __id ## _t *vector, int index) \
|
||||
{ \
|
||||
if (!(0 <= index && index < vector->values_num)) \
|
||||
{ \
|
||||
zabbix_log(LOG_LEVEL_CRIT, "removing a non-existent element at index %d", index); \
|
||||
exit(EXIT_FAILURE); \
|
||||
} \
|
||||
\
|
||||
vector->values_num--; \
|
||||
memmove(&vector->values[index], &vector->values[index + 1], \
|
||||
sizeof(__type) * (size_t)(vector->values_num - index)); \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _sort(zbx_vector_ ## __id ## _t *vector, zbx_compare_func_t compare_func) \
|
||||
{ \
|
||||
if (2 <= vector->values_num) \
|
||||
qsort(vector->values, (size_t)vector->values_num, sizeof(__type), compare_func); \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _uniq(zbx_vector_ ## __id ## _t *vector, zbx_compare_func_t compare_func) \
|
||||
{ \
|
||||
if (2 <= vector->values_num) \
|
||||
{ \
|
||||
int i, j = 1; \
|
||||
\
|
||||
for (i = 1; i < vector->values_num; i++) \
|
||||
{ \
|
||||
if (0 != compare_func(&vector->values[i - 1], &vector->values[i])) \
|
||||
vector->values[j++] = vector->values[i]; \
|
||||
} \
|
||||
\
|
||||
vector->values_num = j; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
int zbx_vector_ ## __id ## _nearestindex(const zbx_vector_ ## __id ## _t *vector, const __type value, \
|
||||
zbx_compare_func_t compare_func) \
|
||||
{ \
|
||||
int lo = 0, hi = vector->values_num, mid, c; \
|
||||
\
|
||||
while (1 <= hi - lo) \
|
||||
{ \
|
||||
mid = (lo + hi) / 2; \
|
||||
\
|
||||
c = compare_func(&vector->values[mid], &value); \
|
||||
\
|
||||
if (0 > c) \
|
||||
{ \
|
||||
lo = mid + 1; \
|
||||
} \
|
||||
else if (0 == c) \
|
||||
{ \
|
||||
return mid; \
|
||||
} \
|
||||
else \
|
||||
hi = mid; \
|
||||
} \
|
||||
\
|
||||
return hi; \
|
||||
} \
|
||||
\
|
||||
int zbx_vector_ ## __id ## _bsearch(const zbx_vector_ ## __id ## _t *vector, const __type value, \
|
||||
zbx_compare_func_t compare_func) \
|
||||
{ \
|
||||
__type *ptr; \
|
||||
\
|
||||
ptr = (__type *)zbx_bsearch(&value, vector->values, (size_t)vector->values_num, sizeof(__type), \
|
||||
compare_func); \
|
||||
\
|
||||
if (NULL != ptr) \
|
||||
return (int)(ptr - vector->values); \
|
||||
else \
|
||||
return FAIL; \
|
||||
} \
|
||||
\
|
||||
int zbx_vector_ ## __id ## _lsearch(const zbx_vector_ ## __id ## _t *vector, const __type value, int *index,\
|
||||
zbx_compare_func_t compare_func) \
|
||||
{ \
|
||||
while (*index < vector->values_num) \
|
||||
{ \
|
||||
int c = compare_func(&vector->values[*index], &value); \
|
||||
\
|
||||
if (0 > c) \
|
||||
{ \
|
||||
(*index)++; \
|
||||
continue; \
|
||||
} \
|
||||
\
|
||||
if (0 == c) \
|
||||
return SUCCEED; \
|
||||
\
|
||||
if (0 < c) \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
return FAIL; \
|
||||
} \
|
||||
\
|
||||
int zbx_vector_ ## __id ## _search(const zbx_vector_ ## __id ## _t *vector, const __type value, \
|
||||
zbx_compare_func_t compare_func) \
|
||||
{ \
|
||||
int index; \
|
||||
\
|
||||
for (index = 0; index < vector->values_num; index++) \
|
||||
{ \
|
||||
if (0 == compare_func(&vector->values[index], &value)) \
|
||||
return index; \
|
||||
} \
|
||||
\
|
||||
return FAIL; \
|
||||
} \
|
||||
\
|
||||
\
|
||||
void zbx_vector_ ## __id ## _setdiff(zbx_vector_ ## __id ## _t *left, const zbx_vector_ ## __id ## _t *right,\
|
||||
zbx_compare_func_t compare_func) \
|
||||
{ \
|
||||
int c, block_start, deleted = 0, left_index = 0, right_index = 0; \
|
||||
\
|
||||
while (left_index < left->values_num && right_index < right->values_num) \
|
||||
{ \
|
||||
c = compare_func(&left->values[left_index], &right->values[right_index]); \
|
||||
\
|
||||
if (0 >= c) \
|
||||
left_index++; \
|
||||
\
|
||||
if (0 <= c) \
|
||||
right_index++; \
|
||||
\
|
||||
if (0 != c) \
|
||||
continue; \
|
||||
\
|
||||
if (0 < deleted++) \
|
||||
{ \
|
||||
memmove(&left->values[block_start - deleted + 1], &left->values[block_start], \
|
||||
(size_t)(left_index - 1 - block_start) * sizeof(__type)); \
|
||||
} \
|
||||
\
|
||||
block_start = left_index; \
|
||||
} \
|
||||
\
|
||||
if (0 < deleted) \
|
||||
{ \
|
||||
memmove(&left->values[block_start - deleted], &left->values[block_start], \
|
||||
(size_t)(left->values_num - block_start) * sizeof(__type)); \
|
||||
left->values_num -= deleted; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _reserve(zbx_vector_ ## __id ## _t *vector, size_t size) \
|
||||
{ \
|
||||
if ((int)size > vector->values_alloc) \
|
||||
{ \
|
||||
vector->values_alloc = (int)size; \
|
||||
vector->values = (__type *)vector->mem_realloc_func(vector->values, \
|
||||
(size_t)vector->values_alloc * sizeof(__type)); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _clear(zbx_vector_ ## __id ## _t *vector) \
|
||||
{ \
|
||||
vector->values_num = 0; \
|
||||
}
|
||||
|
||||
#define ZBX_PTR_VECTOR_IMPL(__id, __type) \
|
||||
\
|
||||
ZBX_VECTOR_IMPL(__id, __type) \
|
||||
\
|
||||
void zbx_vector_ ## __id ## _clear_ext(zbx_vector_ ## __id ## _t *vector, \
|
||||
zbx_ ## __id ## _free_func_t free_func) \
|
||||
{ \
|
||||
if (0 != vector->values_num) \
|
||||
{ \
|
||||
int index; \
|
||||
\
|
||||
for (index = 0; index < vector->values_num; index++) \
|
||||
free_func(vector->values[index]); \
|
||||
\
|
||||
vector->values_num = 0; \
|
||||
} \
|
||||
}
|
||||
/* vector implementation end */
|
||||
|
||||
/* these functions are only for use with zbx_vector_XXX_clear_ext() */
|
||||
/* and only if the vector does not contain nested allocations */
|
||||
void zbx_ptr_free(void *data);
|
||||
void zbx_str_free(char *data);
|
||||
void zbx_free_tag(zbx_tag_t *tag);
|
||||
|
||||
/* these functions are only for use with zbx_vector_XXX_sort() */
|
||||
int zbx_compare_tags(const void *d1, const void *d2);
|
||||
int zbx_compare_tags_and_values(const void *d1, const void *d2);
|
||||
int zbx_compare_tags_natural(const void *d1, const void *d2);
|
||||
|
||||
/* 128 bit unsigned integer handling */
|
||||
void zbx_uinc128_64(zbx_uint128_t *base, zbx_uint64_t value);
|
||||
void zbx_uinc128_128(zbx_uint128_t *base, const zbx_uint128_t *value);
|
||||
void zbx_udiv128_64(zbx_uint128_t *result, const zbx_uint128_t *dividend, zbx_uint64_t value);
|
||||
void zbx_umul64_64(zbx_uint128_t *result, zbx_uint64_t value, zbx_uint64_t factor);
|
||||
|
||||
unsigned int zbx_isqrt32(unsigned int value);
|
||||
|
||||
/* forecasting */
|
||||
|
||||
#define ZBX_MATH_ERROR -1.0
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FIT_LINEAR,
|
||||
FIT_POLYNOMIAL,
|
||||
FIT_EXPONENTIAL,
|
||||
FIT_LOGARITHMIC,
|
||||
FIT_POWER,
|
||||
FIT_INVALID
|
||||
}
|
||||
zbx_fit_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MODE_VALUE,
|
||||
MODE_MAX,
|
||||
MODE_MIN,
|
||||
MODE_DELTA,
|
||||
MODE_AVG,
|
||||
MODE_INVALID
|
||||
}
|
||||
zbx_mode_t;
|
||||
|
||||
int zbx_fit_code(char *fit_str, zbx_fit_t *fit, unsigned *k, char **error);
|
||||
int zbx_mode_code(char *mode_str, zbx_mode_t *mode, char **error);
|
||||
double zbx_forecast(double *t, double *x, int n, double now, double time, zbx_fit_t fit, unsigned k, zbx_mode_t mode);
|
||||
double zbx_timeleft(double *t, double *x, int n, double now, double threshold, zbx_fit_t fit, unsigned k);
|
||||
|
||||
/* fifo queue of pointers */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void **values;
|
||||
int alloc_num;
|
||||
int head_pos;
|
||||
int tail_pos;
|
||||
}
|
||||
zbx_queue_ptr_t;
|
||||
|
||||
#define zbx_queue_ptr_empty(queue) ((queue)->head_pos == (queue)->tail_pos ? SUCCEED : FAIL)
|
||||
|
||||
int zbx_queue_ptr_values_num(zbx_queue_ptr_t *queue);
|
||||
void zbx_queue_ptr_reserve(zbx_queue_ptr_t *queue, int num);
|
||||
void zbx_queue_ptr_compact(zbx_queue_ptr_t *queue);
|
||||
void zbx_queue_ptr_create(zbx_queue_ptr_t *queue);
|
||||
void zbx_queue_ptr_destroy(zbx_queue_ptr_t *queue);
|
||||
void zbx_queue_ptr_push(zbx_queue_ptr_t *queue, void *value);
|
||||
void *zbx_queue_ptr_pop(zbx_queue_ptr_t *queue);
|
||||
void zbx_queue_ptr_remove_value(zbx_queue_ptr_t *queue, const void *value);
|
||||
|
||||
/* list item data */
|
||||
typedef struct list_item
|
||||
{
|
||||
struct list_item *next;
|
||||
void *data;
|
||||
}
|
||||
zbx_list_item_t;
|
||||
|
||||
/* list data */
|
||||
typedef struct
|
||||
{
|
||||
zbx_list_item_t *head;
|
||||
zbx_list_item_t *tail;
|
||||
zbx_mem_malloc_func_t mem_malloc_func;
|
||||
zbx_mem_realloc_func_t mem_realloc_func;
|
||||
zbx_mem_free_func_t mem_free_func;
|
||||
}
|
||||
zbx_list_t;
|
||||
|
||||
/* queue item data */
|
||||
typedef struct
|
||||
{
|
||||
zbx_list_t *list;
|
||||
zbx_list_item_t *current;
|
||||
zbx_list_item_t *next;
|
||||
}
|
||||
zbx_list_iterator_t;
|
||||
|
||||
void zbx_list_create(zbx_list_t *list);
|
||||
void zbx_list_create_ext(zbx_list_t *list, zbx_mem_malloc_func_t mem_malloc_func,
|
||||
zbx_mem_free_func_t mem_free_func);
|
||||
void zbx_list_destroy(zbx_list_t *list);
|
||||
int zbx_list_append(zbx_list_t *list, void *value, zbx_list_item_t **inserted);
|
||||
int zbx_list_insert_after(zbx_list_t *list, zbx_list_item_t *after, void *value, zbx_list_item_t **inserted);
|
||||
int zbx_list_prepend(zbx_list_t *list, void *value, zbx_list_item_t **inserted);
|
||||
int zbx_list_pop(zbx_list_t *list, void **value);
|
||||
int zbx_list_peek(const zbx_list_t *list, void **value);
|
||||
void zbx_list_iterator_init(zbx_list_t *list, zbx_list_iterator_t *iterator);
|
||||
int zbx_list_iterator_init_with(zbx_list_t *list, zbx_list_item_t *next, zbx_list_iterator_t *iterator);
|
||||
int zbx_list_iterator_next(zbx_list_iterator_t *iterator);
|
||||
int zbx_list_iterator_peek(const zbx_list_iterator_t *iterator, void **value);
|
||||
void zbx_list_iterator_clear(zbx_list_iterator_t *iterator);
|
||||
int zbx_list_iterator_equal(const zbx_list_iterator_t *iterator1, const zbx_list_iterator_t *iterator2);
|
||||
int zbx_list_iterator_isset(const zbx_list_iterator_t *iterator);
|
||||
void zbx_list_iterator_update(zbx_list_iterator_t *iterator);
|
||||
void *zbx_list_iterator_remove_next(zbx_list_iterator_t *iterator);
|
||||
|
||||
#endif /* ZABBIX_ZBXALGO_H */
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_ASYNCHTTPPOLLER_H
|
||||
#define ZABBIX_ASYNCHTTPPOLLER_H
|
||||
#include "zbxsysinc.h"
|
||||
|
||||
#if defined(HAVE_LIBCURL) && defined(HAVE_LIBEVENT)
|
||||
#include <event.h>
|
||||
|
||||
typedef void (*process_httpagent_result_callback_fn)(CURL *easy_handle, CURLcode err, void *arg);
|
||||
typedef void (*httpagent_action_callback_fn)(void *arg);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct event_base *ev;
|
||||
struct event *curl_timeout;
|
||||
CURLM *curl_handle;
|
||||
process_httpagent_result_callback_fn process_httpagent_result;
|
||||
httpagent_action_callback_fn http_agent_action;
|
||||
void *http_agent_arg;
|
||||
}
|
||||
zbx_asynchttppoller_config;
|
||||
|
||||
zbx_asynchttppoller_config *zbx_async_httpagent_create(struct event_base *ev,
|
||||
process_httpagent_result_callback_fn process_httpagent_result_callback,
|
||||
httpagent_action_callback_fn httpagent_action_callback, void *arg);
|
||||
void zbx_async_httpagent_clean(zbx_asynchttppoller_config *asynchttppoller_config);
|
||||
#endif
|
||||
#endif
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_ASYNCPOLLER_H
|
||||
#define ZABBIX_ASYNCPOLLER_H
|
||||
|
||||
#include "zbxcommon.h"
|
||||
#ifdef HAVE_LIBEVENT
|
||||
#include <event.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ZBX_ASYNC_TASK_READ,
|
||||
ZBX_ASYNC_TASK_WRITE,
|
||||
ZBX_ASYNC_TASK_STOP,
|
||||
|
||||
}
|
||||
zbx_async_task_state_t;
|
||||
|
||||
typedef int (*zbx_async_task_process_cb_t)(short event, void *data, int *fd, const char *addr, char *dnserr);
|
||||
typedef void (*zbx_async_task_clear_cb_t)(void *data);
|
||||
|
||||
void zbx_async_poller_add_task(struct event_base *ev, struct evdns_base *dnsbase, const char *addr,
|
||||
void *data, int timeout, zbx_async_task_process_cb_t process_cb, zbx_async_task_clear_cb_t clear_cb);
|
||||
#endif
|
||||
#endif
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_AUTOREG_H
|
||||
#define ZABBIX_AUTOREG_H
|
||||
|
||||
#include "zbxdbhigh.h"
|
||||
|
||||
void zbx_autoreg_host_free(zbx_autoreg_host_t *autoreg_host);
|
||||
|
||||
void zbx_autoreg_update_host(zbx_uint64_t proxyid, const char *host, const char *ip, const char *dns,
|
||||
unsigned short port, unsigned int connection_type, const char *host_metadata, unsigned short flags,
|
||||
int clock, const zbx_events_funcs_t *events_cbs);
|
||||
|
||||
void zbx_autoreg_flush_hosts(zbx_vector_ptr_t *autoreg_hosts, zbx_uint64_t proxyid,
|
||||
const zbx_events_funcs_t *events_cbs);
|
||||
|
||||
void zbx_autoreg_prepare_host(zbx_vector_ptr_t *autoreg_hosts, const char *host, const char *ip, const char *dns,
|
||||
unsigned short port, unsigned int connection_type, const char *host_metadata, unsigned short flag,
|
||||
int now);
|
||||
|
||||
#endif
|
@ -0,0 +1,140 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_AVAILABILITY_H
|
||||
#define ZABBIX_AVAILABILITY_H
|
||||
|
||||
#include "zbxtypes.h"
|
||||
#include "zbxdbhigh.h"
|
||||
#include "zbxipcservice.h"
|
||||
#include "zbxthreads.h"
|
||||
|
||||
/* agent (ZABBIX, SNMP, IPMI, JMX) availability data */
|
||||
typedef struct
|
||||
{
|
||||
/* flags specifying which fields are set, see ZBX_FLAGS_AGENT_STATUS_* defines */
|
||||
unsigned char flags;
|
||||
|
||||
/* agent availability fields */
|
||||
unsigned char available;
|
||||
char *error;
|
||||
int errors_from;
|
||||
int disable_until;
|
||||
}
|
||||
zbx_agent_availability_t;
|
||||
|
||||
#define ZBX_FLAGS_AGENT_STATUS_NONE 0x00000000
|
||||
#define ZBX_FLAGS_AGENT_STATUS_AVAILABLE 0x00000001
|
||||
#define ZBX_FLAGS_AGENT_STATUS_ERROR 0x00000002
|
||||
#define ZBX_FLAGS_AGENT_STATUS_ERRORS_FROM 0x00000004
|
||||
#define ZBX_FLAGS_AGENT_STATUS_DISABLE_UNTIL 0x00000008
|
||||
|
||||
#define ZBX_FLAGS_AGENT_STATUS (ZBX_FLAGS_AGENT_STATUS_AVAILABLE | \
|
||||
ZBX_FLAGS_AGENT_STATUS_ERROR | \
|
||||
ZBX_FLAGS_AGENT_STATUS_ERRORS_FROM | \
|
||||
ZBX_FLAGS_AGENT_STATUS_DISABLE_UNTIL)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t interfaceid;
|
||||
zbx_agent_availability_t agent;
|
||||
/* ensure chronological order in case of flapping interface availability */
|
||||
int id;
|
||||
}
|
||||
zbx_interface_availability_t;
|
||||
|
||||
ZBX_PTR_VECTOR_DECL(availability_ptr, zbx_interface_availability_t *)
|
||||
|
||||
void zbx_availability_send(zbx_uint32_t code, unsigned char *data, zbx_uint32_t size, zbx_ipc_message_t *response);
|
||||
void zbx_availabilities_flush(const zbx_vector_availability_ptr_t *interface_availabilities);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_hashset_t hosts;
|
||||
zbx_hashset_t queue;
|
||||
zbx_hashset_t proxy_avail;
|
||||
double last_status_refresh;
|
||||
double last_proxy_avail_refresh;
|
||||
}
|
||||
zbx_avail_active_hb_cache_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t hostid;
|
||||
int lastaccess_active;
|
||||
int heartbeat_freq;
|
||||
int active_status;
|
||||
}
|
||||
zbx_host_active_avail_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t hostid;
|
||||
int status;
|
||||
}
|
||||
zbx_proxy_hostdata_t;
|
||||
|
||||
ZBX_PTR_VECTOR_DECL(proxy_hostdata_ptr, zbx_proxy_hostdata_t *)
|
||||
|
||||
void zbx_availability_serialize_json_hostdata(zbx_vector_proxy_hostdata_ptr_t *hostdata, struct zbx_json *j);
|
||||
int zbx_get_active_agent_availability(zbx_uint64_t hostid);
|
||||
|
||||
void zbx_interface_availability_init(zbx_interface_availability_t *availability, zbx_uint64_t interfaceid);
|
||||
void zbx_interface_availability_clean(zbx_interface_availability_t *ia);
|
||||
void zbx_interface_availability_free(zbx_interface_availability_t *availability);
|
||||
void zbx_agent_availability_init(zbx_agent_availability_t *agent, unsigned char available, const char *error,
|
||||
int errors_from, int disable_until);
|
||||
|
||||
int zbx_interface_availability_is_set(const zbx_interface_availability_t *ia);
|
||||
|
||||
void zbx_db_update_interface_availabilities(const zbx_vector_availability_ptr_t *interface_availabilities);
|
||||
|
||||
void zbx_availability_serialize_interface(unsigned char **data, size_t *data_alloc, size_t *data_offset,
|
||||
const zbx_interface_availability_t *interface_availability);
|
||||
|
||||
void zbx_availability_deserialize(const unsigned char *data, zbx_uint32_t size,
|
||||
zbx_vector_availability_ptr_t *interface_availabilities);
|
||||
|
||||
void zbx_availability_deserialize_active_hb(const unsigned char *data, zbx_host_active_avail_t *avail);
|
||||
|
||||
zbx_uint32_t zbx_availability_serialize_active_heartbeat(unsigned char **data, zbx_uint64_t hostid,
|
||||
int heartbeat_freq);
|
||||
|
||||
zbx_uint32_t zbx_availability_serialize_hostdata(unsigned char **data, zbx_hashset_t *queue);
|
||||
void zbx_availability_deserialize_hostdata(const unsigned char *data, zbx_vector_proxy_hostdata_ptr_t *hostdata);
|
||||
|
||||
zbx_uint32_t zbx_availability_serialize_active_status_request(unsigned char **data, zbx_uint64_t hostid);
|
||||
void zbx_availability_deserialize_active_status_request(const unsigned char *data, zbx_uint64_t *hostid);
|
||||
|
||||
zbx_uint32_t zbx_availability_serialize_active_status_response(unsigned char **data, int status);
|
||||
void zbx_availability_deserialize_active_status_response(const unsigned char *data, int *status);
|
||||
|
||||
zbx_uint32_t zbx_availability_serialize_proxy_hostdata(unsigned char **data, zbx_vector_proxy_hostdata_ptr_t *hosts,
|
||||
zbx_uint64_t proxyid);
|
||||
void zbx_availability_deserialize_proxy_hostdata(const unsigned char *data,
|
||||
zbx_vector_proxy_hostdata_ptr_t *hostdata, zbx_uint64_t *proxyid);
|
||||
|
||||
zbx_uint32_t zbx_availability_serialize_hostids(unsigned char **data, zbx_vector_uint64_t *hostids);
|
||||
void zbx_availability_deserialize_hostids(const unsigned char *data, zbx_vector_uint64_t *hostids);
|
||||
|
||||
void zbx_availability_deserialize_active_proxy_hb_update(const unsigned char *data, zbx_uint64_t *hostid);
|
||||
|
||||
ZBX_THREAD_ENTRY(zbx_availability_manager_thread, args);
|
||||
|
||||
#endif /* ZABBIX_AVAILABILITY_H */
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,138 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_CACHEHISTORY_H
|
||||
#define ZABBIX_CACHEHISTORY_H
|
||||
|
||||
#include "zbxcacheconfig.h"
|
||||
#include "zbxshmem.h"
|
||||
|
||||
#define ZBX_SYNC_DONE 0
|
||||
#define ZBX_SYNC_MORE 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t history_counter; /* the total number of processed values */
|
||||
zbx_uint64_t history_float_counter; /* the number of processed float values */
|
||||
zbx_uint64_t history_uint_counter; /* the number of processed uint values */
|
||||
zbx_uint64_t history_str_counter; /* the number of processed str values */
|
||||
zbx_uint64_t history_log_counter; /* the number of processed log values */
|
||||
zbx_uint64_t history_text_counter; /* the number of processed text values */
|
||||
zbx_uint64_t history_bin_counter; /* the number of processed bin values */
|
||||
zbx_uint64_t notsupported_counter; /* the number of processed not supported items */
|
||||
}
|
||||
zbx_dc_stats_t;
|
||||
|
||||
/* the write cache statistics */
|
||||
typedef struct
|
||||
{
|
||||
zbx_dc_stats_t stats;
|
||||
zbx_uint64_t history_free;
|
||||
zbx_uint64_t history_total;
|
||||
zbx_uint64_t index_free;
|
||||
zbx_uint64_t index_total;
|
||||
zbx_uint64_t trend_free;
|
||||
zbx_uint64_t trend_total;
|
||||
}
|
||||
zbx_wcache_info_t;
|
||||
|
||||
void zbx_sync_history_cache(const zbx_events_funcs_t *events_cbs, int *values_num, int *triggers_num, int *more);
|
||||
void zbx_log_sync_history_cache_progress(void);
|
||||
|
||||
#define ZBX_SYNC_NONE 0
|
||||
#define ZBX_SYNC_ALL 1
|
||||
|
||||
typedef void (*zbx_history_sync_f)(int *values_num, int *triggers_num, const zbx_events_funcs_t *events_cbs, int *more);
|
||||
|
||||
int zbx_init_database_cache(zbx_get_program_type_f get_program_type, zbx_history_sync_f sync_history,
|
||||
zbx_uint64_t history_cache_size, zbx_uint64_t history_index_cache_size,zbx_uint64_t *trends_cache_size,
|
||||
char **error);
|
||||
|
||||
void zbx_free_database_cache(int sync, const zbx_events_funcs_t *events_cbs);
|
||||
|
||||
void zbx_sync_server_history(int *values_num, int *triggers_num, const zbx_events_funcs_t *events_cbs, int *more);
|
||||
|
||||
#define ZBX_STATS_HISTORY_COUNTER 0
|
||||
#define ZBX_STATS_HISTORY_FLOAT_COUNTER 1
|
||||
#define ZBX_STATS_HISTORY_UINT_COUNTER 2
|
||||
#define ZBX_STATS_HISTORY_STR_COUNTER 3
|
||||
#define ZBX_STATS_HISTORY_LOG_COUNTER 4
|
||||
#define ZBX_STATS_HISTORY_TEXT_COUNTER 5
|
||||
#define ZBX_STATS_NOTSUPPORTED_COUNTER 6
|
||||
#define ZBX_STATS_HISTORY_TOTAL 7
|
||||
#define ZBX_STATS_HISTORY_USED 8
|
||||
#define ZBX_STATS_HISTORY_FREE 9
|
||||
#define ZBX_STATS_HISTORY_PUSED 10
|
||||
#define ZBX_STATS_HISTORY_PFREE 11
|
||||
#define ZBX_STATS_TREND_TOTAL 12
|
||||
#define ZBX_STATS_TREND_USED 13
|
||||
#define ZBX_STATS_TREND_FREE 14
|
||||
#define ZBX_STATS_TREND_PUSED 15
|
||||
#define ZBX_STATS_TREND_PFREE 16
|
||||
#define ZBX_STATS_HISTORY_INDEX_TOTAL 17
|
||||
#define ZBX_STATS_HISTORY_INDEX_USED 18
|
||||
#define ZBX_STATS_HISTORY_INDEX_FREE 19
|
||||
#define ZBX_STATS_HISTORY_INDEX_PUSED 20
|
||||
#define ZBX_STATS_HISTORY_INDEX_PFREE 21
|
||||
#define ZBX_STATS_HISTORY_BIN_COUNTER 22
|
||||
|
||||
/* 'zbx_pp_value_opt_t' element 'flags' values */
|
||||
#define ZBX_PP_VALUE_OPT_NONE 0x0000 /* 'zbx_pp_value_opt_t' has no data */
|
||||
#define ZBX_PP_VALUE_OPT_META 0x0001 /* 'zbx_pp_value_opt_t' has log metadata ('mtime' and 'lastlogsize') */
|
||||
#define ZBX_PP_VALUE_OPT_LOG 0x0002 /* 'zbx_pp_value_opt_t' has 'timestamp', 'severity', 'logeventid' and */
|
||||
/* 'source' data */
|
||||
|
||||
/* This structure is complementary data if value comes from preprocessing. */
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint32_t flags;
|
||||
int mtime;
|
||||
int timestamp;
|
||||
int severity;
|
||||
int logeventid;
|
||||
zbx_uint64_t lastlogsize;
|
||||
char *source;
|
||||
}
|
||||
zbx_pp_value_opt_t;
|
||||
|
||||
void zbx_pp_value_opt_clear(zbx_pp_value_opt_t *opt);
|
||||
|
||||
void *zbx_dc_get_stats(int request);
|
||||
void zbx_dc_get_stats_all(zbx_wcache_info_t *wcache_info);
|
||||
|
||||
zbx_uint64_t zbx_dc_get_nextid(const char *table_name, int num);
|
||||
|
||||
void zbx_dc_update_interfaces_availability(void);
|
||||
|
||||
void zbx_hc_get_diag_stats(zbx_uint64_t *items_num, zbx_uint64_t *values_num);
|
||||
void zbx_hc_get_mem_stats(zbx_shmem_stats_t *data, zbx_shmem_stats_t *index);
|
||||
void zbx_hc_get_items(zbx_vector_uint64_pair_t *items);
|
||||
|
||||
int zbx_db_trigger_queue_locked(void);
|
||||
void zbx_db_trigger_queue_unlock(void);
|
||||
|
||||
int zbx_hc_check_proxy(zbx_uint64_t proxyid);
|
||||
|
||||
void zbx_dc_add_history(zbx_uint64_t itemid, unsigned char item_value_type, unsigned char item_flags,
|
||||
AGENT_RESULT *result, const zbx_timespec_t *ts, unsigned char state, const char *error);
|
||||
void zbx_dc_add_history_variant(zbx_uint64_t itemid, unsigned char value_type, unsigned char item_flags,
|
||||
zbx_variant_t *value, zbx_timespec_t ts, const zbx_pp_value_opt_t *value_opt);
|
||||
void zbx_dc_flush_history(void);
|
||||
|
||||
#endif
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_CACHEHISTORY_PROXY_H
|
||||
#define ZABBIX_CACHEHISTORY_PROXY_H
|
||||
|
||||
#include "zbxdbhigh.h"
|
||||
|
||||
void zbx_sync_proxy_history(int *values_num, int *triggers_num, const zbx_events_funcs_t *events_cbs, int *more);
|
||||
|
||||
#endif
|
@ -0,0 +1,122 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_CACHEVALUE_H
|
||||
#define ZABBIX_CACHEVALUE_H
|
||||
|
||||
#include "zbxtypes.h"
|
||||
#include "zbxalgo.h"
|
||||
#include "zbxhistory.h"
|
||||
#include "zbxshmem.h"
|
||||
|
||||
/*
|
||||
* The Value Cache provides read caching of item historical data residing in history
|
||||
* tables. No components must read history tables manually. Instead all history data
|
||||
* must be read from the Value Cache.
|
||||
*
|
||||
* Usage notes:
|
||||
*
|
||||
* Initialization
|
||||
*
|
||||
* The value cache must be initialized at the start of the program with zbx_vc_init()
|
||||
* function. To ensure proper removal of shared memory the value cache must be destroyed
|
||||
* upon a program exit with zbx_vc_destroy() function.
|
||||
*
|
||||
* Adding data
|
||||
*
|
||||
* Whenever a new item value is added to system (history tables) the item value must be
|
||||
* also added added to Value Cache with zbx_dc_add_value() function to keep it up to date.
|
||||
*
|
||||
* Retrieving data
|
||||
*
|
||||
* The history data is accessed with zbx_vc_get_values() and zbx_vc_get_value()
|
||||
* functions. Afterwards the retrieved history data must be freed by the caller by using
|
||||
* either zbx_history_record_vector_destroy() function (free the zbx_vc_get_values()
|
||||
* call output) or zbx_history_record_clear() function (free the zbx_vc_get_value() call output).
|
||||
*
|
||||
* Locking
|
||||
*
|
||||
* The cache ensures synchronization between processes by using automatic locks whenever
|
||||
* a cache function (zbx_vc_*) is called and by providing manual cache locking functionality
|
||||
* with zbx_vc_lock()/zbx_vc_unlock() functions.
|
||||
*
|
||||
*/
|
||||
|
||||
#define ZBX_VC_MODE_NORMAL 0
|
||||
#define ZBX_VC_MODE_LOWMEM 1
|
||||
|
||||
/* indicates that all values from database are cached */
|
||||
#define ZBX_ITEM_STATUS_CACHED_ALL 1
|
||||
|
||||
/* the cache statistics */
|
||||
typedef struct
|
||||
{
|
||||
/* Value cache misses are new values cached during request and hits are calculated by */
|
||||
/* subtracting misses from the total number of values returned (0 if the number of */
|
||||
/* returned values is less than misses. */
|
||||
/* When performing count based requests the number of cached values might be greater */
|
||||
/* than number of returned values. This can skew the hits/misses ratio towards misses. */
|
||||
zbx_uint64_t hits;
|
||||
zbx_uint64_t misses;
|
||||
|
||||
zbx_uint64_t total_size;
|
||||
zbx_uint64_t free_size;
|
||||
|
||||
/* value cache operating mode - see ZBX_VC_MODE_* defines */
|
||||
int mode;
|
||||
}
|
||||
zbx_vc_stats_t;
|
||||
|
||||
/* item diagnostic statistics */
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t itemid;
|
||||
int values_num;
|
||||
int hourly_num;
|
||||
}
|
||||
zbx_vc_item_stats_t;
|
||||
|
||||
int zbx_vc_init(zbx_uint64_t value_cache_size, char **error);
|
||||
|
||||
void zbx_vc_destroy(void);
|
||||
|
||||
void zbx_vc_reset(void);
|
||||
|
||||
void zbx_vc_enable(void);
|
||||
|
||||
void zbx_vc_disable(void);
|
||||
|
||||
int zbx_vc_get_values(zbx_uint64_t itemid, unsigned char value_type, zbx_vector_history_record_t *values,
|
||||
int seconds, int count, const zbx_timespec_t *ts);
|
||||
|
||||
int zbx_vc_get_value(zbx_uint64_t itemid, unsigned char value_type, const zbx_timespec_t *ts,
|
||||
zbx_history_record_t *value);
|
||||
|
||||
int zbx_vc_add_values(zbx_vector_ptr_t *history, int *ret_flush);
|
||||
|
||||
int zbx_vc_get_statistics(zbx_vc_stats_t *stats);
|
||||
|
||||
void zbx_vc_remove_items_by_ids(zbx_vector_uint64_t *itemids);
|
||||
|
||||
void zbx_vc_get_diag_stats(zbx_uint64_t *items_num, zbx_uint64_t *values_num, int *mode);
|
||||
void zbx_vc_get_mem_stats(zbx_shmem_stats_t *mem);
|
||||
void zbx_vc_get_item_stats(zbx_vector_ptr_t *stats);
|
||||
void zbx_vc_flush_stats(void);
|
||||
|
||||
#endif
|
@ -0,0 +1,828 @@
|
||||
/*
|
||||
** Zabbix
|
||||
** Copyright (C) 2001-2023 Zabbix SIA
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**/
|
||||
|
||||
#ifndef ZABBIX_COMMON_H
|
||||
#define ZABBIX_COMMON_H
|
||||
|
||||
#include "zbxsysinc.h"
|
||||
#include "module.h"
|
||||
#include "version.h"
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
# define __try
|
||||
# define __except(x) if (0)
|
||||
#endif
|
||||
|
||||
#ifndef va_copy
|
||||
# if defined(__va_copy)
|
||||
# define va_copy(d, s) __va_copy(d, s)
|
||||
# else
|
||||
# define va_copy(d, s) memcpy(&d, &s, sizeof(va_list))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef snprintf
|
||||
# undef snprintf
|
||||
#endif
|
||||
#define snprintf ERROR_DO_NOT_USE_SNPRINTF_FUNCTION_TRY_TO_USE_ZBX_SNPRINTF
|
||||
|
||||
#ifdef sprintf
|
||||
# undef sprintf
|
||||
#endif
|
||||
#define sprintf ERROR_DO_NOT_USE_SPRINTF_FUNCTION_TRY_TO_USE_ZBX_SNPRINTF
|
||||
|
||||
#ifdef strncpy
|
||||
# undef strncpy
|
||||
#endif
|
||||
#define strncpy ERROR_DO_NOT_USE_STRNCPY_FUNCTION_TRY_TO_USE_ZBX_STRLCPY
|
||||
|
||||
#ifdef strcpy
|
||||
# undef strcpy
|
||||
#endif
|
||||
#define strcpy ERROR_DO_NOT_USE_STRCPY_FUNCTION_TRY_TO_USE_ZBX_STRLCPY
|
||||
|
||||
#ifdef vsprintf
|
||||
# undef vsprintf
|
||||
#endif
|
||||
#define vsprintf ERROR_DO_NOT_USE_VSPRINTF_FUNCTION_TRY_TO_USE_ZBX_VSNPRINTF
|
||||
|
||||
#ifdef strncat
|
||||
# undef strncat
|
||||
#endif
|
||||
#define strncat ERROR_DO_NOT_USE_STRNCAT_FUNCTION_TRY_TO_USE_ZBX_STRLCAT
|
||||
|
||||
#ifdef strncasecmp
|
||||
# undef strncasecmp
|
||||
#endif
|
||||
#define strncasecmp ERROR_DO_NOT_USE_STRNCASECMP_FUNCTION_TRY_TO_USE_ZBX_STRNCASECMP
|
||||
|
||||
#define ON 1
|
||||
#define OFF 0
|
||||
|
||||
#if defined(_WINDOWS)
|
||||
# define ZBX_SERVICE_NAME_LEN 64
|
||||
extern char ZABBIX_SERVICE_NAME[ZBX_SERVICE_NAME_LEN];
|
||||
extern char ZABBIX_EVENT_SOURCE[ZBX_SERVICE_NAME_LEN];
|
||||
|
||||
# pragma warning (disable: 4996) /* warning C4996: <function> was declared deprecated */
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 7
|
||||
# define ZBX_FALLTHROUGH __attribute__ ((fallthrough))
|
||||
#else
|
||||
# define ZBX_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
#define SUCCEED_OR_FAIL(result) (FAIL != (result) ? SUCCEED : FAIL)
|
||||
const char *zbx_sysinfo_ret_string(int ret);
|
||||
const char *zbx_result_string(int result);
|
||||
|
||||
#define MAX_ID_LEN 21
|
||||
#define MAX_STRING_LEN 2048
|
||||
#define MAX_BUFFER_LEN 65536
|
||||
#define ZBX_MAX_HOSTNAME_LEN 128
|
||||
#define ZBX_HOSTNAME_BUF_LEN (ZBX_MAX_HOSTNAME_LEN + 1)
|
||||
#define ZBX_MAX_DNSNAME_LEN 255 /* maximum host DNS name length from RFC 1035 */
|
||||
/*(without terminating '\0') */
|
||||
#define MAX_EXECUTE_OUTPUT_LEN (512 * ZBX_KIBIBYTE)
|
||||
|
||||
#define ZBX_MAX_UINT64 (~__UINT64_C(0))
|
||||
#define ZBX_MAX_UINT64_LEN 21
|
||||
#define ZBX_MAX_DOUBLE_LEN 24
|
||||
|
||||
#define ZBX_SIZE_T_MAX (~(size_t)0)
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Macro: ZBX_UNUSED *
|
||||
* *
|
||||
* Purpose: silences compiler warning about unused function parameter *
|
||||
* *
|
||||
* Parameters: *
|
||||
* var - [IN] the unused parameter *
|
||||
* *
|
||||
* Comments: Use only on unused, non-volatile function parameters! *
|
||||
* *
|
||||
******************************************************************************/
|
||||
#define ZBX_UNUSED(var) (void)(var)
|
||||
|
||||
/* item types */
|
||||
typedef enum
|
||||
{
|
||||
ITEM_TYPE_ZABBIX = 0,
|
||||
/* ITEM_TYPE_SNMPv1,*/
|
||||
ITEM_TYPE_TRAPPER = 2,
|
||||
ITEM_TYPE_SIMPLE,
|
||||
/* ITEM_TYPE_SNMPv2c,*/
|
||||
ITEM_TYPE_INTERNAL = 5,
|
||||
/* ITEM_TYPE_SNMPv3,*/
|
||||
ITEM_TYPE_ZABBIX_ACTIVE = 7,
|
||||
/* ITEM_TYPE_AGGREGATE, */
|
||||
ITEM_TYPE_HTTPTEST = 9,
|
||||
ITEM_TYPE_EXTERNAL,
|
||||
ITEM_TYPE_DB_MONITOR,
|
||||
ITEM_TYPE_IPMI,
|
||||
ITEM_TYPE_SSH,
|
||||
ITEM_TYPE_TELNET,
|
||||
ITEM_TYPE_CALCULATED,
|
||||
ITEM_TYPE_JMX,
|
||||
ITEM_TYPE_SNMPTRAP,
|
||||
ITEM_TYPE_DEPENDENT,
|
||||
ITEM_TYPE_HTTPAGENT,
|
||||
ITEM_TYPE_SNMP,
|
||||
ITEM_TYPE_SCRIPT /* 21 */
|
||||
}
|
||||
zbx_item_type_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
INTERFACE_TYPE_UNKNOWN = 0,
|
||||
INTERFACE_TYPE_AGENT,
|
||||
INTERFACE_TYPE_SNMP,
|
||||
INTERFACE_TYPE_IPMI,
|
||||
INTERFACE_TYPE_JMX,
|
||||
INTERFACE_TYPE_OPT = 254,
|
||||
INTERFACE_TYPE_ANY = 255
|
||||
}
|
||||
zbx_interface_type_t;
|
||||
const char *zbx_interface_type_string(zbx_interface_type_t type);
|
||||
|
||||
#define INTERFACE_TYPE_COUNT 4 /* number of interface types */
|
||||
extern const int INTERFACE_TYPE_PRIORITY[INTERFACE_TYPE_COUNT];
|
||||
|
||||
#define SNMP_BULK_DISABLED 0
|
||||
#define SNMP_BULK_ENABLED 1
|
||||
|
||||
#define ZBX_IF_SNMP_VERSION_1 1
|
||||
#define ZBX_IF_SNMP_VERSION_2 2
|
||||
#define ZBX_IF_SNMP_VERSION_3 3
|
||||
|
||||
#define ZBX_FLAG_DISCOVERY_NORMAL 0x00
|
||||
#define ZBX_FLAG_DISCOVERY_RULE 0x01
|
||||
#define ZBX_FLAG_DISCOVERY_PROTOTYPE 0x02
|
||||
#define ZBX_FLAG_DISCOVERY_CREATED 0x04
|
||||
|
||||
#define ZBX_HOST_PROT_INTERFACES_INHERIT 0
|
||||
#define ZBX_HOST_PROT_INTERFACES_CUSTOM 1
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ITEM_AUTHTYPE_PASSWORD = 0,
|
||||
ITEM_AUTHTYPE_PUBLICKEY
|
||||
}
|
||||
zbx_item_authtype_t;
|
||||
|
||||
/* event status */
|
||||
#define EVENT_STATUS_RESOLVED 0
|
||||
#define EVENT_STATUS_PROBLEM 1
|
||||
|
||||
/* event sources */
|
||||
#define EVENT_SOURCE_TRIGGERS 0
|
||||
#define EVENT_SOURCE_DISCOVERY 1
|
||||
#define EVENT_SOURCE_AUTOREGISTRATION 2
|
||||
#define EVENT_SOURCE_INTERNAL 3
|
||||
#define EVENT_SOURCE_SERVICE 4
|
||||
#define EVENT_SOURCE_COUNT 5
|
||||
|
||||
/* event objects */
|
||||
#define EVENT_OBJECT_TRIGGER 0
|
||||
#define EVENT_OBJECT_DHOST 1
|
||||
#define EVENT_OBJECT_DSERVICE 2
|
||||
#define EVENT_OBJECT_ZABBIX_ACTIVE 3
|
||||
#define EVENT_OBJECT_ITEM 4
|
||||
#define EVENT_OBJECT_LLDRULE 5
|
||||
#define EVENT_OBJECT_SERVICE 6
|
||||
|
||||
/* acknowledged flags */
|
||||
#define EVENT_NOT_ACKNOWLEDGED 0
|
||||
#define EVENT_ACKNOWLEDGED 1
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DOBJECT_STATUS_UP = 0,
|
||||
DOBJECT_STATUS_DOWN,
|
||||
DOBJECT_STATUS_DISCOVER,
|
||||
DOBJECT_STATUS_LOST
|
||||
}
|
||||
zbx_dstatus_t;
|
||||
|
||||
/* item value types */
|
||||
typedef enum
|
||||
{
|
||||
ITEM_VALUE_TYPE_FLOAT = 0,
|
||||
ITEM_VALUE_TYPE_STR,
|
||||
ITEM_VALUE_TYPE_LOG,
|
||||
ITEM_VALUE_TYPE_UINT64,
|
||||
ITEM_VALUE_TYPE_TEXT,
|
||||
ITEM_VALUE_TYPE_BIN, /* Last real value. In some places it is also used in size of array or */
|
||||
/* upper bound for iteration. Do not forget to update when adding new types. */
|
||||
ITEM_VALUE_TYPE_NONE /* Artificial value, not written into DB, used internally in server. */
|
||||
}
|
||||
zbx_item_value_type_t;
|
||||
const char *zbx_item_value_type_string(zbx_item_value_type_t value_type);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int timestamp;
|
||||
int logeventid;
|
||||
int severity;
|
||||
char *source;
|
||||
char *value;
|
||||
}
|
||||
zbx_log_value_t;
|
||||
|
||||
/* value for not supported items */
|
||||
#define ZBX_NOTSUPPORTED "ZBX_NOTSUPPORTED"
|
||||
/* the error message for not supported items when reason is unknown */
|
||||
#define ZBX_NOTSUPPORTED_MSG "Unknown error."
|
||||
|
||||
/* Zabbix Agent non-critical error (agents older than 2.0) */
|
||||
#define ZBX_ERROR "ZBX_ERROR"
|
||||
|
||||
|
||||
/* program type */
|
||||
#define ZBX_PROGRAM_TYPE_SERVER 0x01
|
||||
#define ZBX_PROGRAM_TYPE_PROXY_ACTIVE 0x02
|
||||
#define ZBX_PROGRAM_TYPE_PROXY_PASSIVE 0x04
|
||||
#define ZBX_PROGRAM_TYPE_PROXY 0x06 /* ZBX_PROGRAM_TYPE_PROXY_ACTIVE | ZBX_PROGRAM_TYPE_PROXY_PASSIVE */
|
||||
#define ZBX_PROGRAM_TYPE_AGENTD 0x08
|
||||
#define ZBX_PROGRAM_TYPE_SENDER 0x10
|
||||
#define ZBX_PROGRAM_TYPE_GET 0x20
|
||||
const char *get_program_type_string(unsigned char program_type);
|
||||
|
||||
/* process type */
|
||||
#define ZBX_PROCESS_TYPE_POLLER 0
|
||||
#define ZBX_PROCESS_TYPE_UNREACHABLE 1
|
||||
#define ZBX_PROCESS_TYPE_IPMIPOLLER 2
|
||||
#define ZBX_PROCESS_TYPE_PINGER 3
|
||||
#define ZBX_PROCESS_TYPE_JAVAPOLLER 4
|
||||
#define ZBX_PROCESS_TYPE_HTTPPOLLER 5
|
||||
#define ZBX_PROCESS_TYPE_TRAPPER 6
|
||||
#define ZBX_PROCESS_TYPE_SNMPTRAPPER 7
|
||||
#define ZBX_PROCESS_TYPE_PROXYPOLLER 8
|
||||
#define ZBX_PROCESS_TYPE_ESCALATOR 9
|
||||
#define ZBX_PROCESS_TYPE_HISTSYNCER 10
|
||||
#define ZBX_PROCESS_TYPE_DISCOVERER 11
|
||||
#define ZBX_PROCESS_TYPE_ALERTER 12
|
||||
#define ZBX_PROCESS_TYPE_TIMER 13
|
||||
#define ZBX_PROCESS_TYPE_HOUSEKEEPER 14
|
||||
#define ZBX_PROCESS_TYPE_DATASENDER 15
|
||||
#define ZBX_PROCESS_TYPE_CONFSYNCER 16
|
||||
#define ZBX_PROCESS_TYPE_SELFMON 17
|
||||
#define ZBX_PROCESS_TYPE_VMWARE 18
|
||||
#define ZBX_PROCESS_TYPE_COLLECTOR 19
|
||||
#define ZBX_PROCESS_TYPE_LISTENER 20
|
||||
#define ZBX_PROCESS_TYPE_ACTIVE_CHECKS 21
|
||||
#define ZBX_PROCESS_TYPE_TASKMANAGER 22
|
||||
#define ZBX_PROCESS_TYPE_IPMIMANAGER 23
|
||||
#define ZBX_PROCESS_TYPE_ALERTMANAGER 24
|
||||
#define ZBX_PROCESS_TYPE_PREPROCMAN 25
|
||||
#define ZBX_PROCESS_TYPE_PREPROCESSOR 26
|
||||
#define ZBX_PROCESS_TYPE_LLDMANAGER 27
|
||||
#define ZBX_PROCESS_TYPE_LLDWORKER 28
|
||||
#define ZBX_PROCESS_TYPE_ALERTSYNCER 29
|
||||
#define ZBX_PROCESS_TYPE_HISTORYPOLLER 30
|
||||
#define ZBX_PROCESS_TYPE_AVAILMAN 31
|
||||
#define ZBX_PROCESS_TYPE_REPORTMANAGER 32
|
||||
#define ZBX_PROCESS_TYPE_REPORTWRITER 33
|
||||
#define ZBX_PROCESS_TYPE_SERVICEMAN 34
|
||||
#define ZBX_PROCESS_TYPE_TRIGGERHOUSEKEEPER 35
|
||||
#define ZBX_PROCESS_TYPE_ODBCPOLLER 36
|
||||
#define ZBX_PROCESS_TYPE_CONNECTORMANAGER 37
|
||||
#define ZBX_PROCESS_TYPE_CONNECTORWORKER 38
|
||||
#define ZBX_PROCESS_TYPE_DISCOVERYMANAGER 39
|
||||
#define ZBX_PROCESS_TYPE_HTTPAGENT_POLLER 40
|
||||
#define ZBX_PROCESS_TYPE_AGENT_POLLER 41
|
||||
#define ZBX_PROCESS_TYPE_SNMP_POLLER 42
|
||||
#define ZBX_PROCESS_TYPE_COUNT 43 /* number of process types */
|
||||
|
||||
/* special processes that are not present worker list */
|
||||
#define ZBX_PROCESS_TYPE_EXT_FIRST 126
|
||||
#define ZBX_PROCESS_TYPE_HA_MANAGER 126
|
||||
#define ZBX_PROCESS_TYPE_MAIN 127
|
||||
#define ZBX_PROCESS_TYPE_EXT_LAST 127
|
||||
|
||||
#define ZBX_PROCESS_TYPE_UNKNOWN 255
|
||||
|
||||
const char *get_process_type_string(unsigned char proc_type);
|
||||
int get_process_type_by_name(const char *proc_type_str);
|
||||
|
||||
/* user permissions */
|
||||
typedef enum
|
||||
{
|
||||
USER_TYPE_ZABBIX_USER = 1,
|
||||
USER_TYPE_ZABBIX_ADMIN,
|
||||
USER_TYPE_SUPER_ADMIN
|
||||
}
|
||||
zbx_user_type_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_uint64_t userid;
|
||||
zbx_user_type_t type;
|
||||
zbx_uint64_t roleid;
|
||||
char *username;
|
||||
}
|
||||
zbx_user_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PERM_DENY = 0,
|
||||
PERM_READ = 2,
|
||||
PERM_READ_WRITE
|
||||
}
|
||||
zbx_user_permission_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char type;
|
||||
unsigned char execute_on;
|
||||
char *port;
|
||||
unsigned char authtype;
|
||||
char *username;
|
||||
char *password;
|
||||
char *publickey;
|
||||
char *privatekey;
|
||||
char *command;
|
||||
char *command_orig;
|
||||
zbx_uint64_t scriptid;
|
||||
unsigned char host_access;
|
||||
int timeout;
|
||||
}
|
||||
zbx_script_t;
|
||||
|
||||
#define ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT 0
|
||||
#define ZBX_SCRIPT_TYPE_IPMI 1
|
||||
#define ZBX_SCRIPT_TYPE_SSH 2
|
||||
#define ZBX_SCRIPT_TYPE_TELNET 3
|
||||
#define ZBX_SCRIPT_TYPE_WEBHOOK 5
|
||||
|
||||
#define ZBX_SCRIPT_SCOPE_ACTION 1
|
||||
#define ZBX_SCRIPT_SCOPE_HOST 2
|
||||
#define ZBX_SCRIPT_SCOPE_EVENT 4
|
||||
|
||||
#define ZBX_SCRIPT_EXECUTE_ON_AGENT 0
|
||||
#define ZBX_SCRIPT_EXECUTE_ON_SERVER 1
|
||||
#define ZBX_SCRIPT_EXECUTE_ON_PROXY 2 /* fall back to execution on server if target not monitored by proxy */
|
||||
|
||||
#define POLLER_DELAY 5
|
||||
#define DISCOVERER_DELAY 5
|
||||
|
||||
#define HOUSEKEEPER_STARTUP_DELAY 30 /* in minutes */
|
||||
|
||||
#define ZBX_DEFAULT_INTERVAL SEC_PER_MIN
|
||||
|
||||
#define GET_SENDER_TIMEOUT 60
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define zbx_calloc(old, nmemb, size) zbx_calloc2(__FILE__, __LINE__, old, nmemb, size)
|
||||
#define zbx_malloc(old, size) zbx_malloc2(__FILE__, __LINE__, old, size)
|
||||
#define zbx_realloc(src, size) zbx_realloc2(__FILE__, __LINE__, src, size)
|
||||
#define zbx_strdup(old, str) zbx_strdup2(__FILE__, __LINE__, old, str)
|
||||
|
||||
#define ZBX_STRDUP(var, str) (var = zbx_strdup(var, str))
|
||||
|
||||
void *zbx_calloc2(const char *filename, int line, void *old, size_t nmemb, size_t size);
|
||||
void *zbx_malloc2(const char *filename, int line, void *old, size_t size);
|
||||
void *zbx_realloc2(const char *filename, int line, void *old, size_t size);
|
||||
char *zbx_strdup2(const char *filename, int line, char *old, const char *str);
|
||||
|
||||
void *zbx_guaranteed_memset(void *v, int c, size_t n);
|
||||
|
||||
#if defined(_WINDOWS) || defined(__MINGW32__)
|
||||
# define zbx_get_thread_id() (long int)GetCurrentThreadId()
|
||||
#else
|
||||
# define zbx_get_thread_id() (long int)getpid()
|
||||
#endif
|
||||
|
||||
#define zbx_free(ptr) \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
if (ptr) \
|
||||
{ \
|
||||
free(ptr); \
|
||||
ptr = NULL; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define zbx_fclose(file) \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
if (file) \
|
||||
{ \
|
||||
fclose(file); \
|
||||
file = NULL; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define THIS_SHOULD_NEVER_HAPPEN \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
zbx_error("ERROR [file and function: <%s,%s>, revision:%s, line:%d] Something impossible has just" \
|
||||
" happened.", __FILE__, __func__, ZABBIX_REVISION, __LINE__); \
|
||||
zbx_backtrace(); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* to avoid dependency on libzbxnix.a */
|
||||
#define THIS_SHOULD_NEVER_HAPPEN_NO_BACKTRACE \
|
||||
zbx_error("ERROR [file and function: <%s,%s>, revision:%s, line:%d] Something impossible has just" \
|
||||
" happened.", __FILE__, __func__, ZABBIX_REVISION, __LINE__)
|
||||
|
||||
extern const char *progname;
|
||||
extern const char title_message[];
|
||||
extern const char syslog_app_name[];
|
||||
extern const char *usage_message[];
|
||||
extern const char *help_message[];
|
||||
|
||||
#define ARRSIZE(a) (sizeof(a) / sizeof(*a))
|
||||
|
||||
void zbx_help(void);
|
||||
void zbx_usage(void);
|
||||
void zbx_version(void);
|
||||
|
||||
const char *get_program_name(const char *path);
|
||||
typedef unsigned char (*zbx_get_program_type_f)(void);
|
||||
typedef const char *(*zbx_get_progname_f)(void);
|
||||
typedef int (*zbx_get_config_forks_f)(unsigned char process_type);
|
||||
typedef const char *(*zbx_get_config_str_f)(void);
|
||||
typedef int (*zbx_get_config_int_f)(void);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ZBX_TASK_START = 0,
|
||||
ZBX_TASK_PRINT_SUPPORTED,
|
||||
ZBX_TASK_TEST_METRIC,
|
||||
ZBX_TASK_SHOW_USAGE,
|
||||
ZBX_TASK_SHOW_VERSION,
|
||||
ZBX_TASK_SHOW_HELP,
|
||||
#ifdef _WINDOWS
|
||||
ZBX_TASK_INSTALL_SERVICE,
|
||||
ZBX_TASK_UNINSTALL_SERVICE,
|
||||
ZBX_TASK_START_SERVICE,
|
||||
ZBX_TASK_STOP_SERVICE
|
||||
#else
|
||||
ZBX_TASK_RUNTIME_CONTROL
|
||||
#endif
|
||||
}
|
||||
zbx_task_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HTTPTEST_AUTH_NONE = 0,
|
||||
HTTPTEST_AUTH_BASIC,
|
||||
HTTPTEST_AUTH_NTLM,
|
||||
HTTPTEST_AUTH_NEGOTIATE,
|
||||
HTTPTEST_AUTH_DIGEST,
|
||||
HTTPTEST_AUTH_BEARER
|
||||
}
|
||||
zbx_httptest_auth_t;
|
||||
|
||||
#define ZBX_TASK_FLAG_MULTIPLE_AGENTS 0x01
|
||||
#define ZBX_TASK_FLAG_FOREGROUND 0x02
|
||||
|
||||
typedef struct
|
||||
{
|
||||
zbx_task_t task;
|
||||
unsigned int flags;
|
||||
int data;
|
||||
char *opts;
|
||||
}
|
||||
ZBX_TASK_EX;
|
||||
|
||||
#define NET_DELAY_MAX (SEC_PER_MIN / 4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int values_num;
|
||||
int period_end;
|
||||
#define ZBX_PROXY_SUPPRESS_DISABLE 0x00
|
||||
#define ZBX_PROXY_SUPPRESS_ACTIVE 0x01
|
||||
#define ZBX_PROXY_SUPPRESS_MORE 0x02
|
||||
#define ZBX_PROXY_SUPPRESS_EMPTY 0x04
|
||||
#define ZBX_PROXY_SUPPRESS_ENABLE ( \
|
||||
ZBX_PROXY_SUPPRESS_ACTIVE | \
|
||||
ZBX_PROXY_SUPPRESS_MORE | \
|
||||
ZBX_PROXY_SUPPRESS_EMPTY)
|
||||
int flags;
|
||||
}
|
||||
zbx_proxy_suppress_t;
|
||||
|
||||
#define ZBX_RTC_MSG_SHIFT 0
|
||||
#define ZBX_RTC_SCOPE_SHIFT 8
|
||||
#define ZBX_RTC_DATA_SHIFT 16
|
||||
|
||||
#define ZBX_RTC_MSG_MASK 0x000000ff
|
||||
#define ZBX_RTC_SCOPE_MASK 0x0000ff00
|
||||
#define ZBX_RTC_DATA_MASK 0xffff0000
|
||||
|
||||
#define ZBX_RTC_GET_MSG(task) (int)(((unsigned int)task & ZBX_RTC_MSG_MASK) >> ZBX_RTC_MSG_SHIFT)
|
||||
#define ZBX_RTC_GET_SCOPE(task) (int)(((unsigned int)task & ZBX_RTC_SCOPE_MASK) >> ZBX_RTC_SCOPE_SHIFT)
|
||||
#define ZBX_RTC_GET_DATA(task) (int)(((unsigned int)task & ZBX_RTC_DATA_MASK) >> ZBX_RTC_DATA_SHIFT)
|
||||
|
||||
#define ZBX_RTC_MAKE_MESSAGE(msg, scope, data) (((zbx_uint32_t)msg << ZBX_RTC_MSG_SHIFT) | \
|
||||
((zbx_uint32_t)scope << ZBX_RTC_SCOPE_SHIFT) | \
|
||||
((zbx_uint32_t)data << ZBX_RTC_DATA_SHIFT))
|
||||
|
||||
#define ZBX_KIBIBYTE 1024
|
||||
#define ZBX_MEBIBYTE 1048576
|
||||
#define ZBX_GIBIBYTE 1073741824
|
||||
#define ZBX_TEBIBYTE __UINT64_C(1099511627776)
|
||||
|
||||
#define SEC_PER_MIN 60
|
||||
#define SEC_PER_HOUR 3600
|
||||
#define SEC_PER_DAY 86400
|
||||
#define SEC_PER_WEEK (7 * SEC_PER_DAY)
|
||||
#define SEC_PER_MONTH (30 * SEC_PER_DAY)
|
||||
#define SEC_PER_YEAR (365 * SEC_PER_DAY)
|
||||
#define ZBX_JAN_2038 2145916800
|
||||
#define ZBX_JAN_1970_IN_SEC 2208988800.0 /* 1970 - 1900 in seconds */
|
||||
|
||||
#define ZBX_MAX_RECV_DATA_SIZE (1 * ZBX_GIBIBYTE)
|
||||
#if defined(_WINDOWS)
|
||||
#define ZBX_MAX_RECV_LARGE_DATA_SIZE (1 * ZBX_GIBIBYTE)
|
||||
#else
|
||||
#define ZBX_MAX_RECV_LARGE_DATA_SIZE (__UINT64_C(16) * ZBX_GIBIBYTE)
|
||||
#endif
|
||||
|
||||
/* max length of base64 data */
|
||||
#define ZBX_MAX_B64_LEN (16 * ZBX_KIBIBYTE)
|
||||
|
||||
/* string functions that could not be moved into libzbxstr.a because they */
|
||||
/* are used by libzbxcommon.a */
|
||||
|
||||
/* used by log which will be part of common*/
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
# define __zbx_attr_format_printf(idx1, idx2) __attribute__((__format__(__printf__, (idx1), (idx2))))
|
||||
#else
|
||||
# define __zbx_attr_format_printf(idx1, idx2)
|
||||
#endif
|
||||
|
||||
/* used by cuid and also by log */
|
||||
size_t zbx_snprintf(char *str, size_t count, const char *fmt, ...) __zbx_attr_format_printf(3, 4);
|
||||
|
||||
/* could be moved into libzbxstr.a but it seems to be logically grouped with surrounding functions */
|
||||
void zbx_snprintf_alloc(char **str, size_t *alloc_len, size_t *offset, const char *fmt, ...)
|
||||
__zbx_attr_format_printf(4, 5);
|
||||
|
||||
/* used by log */
|
||||
size_t zbx_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
||||
|
||||
/* used by log */
|
||||
char *zbx_dsprintf(char *dest, const char *f, ...) __zbx_attr_format_printf(2, 3);
|
||||
|
||||
/* used by zbxcommon, setproctitle */
|
||||
size_t zbx_strlcpy(char *dst, const char *src, size_t siz);
|
||||
|
||||
/* used by dsprintf, which is used by log */
|
||||
char *zbx_dvsprintf(char *dest, const char *f, va_list args);
|
||||
|
||||
#define VALUE_ERRMSG_MAX 128
|
||||
#define ZBX_LENGTH_UNLIMITED 0x7fffffff
|
||||
|
||||
#if defined(_WINDOWS) || defined(__MINGW32__)
|
||||
wchar_t *zbx_acp_to_unicode(const char *acp_string);
|
||||
wchar_t *zbx_utf8_to_unicode(const char *utf8_string);
|
||||
wchar_t *zbx_oemcp_to_unicode(const char *oemcp_string);
|
||||
#endif
|
||||
/* string functions that could not be moved into libzbxstr.a because they */
|
||||
/* are used by libzbxcommon.a END */
|
||||
|
||||
char **zbx_setproctitle_init(int argc, char **argv);
|
||||
void zbx_setproctitle(const char *fmt, ...) __zbx_attr_format_printf(1, 2);
|
||||
void zbx_setproctitle_deinit(void);
|
||||
|
||||
void zbx_error(const char *fmt, ...) __zbx_attr_format_printf(1, 2);
|
||||
|
||||
/* misc functions */
|
||||
int zbx_validate_hostname(const char *hostname);
|
||||
|
||||
void zbx_backtrace(void);
|
||||
|
||||
int get_nearestindex(const void *p, size_t sz, int num, zbx_uint64_t id);
|
||||
int uint64_array_add(zbx_uint64_t **values, int *alloc, int *num, zbx_uint64_t value, int alloc_step);
|
||||
void uint64_array_remove(zbx_uint64_t *values, int *num, const zbx_uint64_t *rm_values, int rm_num);
|
||||
|
||||
#if defined(_WINDOWS) || defined(__MINGW32__)
|
||||
const OSVERSIONINFOEX *zbx_win_getversion(void);
|
||||
void zbx_wmi_get(const char *wmi_namespace, const char *wmi_query, double timeout, char **utf8_value);
|
||||
#endif
|
||||
|
||||
#if defined(_WINDOWS) || defined(__MINGW32__)
|
||||
typedef struct __stat64 zbx_stat_t;
|
||||
int __zbx_stat(const char *path, zbx_stat_t *buf);
|
||||
#else
|
||||
typedef struct stat zbx_stat_t;
|
||||
#endif /* _WINDOWS */
|
||||
|
||||
int MAIN_ZABBIX_ENTRY(int flags);
|
||||
|
||||
unsigned char get_interface_type_by_item_type(unsigned char type);
|
||||
|
||||
#define ZBX_SESSION_ACTIVE 0
|
||||
#define ZBX_SESSION_PASSIVE 1
|
||||
#define ZBX_AUTH_TOKEN_ENABLED 0
|
||||
#define ZBX_AUTH_TOKEN_DISABLED 1
|
||||
#define ZBX_AUTH_TOKEN_NEVER_EXPIRES 0
|
||||
|
||||
#define ZBX_DO_NOT_SEND_RESPONSE 0
|
||||
#define ZBX_SEND_RESPONSE 1
|
||||
|
||||
/* Do not forget to synchronize HOST_TLS_* definitions with DB schema ! */
|
||||
#define HOST_TLS_ISSUER_LEN 4096 /* for up to 1024 UTF-8 characters */
|
||||
#define HOST_TLS_ISSUER_LEN_MAX (HOST_TLS_ISSUER_LEN + 1)
|
||||
#define HOST_TLS_SUBJECT_LEN 4096 /* for up to 1024 UTF-8 characters */
|
||||
#define HOST_TLS_SUBJECT_LEN_MAX (HOST_TLS_SUBJECT_LEN + 1)
|
||||
#define HOST_TLS_PSK_IDENTITY_LEN 512 /* for up to 128 UTF-8 characters */
|
||||
#define HOST_TLS_PSK_IDENTITY_LEN_MAX (HOST_TLS_PSK_IDENTITY_LEN + 1)
|
||||
#define HOST_TLS_PSK_LEN 512 /* for up to 256 hex-encoded bytes (ASCII) */
|
||||
#define HOST_TLS_PSK_LEN_MAX (HOST_TLS_PSK_LEN + 1)
|
||||
#define HOST_TLS_PSK_LEN_MIN 32 /* for 16 hex-encoded bytes (128-bit PSK) */
|
||||
|
||||
#define ZBX_PSK_FOR_HOST 0x01 /* PSK can be used for a known host */
|
||||
#define ZBX_PSK_FOR_AUTOREG 0x02 /* PSK can be used for host autoregistration */
|
||||
#define ZBX_PSK_FOR_PROXY 0x04 /* PSK is configured on proxy */
|
||||
|
||||
void zbx_alarm_flag_set(void);
|
||||
void zbx_alarm_flag_clear(void);
|
||||
|
||||
#ifndef _WINDOWS
|
||||
unsigned int zbx_alarm_on(unsigned int seconds);
|
||||
unsigned int zbx_alarm_off(void);
|
||||
#endif
|
||||
|
||||
int zbx_alarm_timed_out(void);
|
||||
|
||||
#define zbx_bsearch(key, base, nmemb, size, compar) (0 == (nmemb) ? NULL : bsearch(key, base, nmemb, size, compar))
|
||||
|
||||
#define ZBX_PREPROC_NONE 0
|
||||
#define ZBX_PREPROC_MULTIPLIER 1
|
||||
#define ZBX_PREPROC_RTRIM 2
|
||||
#define ZBX_PREPROC_LTRIM 3
|
||||
#define ZBX_PREPROC_TRIM 4
|
||||
#define ZBX_PREPROC_REGSUB 5
|
||||
#define ZBX_PREPROC_BOOL2DEC 6
|
||||
#define ZBX_PREPROC_OCT2DEC 7
|
||||
#define ZBX_PREPROC_HEX2DEC 8
|
||||
#define ZBX_PREPROC_DELTA_VALUE 9
|
||||
#define ZBX_PREPROC_DELTA_SPEED 10
|
||||
#define ZBX_PREPROC_XPATH 11
|
||||
#define ZBX_PREPROC_JSONPATH 12
|
||||
#define ZBX_PREPROC_VALIDATE_RANGE 13
|
||||
#define ZBX_PREPROC_VALIDATE_REGEX 14
|
||||
#define ZBX_PREPROC_VALIDATE_NOT_REGEX 15
|
||||
#define ZBX_PREPROC_ERROR_FIELD_JSON 16
|
||||
#define ZBX_PREPROC_ERROR_FIELD_XML 17
|
||||
#define ZBX_PREPROC_ERROR_FIELD_REGEX 18
|
||||
#define ZBX_PREPROC_THROTTLE_VALUE 19
|
||||
#define ZBX_PREPROC_THROTTLE_TIMED_VALUE 20
|
||||
#define ZBX_PREPROC_SCRIPT 21
|
||||
#define ZBX_PREPROC_PROMETHEUS_PATTERN 22
|
||||
#define ZBX_PREPROC_PROMETHEUS_TO_JSON 23
|
||||
#define ZBX_PREPROC_CSV_TO_JSON 24
|
||||
#define ZBX_PREPROC_STR_REPLACE 25
|
||||
#define ZBX_PREPROC_VALIDATE_NOT_SUPPORTED 26
|
||||
#define ZBX_PREPROC_XML_TO_JSON 27
|
||||
#define ZBX_PREPROC_SNMP_WALK_TO_VALUE 28
|
||||
#define ZBX_PREPROC_SNMP_WALK_TO_JSON 29
|
||||
|
||||
/* custom on fail actions */
|
||||
#define ZBX_PREPROC_FAIL_DEFAULT 0
|
||||
#define ZBX_PREPROC_FAIL_DISCARD_VALUE 1
|
||||
#define ZBX_PREPROC_FAIL_SET_VALUE 2
|
||||
#define ZBX_PREPROC_FAIL_SET_ERROR 3
|
||||
|
||||
|
||||
|
||||
/* includes terminating '\0' */
|
||||
#define CUID_LEN 26
|
||||
void zbx_new_cuid(char *cuid);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *tag;
|
||||
char *value;
|
||||
}
|
||||
zbx_tag_t;
|
||||
|
||||
#define ZBX_STR2UCHAR(var, string) var = (unsigned char)atoi(string)
|
||||
|
||||
#define ZBX_CONST_STRING(str) "" str
|
||||
#define ZBX_CONST_STRLEN(str) (sizeof(ZBX_CONST_STRING(str)) - 1)
|
||||
|
||||
/* time and memory size suffixes */
|
||||
zbx_uint64_t suffix2factor(char c);
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* CODE BELOW IS LIBC WRAPPERS WHICH COULD BE LATER MOVED TO SEPARATE LIBRARY *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#define ZBX_MESSAGE_BUF_SIZE 1024
|
||||
|
||||
char *zbx_strerror(int errnum);
|
||||
|
||||
#if !defined(_WINDOWS)
|
||||
# if defined(HAVE_LIBPTHREAD)
|
||||
# define zbx_sigmask pthread_sigmask
|
||||
# else
|
||||
# define zbx_sigmask sigprocmask
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define ZBX_GET_CONFIG_VAR(type, varname, defvalue) \
|
||||
static type varname = defvalue; \
|
||||
static type get_##varname(void) \
|
||||
{ \
|
||||
return varname; \
|
||||
}
|
||||
|
||||
#define ZBX_GET_CONFIG_VAR2(type1, type2, varname, defvalue) \
|
||||
static type1 varname = defvalue; \
|
||||
static type2 get_##varname(void) \
|
||||
{ \
|
||||
return varname; \
|
||||
}
|
||||
|
||||
#define LOG_LEVEL_EMPTY 0 /* printing nothing (if not LOG_LEVEL_INFORMATION set) */
|
||||
#define LOG_LEVEL_CRIT 1
|
||||
#define LOG_LEVEL_ERR 2
|
||||
#define LOG_LEVEL_WARNING 3
|
||||
#define LOG_LEVEL_DEBUG 4
|
||||
#define LOG_LEVEL_TRACE 5
|
||||
|
||||
#define LOG_LEVEL_INFORMATION 127 /* printing in any case no matter what level set */
|
||||
|
||||
#define ZBX_CHECK_LOG_LEVEL(level) \
|
||||
((LOG_LEVEL_INFORMATION != (level) && \
|
||||
((level) > zbx_get_log_level() || LOG_LEVEL_EMPTY == (level))) ? FAIL : SUCCEED)
|
||||
|
||||
#ifdef HAVE___VA_ARGS__
|
||||
# define ZBX_ZABBIX_LOG_CHECK
|
||||
# define zabbix_log(level, ...) \
|
||||
\
|
||||
do \
|
||||
{ \
|
||||
if (SUCCEED == ZBX_CHECK_LOG_LEVEL(level)) \
|
||||
zbx_log_handle(level, __VA_ARGS__); \
|
||||
} \
|
||||
while (0)
|
||||
#else
|
||||
# define zabbix_log zbx_log_handle
|
||||
#endif
|
||||
|
||||
typedef void (*zbx_log_func_t)(int level, const char *fmt, va_list args);
|
||||
|
||||
void zbx_init_library_common(zbx_log_func_t log_func);
|
||||
void zbx_log_handle(int level, const char *fmt, ...);
|
||||
int zbx_get_log_level(void);
|
||||
void zbx_set_log_level(int level);
|
||||
const char *zbx_get_log_component_name(void);
|
||||
|
||||
#ifndef _WINDOWS
|
||||
void zabbix_increase_log_level(void);
|
||||
void zabbix_decrease_log_level(void);
|
||||
void zabbix_report_log_level_change(void);
|
||||
const char *zabbix_get_log_level_string(void);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int level;
|
||||
const char *name;
|
||||
}
|
||||
zbx_log_component_t;
|
||||
|
||||
void zbx_set_log_component(const char *name, zbx_log_component_t *component);
|
||||
void zbx_change_component_log_level(zbx_log_component_t *component, int direction);
|
||||
#endif
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue