Ad Widget

Collapse

adding custom checks to zabbix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KingJustice
    Junior Member
    • Jan 2015
    • 1

    #1

    adding custom checks to zabbix

    we have recently made the decision to move from nagios to zabbix. and i'm actually very excited to try zabbix!

    just one question. i have a lot of existing scripts and all i want to do is how do i set up a script like this in zabbix??

    the below script must run on the remote node (the monitored node). i understand this particular script may already exists in the zabbix repository as this is only a process check. but i need to be able to set up other checks like it. checks that will need be passed parameters.

    i understand 'userParameter' can be used here. but i've been googling this for days and i see so many different confusinng things. so im hoping someone can show me exactly how to set this up in zabbix so i can begin importing all my custom scripts from nagios.

    Thank you all!

    Code:
    #!/bin/sh
    
    STATE_OK=0
    STATE_WARNING=1
    STATE_CRITICAL=2
    STATE_UNKNOWN=3
    
    UPROCESS="${1}"
    THRESHOLD=${2}
    
    if [ $# -ne 2 ] ; then
    
            echo "ERROR: No processname was specified!"
            exit $STATE_UNKNOWN
    
    elif [ $# -eq 1 ] ; then
    
            COUNT=$(ps -ef | egrep ${UPROCESS} | wc -l)
    
            if [ $COUNT -ge $THRESHOLD ] ; then
                    echo "OK: $COUNT $UPROCESS running"
                    exit ${STATE_OK}
            elif [ $COUNT -lt $THRESHOLD ] ; then
                    echo "CRITICAL: $COUNT $UPROCESS running"
                    exit ${STATE_CRITICAL}
            fi
    fi
  • Colttt
    Senior Member
    Zabbix Certified Specialist
    • Mar 2009
    • 878

    #2
    ok for this script you can use proc.num

    if you would like to run this script you can use UserParameter
    Example:

    UserParameter=name.u.like[*],/path/to/script $1

    then you must create an zabbix item key is:
    name.u.like[Paramter1,Paramter2]
    Debian-User

    Sorry for my bad english

    Comment

    Working...