<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Mangal;
        panose-1:0 0 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:Mangal;
        panose-1:0 0 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">That depends on your definition of dynamically.  I would like to see it be able to add/remove hosts without requiring a restart of the service.  I currently
 use puppet, but it’s still just updating files and then you have to restart to pickup the changes.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Dan<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> ranjib dey [mailto:dey.ranjib@gmail.com]
<br>
<b>Sent:</b> Friday, February 10, 2012 11:42 PM<br>
<b>To:</b> Nagios Users List<br>
<b>Subject:</b> Re: [Nagios-users] Dynamically add/remove hosts on Nagios<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p>Have you considered using a configuration management tool like chef or puppet ? They address the exact usecase
<o:p></o:p></p>
<div>
<p class="MsoNormal">On Feb 10, 2012 7:08 AM, "Felipe Cecagno" <<a href="mailto:fcecagno@gmail.com">fcecagno@gmail.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">Hi everybody,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This is the first time I'm posting on this mailing list, so I'm sorry if my question was already discussed here - I tried to find information about it on the mailing list and also on Nagios documentation + googling, but couldn't find it.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Well, I'm setting up Nagios to monitor a group of servers in a cloud environment. I decided to use passive checks, so I will have one Nagios central monitor and all servers push statistics to Nagios using NSCA. Everything is OK so far.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The problem is that I want to add and remove instances dynamically, I don't want to manually modify hosts.cfg on the central each time I change my infrastructure. So my idea was that when a new instance gets up, it will send to Nagios something
 like (always using NSCA):<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">"localhost     Server UP     0     <new instance IP>"<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">On Nagios I would create a new service on localhost to handle this passive check.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I've created a Python script (that uses pynag) to modify the hosts.cfg file in order to add and remove host definitions. When Nagios receives this passive check, I would call the script to modify the hosts definition files, and a cron job
 would execute every minute to look for modifications on hosts.cfg and make Nagios reload the definition files.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">My doubts are:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- is there a smarter way to do that (dynamically add and remove hosts from Nagios)?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">- since my "Server UP" service uses passive checks only, how do I make Nagios call my script to modify hosts.cfg every time it receives the passive check?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Any thoughts/suggestions would be appreciated. :)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you in advance,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Best regards,<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">--<o:p></o:p></p>
</div>
<p class="MsoNormal">   Felipe Cecagno<o:p></o:p></p>
<div>
<p class="MsoNormal">   Mconf Development Team<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">   <a href="https://mconf.org/" target="_blank">https://mconf.org</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><br>
------------------------------------------------------------------------------<br>
Virtualization & Cloud Management Using Capacity Planning<br>
Cloud computing makes use of virtualization - but cloud computing<br>
also focuses on allowing computing to be delivered as a service.<br>
<a href="http://www.accelacomm.com/jaw/sfnl/114/51521223/" target="_blank">http://www.accelacomm.com/jaw/sfnl/114/51521223/</a><br>
_______________________________________________<br>
Nagios-users mailing list<br>
<a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/nagios-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.<br>
::: Messages without supporting info will risk being sent to /dev/null<o:p></o:p></p>
</div>
</div>
</body>
</html>