Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Write Config fails

2006-05-08
2013-04-15
  • Warning: fopen(/usr/local/nagios/etc/hosts.cfg): failed to open stream: Permission denied in /usr/local/apache/htdocs/nagiosweb/createtxt.php on line 6

    Warning: fwrite(): supplied argument is not a valid stream resource in /usr/local/apache/htdocs/nagiosweb/createtxt.php on line 7

    ??????

    Not quite sure what this means.  I can write to mysql but not to the config files.

    Securty is nagios.nagios 664 on all config files.

    user apache is part of nagios group....

    Help

    Thanks

     
    • Josh Konkol
      Josh Konkol
      2006-05-09

      Things to try:

      1. Verify that httpd is running as the user apache and not something else. 

      2. su to apache and see if you can open one of the config files. 

      3. Change security to apache.nagios 644 on the config files and see if it works.

      Josh

       
    • that did it... Sweet!  ok just like everyone else that gets it to work, one last question.  Is there anyway to remove the hosts, services, etc.?  Via the  gui?

      Thanks

      Tony

       
    • never mind.. having several senior moments.

      Thanks.

       
    • Gents, having the strangest issue.

      I am trying to write the configs, and I am able to after I switch to the web user...

      I did change the names of the config files nagios:web writes to...  i changed them in the createtxt.php

      Any suggestions?

      I am still getting the "unable to write the config files..."

       
    • RAETO
      RAETO
      2006-10-28

      I have just a very similar problem.

      "There was an error writing the configuration files. Call ME at foo or send an e-mail to foo"

      the apache error log says, if i press write config in menue bar:

      "[Sat Oct 28 15:49:12 2006] [error] [client 134.102.114.3] PHP Notice:  Undefined variable: action in /srv/www/htdocs/nagiosweb/runscript.php on line 52, referer: http://195.37.49.112/nagios/side.html
      [Sat Oct 28 15:49:12 2006] [error] [client 134.102.114.3] PHP Notice:  Undefined variable: action in /srv/www/htdocs/nagiosweb/runscript.php on line 92, referer: http://195.37.49.112/nagios/side.html
      [Sat Oct 28 15:49:12 2006] [error] [client 134.102.114.3] PHP Notice:  Undefined variable: action in /srv/www/htdocs/nagiosweb/runscript.php on line 100, referer: http://195.37.49.112/nagios/side.html
      [Sat Oct 28 15:49:12 2006] [error] [client 134.102.114.3] PHP Notice:  Undefined variable: action in /srv/www/htdocs/nagiosweb/runscript.php on line 119, referer: http://195.37.49.112/nagios/side.html
      [Sat Oct 28 15:49:12 2006] [error] [client 134.102.114.3] PHP Notice:  Undefined variable: action in /srv/www/htdocs/nagiosweb/runscript.php on line 175, referer: http://195.37.49.112/nagios/side.html
      [Sat Oct 28 15:49:12 2006] [error] [client 134.102.114.3] PHP Notice:  Undefined variable: action in /srv/www/htdocs/nagiosweb/runscript.php on line 195, referer: http://195.37.49.112/nagios/side.html

      "

      and it says, if i see the site:
      Implementing the Configuration is a 3 Step Process
      1. Write Config      2. Verify Config      3. Restart Process:

      and i press "Write the config"
      "
      sh: /usr/local/bin/php: No such file or directory
      "

      My System:
      Suse 10.1
      apache 2.2.0
      php 5.1.2
      apache mod_php5 5.1.2

      File rights are proper and if i set them recursiv to 777 its the same problem.

      global_variables aka register_globals are off, becaus ists normal in php5. see php.ini in php 5. Or do i missunderstand this?

      What's my problem?
      What can i do to solve this?

      I look deep in my coffe mug ...

      :)

       
    • Josh Konkol
      Josh Konkol
      2006-10-30

      and i press "Write the config"
      "
      sh: /usr/local/bin/php: No such file or directory
      "

      Did you configure your configdb.php file to tell it where your php binary is?

      Josh

       
    • RAETO
      RAETO
      2006-11-01

      no didn't

      or do you mean dbconfig.php ??

      Still the same Problem if i do the first step.

      but in the second step:

      PHP Notice:  Undefined variable: servicegroupid in /srv/www/htdocs/nagiosweb/createtxt.php on line 319
      PHP Notice:  Undefined variable: servicegroupid in /srv/www/htdocs/nagiosweb/createtxt.php on line 319

      what could be wrong on it?

       
    • meltingrobot
      meltingrobot
      2006-11-14

      I am having the same problem.

      [client 160.129.212.59] PHP Notice:  Undefined variable:  action in /var/www/html/nagiosweb/runscript.php on line 50, referer: http://bumblebee/nagios/side.html
      [client 160.129.212.59] PHP Notice:  Undefined variable:  action in /var/www/html/nagiosweb/runscript.php on line 50, referer: http://bumblebee/nagios/side.html
      [client 160.129.212.59] PHP Notice:  Undefined variable:  action in /var/www/html/nagiosweb/runscript.php on line 50, referer: http://bumblebee/nagios/side.html

      I have checked everything possible and cannot find a reason why it will not write the config files.  All of them are there, and I tried changing the permissions to 777.

       
    • Hi,

      I verified the permissions of files and modified for 644, and modified the owner and group for apache.nagios.
      I verified the variable "register_globals" and its value is "On". I am using the FC5, with nagios 2.6, php 5, apache 2.0, all packages rpm.
      I made a program has tested in php to know if exec() obtains to use the function. I verified that the command was not executed, therefore, the problem is in the user who executes the function. However, already it modifies shell of the apache user.
      Somebody has some idea of as to change the user to execute the command.
      Thanks,

      Luís Henrique