Icinga2 check_file_age always returns File not found - nagios

I'm using check_file_age command with service created in icinga2 director. It always returns file not found.
FILE_AGE CRITICAL: File not found - /root/last-backup
The file exists on the server and returns OK if ran in terminal.
~ '/usr/lib/nagios/plugins/check_file_age' '-c' '95000' '-f' '/root/last-backup' '-w' '90000'
FILE_AGE OK: /root/last-backup is 70052 seconds old and 11 bytes | age=70052s;90000;95000 size=11B;0;0;0
If I check the debug.log, the command returns exit code 2.

The problem is in permission, the agent is not able to access the file.
Move your file to different folder. Like /var/backups/last-backup.

Related

Apache kafka error on windows 10: kafka-topics.bat file gives syntax error

I am starting to learn Kafka. I managed to run zookeeper and kafka successfully. I am using Windows10 and my kafka version is 2_12-2.5.0.
My question is that when I try to create a topic from cmd using the below command:
kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic firstTopic`
I get the error:
The syntax of the command is incorrect.
I know that the command I wrote is correct and the issue is the command inside the .bat file as I changed the command inside the kafka-topics.bat, the error changes. However I could not manage to run it. This is the content of kafka-topics.bat:
"%~dp0kafka-run-class.bat" kafka.admin.TopicCommand %*
I also tried to run kafka-topics.sh file instead of batch, but that gives a different error opening git bash, that is:
Error:Could not find or load main class kafka.admin.topicCommand
I also got rid of the space in "Program Files" while writing the path, so I don't think that is the reason of this error.
I got stuck and its hard to understand these errors as I am new.
Can you please help?
in my case it worked only when I moved Kafka folder to C: partition without any space in path
for example C:\Kafka_sources
and I used the below command to create a topic
kafka-topics.bat --create --topic test --zookeeper localhost:2181 --partitions 1 --replication-factor 1
in my case:
i removed the quotation marks in .properties for directories
use forward slashes in .properties for directories
i removed the dot-version numbers in directory path (don't know if that was deciding)
but start with point and backlashes .\bin\windows\kafka-server-start.bat .\config\server.properties)
d:\ is possible !

How do Thunar and MC decide how to open a file?

It seems that Thunar and Midnight Commander (any maybe other tools) don't use Mailcap to decide how to open a file. What do they use instead?
Background of the question: On my system, Thunar and Midnight Commander open all ODT files with Okular instead of LibreOffice.
I tried to debug this by checking ~/.mailcap and /etc/mailcap, which do contain Okular rules for ODT, but the LibreOffice (soffice) rules clearly take precedence.
I verified this by running mailcap directly on an ODT file:
run-mailcap --norun /tmp/example.odt
The output is exactly what I expect:
soffice --nologo --writer '/tmp/example.odt'
Also, if I run that command, LibreOffice is indeed started and opens the file.
So to my understanding, MC and Thunar should open ODT files with LibreOffice. But they use Okular. Why?
To answer my own question, these applications use xdg-open instead of run-mailcap.
And indeed the following command runs Okular instead of LibreOffice:
Command:
xdg-open /tmp/example.odt
I can verify the assigned MIME type with:
Command:
xdg-mime query filetype /tmp/example.odt
Output:
application/vnd.oasis.opendocument.text
Then, I can check which application is assigned to that MIME type:
Command:
xdg-mime query default application/vnd.oasis.opendocument.text
Output:
kde4-okularApplication_ooo.desktop
This explains the issue. When I uninstall Okular, it leads to the correct response:
Output:
libreoffice-writer.desktop
So there's something wrong in either the Okular or the LibreOffice package.

StartService error 2

I've written a very simple batch file that bluescreens windows 7 (ultimate,enterprise,home) beyond normal repair, by making an attempt of loading a Win32 exe-file (the well known notepad.exe) into the operating system's kernel. Feel free to test it in a Virtual Machine, just open it as an administrator. Do NOT run this as administrator on your primary computer.
#echo off
sc create bluescreener binpath = C:/Windows/System32/notepad.exe type= filesys start= boot
sc start bluescreener
timeout /t 30
However: When I run this program on windows 10, it successfully creates the service, but it doesn't start. Instead it returns the following error:
[SC] StartService Failed 2: The system cannot find the file specified.
It is referring to the binpath I set in the batch file. I am sure this path exists, and that this is the exact path name. I don't understand why it can't find the file. I have tried using backslashes instead of forward-slashes, and that didn't work either. (I have forward-slashes because I have a python program that writes this batch file, and the line break in python uses a backslash, and that conflicts with the path.)
I tried the "sc qc bluescreener" test that shows information about the service I have created. This is what comes up. (It is the same thing that comes up when I test it on windows 7, where it works.)
[SC] QueryServiceConfig SUCCESS
SERVICE_NAME: bluescreener
TYPE : 2 FILE_SYSTEM_DRIVER
START_TYPE : 0 BOOT_START
ERROR_CONTROL : 1 NORMAL
BINARY_PATH_NAME : \SystemRoot\System32\notepad.exe
LOAD_ORDER_GROUP :
TAG : 0
DISPLAY_NAME : bluescreener
DEPENDENCIES :
SERVICE_START_NAME :
I can't find any explanation for why it can't find the file.
When I try to reboot windows 10 after creating the service, it can't boot, which means that the service is probably working and that the file was located. I just want to know why Windows 7 can find the file and immediately bluescreens, while Windows 10 can't find the file and needs to be rebooted for the service to run.
Any suggestions on how I might reproduce the same effect i get on Windows 7, but on Windows 10?

Cannot delete view-private file

In a dynamic ClearCase view on Windows 7, I've got a file with size 0 and name myproject.prj.$$$. I cannot open, delete, rename or modify that file. I'd prefer to delete the file, but when trying to delete it:
Windows Explorer shows the error message “Invalid MS-DOS function”.
cmd.exe’s del: “Incorrect function”.
ClearCase Explorer simply does nothing.
I've created a file with the same name at a different location, and was able to edit and delete that file without any issues - so I guess the file name is not the issue. The file first showed up after the computer had crashed. I'd prefer not to delete and recreate the view.
What can I do to delete this file?
It looks similar to "Delete of view private file fails with error: Cannot find the specified file":
Cause
The view-private file has been moved or deleted from the view storage within the .s directory.
The view database is still aware of the file and is out of sync with the source container.
Note: The most common reason of this occurrence is due to Virus Scanning. The Virus Scanner is configured to either move a file suspected of a virus to quarantine or is configured to delete the file.
Solution 1
Remove and recreate the view.
Solution 2
If removal of the view is not an option, then synchronize the view database and the source container
The Example below is quite complete, but the OP Martin mentions in the comments:
It was not necessary to run the commands:
The mvfs log already contained the name of the missing file several times.
After creating an empty file at the "view storage container path", the file in the view could be deleted.
Example
The view storage container 800011174be29f22Paul.txt of the file Paul.txt was deleted.
M:\niewandt_view5\rn-robin>mvfsstorage Paul.txt
C:\ccstg_c\views\niewandt_view5.vws\.s\00007\800011174be29f22Paul.txt
This is the expected result although the file is not there anymore.
Now we flush the mvfs cache:
M:\niewandt_view5\rn-robin>mvfscache -f mnode
And run the mvfsstorage command again:
M:\niewandt_view5\rn-robin>mvfsstorage Paul.txt
mvfsstorage: Error: Paul.txt - can't fetch cleartext
Now we have a problem to identify which storage container is missing.
Trying to open the file gives:
---------------------------
Editor
---------------------------
Invalid Function.
---------------------------
OK
---------------------------
If we try to delete the file, it is reporting:
---------------------------
Error deleting file or folder
---------------------------
Paul can not be deleted: Invalid MS-DOS function.
---------------------------
OK
---------------------------
To find the view storage container path for that file you need to look in the mvfs log.
The mvfs log is showing:
{89 pid/tid 139400000cf0/883b7838eb6b63d0} cleartext lookup view=niewandt_view5 vob=\rn-robin dbid=0x80001117 - No such file or directory
{90 pid/tid 139400000cf0/883b7838eb6b63d0} cleartext pname= \Device\HarddiskVolume1\ccstg_c\views\niewandt_view5.vws\.s\00007\800011174be29f22Paul.txt
The "\Device\HarddiskVolume1" location can be found on the view properties 'advanced' tab, "Host path" in ClearCase Explorer
I faced this problem recently in windows environment.
*
(Caution : proceed if you are okay to delete local view-private
file which is corrupted and no data of that file can be retrieved)
*
My case was similar to above and was getting the following errors -
1. Windows Explorer shows the error message “Invalid MS-DOS function”.
2. cmd.exe’s del: “Incorrect function”.
I found mvfs log path by typing mvfslog in command prompt and that would output following details
Log priority: error
irpops mask: 0x00000000
vops mask: 0x00000000
vfsops mask: 0x00000000
xops mask: 0x00000000
traps mask: 0x00000000
Kernel logfile: "C:\mvfslogs\20191205.log"
Now open the log file from above path
"C:\mvfslogs\20191205.log"
So if you have got incorrect function recently, then that would be the last data logged as error in above log file.
Opening the log file and observe at the end of file, it reads something similar to below-
line #(last-1) - mvfs: Error: ....da..da..da...da... - No such file or directory
line #(last) - mvfs: Error: ....da...da...da...da... \your_container_location\..da..\..da..\..da..your_view_name.vws\.s\00037\800001765bf06476cc3080a
So that last word in above path(800001765bf06476cc3080a) is you actual file reference of your file in your_container_location. (Some times it might read as 800001765bf06476cc3080ayour_file_name.extension).
So now what is happening is
it is looking for your file reference 800001765bf06476cc3080a in
your_container_location path
(\your_container_location..da....da....da..your_view_name.vws.s\00037)
but it is not found(As data is not synchronized between your local
view and your_container_location).
So now all is required is
Step 1-to create a file named as 800001765bf06476cc3080a (as per your file name) in \your_container_location\..da..\..da..\..da..your_view_name.vws\.s\00037
Step 2-refresh your local view.
Step 3-Delete the file.
Now that the file should be able to delete permanently. And you can reuse your view.

exe4j fails unable creating temp directory (potentially causing Windows error 7)

We use exe4j 4.4.4 to build an exe that runs our Java program. One of our customers is complaining that sometimes they are getting "Windows error 7" when running our exe. This only happens intermittently and only on a couple of machines out of hundreds.
We enabled exe4j debugging and noticed that in cases when we get the error exe4j log file contains several entries like the one below and then ends. However, on successful exe launch the log file goes beyond these entries and eventually launches our Java program.
These are the last several log messages in exe4j log file when we get the error:
GetTempPath returned 14 (last error 183)
make dir returned -1
tempPath is C:\WINNT\TEMP\
tempFile is C:\WINNT\TEMP\e4j38.tmp
Temp dir: C:\WINNT\TEMP\e4j38.tmp_dir
Could not create dir (183)
GetTempPath returned 14 (last error 183)
make dir returned -1
tempPath is C:\WINNT\TEMP\
tempFile is C:\WINNT\TEMP\e4j39.tmp
Temp dir: C:\WINNT\TEMP\e4j39.tmp_dir
Could not create dir (183)
GetTempPath returned 14 (last error 183)
make dir returned -1
tempPath is C:\WINNT\TEMP\
tempFile is C:\WINNT\TEMP\e4j3A.tmp
Temp dir: C:\WINNT\TEMP\e4j3A.tmp_dir
Could not create dir (183)
There was a bug in exe4j which caused it to cycle through its temp folders after a bunch application restarts. Exe4j reduced the chance for temp folder collisions in 4.4.5 version by adding a timestamp to the names of their temp folders.

Resources