Ad Widget

Collapse

use cscript with zabbix sender(windows)?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tristan
    Senior Member
    • Feb 2008
    • 110

    #1

    use cscript with zabbix sender(windows)?

    I use zabbix sender in a lot of linux scripts to send the output from awk and sed to my zabbix server. It works perfect, but if i do the same with the windows version it just send my text string(cscript) to the zabbix server.

    Has somebody a solution to this? or is this not possible?

    I use for my -o parameter a lot of characters for my expression like `'"{} but it just send the characters and not my cscript command.

    thnx!
  • bbrendon
    Senior Member
    • Sep 2005
    • 870

    #2
    I have a zabbix sender running somewhere on a windows box out there. I think its from 1.4. Its still working, so I know its possible.
    Unofficial Zabbix Expert
    Blog, Corporate Site

    Comment

    • Jason
      Senior Member
      • Nov 2007
      • 430

      #3
      I use several vbs scripts on windows to send back data using zabbix_sender and cscript and it works fine on both 1.4 & 1.6.

      Have you any sample windows code can post up?

      Comment

      • Tristan
        Senior Member
        • Feb 2008
        • 110

        #4
        in my zabbix_agentd.conf i use the following command:
        userParameter=biwrites[*],cscript //nologo c:\vma_beheer\scripts\fetchinfo.vbs $1 "BI Writes"

        when i use zabbix_sender i use the following command:
        zabbix_sender -vv -c zabbix_agentd.conf -k test -o cscript c:\vma_beheer\scripts\fetchinfo.vbs tmp.txt "BI Writes"

        I see in the verbose output only the word cscript.
        When i replace my script thing through a type command, it only sends "type" back. So it looks like that everything after the -o parameter is processed as a string, and only the first word.

        I tried to use zabbix_sender within vbscript, but it still returned only the first word.

        i tried using "" or '' but nothing helps.

        WHen i use the zabbix_sender in my linux script i don't have any problem

        thnx for your help.

        Comment

        • Jason
          Senior Member
          • Nov 2007
          • 430

          #5
          I use the following and it works fine..

          UserParameter=systemStatePowerSupplyStatusCombined ,cscript.exe /nologo c:\zabbix\zabbix.vbs 127.0.0.1 .1.3.6.1.4.1.674.10892.1.200.10.1.9.1

          my zabbix.vbs script just does an snmpget for the value.

          The only thing that looks wrong with yours is that there are 2 // just before the nologo

          Comment

          • Tristan
            Senior Member
            • Feb 2008
            • 110

            #6
            I know..
            but this is the config file with the zabbix agent. that's not my problem.
            My problem is that i use zabbix_sender.exe within a few cmd scripts, and zabbix_sender.exe does'nt accpept the cscript command. It just returns the word "cscript" instead of the output of the script.

            so i have a script.cmd witch call's a zabbix_sender.exe with a few parameters.. and that won't work.
            I need this solution because i need to send data to zabbix on a specified time.

            Comment

            • Jason
              Senior Member
              • Nov 2007
              • 430

              #7
              From within vbs scripts I have a function I use to send data to zabbix..

              zsendpath is path to zabbix_sender You should be able to modify that to use cscript in the command line for zabbix_sender.

              function SendData(Zabbix_var,item_desc,data_item,DryRun)
              dim objShell, objScriptExec
              ' Check to see if print instead of send
              if DryRun then
              wscript.echo(item_desc & " : " & data_item)
              else
              ' Send the data to zabbix
              Set objShell = CreateObject("Wscript.Shell")
              Set objScriptExec = objShell.Exec(zsendpath & " -v " & Zabbix_opts & "-k " & Zabbix_var & " -o " & data_item)
              end if
              end function

              Comment

              • Tristan
                Senior Member
                • Feb 2008
                • 110

                #8
                thnx for your code.. It's almost the same as i used in a test script.
                Now i have just one problem: if i use for data_item a string ("this is a test"), then zabbix received only the word "this".

                I have fixed this to rewrite my code into C++ and add it to zabbix_sender.exe
                This is also faster. Only problem is dat i need to recompile my zabbix_sender with every update.

                but thanx for your help!

                Comment

                • Jason
                  Senior Member
                  • Nov 2007
                  • 430

                  #9
                  Try using character or text for the data type?

                  Comment

                  • Tristan
                    Senior Member
                    • Feb 2008
                    • 110

                    #10
                    it is text. It works fine when i run zabbix_sender.exe from the commandline with the -o "this is a test"

                    I have this problem only with windows. But my C++ solution works perfect, so i stay with that.

                    Comment

                    Working...