承接 dubture/nagios-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dubture/nagios-php

最新稳定版本:0.0.2

Composer 安装命令:

composer require dubture/nagios-php

包简介

Nagios php plugin

README 文档

README

Build Status Scrutinizer Code Quality

Simple utility to help writing nagios plugins in PHP inspired by the Silex microframework.

Usage:

Example - check_hello :

<?php 

require_once __DIR__ . '/nagios.phar';

use Dubture\Nagios\Plugin;

$plugin = new Plugin();
$plugin->run(function($name, $foo = 'bar') use ($plugin) {
                
    return array(Plugin::OK, array('hello' => $name, $foo));
    
});

Running the above plugin using check_hello pulse00 will result in an nagios service state OK and the multiline output:

hello | pulse00
bar

The Dubture\Nagios\Plugin::run() method expects a Closure whose method signature determines the nagios plugin arguments. A parameter without a default value represents a mandatory argument, a parameter with a default value represents an optional argument.

The plugin in the above example has one mandatory argument name and an optional argument foo with the default value bar.

The Closure should return an array with the status code as the first element and the output as the second argument, which will be formatted after the following rules:

  • If the second array element is a string, the output is a single-line message
  • If the second array element is an array, the output is a multi-line message.
  • Every element of the multiline message can either be a simple message (literal value), or a message / performance output if the array paramater is a key/value pair.

Installation

Download and include the nagios.phar file. That's all.

统计信息

  • 总下载量: 25
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-03-14