ZABBIX Forums  
  #11  
Old 09-04-2012, 23:35
richlv richlv is offline
Administrator
Zabbix Certified Specialist
 
Join Date: Oct 2005
Posts: 2,983
Default

could you please specify what you mean by "sending each line as item" ?

also, what do you consider to be missing from the sender documentation ? it was improved some time ago, and i considered it to be pretty great by now ;)
Reply With Quote
  #12  
Old 17-04-2012, 01:30
BrentN BrentN is offline
Member
 
Join Date: Mar 2012
Posts: 37
Default

Couple updates:

I stand corrected Richlv, I got the sender to send multiple line values from my powershell script. The syntax is still a bit confusing though. It doesn't clearly state how to get the host name from the conf file. It talks about it in the last example but it should explain it better than just an example. Also, the bit about getting sender to use stdin is sort of confusing. The order of the switches also appears to matter. Here's the only way I could get sender to use the conf file for all info and send a multi-line value (at the powershell prompt):

Code:
 .\zabbix_sender.exe -c zabbix_agentd.conf - -T -k trapperTest -o ($Result)
Would be a bit less confusing if when specifying a config file and no "-h" option, sender would default to the hostname in the config...


Ok - All of this brings me back to my original post. I've been able to use user parameters to cover most of the scripts I need to run, but there are a few that still need additional time to process and I don't want to resort to using the Windows Task Schedular or a 3rd party tool. Zabbix schedules things all the time (so to speak) - this should work.

So, I tried using an item with system.run to run the script in question (with the nowait switch) and the script can use sender (which now works as I'd like) to send the result back to another key. There ya go! I scheduled the script with Zabbix! Only.... Now I find out that system.run doesn't work on an agent that is purely using active checks. Darn.

Based on other threads I've found, it looks like this functionality has been requested but isn't on the short list, which is unfortunate. However - consider the following: Add that "nowait" option to user parameters. We'd still have to use sender to get data back into Zabbix, but at least we'd be able to execute longer running scripts without having to use yet another task scheduler.

:-)
Reply With Quote
  #13  
Old 17-04-2012, 16:47
richlv richlv is offline
Administrator
Zabbix Certified Specialist
 
Join Date: Oct 2005
Posts: 2,983
Default

Quote:
Originally Posted by BrentN View Post
Couple updates:

I stand corrected Richlv, I got the sender to send multiple line values from my powershell script. The syntax is still a bit confusing though. It doesn't clearly state how to get the host name from the conf file. It talks about it in the last example but it should explain it better than just an example. Also, the bit about getting sender to use stdin is sort of confusing. The order of the switches also appears to matter. Here's the only way I could get sender to use the conf file for all info and send a multi-line value (at the powershell prompt):

Code:
 .\zabbix_sender.exe -c zabbix_agentd.conf - -T -k trapperTest -o ($Result)
hmm. are we talking about the same sender ? :)

did you try the example from the manpage ?

echo "- hw.serial.number 1287872261 SQ4321ASDF" | zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -T -i -

Send a timestamped value from the commandline to Zabbix server, specified in the agent daemon configuration file. Dash in the input data indicates that hostname also should be used from the same configuration file.

Quote:
Originally Posted by BrentN View Post
Would be a bit less confusing if when specifying a config file and no "-h" option, sender would default to the hostname in the config...
-h, --help
Display this help and exit.

Quote:
Originally Posted by BrentN View Post
So, I tried using an item with system.run to run the script in question (with the nowait switch) and the script can use sender (which now works as I'd like) to send the result back to another key. There ya go! I scheduled the script with Zabbix! Only.... Now I find out that system.run doesn't work on an agent that is purely using active checks. Darn.
where did you see that system.run doesn't work as an active check ?
note... not remote commands. system.run item.
Reply With Quote
  #14  
Old 01-05-2012, 17:26
BrentN BrentN is offline
Member
 
Join Date: Mar 2012
Posts: 37
Default

You are correct, -h is help, I meant to say -s. All I'm saying is it could be made a little bit less confusing with some simple tweaks as I outlined in my previous reply.

You are also correct about system.run. Confusion on my part there. In case anybody comes across this thread while searching for help on system.run on a Windows active agent, here's the item I used to make this work. Note that %ZabbixRoot% is an env. variable with the root directory of our Zabbix agent.

This item runs a powershell script. The script returns data using Zabbix_Sender.

Code:
system.run[powershell.exe -NoLogo -NonInteractive -File "%ZabbixRoot%\scripts\WindowsUpdates.ps1",nowait]
Reply With Quote
Reply

Tags
external scripts agent

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 23:29.