smartd: not receive test email - linux

I try to use smartmontools to monitor my device and I met 2 problems:
can't receive the test email
As the document says:http://smartmontools.sourceforge.net/man/smartd.conf.5.html, I configure the conf file with:
/dev/sda -m my#exaple.com -M test
and I start the smartd with:
/etc/init.d/smartd start
However, I don't receive the test email. I've no idea how to solve it.
BTW, As the device is something like a NAS, I guess may be there is no email service. But I don't know how to fix it.
2 log for the smartd is missing
I searched /var/log, and found nothing. Then I do the following:
add local3.* /var/log/smartd3.log to the file /etc/syslog.conf
exec: smartd -l local3
kill the smartd and start it again with: /etc/init.d/smartd start
Then,I still can't find the log file. why it is missing?
My smartmontool is 5.38 [arm-unknown-linux-gnu].
Thanks!

Related

Strange Behavior with clamd scan function

I have a simple python3 script running on ubuntu server 20.04 that tries to call clamd (clamav-daemon process) library to scan a file. The scan ping() and version() function all work correctly. However when I actually do a test write and scan, i get the following error:
{'/filedrop/test.doc': ('ERROR', "Can't open file or directory")}
This is the code that I used to call the test write and scan, and this is all standard sample from the clamd website:
open('/filedrop/test.doc','wb').write(clamd.EICAR)
print(cd.scan('/filedrop/test.doc'))
After the code is run, i get the following string in the test file which indicates that the python3 script was able to successfully write to the file, yet i keep getting the error that the file can't be opened when i use the clamd scan function.
This is the string that was written to the file:
X5O!P%#AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
I am also able to run clamscan from command line on the folder and it successfully scans the files as well.
I'm running as root user while the service is using clamav:clamav.
I did give read/write permission to the folder and the files to "other users", and also indicated by the fact that the file could be written by the python script.
I believe the solution to the problem here is that AppArmour is blocking clamd for that particular directory. I would look at the AppArmour profile for clamd. It should be called something like /etc/apparmor.d/clamav or similar. You can adjust that profile or alternatively disable it (according to Ubuntu):
sudo ln -s /etc/apparmor.d/profile.name /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/profile.name
More complete instructions available here:
https://help.ubuntu.com/community/AppArmor
You can also disable AppArmour, for the purposes of testing (I don't like to advise anyone to remove security features permanently), with:
sudo systemctl stop apparmor
sudo systemctl disable apparmor

how can i fix crond[296824]: No configuration file found at /root/.esmtprc or /etc/esmtprc?

I use aws crontab to run my task.
it ran smoothly for some days, but today, i found crontab failed, when i open /var/log/cron
it failed to print new message, and i found
crond[296824]: No configuration file found at /root/.esmtprc or
/etc/esmtprc
in /var/log/messages, and all mail log is empty.
My Os is Centos8, can anyone offer some suggestions? Thanks a lot
Today I had the same problem. Cron send mail notifications about errors, so it take destination info from "~/.esmtprc". If you haven't configured propertly this file, you could get that error in cron log:
crond[296824]: No configuration file found at /root/.esmtprc or /etc/esmtprc
All mails whit errors that cron couldn't sent are locate in "~/.esmtp_queue/".

How can I get source code of nodejs from running app

I have accidentally delete source code of nodejs application, but this application is running, so how can I get source code back from running app?
I hope source code has been cached in some directory.
I was able to recover the full file by attaching the debugger (as TGrif suggested).
To actually recover the code:
Use setBreakpoint('app.js', 10), where 10 is a line of the code you know will be ran over again in the running process
Say pause, then next until it's paused on the script you want to recover.
Finally, say list(5000), where 5000 is an arbitrarily long number of lines to list.
You will now have your full script printed out, albeit with line numbers at the front, but you can use a site like this to remove them.
Hope this helps anyone who encounters this unique issue in the future, as this took me a couple hours to figure out.
There is maybe a way to retrieve some of your source code with the Nodejs debugger.
Assuming Linux OS, you need to get the process id of your application:
$ ps -e | grep node
Next you entering your app in debug mode with something like that:
$ kill -s USR1 PID
where PID is the pid of your node app.
Then your start the debug console:
$ node debug -p PID
If you have an app console, you'll see:
Starting debugger agent.
Debugger listening on port 5858
In your debug console you should see a debug prompt and you can get available commands with:
debug> help
I am able to show some of the running app source with the list command:
debug> list(NUMBER_OF_LINE)
where NUMBER_OF_LINE is the number of source code line you want to display.
I'm not sure this is a one shot try for you or not because my source code was not deleted.
Hope you can get some results.

How to add Dell Equillogic to Nagios

Note: All firmware and models are compatible, that is why nothing is posted about it.
I've been working on this now for a few hours (reading manuals and such) so I'm not just coming here right out of the blue. I am working on a PRE-EXISTING Nagios server where there are several other existing plugins and checks running and working. Now I want to add another server there to check so I made the following modifications:
First and foremost, I added a file to /usr/local/nagios/libexec named: check_equallogic.sh. The permissions are 755, the same as all others. I have chowned to nagios:nagios and in the listing it shows the Owner as Nagios.
I then added a command to the commands.cfg file in \usr\local\nagios\etc\objects that shows the following:
# 'check_equallogic' command definition
define command{
command_name check_equallogic
command_line $USER1$/check_equallogic -H $HOSTADDRESS$ -C $ARG1$ -t $ARG2$ $ARG3$
}
Following this, I created a file named equallogic.cfg in the objects directory and it contains (more or less):
define host{
use linux-server ; Inherit default values from a template
host_name 172.16.50.11 ; The name we're giving to this device
alias EqualLogic ; A longer name associated with the device
address 172.16.50.11 ; IP address of the device
contact_groups admins
}
Check Equallogic Information
define service{
use generic-service
host_name 172.16.50.11
service_description General Information
check_command check_equallogic!public!info
}
After ensuring that permissions are okay for all files, I restart the nagios service, no errors. When I go into the WebGUI, I get the following errors AFTER the check runs:
(Return code of 127 is out of bounds - plugin may be missing)
Extra, probably unrelated problem
Furthermore, when I log into the EquilLogic server, under Audit logs I get the following error:
Level: AUDIT
Time: 26/05/2014 3:59:13 PM
Member: ps4100-1
Subsystem: agent
Event ID: 22.7.1
SNMP packet validation failed, request received from 172.16.10.11
An snmpwalk receives a timeout, whereas others succeed. I will work on importing the MIBs tomorrow. The reason why I am mentioning it is because I want to make sure that it is only a MIB issue for the SNMP. If it is, then ignore this area.
I am entirely unsure of what to do here.
This doesn't look like a MiBs issue at all.
If snmpwalk fails, your device is not configured properly for snmp or the credentials in your possession are wrong.
Furthermore, on a general note, it is bad practice to create commands definitions for untested plugins. First you need to make sure that your plugin works from the command line, then you add it to Nagios' config.
Since I don't see this essential step in what you wrote, i will assume you didn't test the plugin.
If the plugin does not work and you need help with that please open a new question.

Monit exec not working

This is my applicable monit.conf
check file feedabilityLog with path /var/www/scraper/feedability/feedabilityLog.txt
if timestamp > 20 seconds then
exec "/usr/local/bin/forever restart feedability.js"
group feedabilityLog
In my monit log file, I get the following:
error : 'feedabilityLog' timestamp test failed for /var/www/scraper/feedability/feedabilityLog.txt
which seems to signal that the timestamp check is working. However, monit the exec portion of the script does not work. I even tried putting the restart in a bash file, but that doesn't restart the forever process. I'm not sure what I'm doing wrong. Any help would be greatly appreciated.
Nevermind. Figured it out. Absolute paths for EVERYTHING!

Resources