ErAB
ErAB

Reputation: 915

REST API not working

If we run the following command in command line, it works fine. But when we run this command from nagios based tool, it failes with an ERROR below:-

java -jar /opt/monitor/nagios/notify/REST/RestInterface.jar 
/opt/monitor/nagios/notify/REST/settings.xml "2015-10-20 12:57:11" L  

Result code: 1

ERROR OUTPUT:

java.io.IOException: Couldn't get lock for RestInterface.log    
        at java.util.logging.FileHandler.openFiles(FileHandler.java:389)    
        at java.util.logging.FileHandler.(FileHandler.java:363)    
        at com.google.nagios.notify.RestInterface.loggerInit(Unknown Source)    
        at com.google.nagios.notify.RestInterface.main(Unknown Source)    
Oct 20, 2015 12:57:11 PM com.google.nagios.notify.RestInterface logToOS  
SEVERE: null  
java.io.IOException: Cannot run program "EVENTCREATE": error=2, No such file   or directory    
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)    
        at java.lang.Runtime.exec(Runtime.java:617)    
        at java.lang.Runtime.exec(Runtime.java:450)    
          at java.lang.Runtime.exec(Runtime.java:347)    
        at com.google.nagios.notify.RestInterface.logToOS(Unknown Source)    
         at com.google.nagios.notify.RestInterface.loggerInit(Unknown Source)    
        at com.google.nagios.notify.RestInterface.main(Unknown Source)  
Caused by: java.io.IOException: error=2, No such file or directory    
        at java.lang.UNIXProcess.forkAndExec(Native Method)    
        at java.lang.UNIXProcess.(UNIXProcess.java:186)  
        at java.lang.ProcessImpl.start(ProcessImpl.java:130)    
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)    
        ... 6 more  
Exception in thread "main" java.lang.NullPointerException      
        at com.google.nagios.notify.RestInterface.loggerInit(Unknown Source)      
        at com.google.nagios.notify.RestInterface.main(Unknown Source)    

Upvotes: 0

Views: 747

Answers (1)

Oscar
Oscar

Reputation: 13960

It seems that RestInterface.log is locked by some other process. Just kill the other process so the file can be written.

Upvotes: 2

Related Questions