clustat -x equivalent in rhel 7 pacemaker - cluster-computing

There was a command clustat -x in rhel 6 cluster which gives "last_transition_str" of a resource.
<group name="service:MNGT" state="112" state_str="started" flags="0" flags_str="" owner="mifeas01" last_owner="mifeas02" restarts="0" last_transition="1551262689" last_transition_str="Wed Feb 27 11:18:09 2019"/>
<group name="service:MRFC" state="112" state_str="started" flags="0" flags_str="" owner="mifeas02" last_owner="mifeas01" restarts="1" last_transition="1551264585" last_transition_str="Wed Feb 27 11:49:45 2019"/>
</groups>
</clustat>
I couldn't find any RHEL 7 pacemaker command to get mentioned above value.

Last transition change state is specific to individual resources of a resource group.
Use the following command:
crm_resource --resource=<resource_name> -O | grep -i 'last-rc-change'

Related

Unable to connect to local redis docker although up and running

Using the following redis.conf
▶ cat redis.conf
bind 0.0.0.0
spinning up a redis container
▶ docker run -d --name redis-test -p 11111:6379 -v /Users/redis.conf:/redis.conf redis redis-server /redis.conf
59eb1612e8c3e2403e18ce889ce1438f6c6a23a7c70bed30b46ff765b7fe7038
logs seem healthy
▶ docker logs -f 59eb1612e8c3e2403e18ce889ce1438f6c6a23a7c70bed30b46ff765b7fe7038
1:C 18 Mar 2021 17:57:13.954 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 18 Mar 2021 17:57:13.954 # Redis version=6.2.1, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 18 Mar 2021 17:57:13.954 # Configuration loaded
1:M 18 Mar 2021 17:57:13.955 * monotonic clock: POSIX clock_gettime
1:M 18 Mar 2021 17:57:13.955 * Running mode=standalone, port=6379.
1:M 18 Mar 2021 17:57:13.955 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 18 Mar 2021 17:57:13.956 # Server initialized
1:M 18 Mar 2021 17:57:13.956 * Ready to accept connections
container seems up
▶ docker ps | grep -i redis
59eb1612e8c3 redis "docker-entrypoint.s…" 3 minutes ago Up 3 minutes 0.0.0.0:11111->6379/tcp redis-test
If all the above are more or less good indications, why am I unable to connect to the container
▶ redis-cli -h localhost -p 11111
Could not connect to Redis at localhost:11111: Connection refused
not connected>
▶ redis-cli -h 127.0.0.1 -p 11111
Could not connect to Redis at 127.0.0.1:11111: Connection refused
not connected>
Working on MacOS Catalina
Find the IP Address of container called redis-test by running this command (I'm in Linux, but I think that should be the same on MacOS, sorry if that's not the same):
docker inspect redis-test | grep -i ipaddress
The result should be something like this:
"IPAddress": "172.21.0.2"
Now try:
redis-cli -h 172.21.0.2 -p 11111

Bash script for monitoring logs based upon last update time

I have a directory on a RHEL 6 server where logs are being written as below. As you can see there are 4 logs already written within 1 minute. I just want to write a script which can check in every 15 minute (Cron ) & if log files are not updating then send an email alert like " Adapter is in hang status, Restart Required". I know basic linux commands & knowledge of crons. This is how i am trying
-rw-r--r-- 1 root root 11M Oct 6 00:32 Adapter.log.3
-rw-r--r-- 1 root root 11M Oct 6 00:32 Adapter.log.2
-rw-r--r-- 1 root root 10M Oct 6 00:32 Adapter.log.1
-rw-r--r-- 1 root root 6.3M Oct 6 00:32 Adapter.log
$ ll Adapter.log >/tmp/test.txt
$ cat test.txt | awk '{print $6,$7,$8}'
Oct 6 03:10
Now how can i get the time of same log file after 15 minutes, so that i can compare the time difference and write a script to send the alert.
Given description, looks like you timestamp can be checked every 15 minutes.
If file was updated in last 15 minutes, do nothing
If file was updated 15 to 30 minutes ago, send email alert
If file was updated 30 minutes ago, do nothing, as error was already reported on previous cycle
Consider placing the following into cron, on 15 minute interval:
find /path/to/log/Adapter.log* -mmin +15 -mmin -30 | xargs -L1 send-alert
This solution will work on most situations. However, it's worth noting that if the system load is very high, cron execution may be delayed, impacting the age test. In those cases, extra file to store the last test time is needed.

Configure Multiple Data soureces in Logstash configuration files?

I'm trying to load two different configurations at a time in Logstash Pipeline. Those two configurations have different Input, Filters, and Output.
Note: My ELK setup on Docker Swarm
I tried like below:
[ec2-user#ip-10-9-9-92 logstash]$ ls -lrth pipeline/
-rw-rw-r-- 1 ec2-user ec2-user 1.4K Feb 20 16:53 alb.conf
-rw-rw-r-- 1 ec2-user ec2-user 2.0K Feb 20 17:28 logstash.conf
#Here my Elasticsearch is same but indexes are different in those files. Please help me with it.
You can try to use de -f flag for different inputs:
Edit with thanks to #leandrojmp:
logstash -f '/path/{file1,file2}'
Or use a single file with if conditions for the filter and output plugins - if you have the same input.

ls -l command output

This is the output of ls -l command on mac os terminal
drwx------# 47 abhishekkumarjha staff 1598 Nov 15 00:05 Library
drwx------+ 3 abhishekkumarjha staff 102 Apr 9 2015 Movies
What does '#' or '+' symbol signify?
If the file or directory has extended attributes, the permissions field printed by the -l
option is followed by a '#' character. Otherwise, if the file or directory has extended security
information (such as an access control list), the permissions field printed by the -l option is followed by a '+' character.
You can find more info on Apple's developer website and look for The Long Format

Use newsyslog to rotate log files, but only if they have a certain size

I'm on OS X 10.9.4 and trying to use newsyslog to rotate my app development log files.
More specifically, I want to rotate the files daily but only if they are not empty (newsyslog writes one or two lines to every logfile it rotates, so let's say I only want to rotate logs that are at least 1kb).
I created a file /etc/newsyslog.d/code.conf:
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/Users/manuel/code/**/log/*.log manuel:staff 644 7 1 $D0 GN
The way I understand the man page for the configuration file is that size and when conditions should work in combination, so logfiles should be rotated every night at midnight only if they are 1kb or larger.
Unfortunately this is not what happens. The log files are rotated every night, no matter if they only the rotation message from newsyslog or anything else:
~/code/myapp/log (master) $ ls
total 32
drwxr-xr-x 6 manuel staff 204B Aug 8 00:17 .
drwxr-xr-x 22 manuel staff 748B Jul 25 14:56 ..
-rw-r--r-- 1 manuel staff 64B Aug 8 00:17 development.log
-rw-r--r-- 1 manuel staff 153B Aug 8 00:17 development.log.0
~/code/myapp/log (master) $ cat development.log
Aug 8 00:17:41 localhost newsyslog[81858]: logfile turned over
~/code/myapp/log (master) $ cat development.log.0
Aug 7 00:45:17 Manuels-MacBook-Pro newsyslog[34434]: logfile turned over due to size>1K
Aug 8 00:17:41 localhost newsyslog[81858]: logfile turned over
Any tips on how to get this working would be appreciated!
What you're looking for (rotate files daily unless they haven't logged anything) isn't possible using newsyslog. The man page you referenced doesn't say anything about size and when being combined other than to say that if when isn't specified, than it is as-if only size was specified. The reality is that the log is rotated when either condition is met. If the utility is like its FreeBSD counterpart, it won't rotate logs less than 512 bytes in size unless the binary flag is set.
MacOS' newer replacement for newsyslog, ASL, also doesn't have the behavior you desire. As far as I know, the only utility which has this is logrotate using its notifempty configuration option. You can install logrotate on your Mac using Homebrew

Resources