Ad Widget

Collapse

Script Writing/Custom Check Writing best Practice Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SouperGrover
    Junior Member
    • May 2013
    • 22

    #1

    Script Writing/Custom Check Writing best Practice Question

    Hey all,

    One thing I love about Zabbix is how easy it is to make up your own custom checks. All you have to do is be able to feed it a value and tell it how to respond accordingly with a trigger. Awesome.

    I find that more often than not, the easiest thing for me to do in an environment is to write a script and run it on the agent PC to call the zabbix_sender process and feed it a value. For example, I made up a template for checking windows updates. I run a vbscript on the server which calls the zabbix_sender process and tells it how many updates need to be installed. Then I have an item set as a zabbix trapper that gets this, and a trigger that fires if the value is greater than zero. The script is set to run on a schedule as a Scheduled Task from within Windows. 99% of the time this all works great, but I'm wondering if this is the best way to do it.

    As I start to review this approach, there are a lot of pieces to make this work. A scheduled task, a vbscript, the zabbix_sender process, the items and the triggers. A couple of my pains with this apprach are the Task Scheduler can be flaky at times. Plus, if I update the script, I have to remember to update it on all of the servers. I'm wondering if there is a way to utilize Zabbix more to pull these off so there are less points of failure.

    It's the same for Linux custom checks. Substitute cron for Task Scheduler and bash/PHP/Perl for vbscript. It really isn't an OS issue. The question would apply to both

    Thanks for your advice!
  • SouperGrover
    Junior Member
    • May 2013
    • 22

    #2
    Ironically, a few days after I posted this my Zabbix server crashed and I had to rebuild the whole thing from scratch. Doing this gave me some insight and helped me answer my own question.

    I had read up on UserParameters and felt that extending zabbix in this way was going to be the best approach. Write my script, att a UserParameter line to the conf file on the host and create my items. This works great for checks that happen quickly (less than 30 seconds) because Zabbix has a timeout limit of 30 seconds.

    For things that may take a little longer to process and return a result (like checking for updates) a Scheduled task is still your best bet. I ended up feeding my results to zabbix_sender commands which updates the items on the zabbix server to monitor windows updates.

    Comment

    Working...