Ad Widget

Collapse

The Key To Sending Traps/Scripts info to Specific hosts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • low10sws6
    Member
    • Oct 2008
    • 44

    #1

    The Key To Sending Traps/Scripts info to Specific hosts

    Comments?
    i know this works very well with scripts

    Code:
    //scripts ($script.sh 0.0.0.0)
    address=$1
    ----------------
    //traps
    read address
    address=`echo $address|cut -f2 -d' '`
    //
    
    ------------------------------------------------
    //adding this line should split up the Traps/scripts to different hosts
    gethostname=$(mysql -Dzabbix -uzabbix -pzabbix -e"Select host from hosts where ip='$address';" | tail -n1)
    
    ///sender
    $ZABBIX_SENDER -z $ZABBIX_SERVER -p $ZABBIX_PORT -s $gethostname -k $KEY -o "$str"
    no matter what your information your retrieving from a script or snmp trap in most in cases we only have the IP Address

    so a quick query to the database to match IP to get Hostname

    then using the zabbix sender to send it the the proxy

    just need a generic zbx trapper item/template configured in the web interface to apply to all you hosts

    then either use another zbx item to run the external script or by via cron
Working...