首页 > xen > nagiospnp 添加模版替换默认模版

nagiospnp 添加模版替换默认模版

2010年8月25日 eric 发表评论 阅读评论

PNP,我们安装好了,有很多监控服务,都是使用的默认模版,而且有三条数据的,都不在同一图上显示,会出三个图,所以默认模版不可取,而且也难看。那么我就来添加新的模版替换掉默认模版。
添加模版呢,记得要与commands.cfg里的 check_cpu 名字相同。

比如我的 commands.cfg 里的 check_memory 我添加一个模版。

nagios $> cd /usr/local/pnp4nagios/share/templates
nagios $> vim check_memory.php
< ?php
#
# Copyright (c) 2006-2010 Joerg Linge (http://www.pnp4nagios.org)
# Plugin: check_load
#
$opt[1] = "--vertical-label MEMORY -l0  --title \"NGINX_MEMORY for $hostname / $servicedesc\" ";
#
#
#
$def[1] = rrd::def("var1", $RRDFILE[1], $DS[1], "AVERAGE");   //第一条数据 变量1
$def[1] .= rrd::def("var2", $RRDFILE[1], $DS[2], "AVERAGE");  //第二条数据 变量2
$def[1] .= rrd::def("var3", $RRDFILE[1], $DS[3], "AVERAGE");  //第三条数据 变量3
$def[1] .= rrd::def("var4", $RRDFILE[1], $DS[4], "AVERAGE");  //第四条数据 变量4

if ($WARN[1] != "") {
    $def[1] .= "HRULE:$WARN[1]#FFFF00 ";
}
if ($CRIT[1] != "") {
    $def[1] .= "HRULE:$CRIT[1]#FF0000 ";
}
$def[1] .= rrd::area("var1", "#ff0000", "TOTAL") ;
$def[1] .= rrd::gprint("var1", array("LAST", "AVERAGE", "MAX"), "%6.2lf");
$def[1] .= rrd::area("var2", "#0000FF", "FREE") ;
$def[1] .= rrd::gprint("var2", array("LAST", "AVERAGE", "MAX"), "%6.2lf");
$def[1] .= rrd::area("var3", "#00FFFF", "USED") ;
$def[1] .= rrd::gprint("var3", array("LAST", "AVERAGE", "MAX"), "%6.2lf");
$def[1] .= rrd::area("var4", "#00FF00", "CACHES") ;
$def[1] .= rrd::gprint("var4", array("LAST", "AVERAGE", "MAX"), "%6.2lf");
?>
#保存

PS:注意一点,首先要用默认的模版出一下图,然后在做自己的模版,这样的话就有几条数据,这样可以在模版上声明几条变量!
效果图:

pnp新建模版

转载请注明:文章转载自:Eric's linux and nginx! (http://www.nginxs.com)
本文地址:http://www.nginxs.com/linux/247.html

分类: xen 标签: , ,
  1. 2017年11月11日21:32 | #1

    Howdy very nice web site!! Guy .. Excellent .. Amazing ..
    I’ll bookmark your site and take the feeds additionally? I am satisfied to search out
    numerous useful information here within the
    put up, we need work out extra strategies in this regard, thanks for sharing.
    . . . . .

  2. 2017年11月12日06:30 | #2

    Hello! I know this is kind of off topic but I was wondering if you knew where I could locate a captcha plugin for my comment
    form? I’m using the same blog platform as yours and I’m having
    difficulty finding one? Thanks a lot!

  3. 2017年11月15日17:24 | #3

    To maintain your valuables in safety?

  4. 2017年11月16日02:00 | #4

    Do you have a spam issue on this blog; I also am a blogger, and I was
    wanting to know your situation; we have created some nice procedures and
    we are looking to swap techniques with other folks, be sure
    to shoot me an e-mail if interested.

  5. 2017年11月21日10:52 | #5

    Terrific article! This is the kind of info that are meant to be shared
    around the web. Shame on the search engines for
    not positioning this post upper! Come on over and consult
    with my web site . Thanks =)

  6. 2017年11月22日04:03 | #6

    Just wish to say your article is as astonishing. The clarity to your put up is
    just excellent and i can assume you’re a professional in this subject.
    Fine along with your permission allow me to take hold of your RSS feed to keep updated with imminent post.
    Thanks one million and please keep up the gratifying work.

  7. 2017年11月24日20:46 | #7

    Thanks for the marvelous posting! I quite
    enjoyed reading it, you can be a great author.
    I will remember to bookmark your blog and may come back from now on. I want
    to encourage continue your great work, have a nice weekend!

  8. 2017年11月29日05:47 | #8

    This is really interesting, You are a very skilled blogger.
    I have joined your feed and look forward to seeking more of your magnificent
    post. Also, I’ve shared your website in my social networks!

  9. 2017年11月29日06:23 | #9

    I think what you published was very reasonable.
    But, what about this? what if you added a little information? I mean, I don’t wish to tell you
    how to run your blog, however what if you added something
    that grabbed a person’s attention? I mean Eric's linux and nginx!
    » nagiospnp 添加模版替换默认模版 is a
    little vanilla. You might look at Yahoo’s home page and see how they write article headlines to grab viewers
    to click. You might try adding a video or a
    related picture or two to grab readers excited about what you’ve written. In my opinion, it could bring your posts a little bit more interesting.

  10. 2017年11月29日11:24 | #10

    Aw, this was a very nice post. Finding the time and actual effort to produce a very good article… but what
    can I say… I put things off a whole lot and don’t manage to get nearly anything done.

  11. 2017年12月1日13:22 | #11

    cash advance
    pay day loans
    payday loan online
    online loans
    pay day loans

  12. 2017年12月1日14:08 | #12

    What’s up to all, how is all, I think every one is getting more from this web site, and your views are nice designed
    for new viewers.

  13. 2017年12月2日17:03 | #13

    payday loan online
    payday loans
    payday loan online
    payday loans online
    cash advance loans

  14. 2017年12月5日01:27 | #14

    I have read so many content on the topic of the blogger lovers except this piece of
    writing is genuinely a pleasant paragraph, keep it up.

  15. 2017年12月8日09:54 | #15

    real money casino
    slot games
    free online casino games
    free online casino games
    free casino games

  16. 2017年12月10日08:54 | #16

    payday loans for bad credit
    online payday loans no credit check
    online payday loans no credit check
    payday loans for bad credit
    payday loans for bad credit

  17. 2017年12月18日04:25 | #17

    Right now it appears like BlogEngine is the top blogging platform out there right now.

    (from what I’ve read) Is that what you are using on your blog?

  18. 2017年12月18日16:51 | #18

    Thanks very nice blog!

  19. 2017年12月20日07:51 | #19

    casino games list
    casino games list
    online casino real money
    online casino games
    online casino games

  20. 2017年12月23日04:11 | #20

    payday loans online no credit check
    payday loans no credit
    payday loans no credit check
    payday loans no credit check
    payday loans online no credit check

  21. 2017年12月27日16:41 | #21

    Hi there, I want to subscribe for this web site to obtain latest updates, therefore where can i do it please help out.

  22. 2017年12月30日17:30 | #22

    free casino games
    free casino games
    casino online
    online casino
    online casino

  23. 2018年1月8日23:15 | #23

    Thanks for the good writeup. It actually used to
    be a entertainment account it. Look complicated to more introduced agreeable from
    you! By the way, how can we be in contact?

  24. 2018年1月11日16:18 | #24

    Attractive element of content. I just stumbled upon your blog and in accession capital to
    say that I acquire in fact loved account your weblog posts.
    Anyway I will be subscribing to your augment or
    even I achievement you get admission to persistently rapidly.

  25. 2018年1月12日10:23 | #25

    I’ll immediately grab your rss feed as I can’t in finding your e-mail subscription link or e-newsletter service.
    Do you’ve any? Please let me recognize so that I
    may subscribe. Thanks.

  26. 2018年1月13日19:12 | #26

    payday loans online no credit check
    loans no credit
    loans no credit check
    payday loans no credit
    loans no credit check

  27. 2018年1月18日01:56 | #27

    casino games
    online casino
    casino online
    casino online
    online slots

  28. 2018年1月20日04:29 | #28

    Greetings, I do think your blog may be having internet browser
    compatibility issues. Whenever I take a look at your site
    in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping issues.
    I merely wanted to give you a quick heads up! Apart from that, fantastic website!

  29. 2018年1月20日20:55 | #29

    Your style is really unique compared to other folks
    I’ve read stuff from. Many thanks for posting when you have the opportunity, Guess I’ll just bookmark this site.

评论分页
1 2 3 4 247
订阅评论
1+7= (必填)