mongodb fails to start in opensuse - mongodb

I followed this to install and start mongodb in openSUSE: https://en.opensuse.org/MongoDB
Also created a btrfs subvolume with mongodb directory, all good.
However, when I run systemctl status mongodb, i get this error:
Job for mongodb.service failed because the control process exited with error code.
See "systemctl status mongodb.service" and "journalctl -xe" for details.
Then, I run systemctl status mongodb.service, i get:
● mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/usr/lib/systemd/system/mongodb.service; disabled; vendor pr>
Active: failed (Result: exit-code) since Wed 2019-10-09 19:41:36 EDT; 18s ago
Process: 31299 ExecStart=/usr/sbin/mongod -f $CONFIG $OPTIONS (code=exited, s>
More details, i run journalctl -xe:
Oct 09 19:41:29 ryzen-pc polkit-kde-authentication-agent-1[3702]: WinId of the >
Oct 09 19:41:29 ryzen-pc polkit-kde-authentication-agent-1[3702]: Trying again
Oct 09 19:41:29 ryzen-pc polkit-kde-authentication-agent-1[3702]: REQUEST
Oct 09 19:41:29 ryzen-pc polkit-kde-authentication-agent-1[3702]: Request: "Pa>
Oct 09 19:41:29 ryzen-pc polkit-kde-authentication-agent-1[3702]: "Password: "
Oct 09 19:41:31 ryzen-pc polkit-kde-authentication-agent-1[3702]: Dialog accept>
Oct 09 19:41:31 ryzen-pc polkit-agent-helper-1[31292]: gkr-pam: unable to locat>
Oct 09 19:41:31 ryzen-pc polkit-agent-helper-1[31292]: pam_unix(polkit-1:auth):>
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: COMPLETED
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: Completed: f>
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: Finishing obt>
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: Trying again
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: REQUEST
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: Request: "Pa>
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: "Password: "
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: Dialog accept>
Oct 09 19:41:36 ryzen-pc polkit-agent-helper-1[31294]: gkr-pam: unable to locat>
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: COMPLETED
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: Completed: t>
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: Finishing obt>
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: Listener adap>
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: polkit_qt_lis>
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: Finish obtain>
lines 1286-1308/1308 (END)
Oct 09 19:41:29 ryzen-pc polkit-kde-authentication-agent-1[3702]: WinId of the shown dialog is 33554461 33554461
Oct 09 19:41:29 ryzen-pc polkit-kde-authentication-agent-1[3702]: Trying again
Oct 09 19:41:29 ryzen-pc polkit-kde-authentication-agent-1[3702]: REQUEST
Oct 09 19:41:29 ryzen-pc polkit-kde-authentication-agent-1[3702]: Request: "Password: "
Oct 09 19:41:29 ryzen-pc polkit-kde-authentication-agent-1[3702]: "Password: "
Oct 09 19:41:31 ryzen-pc polkit-kde-authentication-agent-1[3702]: Dialog accepted
Oct 09 19:41:31 ryzen-pc polkit-agent-helper-1[31292]: gkr-pam: unable to locate daemon control file
Oct 09 19:41:31 ryzen-pc polkit-agent-helper-1[31292]: pam_unix(polkit-1:auth): authentication failure; logname= uid=1000 euid=0 tty= ruser=root rhost= user=root
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: COMPLETED
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: Completed: false
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: Finishing obtaining privileges
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: Trying again
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: REQUEST
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: Request: "Password: "
Oct 09 19:41:33 ryzen-pc polkit-kde-authentication-agent-1[3702]: "Password: "
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: Dialog accepted
Oct 09 19:41:36 ryzen-pc polkit-agent-helper-1[31294]: gkr-pam: unable to locate daemon control file
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: COMPLETED
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: Completed: true
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: Finishing obtaining privileges
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: Listener adapter polkit_qt_listener_initiate_authentication_finish
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: polkit_qt_listener_initiate_authentication_finish callback for 0x55afc7e206a0
Oct 09 19:41:36 ryzen-pc polkit-kde-authentication-agent-1[3702]: Finish obtain authorization: true
I tried googling but no avail. Any idea what's going on?
Thanks.

Related

postgresql convert 'Thu Jul 02 13:36:17 UTC 2020' to timestamp

I have a string that I need to insert into a table as a timestamp.
'Thu Jul 02 13:36:17 UTC 2020'
Without UTC the following conversion works
SELECT to_timestamp('Thu Jul 02 13:36:17 2020', 'Dy Mon dd HH24:MI:SS yyyy');
How can I convert the timestamp with the UTC portion?
Any help would be greatly appreciated!
Database Type: PostgreSQL
Table Data Type: timestamp (this can change if needed)
If it's always going to be UTC, then you can use:
> select to_timestamp(
'Thu Jul 02 13:36:17 UTC 2020',
'Dy Mon DD HH24:MI:SS UTC YYYY'
);

Why does systemd always restart a udp service?

I test a simple example program for a UDP service with systemd:
int main(int argc, char *argv[], char **envp)
{
int cnt;
char Buffer[100];
struct sockaddr_in clientaddr;
socklen_t clen = sizeof (clientaddr);
int Nbytes;
if ((cnt = sd_listen_fds(0)) != 1) {
fprintf(stderr, "No or too many file descriptors received: %d\n", cnt);
exit(1);
}
fprintf(stderr, "Socket-activated.\n");
fd = SD_LISTEN_FDS_START + 0;
if ((Nbytes = recvfrom (fd, Buffer, 100, MSG_PEEK, (struct sockaddr *) &clientaddr, &clen)) < 0)
{
fprintf (stderr, "Receive failed: %s\n", strerror(errno));
exit (1);
}
fprintf (stderr, "Buffer:%s\n", Buffer);
close (fd);
exit (0);
} /* MAIN */
example.service:
[Unit]
Description=example
[Service]
ExecStart=/opt/VdLrp2/bin/udpg
example.socket:
[Unit]
Description=example
[Socket]
ListenDatagram=0.0.0.0:12300
# Restart is by default "no"
[Install]
WantedBy=sockets.target
I am testing the service with:
echo "xx" >/dev/udp/10.0.1.2/12300
I expect the service to be started once, and then finished. The service is started so often until the start limit is reached:
Mar 03 18:09:49 VdLrp2 systemd[1]: Reloading.
Mar 03 18:10:01 VdLrp2 systemd[1]: Listening on example.
Mar 03 18:10:06 VdLrp2 systemd[1]: Started example.
Mar 03 18:10:06 VdLrp2 udpg[1164]: Socket-activated.
Mar 03 18:10:06 VdLrp2 udpg[1164]: Buffer:xx
Mar 03 18:10:06 VdLrp2 systemd[1]: example.service: Succeeded.
Mar 03 18:10:06 VdLrp2 systemd[1]: Started example.
Mar 03 18:10:06 VdLrp2 udpg[1165]: Socket-activated.
Mar 03 18:10:06 VdLrp2 udpg[1165]: Buffer:xx
Mar 03 18:10:06 VdLrp2 systemd[1]: example.service: Succeeded.
Mar 03 18:10:06 VdLrp2 systemd[1]: Started example.
Mar 03 18:10:06 VdLrp2 udpg[1166]: Socket-activated.
Mar 03 18:10:06 VdLrp2 udpg[1166]: Buffer:xx
Mar 03 18:10:06 VdLrp2 systemd[1]: example.service: Succeeded.
Mar 03 18:10:06 VdLrp2 systemd[1]: Started example.
Mar 03 18:10:06 VdLrp2 udpg[1167]: Socket-activated.
Mar 03 18:10:06 VdLrp2 udpg[1167]: Buffer:xx
Mar 03 18:10:06 VdLrp2 systemd[1]: example.service: Succeeded.
Mar 03 18:10:06 VdLrp2 systemd[1]: Started example.
Mar 03 18:10:06 VdLrp2 udpg[1168]: Socket-activated.
Mar 03 18:10:06 VdLrp2 udpg[1168]: Buffer:xx
Mar 03 18:10:06 VdLrp2 systemd[1]: example.service: Succeeded.
Mar 03 18:10:06 VdLrp2 systemd[1]: example.service: Start request repeated too quickly.
Mar 03 18:10:06 VdLrp2 systemd[1]: example.service: Failed with result 'start-limit-hit'.
Mar 03 18:10:06 VdLrp2 systemd[1]: Failed to start example.
Mar 03 18:10:06 VdLrp2 systemd[1]: example.socket: Failed with result 'service-start-limit-hit'.
I have tried all possible variations with "Type =" etc., just everything I found in the "systemd" manuals. But the result is always the same.
The version of systemd is 246.
What am I doing wrong?
Thanks in advance,
Poldi
I answer the question myself:
the problem is the "MSG_PEEK"-Flag.The buffer is not emptied

Blocking Spam from Sendgrid

Since July 3, we have been receiving hundreds of spam emails from Sendgrid, through Rackspace to our emails.
I have blacklisted the full SendGrid IP range 192.254.125.xxx
I have blacklisted the sender email - bounce#smecos.bes
I have blacklisted the sender domain - smecos.best
I have verified that there is no entry on our whitelist for it.
Does anyone have an idea on how to block this?
Delivered-To: myemail#mydomain.com
Return-Path: <bounces+14130655-c4d2-myemail=mydomain.com#sendgrid.net>
Delivered-To: myemail#mydomain.com
Received: from director12.mail.ord1d.rsapps.net ([172.27.255.8]) by backend25.mail.ord1d.rsapps.net with LMTP id OALhG8KxBF9jTAAAANS3aA for <myemail#mydomain.com>; Tue, 07 Jul 2020 13:32:50 -0400
Received: from proxy10.mail.iad3a.rsapps.net ([172.27.255.8]) by director12.mail.ord1d.rsapps.net with LMTP id WBInGcKxBF/cKgAAIasKDg ; Tue, 07 Jul 2020 13:32:50 -0400
Received: from smtp15.gate.iad3a ([172.27.255.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy10.mail.iad3a.rsapps.net with LMTP id QPz7EsKxBF80MAAAnQ/bqA ; Tue, 07 Jul 2020 13:32:50 -0400
Return-Path: <bounces+14130655-c4d2-myemail=mydomain.com#sendgrid.net>
X-Spam-Exception: WHITELISTED
X-Spam-Threshold: 95
X-Spam-Score: 100
X-MS-Exchange-Organization-SCL: 9
Precedence: junk
X-Spam-Flag: YES
X-Virus-Scanned: OK
X-Orig-To: myemail#mydomain.com
X-Originating-Ip: [192.254.125.54]
Authentication-Results: smtp15.gate.iad3a.rsapps.net; iprev=pass policy.iprev="192.254.125.54"; spf=pass smtp.mailfrom="bounces+14130655-c4d2-myemail=mydomain.com#sendgrid.net" smtp.helo="o19225412554.outbound-mail.sendgrid.net"; dkim=pass header.d=sendgrid.net; dmarc=none (p=nil; dis=none) header.from=smecos.best
X-Suspicious-Flag: NO
X-Classification-ID: e0a3814e-c077-11ea-8ea3-525400f46865-1-1
Received: from [192.254.125.54] ([192.254.125.54:40911] helo=o19225412554.outbound-mail.sendgrid.net) by smtp15.gate.iad3a.rsapps.net (envelope-from <bounces+14130655-c4d2-myemail=mydomain.com#sendgrid.net>) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=AES256-GCM-SHA384) id 69/3D-03017-1C1B40F5; Tue, 07 Jul 2020 13:32:49 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendgrid.net; h=content-type:from:subject:to; s=smtpapi; bh=kfSTUxrtrj7Cfftqpn3LN0WgHvE5kCnC+uOSG98vgVw=; b=h9mc6mDQC6rOc ccC9wL3Kli8FNwOSt5jau76QDpLrBAbHKhT396C0WbX2/KSD3uThrlp4nUXnvjSz r89bSPYTB6MJrgneNAlDS8NUaLi+NsKiUoR2rzuNp4DiS7srNyXLmpiDD2CT1ngR 1sWo8vVID+7G9+Zj/LmG4Hf8n1JV44=
Received: by filter1449p1las1.sendgrid.net with SMTP id filter1449p1las1-6945-5F04B1AF-2 2020-07-07 17:32:31.196480369 +0000 UTC m=+669233.137313263
Received: from localhost.local (unknown) by ismtpd0002p1lon1.sendgrid.net (SG) with ESMTP id ubRiQA93Qiu1jVJoiOUwWA for <myemail#mydomain.com>; Tue, 07 Jul 2020 17:32:30.923 +0000 (UTC)
Content-Type: text/html;
From: LeafFilter Promotion <bounce#smecos.best>
Subject: Clean-Flowing Gutters For Life. NOW 10% Off
To: myemail#mydomain.com
Date: Tue, 07 Jul 2020 17:32:31 +0000 (UTC)
Message-ID: <ubRiQA93Qiu1jVJoiOUwWA#ismtpd0002p1lon1.sendgrid.net>
X-SG-EID: pcWxy9UBUtUw1gLvETZLKtJE+upTXkXQzSeXVboYOfj8445+b2JsYfGgCpUWh8jVevl8/mhHKM7/bO cH66Ixkc6hUTlPM1+gw7fPZ+GgUnTm9aSlAe3BVn04Ij2UoKzBcvDZTSeQ36bqJOD3LuCa3N042M5N 5w7kLpwCQtqtjsCrM4HXT078AKROMUSpgkSXwz0ZXJbX5V+mjjJlMheILWef2HZCdQIqmghlz64LFz s=
Postfix Filter header_checks.pcre on
/^Message-ID: .*\.sendgrid\.net\>$/ REJECT spam emails from Sendgrid

Error running coral.cloudiot.core apperas suddenly

I am using the coral.cloudiot.core class (install instructions). This is a high level API for paho-mqtt.
Please find a simplified version of my code below:
with CloudIot("./cloud_config.ini", config_section='DEFAULT') as cloud:
while True:
"""if a defined if clause evalutes to True,
the following method is executed."""
cloud.publish_message(message)
Port 443 is used for the communication with the gcloud iot hub.
I tried qos = 0 and 1
systemctl is used to run the code.
The scripts sends up to 48 messages per minute.
ntp port is blocked by firewall (htpdate is used with crontab 5 * * * *)
After sometime the following error message accrues.
Mar 08 03:17:33 mocha-orange systemd[1]: Started ANN Client Detection.
Mar 09 07:18:30 mocha-orange start_service_client[3957]: Exception in thread Thread-1:
Mar 09 07:18:30 mocha-orange start_service_client[3957]: Traceback (most recent call last):
Mar 09 07:18:30 mocha-orange start_service_client[3957]: File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
Mar 09 07:18:30 mocha-orange start_service_client[3957]: self.run()
Mar 09 07:18:30 mocha-orange start_service_client[3957]: File "/usr/lib/python3.7/threading.py", line 865, in run
Mar 09 07:18:30 mocha-orange start_service_client[3957]: self._target(*self._args, **self._kwargs)
Mar 09 07:18:30 mocha-orange start_service_client[3957]: File "/usr/lib/python3/dist-packages/coral/cloudiot/core.py", line 196, in _token_update_loop
Mar 09 07:18:30 mocha-orange start_service_client[3957]: username='unused', password=self._create_jwt())
Mar 09 07:18:30 mocha-orange start_service_client[3957]: File "/usr/lib/python3/dist-packages/coral/cloudiot/core.py", line 225, in _create_jwt
Mar 09 07:18:30 mocha-orange start_service_client[3957]: return self._jwt_inst.encode(token, self._private_key, algorithm=self._algorithm)
Mar 09 07:18:30 mocha-orange start_service_client[3957]: File "/usr/lib/python3/dist-packages/jwt/api_jwt.py", line 65, in encode
Mar 09 07:18:30 mocha-orange start_service_client[3957]: json_payload, key, algorithm, headers, json_encoder
Mar 09 07:18:30 mocha-orange start_service_client[3957]: File "/usr/lib/python3/dist-packages/jwt/api_jws.py", line 114, in encode
Mar 09 07:18:30 mocha-orange start_service_client[3957]: signature = alg_obj.sign(signing_input, key)
Mar 09 07:18:30 mocha-orange start_service_client[3957]: File "/usr/lib/python3/dist-packages/coral/cloudiot/ecc608.py", line 132, in sign
Mar 09 07:18:30 mocha-orange start_service_client[3957]: return ecc608_hw_sign(msg)
Mar 09 07:18:30 mocha-orange start_service_client[3957]: File "/usr/lib/python3/dist-packages/coral/cloudiot/ecc608.py", line 81, in ecc608_hw_sign
Mar 09 07:18:30 mocha-orange start_service_client[3957]: assert status == 0
Mar 09 07:18:30 mocha-orange start_service_client[3957]: AssertionError
I do not understand how to solve this problem. I appreciate any hint.

From mongoshell how to insert utc datetime and epoch values as utc datetimes into mongodb

Trying to do a proof of concept of loading sample tick data into mongo db and the tick archive data is generally in utc and epoch and need to load it as is and output as utc only not local datetimes.
How to insert utc datetime and epoch in mongodb without being cast into utc again and retrieve the
same as utc only.
db.equity_ticks.insert(
{
"SNAPSHOT_DTTM" : Date("2013-07-09 19:00:00.000000"),
"CLOSE_DATE" : Date(15895) ,
"PREV_DAY_CLOSE_DATE" : Date(15895)
}
instead it inserted the local CST and output as CST too !
db.equity_ticks.find().pretty()
{
"_id" : ObjectId("52040942e5171b792b258ae8"),
"SNAPSHOT_DTTM" : "Thu Aug 08 2013 16:10:26 GMT-0500 (CDT)",
"CLOSE_DATE" : "Thu Aug 08 2013 16:10:26 GMT-0500 (CDT)",
"PREV_DAY_CLOSE_DATE" : "Thu Aug 08 2013 16:10:26 GMT-0500 (CDT)"
}
any help is appreciated.