Name: |
mod_ctlextra |
Purpose: |
Additional commands for ejabberdctl |
Author: |
Badlop |
Type: |
Module |
Requirements: |
ejabberd 1.1.x or 2.0.x |
Download: |
ejabberd-modules |
Note: if you are using ejabberd 2.1.0 or newer, install this instead: mod_admin_extra.
- SERVER:
compile file recompile and reload file
load-config file load config from file
remove-node nodename remove an ejabberd node from the database
export2odbc server output export all possible tables on server to output
stats registeredusers number of registered users
stats onlineusers number of logged users
- MAINTANCE:
delete-older-messages days delete offline messages older than 'days'
delete-older-users days delete users that have not logged in the last 'days'
- USERS:
set-password user server password set password to user@server
vcard-get user server data [data2] get data from the vCard of the user
vcard-set user server data [data2] content sets data to content on the vCard
num-active-users vhost days number of users active in the last 'days'
stats registeredusers number of registered users
stats onlineusers number of logged users
killsession user server resource kill a user session
status-list status list the logged users with status
status-num status number of logged users with status
- SHARED ROSTER GROUPS:
srg-create group host name description display Create the group with options
srg-delete group host Delete the group
srg-user-add user server group host Adds user@server to group on host
srg-user-del user server group host Removes user@server from group on host
- ROSTERS:
add-rosteritem user1 server1 user2 server2 nick group subs
Adds user2@server2 to user1@server1
subs= none, from, to or both
example: add-roster peter localhost mike server.com MiKe Employees both
will add mike@server.com to peter@localhost roster
pushroster file user server push template roster in file to user@server
pushroster-all file push template roster in file to all those users
push-alltoall server group adds all the users to all the users in Group
works not in ejabberd 2.1.2 with remsh
I have the problem, that I can't start the module from erlang shell.
I'm running a FreeBSD 7.2 Stable with ejabberd 2.1.2
Try mod_admin_extra
I noticed that mod_ctlextra can't work with ejabberd 2.1.0 or newer. I've updated the module documentation. Use mod_admin_extra instead.
Regarding the module start, this works for me:
status-list command
Hi,
I used the status-list command of revision 36 or 364, and it worked fine.
But with the latest revision it doesn't :
=ERROR REPORT==== 2-Jun-2008::15:27:23 ===
E(<3916.526.0>:ejabberd_hooks:187): {{badrecord,session},
[{mod_ctlextra,
'-get_status_list/2-lc$^0/1-0-',
1},
{mod_ctlextra,get_status_list,2},
{mod_ctlextra,ctl_process,3},
{ejabberd_hooks,run_fold1,4},
{ejabberd_ctl,process,1},
{rpc,'-handle_call/3-fun-0-',5}]}
running hook: {ejabberd_ctl_process,[["status-list","all"]]}
** at node ejabberd@localhost **
I don't know erlang enough to try to debug.
I am running the debian stable version of ejabberd (1.1.2).
Try 1.1.x branch of the module
Yes, recently trunk/mod_ctlextra was updated to be compatible with ejabberd 2.0.0, and it broke compatibility with old ejabberd 1.1.x.
I've created a branch of the module, try it: ejabberd-modules/mod_ctlextra/branches/ejabberd-1.1.x
branch Ok
Great! the branch works fine.
Thank you for your reactivity!
Submission of Patch
I've made some modifications to mod_ctlextra to suit the needs of a project and since it might be of interest to someone else, would like to submit it for inclusion ( though no credit is required ) into the module.
The patch is quite small and just adds the commands 'srg-get-shared' & 'srg-shared-info' which do the following:
srg-get-shared Host -> returns all the shared rosters for a particular vhost, each on it's own line.
srg-shared-info Group Host -> returns the Name & Description for a particular Shared Roster (':' separated).
'srg-shared-info' is more of a hack then anything and could be done better and with more options as originally I wanted it to process based on the desired property of the SR (Name, Description, Displayed, Members, All) but my erlang isn't that great and I kept encountering an 'Unused Variable' for the what would have been 'Detail'.
Publish the code or join the chatroom
You can publish the code in some website and announce it in a comment here; or send to the mailing list; or join the ejabberd chatroom and contact me to upload the code...
Suggestion for addition : connecter user per node
Maybe a good addition would be querying for the # of authenticated users for that particular node such as :
# ejabberdctl ejabberd@node1 connected-users-number
10
# ejabberdctl ejabberd@node1 node-connected-users-number
7
# ejabberdctl ejabberd@node2 node-connected-users-number
3
Or something similar. Unfort my erl skills are just barely above 'Hello World' and this doesn't look like something I can steal from ejabberd_web_admin.
Try the new command in SVN
Try the new command in SVN r503:
I don't have right now an ejabberd cluster to test this command properly. So please tell me if it works or not.
Success
Just put into production and works fine though I had to omit the '--node' portion.
To be tested next maintence window
Doh unfortionately I didn't check the forums until after the maintence windows had closed so I'll have to test compile/test it during the next schedualed downtime. I did notice that adding '--node' produced an failure:ejabberd@van-xmpp1.test.com stats onlineusernode
]# /usr/local/bin/ejabberdctl --node
RPC failed on the node '--node': nodedown
Though this run from a system running in standalone mode so I'm guessing that this is to be expected.
Thanks again though. This is much more elegant then the Perl+CURL script pulling the info from the WebAdmin.
Hi, Is this really no way to
Hi,
Is this really no way to add more then one group to display with srg-create command? Without this it looks completely useless. Or is there any other way to add multiple displayed groups to shared group?
Thanks in advance.
Assuming that faculty and
Assuming that "faculty" and "students" are two existing groups and you want to create a new group "everybody" having both these groups as display groups, this is what you can do:
ejabberdctl srg-create everybody example.com "Everybody" "Consists of both faculty and students" "`echo -e 'faculty\nstudents'`"
Doesn't work.
I tried the above. When I 'ejabberdctl srg-get-info everybody X' I see:
displayed_groups: ["faculty\nstudents"]
instead of:
displayed_groups: ["faculty", "students"]
Newlines in ejabberdctl arguments: supported in trunk SVN
It seems ejabberdctl of ejabberd 2.0.x + mod_ctlextra does not support anyway to represent newlines inside arguments.
The good news is that ejabberdctl in ejabberd trunk SVN + mod_admin_extra supports it:
You can get and compile ejabberd trunk SVN, or wait for ejabberd 2.1.0, but the release doesn't have fixed date (it may be weeks or a few months).
Thanks
Thanks for the quick response. This feature allows us to do some very nice things with shared rosters based on ldap.
Yes you are right. That hack
Yes you are right. That hack is not working. I actually saw the displayed groups list through the webadmin interface and as they were displayed in separate lines, I thought that they were added properly. But they are not.
Using ejabberdctl to startup
I use ejabberdctl to start the ejabberd service defining a sym link to /sbin/ejabberdctl file .. whe the server reach the 1000 users aproximatelly the service stop ... the node is down .... if found some script in the web but think tht resolving this bug is better .... the web interface dont have the remove users option .. then i use ejabberdctl to make this and all this things listed up ...
badlop .... can u look this that i think is a but ?
How is mod_ctlextra related to your issue?
I use ejabberdctl to start the ejabberd service defining a sym link to /sbin/ejabberdctl file .. whe the server reach the 1000 users aproximatelly the service stop ... the node is down .... if found some script in the web but think tht resolving this bug is better .... the web interface dont have the remove users option .. then i use ejabberdctl to make this and all this things listed up ...
badlop .... can u look this that i think is a but ?
What do you want me to look at? Your server should not stop when reaches 1.000 users.
no output with : ejabberdctl export2odbc
Hi all,
When I try to export my Mnesia db to sql scripts, I get this :
# ./ejabberdctl ejabbered@pr01-c30900-db03 export2odbc mydomain.com /tmp/test2
Trying to export Mnesia table 'last' on server 'mydomain.com' to file '/tmp/test2/last.txt'
Trying to export Mnesia table 'offline' on server 'mydomain.com' to file '/tmp/test2/offline.txt'
Trying to export Mnesia table 'passwd' on server 'mydomain.com' to file '/tmp/test2/passwd.txt'
Trying to export Mnesia table 'private_storage' on server 'mydomain.com' to file '/tmp/test2/private_storage.txt'
Trying to export Mnesia table 'roster' on server 'mydomain.com' to file '/tmp/test2/roster.txt'
Trying to export Mnesia table 'vcard' on server 'mydomain.com' to file '/tmp/test2/vcard.txt'
Trying to export Mnesia table 'vcard_search' on server 'mydomain.com' to file '/tmp/test2/vcard_search.txt'
#
#
# du /tmp/test2/*
4.0K /tmp/test2/last.txt
4.0K /tmp/test2/offline.txt
4.0K /tmp/test2/passwd.txt
4.0K /tmp/test2/roster.txt
4.0K /tmp/test2/vcard_search.txt
4.0K /tmp/test2/vcard.txt
-> Nothing into files.
Is someone can help me ?
Problem solved using the
Problem solved using the last svn version of ejabberd ...
Thanks for your active helping and for the awesome documentation ...
Another vcard Bug
Hello Badlop,
I do not hope I stresses you too much with the vcard thing =;-)
I found another vcard bug, with normal mod_vcard NOT mod_vcard_odbc!:
ejabberdctl vcard-set USER1 SERVER1 N GIVEN user1
done
ejabberdctl vcard-set USER1 SERVER1 N FAMILY useruser1
done
ejabberdctl vcard-get USER1 SERVER1 N GIVEN
user1
ejabberdctl vcard-get USER1 SERVER1 N FAMILY
no_value
Another case:
ejabberdctl vcard-set USER1 SERVER1 N FAMILY useruser1
done
ejabberdctl vcard-set USER1 SERVER1 N GIVEN user1
done
ejabberdctl vcard-get USER1 SERVER1 N GIVEN
user1
ejabberdctl vcard-get USER1 SERVER1 N FAMILY
no_value
Another other case:
ejabberdctl vcard-set USER1 SERVER1 N FAMILY useruser1
done
ejabberdctl vcard-get USER1 SERVER1 N GIVEN
no_value
ejabberdctl vcard-get USER1 SERVER1 N FAMILY
user1user1
the errors are not really tragic. Thanks again!
Daniel
I think I fixed the bug.
I think I fixed the bug. Update to SVN.
mod_vcard_odbc doesn't work?
Hello together,
runs vcard_get and vcard_set with mod_vcard_odbc? For me it doesn't work.
Thanks for help.
Daniel
Fixed in SVN
I think I found a solution. Update SVN and try.
"Small" Bugs
Hello Badlop,
when i do
"ejabberdctl vcard-set USER1 SERVER1 N GIVEN Test"
or
"ejabberdctl vcard-get USER1 SERVER1 N GIVEN"
comes the help screen.
A other case is, when i edit a existing vcard in the Database:
"ejabberdctl vcard-set USER2 SERVER1 N GIVEN Best"
it comes the help screen and:
E(<4178.315.0>:ejabberd_hooks:187): {{case_clause,
[undefined,
{xmlelement,
"error",
[{"code","500"},{"type","wait"}],
[{xmlelement,
"internal-server-error",
[{"xmlns",
"urn:ietf:params:xml:ns:xmpp-stanzas"}],
[]}]}]},
[{mod_ctlextra,vcard_set2,4},
{mod_ctlextra,ctl_process,2},
{ejabberd_hooks,run_fold1,4},
{ejabberd_ctl,process,1},
{rpc,'-handle_call/3-fun-0-',5}]}
running hook: {ejabberd_ctl_process,[["vcard-set",
"USER2",
"SERVER1",
"N",
"GIVEN",
"Best"]]}
An "ejabberdctl vcard-get USER2 SERVER1 N GIVEN" print the help screen.
When You need more Tests, Results or logs, let me know.
THANKS!
Daniel
I can't reproduce this bug
I can't reproduce this bug using the last updated SVN.
You are right: vcard_set and
You are right: vcard_set and vcard_get are only compatible with mod_vcard, not with mod_vcard_odbc. Your feature request seems not hard to implement, but I will need some days to do it.
Also, I don't know much about ODBC, so you will have to beta test it once I implement :)
I'll post a comment here once I improve the code to support mod_vcard_odbc.
Thanks
Thanks for your help. I'm the Betatester for you =;-)
deleting my admin user :(
I've got an admin user added by the Debian package which I only ever use via the web interface. Running delete-older-users deleted it because it had never had any presence. Is there some way we can avoid deleting admin users (either by detecting them, or by allowing me to specify users not to remove), so I can put this command on cron? We have a development server, which gets a lot of users created automatically by our software which get used once or twice, and then the credentials lost when the developers reflash their devices.
Not implemented account protection
This is a nice feature request.
But right now it is not possible to protect certain Jabber accounts. On your case, a quick and dirty solution is to call 'delete-older-users' and immediately after that register again the Jabber account you want to keep. There's a command to register accounts.
ask the command
can you give an example for execute command "vcard-get" and "vcard-set"
the white-spaces?
how can i make whitespaces in NICKNAME for example:
...vcard-set user1 server1 NICKNAME first second?
Possible in the new ejabberd 2.0.1-rc1 + mod_admin_extra
I think not possible in ejabberd 2.0.5 + mod_ctlextra.
Good news are: it is possible using ejabberd 2.1.0-rc1 + mod_admin_extra. See:
set_vcard white spaces
Hi,
It seems it doesn't work (anymore?) with running ejabberd-2.1.3 (installed with .bin) and the svn check out of mod_admin_extra.
I tried :
ejabberdctl set_vcard test 192.168.0.70 FN "Bla bla"
ejabberdctl set_vcard test 192.168.0.70 FN \"Bla bla\"
ejabberdctl set_vcard test 192.168.0.70 FN "Bla\ bla"
ejabberdctl set_vcard test 192.168.0.70 FN \"Bla\ bla\"
(on a Scientific Linux 5.3 (same as Red Hat Entreprise Linux 5.3, and surely CentOS...))
I did something wrong? (I don't know Erlang at all...)
Thank you in advance
Seems a bug. Try a simple workaround
It seems it doesn't work (anymore?) with running ejabberd-2.1.3 (installed with .bin)
The problem is in the ejabberdctl file included in the binary installers. As it must be cross-platform, it doesn't use the same tools and the source code package.
I've submitted a ticket, including a quick and dirty solution that you can apply:Support for space in ejabberdctl of binary installers
2.1.0-rc1
oo.. i see.. thanks ;)
Examples of vcard-get and vcard-set
For example. Note that some fields are double "N FAMILY" and other are single "NICKNAME":
The available fields are:
not work for user dont hv vcard
The available fields are:
TITLE - also can :D
but i only can set the data if i have vcard already.
example: i add user with 'ejabberctl register user1 localhost passwd'
i can't set the vcard using 'ejabberctl vcard-set user1 localhost FN userone'
i must create user info from client such as tkabber, just create any info to make system generate card. after that i can play with vcard-set. any solution to use vcard-set without need to create user info ?
Bug fixed on SVN
any solution to use vcard-set without need to create user info ?
Thanks for the report. I've fixed the bug. Check SVN and tell me if it fails.
work
it's work for me, only cant comunicate with mod_vcard_odbc :D
but no problem with mod_vcard