Hi,
For custom ITEMs, in zabbix we create ITEM, and ITEM runs a custom scripts and capture value returned by the script (0 or 1 etc.) and store it in its DB. Based on this value returned, zabbix trigger turns ON/OFF.
But how to configure an ITEM to also capture comments returned by any particular script.
Suppose if we compose a script which check if perticular file is writable or not by zabbix user, following are the contents:
ITEM Name: check_file
TYPE: zabbix_agent
Type of info: FLOAT
Interval: 300 (5 mins)
Script:
check_writable.sh
echo "YES Writable" >> /tmp/test_file.txt
if [ $? == 0 ]
then
#File is writable
Return_value=1
else
#File is not writable
Return_value=0
fi
echo $Return_value
The value returned by above script will be examined by Trigger, and if '0' is returned, trigger will be turned ON to let administrator know that the file is no longer writable.
Now if the file is not writable, there may be several reasons, like "Disk Space Full" or "Permission Denied" etc. But that reason of not able to write to file is not displayed in zabbix.
Now suppose we make small modification in script and change to:
Script:
check_writable.sh
echo "YES Writable" >> /tmp/test_file.txt
if [ $? == 0 ]
then
echo File is writable
Return_value=1
else
echo "Disk Space Full"
Return_value=0
fi
echo $Return_value
The above script will also return some comments like "Disk Space Full".
Is there any way we can capture these comments and put in COMMENTS in triggers.
Please suggest.
Thanks & regards
Ashwani Jain
For custom ITEMs, in zabbix we create ITEM, and ITEM runs a custom scripts and capture value returned by the script (0 or 1 etc.) and store it in its DB. Based on this value returned, zabbix trigger turns ON/OFF.
But how to configure an ITEM to also capture comments returned by any particular script.
Suppose if we compose a script which check if perticular file is writable or not by zabbix user, following are the contents:
ITEM Name: check_file
TYPE: zabbix_agent
Type of info: FLOAT
Interval: 300 (5 mins)
Script:
check_writable.sh
echo "YES Writable" >> /tmp/test_file.txt
if [ $? == 0 ]
then
#File is writable
Return_value=1
else
#File is not writable
Return_value=0
fi
echo $Return_value
The value returned by above script will be examined by Trigger, and if '0' is returned, trigger will be turned ON to let administrator know that the file is no longer writable.
Now if the file is not writable, there may be several reasons, like "Disk Space Full" or "Permission Denied" etc. But that reason of not able to write to file is not displayed in zabbix.
Now suppose we make small modification in script and change to:
Script:
check_writable.sh
echo "YES Writable" >> /tmp/test_file.txt
if [ $? == 0 ]
then
echo File is writable
Return_value=1
else
echo "Disk Space Full"
Return_value=0
fi
echo $Return_value
The above script will also return some comments like "Disk Space Full".
Is there any way we can capture these comments and put in COMMENTS in triggers.
Please suggest.
Thanks & regards
Ashwani Jain
Comment