mirror of
				https://github.com/limosek/zaf.git
				synced 2025-10-31 17:47:37 +01:00 
			
		
		
		
	Updated cfg creation process
This commit is contained in:
		
							
								
								
									
										14
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								README.md
									
									
									
									
									
								
							| @@ -145,6 +145,20 @@ Commands: | ||||
| ./zaf cache-clean		To remove all entries from cache | ||||
| ``` | ||||
|  | ||||
| Zaf can even communicate with zabbix server using its API.  If you set ZAF_ZBXAPI_URL, ZAF_ZBXAPI_USER and ZAF_ZBXAPI_PASS in /etc/zaf.conf, you can use it: | ||||
| ``` | ||||
| ./zaf api command [parameters] | ||||
| hostid 'host'			Get hostid from hostname | ||||
| host 'hostid'			Get hostname from hostid | ||||
| hostgroupid 'hostgroup'		Get hostgroup id from hostgroup | ||||
| hosts 'hostgroup'		Get hosts in group | ||||
| export-hosts dir [hostgroup]	Backup all hosts [in group] (get their config from zabbix and save to dir/hostname.xml) | ||||
| export-host 'host'		Backup host (get config from zabbix to stdout) | ||||
| import-template {plugin|file}	Import template for plugin or from file | ||||
| export-template 'name'		Export template to stdout | ||||
| export-templates dir		Export all template to dir | ||||
| ``` | ||||
|  | ||||
| ### Installing plugin | ||||
| To install plugin from common repository. If git is available, local git repo is tried first. If not, remote https repo is tried second. | ||||
| ``` | ||||
|   | ||||
| @@ -218,16 +218,13 @@ zaf_ctrl_generate_cfg() { | ||||
|                 $(which echo) "UserParameter=$ikey,${ZAF_LIB_DIR}/preload.sh $cache $lock$cmd"; | ||||
|                 continue | ||||
|             fi | ||||
|             cmd=$(zaf_ctrl_get_item_option $1 $i "Function") | ||||
|             if [ -n "$cmd" ]; then | ||||
|                 $(which echo) "UserParameter=$ikey,${ZAF_LIB_DIR}/preload.sh $cache $lock$cmd"; | ||||
|                 continue; | ||||
|             fi | ||||
|             cmd=$(zaf_ctrl_get_item_option $1 $i "Script") | ||||
|             if [ -n "$cmd" ]; then | ||||
|                 zaf_ctrl_get_item_option $1 $i "Script" >${ZAF_TMP_DIR}/${iscript}.sh; | ||||
|                 zaf_ctrl_get_item_option $1 $i "Script" | \ | ||||
| 		  zaf_far '{INCLUDES}' '. /etc/zaf.conf; . ${ZAF_LIB_DIR}/zaf.lib.sh; . ${ZAF_LIB_DIR}/ctrl.lib.sh; . ${ZAF_LIB_DIR}/zbxapi.lib.sh; . ${ZAF_LIB_DIR}/cache.lib.sh; ' \ | ||||
| 		  >${ZAF_TMP_DIR}/${iscript}.sh; | ||||
|                 zaf_install_bin ${ZAF_TMP_DIR}/${iscript}.sh ${ZAF_PLUGINS_DIR}/$2/ | ||||
|                 $(which echo) "UserParameter=$ikey,${ZAF_LIB_DIR}/preload.sh $cache $lock${ZAF_PLUGINS_DIR}/$2/${iscript}.sh $args"; | ||||
|                 $(which echo) "UserParameter=$ikey,$cache $lock${ZAF_PLUGINS_DIR}/$2/${iscript}.sh $args"; | ||||
|                 continue; | ||||
|             fi | ||||
| 	    zaf_err "Item $i declared in control file but has no Cmd, Function or Script!" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Lukas Macura
					Lukas Macura