1. PHP / Говнокод #22413

    −104

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    #!/usr/bin/php
    <?php
    /**
     * Bukkit player online Munin plugin
     * ---------------------------------
     *
     * Shows the current online players
     * (parsed via JSONAPI)
     *
     * Read more about my plugins on my blog:
     * http://s.frd.mn/XJsryR
     *
     * Author: Jonas Friedmann (http://frd.mn)
     *
     */
    /**
     * JSONAPI configuration
     */
    $hostname = 'your-hostname';
    $username = 'your-username';
    $password = 'your-password';
    $salt     = 'your-salt';
    $port     = 20059;
    /**
     * !!! DO NOT EDIT THIS PART BELOW !!!
     */
    if ((count($argv) > 1) && ($argv[1] == 'config'))
    {
    print("graph_title Bukkit / JSONAPI - players online
    graph_category bukkit
    graph_vlabel players
    graph_args --base 1000 -l 0
    players.type GAUGE
    players.label players
    ");
    exit();
    }
    // Include JSONAPI.php SDK (get this file here: https://github.com/alecgorge/jsonapi/raw/master/sdk/php/JSONAPI.php)
    require('/var/cache/munin/JSONAPI.php');
    // Prepare API call
    $api = new JSONAPI($hostname, $port, $username, $password, $salt);
    $result = $api->call("getPlayerCount");
    // Check for success
    if ($result['result'] == 'success'){
      // Print values
      print('players.value ' . $result['success'] . "\n");
    }
    ?>

    Запостил: munin, 19 Февраля 2017

    Комментарии (7) RSS

    Добавить комментарий