Ad Widget

Collapse

[HOW] How I Create script in PHP and use in Zabbix?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • velrino
    Junior Member
    • Feb 2015
    • 1

    #1

    [HOW] How I Create script in PHP and use in Zabbix?

    Good morning

    I'm testing Zabbix , and would desaber how do I create a PHP script or Sheel Script ?

    Have to put in some folder ? Zabbix has the function to run automatically?

    My script

    PHP Code:

    #!/usr/bin/php
    <?php
    $used_space
    =chop(shell_exec("df -h / | grep -v Filesystem | awk '{print $5}'"));

    switch (
    $used_space) {
            case 
    "$used_space"85%":
            print 
    "OK - $used_space of disk space used.";
            exit(
    0);

            case 
    "$used_space== "85%":
            print 
    "WARNING - $used_space of disk space used.";
            exit(
    1);

            case 
    $used_space "85%":
            print 
    "CRITICAL - $used_space of disk space used.";
            exit(
    2);

            default:
            print 
    "UNKNOWN - $used_space of disk space used.";
            exit(
    3);
    }
    ?>
Working...