Rest call for mod_rest in ejabberd not working - erlang

Hello guys in my project I have the JID of sender and receiver and the body of the message. I need to send the message without using any chat client, hence I am using mod_rest so that I can access mod_admin_extra. I configured it with Ejabberd server 14.05 and tried to run the following rest call
[root#centos ~]# wget localhost:5280/rest/ --server-response --post-data 'registered_users localhost'
--2016-06-20 17:03:33-- http://localhost:5280/rest/
Connecting to <<proxy ip>>... connected.
Proxy request sent, awaiting response...
HTTP/1.0 200 OK
Content-Type: text/html; charset=utf-8
Content-Length: 1015
Connection: close
Date: Mon, 20 Jun 2016 11:33:33 GMT
Length: 1015 [text/html]
Saving to: “index.html.3”
Where index.html.3 had the following message,
Problem 'error function_clause' occurred executing the command.
Stacktrace: [{ejabberd_commands,'-check_access_commands/5-fun-0-',
[{rest,[{registered_users,[all]},{connected_users,[all]}]}],
[{file,"src/ejabberd_commands.erl"},{line,372}]},
{lists,'-filter/2-lc$^0/1-0-',2,[{file,"lists.erl"},{line,1284}]},
{ejabberd_commands,check_access_commands,5,
[{file,"src/ejabberd_commands.erl"},{line,371}]},
{ejabberd_commands,execute_command,4,
[{file,"src/ejabberd_commands.erl"},{line,308}]},
{ejabberd_ctl,call_command,3,
[{file,"src/ejabberd_ctl.erl"},{line,293}]},
{ejabberd_ctl,try_call_command,3,
[{file,"src/ejabberd_ctl.erl"},{line,269}]},
{ejabberd_ctl,process2,3,
[{file,"src/ejabberd_ctl.erl"},{line,218}]},
{mod_rest,maybe_post_request,3,
[{file,"src/mod_rest.erl"},{line,135}]}]
Mod_admin_extra is added in ejabberd configuration file.Is this an issue of command not been identified.If yes the please explain how to add mod_Admin_extra commands in ejabberdctl I am new to erlang so its quite difficult for me to debug hence any help would be beneficial for me and if you guys know any better approach to send message other than using mod_rest please do let me know
Thanks alot

I got the issue. The ejabberd_commands.hrl and mod_admin_extra modules of ejabberd 14.05 do not support the commands I needed. Hence I added newer version of both modules and it started working

You can even try with command send__message

Related

Openwrt repos miss libsmpp library

RUTOS SDK (teltonika) requires the download of libsmpp34 from openwrt repositories, but none of them contain it.
Should I get it elsewhere ?
Traces below:
wget --tries=5 --timeout=20 --no-check-certificate --output-document=- https://sources.cdn.openwrt.org/libsmpp34-1.14.1.tar.xz --2022-07-04 14:38:15-- https://sources.cdn.openwrt.org/libsmpp34-1.14.1.tar.xz Resolving sources.cdn.openwrt.org (sources.cdn.openwrt.org)... 151.101.122.132, 151.101.2.132, 151.101.66.132, ... Connecting to sources.cdn.openwrt.org (sources.cdn.openwrt.org)|151.101.122.132|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2022-07-04 14:38:16 ERROR 404: Not Found.
Open /package/libs/libsmpp34/Makefile and change the line from:
PKG_SOURCE_URL=git://git.osmocom.org/libsmpp34.git
to
PKG_SOURCE_URL=https://git.osmocom.org/libsmpp34

nagios - nsclient - nsca - host_check message

I’ve configured some clients to use the nsca to send data to Nagios since I’m not able to connect from server to the client. I was able to achieve like everything I wanted, but one last thing is not exactly how I would like.
The host check / status information is not appending a message I want. This is my nsclient.ini conf:
[/settings/scheduler/schedules]
host_check = Check_OK
;host_check = Check_OK “OK”
And in the nagios server I see these messages:
Jun 30 06:52:02 localhost nagios: EXTERNAL COMMAND:
PROCESS_HOST_CHECK_RESULT;client;0;No message Jun 30 06:57:16
localhost nagios: EXTERNAL COMMAND:
PROCESS_HOST_CHECK_RESULT;client;0;No message Jun 30 07:02:31
localhost nagios: EXTERNAL COMMAND:
PROCESS_HOST_CHECK_RESULT;client;0;No message Jun 30 07:11:17
localhost nagios: EXTERNAL COMMAND:
PROCESS_HOST_CHECK_RESULT;client;3;Invalid command line: unrecognised
option 'OK' Jun 30 07:11:17 localhost nagios: Error: External command
failed -> PROCESS_HOST_CHECK_RESULT;client;3;Invalid command line:
unrecognised option 'OK' Jun 30 07:11:17 localhost nagios: External
command [1656573077] PROCESS_HOST_CHECK_RESULT;client;3;Invalid
command line: unrecognised option 'OK' returned error Command failed
So, when I use the “OK” I get that 3 invalid command line: unrecognised option ‘OK’ and when I don’t use any message I got that 0 No message.
Any thought what I’m doing wrong here?
nsclient version = NSCP-0.5.2.35-x64
Thanks!
It gave me some hard time to figure out but after deciding to check the documentation I tried couple other stuff and ended up with this way to get that message passed along:
host_check = check_ok message=OK
This way Nagios UI I can see the Status Information for the host as "OK" and how I was expecting.

Terraform apply access denied error

So I was upgrading Terraform from 0.9.5 to 0.9.6 and I am now getting the following error when I run a jenkins job on a build slave with IAM permissions attached:
terraform096 apply -var db_snap_stamp=171120171217 -var db_snapshot=rds-dev-13102017 -var-file=env.tfvars -no-color
Error loading state: AccessDenied: Access Denied
status code: 403, request id: 288766CE5CCA24A0, host id: FOOBAR
The jenkins job does run terraform init before hand and on my local test server I am not seeing the error. On the local test server I am using an aws credentials file.
I have had a look through the release notes for 0.9.6 but I can't see which of the changes could be causing this ( https://github.com/hashicorp/terraform/issues/14423 maybe?).
Any ideas?
UPDATE
I turned on terraform debug and found that the 403 was happening on a s3 list object. The IAM role in use allows this in 0.9.5 but NOT in 0.9.6 - I tried giving the role admin access but no change:
-----------------------------------------------------
2017/11/17 15:01:47 [DEBUG] [aws-sdk-go] DEBUG: Response s3/ListObjects
Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 403 Forbidden
Connection: close
Transfer-Encoding: chunked
Content-Type: application/xml
Date: Fri, 17 Nov 2017 15:01:47 GMT
Server: AmazonS3
X-Amz-Bucket-Region: eu-west-2
The S3 bucket in question does use KMS encryption but all that is set up in the init run prior:
terraform096 init -backend=true -get=true -input=false -backend-config="bucket=${BUCKET}" -backend-config="key=${ENV}.tfstate" -backend-config="region=eu-west-2" backend-config="profile=${AWS_PROFILE}" -backend-config="encrypt=true" -backend-config="kms_key_id=${KMS}"
So I raised this as an issue with Hashicorp and this does look like a bug - if anyone wants to keep an eye on the progress have a look here:
https://github.com/hashicorp/terraform/issues/16710

Passenger gem getting updated for Rails app

I have a staging server from my client which has passenger(3.0.5 and 3.0.2) installed on it for an rails app(v=2.3.13), but when I start the server using passenger on the console it's getting updated to 3.0.5-x86_64-ruby1.8.7-linux-gcc4.4.3-1002. In my Gemfile I have mentioned
gem 'passenger', '=3.0.5'
Why is it getting updated?
Thanks in advance.
Here's the log....
when I run the command, **`**RAILS_ENV=staging passenger start**.`**
__________________________________________________________
Nginx core 0.8.54 isn't installed
Phusion Passenger Standalone will automatically install it into:
/var/lib/passenger-standalone/3.0.5-x86_64-ruby1.8.7-linux-gcc4.4.3-1002/nginx-0.8.54
This will only be done once. Please sit back and relax while installation is
in progress.
Checking for required software...
GNU C++ compiler... found at `/usr/bin/g++`
GNU make... found at `/usr/bin/make`
A download tool like 'wget' or 'curl'... found at /usr/bin/wget
Ruby development headers... found
OpenSSL support for Ruby... found
RubyGems... found
Rake... found at `/usr/local/bin/rake`
rack... found
Curl development headers with SSL support... found
OpenSSL development headers... found
Zlib development headers... found
file-tail... found
daemon_controller >= 0.2.5... found
Downloading Passenger binaries for your platform, if available...
Resolving standalone-binaries.modrails.com... 97.107.130.55
Connecting to standalone-binaries.modrails.com|97.107.130.55|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-10-09 08:52:00 ERROR 404: Not Found.
Looks like it's not. But don't worry, the necessary binaries will be compiled from source instead.
Downloading Nginx binaries for your platform, if available...
#
Resolving standalone-binaries.modrails.com... 97.107.130.55
Connecting to standalone-binaries.modrails.com|97.107.130.55|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-10-09 08:52:00 ERROR 404: Not Found.
Looks like it's not. But don't worry, the necessary binaries will be compiled from source instead.
Downloading Nginx...
# wget -O /tmp/root-passenger-standalone-21842/nginx-0.8.54.tar.gz http://nginx.org/download/nginx-0.8.54.tar.gz
--2013-10-09 08:52:00-- http://nginx.org/download/nginx-0.8.54.tar.gz
Resolving nginx.org... 206.251.255.63
Connecting to nginx.org|206.251.255.63|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 650001 (635K) [application/octet-stream]
Saving to: '/tmp/root-passenger-standalone-21842/nginx-0.8.54.tar.gz'
100%
[======================================================================================================>] 650,001 788K/s in 0.8s
2013-10-09 08:52:01 (788 KB/s) - `/tmp/root-passenger-standalone-21842/nginx-0.8.54.tar.gz' saved [650001/650001]
Installing Phusion Passenger Standalone...

imap_search "FROM" issue

I tried to search by the following criteria:
imap_search($this->box, 'FROM "#avito.ru"');
And I faced with such problem:
2013/03/03 11:24:23 [error] 12481#0: *102 FastCGI sent in stderr: "PHP message: PHP Notice: Unknown: NOT IMPLEMENTED (errflg=2) in Unknown on line 0" while reading upstream, client: 9*.2*6.1*9.18*, server: 1*6.1*.1*8.*3, request: "GET /testmail.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "r*****ger.ru"
What you should do is check whether it is an IMAP issue or a PHP issue. Try connecting to the IMAP server manually using telnet (or, if the server uses SSL and you're on Windows, something like my IMAPTalk client will be necessary).
Login and select the folder (done automatically in IMAPTalk if you supply the credentials and folder name in the login window), and then enter your search command, such as:
01 SEARCH FROM "#avito.ru"
See what the response is. If you get an error at this point, you know it's a problem with the IMAP server.
I would also suggest trying the query without quotes, i.e.
01 SEARCH FROM #avito.ru

Resources