Ad Widget

Collapse

Getting data from file thanks to custom scripts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spoofiz
    Junior Member
    • Apr 2006
    • 5

    #1

    Getting data from file thanks to custom scripts

    Hi all,
    Zabbix is really awesome (i've got "almost" whatever I want) so first of all i'd like to congratulate all the one who did this great work.

    I'm monitoring my Linux (FC4) station and others Unix hosts ... everything is ok.

    I've said "almost" because there is a thing i haven't figured out yet.

    Actually I was wondering how i could do to use my own scripts (in perl/sh/php or whatever language) and to get graphs from anything I want... --> For example i'd like to get the data that are stored in a csv file ...
    or to be more precise I'd like to know if we can tell to Zabbix to execute every 5 minutes a script that read a data in a file and store the value (every 5 minutes) ...

    Thanks for answer.
    Last edited by spoofiz; 10-04-2006, 16:20.
  • sbadger
    Member
    • Dec 2005
    • 81

    #2
    I am using a shell script to pull statistics out of a CSV file by using the following script:
    case $2 in
    "total") #Totol IO's
    grep -w $1 /home/zabbix/perf.txt|cut -d, -f2
    ;;
    "read") #Read Percentage
    grep -w $1 /home/zabbix/perf.txt|cut -d, -f3
    ;;
    "cache") #Cache Hit Percentage
    grep -w $1 /home/zabbix/perf.txt| cut -d, -f4
    ;;
    "cur-kb") #Current KB per second
    grep -w $1 /home/zabbix/perf.txt|cut -d, -f5
    ;;
    "max-kb") #Maximum KB per second
    grep -w $1 /home/zabbix/perf.txt|cut -d, -f6
    ;;
    "cur-io") #Current IO per second
    grep -w $1 /home/zabbix/perf.txt| cut -d, -f7
    ;;
    "max-io") #Maximum IO per second
    grep -w $1 /home/zabbix/perf.txt|cut -d, -f8
    ;;


    esac



    The $1 is the volume in our SAN and $2 is the parameter we are looking for.


    I hope this helps
    Last edited by sbadger; 10-04-2006, 22:44.

    Comment

    • spoofiz
      Junior Member
      • Apr 2006
      • 5

      #3
      Thanks for the example script ..

      How do you add this to Zabbix ?
      I mean.. where do you specify that zabbix must use this script to get those items ?

      Comment

      • sbadger
        Member
        • Dec 2005
        • 81

        #4
        In the server with script on it I put an entry in the zabbix_agentd.conf file that looks like this:
        UserParameter=san[*],/home/zabbix/san.sh $1 $2

        and then is the Zabbix frontend you just enter something like:
        san[volume,cache]
        as you key for the item.

        Comment

        • spoofiz
          Junior Member
          • Apr 2006
          • 5

          #5
          [Solved]

          Great ! Thanks a lot sbadger !

          Comment

          Working...