How to send a notification to another user with notify-send - libnotify

notify-send displays a notification box with the message that you want to display on your own machine.
Is there a way to use notify-send to send a notification message to another user and display the message on his machine?

Bash can write to network sockets but can't listen/read. You could use GNU Netcat for this functionality.
A network notify-reader listening on port 10000 (no security):
#!/bin/bash
# no multiple connections: needs to improve
while true; do
line="$(netcat -l -p 10000)"
notify-send -- "Received Message" "$line"
done
And a corresponding client:
#!/bin/bash
host="$1"
echo "$#" >/dev/tcp/$host/10000
So you can send messages using
notify-sender.sh your-host message

Related

Using IPMI tool from Romulus

How to run IPMI tool from the openBMC romulus image. I was successful in running the Hello World program as per the tutorials. I want to run IPMI tool command from the romulus to the BMC of another server. Is there is any method of doing this? As ipmitool command is not included. Is there any way of including it in the romulus Image.
ipmitool is really meant to be used outside of the BMC to control it. So in most use cases you install the ipmitool package on your computer (sudo apt install ipmitool), and then use it to talk to the server.
i.e.:
ipmitool -I lanplus -U root -H <server> -P <password> chassis power status
If you're using QEMU, then I believe you need to hostfwd port 623 for this to work. I personally have not gotten ipmitool to talk to a QEMU session before though.
If you really want ipmitool in your BMC image, then you could add it as a RDEPENDS to the packagegroup file similar to what facebook does in https://github.com/openbmc/meta-facebook/blob/master/meta-tiogapass/recipes-fbtp/packagegroups/packagegroup-fb-apps.bb
Romulus does not have ipmitool in it OpenBMC firmware image, as do some other OpenBMC platforms; not all platforms have the SPI FLASH space supply many utilites. You can use ipmitool from a remote machine to a Romulus like below.
ipmitool -I lanplus -C 17 -p 623 -U root -H <server> -P <password> bmc info
or
ipmitool -I lanplus -C 17 -p 623 -U root -H <server> -P <password> raw 0x06 0x01
I chose to use -C 17 for cipher suite 17 as ipmitool defaults to cipher suite 3 and modern platforms have deprecated cipher suite 3 for security reasons.
Cipher suites 3 and 17 were last 2 suites that had any security strength, and 17 is the stronger (do not read that as strong) and now suite 3 is considered weak.
and here are the ipmitool commands:
usage: ipmitool [options...] <command>
-h This help
-V Show version information
-v Verbose (can use multiple times)
-c Display output in comma separated format
-d N Specify a /dev/ipmiN device to use (default=0)
-I intf Interface to use
-H hostname Remote host name for LAN interface
-p port Remote RMCP port [default=623]
-U username Remote session username
-f file Read remote session password from file
-z size Change Size of Communication Channel (OEM)
-S sdr Use local file for remote SDR cache
-D tty:b[:s] Specify the serial device, baud rate to use
and, optionally, specify that interface is the system one
-4 Use only IPv4
-6 Use only IPv6
-a Prompt for remote password
-Y Prompt for the Kg key for IPMIv2 authentication
-e char Set SOL escape character
-C ciphersuite Cipher suite to be used by lanplus interface
-k key Use Kg key for IPMIv2 authentication
-y hex_key Use hexadecimal-encoded Kg key for IPMIv2 authentication
-L level Remote session privilege level [default=ADMINISTRATOR]
Append a '+' to use name/privilege lookup in RAKP1
-A authtype Force use of auth type NONE, PASSWORD, MD2, MD5 or OEM
-P password Remote session password
-E Read password from IPMI_PASSWORD environment variable
-K Read kgkey from IPMI_KGKEY environment variable
-m address Set local IPMB address
-b channel Set destination channel for bridged request
-t address Bridge request to remote target address
-B channel Set transit channel for bridged request (dual bridge)
-T address Set transit address for bridge request (dual bridge)
-l lun Set destination lun for raw commands
-o oemtype Setup for OEM (use 'list' to see available OEM types)
-O seloem Use file for OEM SEL event descriptions
-N seconds Specify timeout for lan [default=2] / lanplus [default=1] interface
-R retry Set the number of retries for lan/lanplus interface [default=4]
Interfaces:
open Linux OpenIPMI Interface [default]
lan IPMI v1.5 LAN Interface
lanplus IPMI v2.0 RMCP+ LAN Interface
serial-terminal Serial Interface, Terminal Mode
serial-basic Serial Interface, Basic Mode
Commands:
raw Send a RAW IPMI request and print response
i2c Send an I2C Master Write-Read command and print response
spd Print SPD info from remote I2C device
lan Configure LAN Channels
chassis Get chassis status and set power state
power Shortcut to chassis power commands
event Send pre-defined events to MC
mc Management Controller status and global enables
sdr Print Sensor Data Repository entries and readings
sensor Print detailed sensor information
fru Print built-in FRU and scan SDR for FRU locators
gendev Read/Write Device associated with Generic Device locators sdr
sel Print System Event Log (SEL)
pef Configure Platform Event Filtering (PEF)
sol Configure and connect IPMIv2.0 Serial-over-LAN
tsol Configure and connect with Tyan IPMIv1.5 Serial-over-LAN
isol Configure IPMIv1.5 Serial-over-LAN
user Configure Management Controller users
channel Configure Management Controller channels
session Print session information
dcmi Data Center Management Interface
nm Node Manager Interface
sunoem OEM Commands for Sun servers
kontronoem OEM Commands for Kontron devices
picmg Run a PICMG/ATCA extended cmd
fwum Update IPMC using Kontron OEM Firmware Update Manager
firewall Configure Firmware Firewall
delloem OEM Commands for Dell systems
shell Launch interactive IPMI shell
exec Run list of commands from file
set Set runtime variable for shell and exec
hpm Update HPM components using PICMG HPM.1 file
ekanalyzer run FRU-Ekeying analyzer using FRU files
ime Update Intel Manageability Engine Firmware
vita Run a VITA 46.11 extended cmd
lan6 Configure IPv6 LAN Channels

how to capture openflow packets using tshark

I have a system with arch linux running OVS. I also have a controller running in the same box. I have the following setup:-
ovs-vsctl set-controller br-int tcp:192.168.1.201:6633
I was hoping to use tshark( tshark 2.2.8) to capture the openflow using the following command:-
sudo tshark -i br-int -d tcp.port==6633,openflow -O openflow_v4
it dumps all the all the flows that is flowing in the system but no packetIn openflow messages. I did confirm packetIn message was received by the controller. ( pasting the last few lines:-)
EVENT ofp_event->EventOFPPacketIn
packet in 1237689849893337 b8:27:xx:xx:yy:yy:zz ff:ff:ff:ff:ff:ff:3
I also understand from the tshark document that by default it uses the port 6653 for openflow.
tshark -G decodes | grep -i openflow
tcp.port 6653 openflow
However I was in the impression that I can still look for openflow traffic by using the following capture command:-
https://wiki.wireshark.org/OpenFlow
tshark tcp port 6633
This also doesn't work as no events are captured though I can see the controller receiving lots of events..
would greatly appreciate any help here.
My guess would be that you're not listening on the correct interface. Try the following:
sudo tshark -i any -d tcp.port==6633,openflow -O openflow_v4
If that doesn't work, it's possible your controller and switch are not communicating using OpenFlow 1.3. To make sure you see everything, try:
sudo tshark -i any -d tcp.port==6633
Details. Unless there's something particular in your setup, packets from Open vSwitch to the controller and back do not go through the bridge. Since both ends of the communication are on the same host, packets are probably going through the loopback interface:
sudo tshark -i lo -d tcp.port==6633
I was able to reproduce your setup and issue to confirm my answer with Open vSwitch 2.5.2 and Floodlight (master branch). I can see packets passing through on the loopback interface with both tcpdump and tshark.

How do I execute a python file when I receive a specific msg from Mosquitto broker

I have made an android app that publishes topics to Cloudmqtt(powered by AWS ) using Mqtt protocol. My raspberrypi has a local Mosquitto broker which is bridged with remote Cloudmqtt. So as soon as I publish a topic via my android app it is received on the raspberrypi console.
Here comes the problem. As soon as I receive the msg on my raspberrypi console it should execute a python file. How can it be done?
I write this following command to receive the topic
mosquitto_sub -h host_name -p port_no -u remote_user_name -P remote_password -t hello/today/world
Now as soon as I receive a msg through the topic hello/today/world I have to run a python file that makes decisions according to the msg received from the topic(if the msg received is on, the led turns on)
But the main problem is that how can we read the msg and execute the file accordingly?
This morning I saw someone posted a similar question and I took up the challenge to find out the solution but I am not getting any way to do so.
I tried to write in shell but it didn't work
c=mosquitto_sub -h host_name -p port_no -u remote_user_name -P remote_password -t hello/today/world
if ( c == "rushabh welcome to garden assistant" )
then
GPIO mode 12 out
GPIO mode 12 1
GPIO mode 12 0
else
echo "not matched"
fi
Since I want to turn on the led at gpio 12 as soon as I receive rushabh welcome to garden assistant from the mosquitto broker
Can we use $SYS/broker/messages/stored

RabbitMQ list queue only for specific queue via Command line

I would like to know if its possible to list the message_unacknowledged of specific queue ? I mean I have a 4-5 queue in 1 vhosts but I want to check the message_unacknowledged for specific queue only.
Here is my command:
C:\Python26\python.exe C:\Python26\rabbitmqadmin.exe --host %host% --port 443 --ssl --user %user% --password %password% list queues messages_unacknowledged
Output:
Output of with name
Here is what I want to see only.
enter image description here
Thanks!
If you run this command
C:\Python26\python.exe C:\Python26\rabbitmqadmin.exe help subcommands
It will show all the commands that you can run.
Unfortunately you cannot get the count of messages for a specific queue.
But you can write a script to hit this url which will return a Json with all the details about the queue
http://username:password#queue-server:15672/api/queues/%2f/queue_name

sending TCP message via command line on macosx

For testing purposes I am sending tcp messages to a local server as follows:
echo -e "some message" | netcat localhost 1234
With netcat installed using brew install netcat.
This works fine except for that this blocks for quite a long time (about a minute). I tried to use the options "-w 1" for specifying the timeout, but this does not change anything.
The process listening on the other end is a spring-xd tcp source.
Is there any other way of sending a tcp message that does not block as long?
I've not seen such a delay on linux; haven't tried on OS X (it comes with nc instead).
What is your stream definition? The default tcp source expects data to be terminated with CRLF - e.g telnet localhost 1234. You need a RAW decoder for netcat.
EDIT:
I just tested
xd:>stream create foo --definition "tcp --decoder=RAW | log" --deploy
with
$ echo "foo" | nc localhost 1234
and had no problems.