Service keeps disappearing from .cfg file and other questions (newbie alert!)
Matty Sarro
msarro at gmail.com
Wed Jun 8 15:49:16 CEST 2011
Its strange, as I've literally got backup copies that I keep copying
back into the directory. I validate, make certain that the changes are
still there, reload nagios, and suddenly they're gone. I can see the
service run two or three times, and then it's suddenly gone from the
files.
I'll modify the macros to the simpler format, thanks for the advice on
that issue.
-Matty
On Wed, Jun 8, 2011 at 9:43 AM, Andreas Ericsson <ae at op5.se> wrote:
> On 06/08/2011 03:18 PM, Matty Sarro wrote:
>> Hey everyone,
>> First, I'm new, so please be gentle :)
>>
>> I have made some recent modifications to our nagios3 files. In
>> resource.cfg I added the following macros: $db_name$, $db_user_name$,
>> and $db_user_pass$. These seem to be ok.
>> I added a service like this:
>> define service {
>> hostgroup_name mysql-servers
>> service_description Mysql FSRW
>> check_command check_mysql_FSRW
>> use generic-service
>> notification_interval 0
>> }
>>
>>
>> And finally I added a command like this:
>> define command {
>> command_name check_mysql_FSRW
>> command_line $USER1$/check_mysql_query -q "SELECT COUNT(*) FROM
>> entry WHERE period<DATE_SUB(now(),INTERVAL 2 DAY) AND status_code<2
>> AND retries=0 AND type=0" -w0:0 -c10 -H $HOSTADDRESS$ -P 3306 -d
>> $db_name$ -u $db_user_name$ -p $db_user_pass$
>> }
>>
>> When I have nagios validate everything, it gives no errors. I then
>> restart nagios for the config to take effect, and it comes up. In the
>> event log I see some issues with the service (it appears to be trying
>> to connect to the mysql servers as user nagios, not the specified
>> user). When I then log back into the server and look at my
>> services.cfg file, and my commands.cfg file, the entries I added to
>> both of them have been removed - like they were never there.
>>
>
> Then perhaps you forgot to save, or someone undid your changes from a
> backup, or some other kind of pilot error happened. It's most certainly
> not Nagios' fault though, so you're asking in the wrong forum.
>
>> So, I guess I have a few questions.
>>
>> First, are those entries in the resource.cfg file ok? Does nagios
>> support the underscores and longer names? Its easier to understand at
>> a glance than $USER3$ $USER4$ and $USER5$.
>>
>> Second, does the command_line look ok? I'm trying to figure out why it
>> isn't using the username and password I'm passing to it.
>>
>
> Not yet, no. It will some day though.
>
>> Finally, why do the command and service keep disappearing out of my
>> config file? It's making it a pain to troubleshoot.
>
> Because someone is removing them, or you're forgetting to save them.
> Things don't just remove themselves.
>
>> Any suggestions or advice would be greatly appreciated.
>
> Ask around if anyone's altering the configuration besides you. Files
> really don't just alter themselves. Trust me on this.
>
> --
> Andreas Ericsson andreas.ericsson at op5.se
> OP5 AB www.op5.se
> Tel: +46 8-230225 Fax: +46 8-230231
>
> Considering the successes of the wars on alcohol, poverty, drugs and
> terror, I think we should give some serious thought to declaring war
> on peace.
>
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list