Type: Change Request
Affects Version/s: 1.8.2
Fix Version/s: 1.8.4
It should be possible to specify a hostname like "-" in the input file (-i option) to indicate that the hostname from the command line/config files should be used (-c and -s options).
Right now if I want to write a script using zabbix_sender I have to either hardcode the hostname into the script or write a parsing function that reads /etc/zabbix/zabbix_agentd.conf to get the hostname to put into the text file. That means either I have to duplicate configuration information and keep it in sync or I have to write extra code to do what is probably the most common use-case for this tool i.e. to send data for the host the tool is running on.
If a hostname of "-" would indicate "use the default hostname specified with -s or present in the config file specified by -c" then this would simplify things greatly.
A simple "zabbix_sender -z <server> -i <input>" would submit values for "this" server which probably is what people want most of the time. If the hostname changes in the config file then zabbix_sender would automatically pick this change up and keep working correctly. Right now you have to be careful to also change any scripts that generate the input files. The system would become more robust in the most common use-case.
" is a valid hostname this should be backwards compatible. Users who already specify a hostname can keep doing so and even a mixed mode is possible where some values specify a full hostname and others just "" for "this host".
The input file would look like this:
- mysql.connections 1234
- mysql.uptime 1234
MyHost mysql.selects 1234