Bitbull Tech Notes - home of free minds ...

Install collectd on CentOS 7

Below you find my notes to install collectd on CentOS 7

 yum install epel-release
 yum install -y collectd collectd-rrdtool rrdtool collectd-web httpd
 yum search collectd
 yum -y install collectd-disk collectd-virt # you may skip that step
 systemctl enable httpd collectd
 cat /etc/httpd/conf.d/collectd.conf 
 sed -i 's/# Require all granted/Require all granted/g;s/Require local/# Require local/g' /etc/httpd/conf.d/collectd.conf 
 systemctl restart httpd collectd

Now, you can access collectd by pointing to: http://servername/collectd/bin/index.cgi



domoticz ASPSms gateway via JSON API

With this setting, you can send SMS notifications by ASPSMS gateway.

Domoticz > Setup > Settings > TAB:Notifications > Section: "Custom HTTP/Action"

#FIELD1: aPi-Key-here
#FIELD2: pAssw0rd-here
#FIELD3: SenderName
#TO: 0761112233


Post Data:

{ "UserName": "#FIELD1", "Password": "#FIELD2", "Originator": "#FIELD3", "Recipients": [ "#TO" ], "MessageText": "#MESSAGE", "DeferredDeliveryTime": "", "FlashingSMS": "", "URLBufferedMessageNotification": "", "URLDeliveryNotification": "", "URLNonDeliveryNotification": "", "AffiliateID": "" }

POST Content-Type: application/json


That's all, now you can send out sms by http json api


Modify Debian Package

I found this useful when needed to fix a pre-install error in a debian package.

mkdir another-out-dir
dpkg-deb -x some-deb.deb another-out-dir
dpkg-deb -e some-deb.deb another-out-dir/DEBIAN
# modify another-out-dir/DEBIAN/preinst)
dpkg-deb -b another-out-dir some-deb2.deb
dpkg -i some-deb2.deb

yum check-update: Updateinfo file is not valid XML: ...7/epel/gen/updateinfo.xml', mode 'rt' at 0x4bbe150>

This errors are created hourly on CentOS7 systems by: /etc/cron.hourly/0yum-hourly.cron

I fixed like this:

[root@name1 named]# yum check-update  | tail -2  
Updateinfo file is not valid XML: <open file '/var/cache/yum/x86_64/7/epel/gen/updateinfo.xml', mode 'rt' at 0x4bbe150>
util-linux.x86_64                         2.23.2-33.el7_3.2              updates
webmin.noarch                             1.840-1                        Webmin 

[root@name1 named]# yum clean all

[root@name1 named]# rm -rf /var/cache/yum/*

[root@name1 named]# yum makecache

[root@name1 named]# yum check-update  | tail -2  
util-linux.x86_64                         2.23.2-33.el7_3.2              updates
webmin.noarch                             1.840-1                        Webmin 

**** ERROR IS GONE ****



SANNCE 20$ pan/tilt night vision camera hacked into domoticz

On Aliexpress I found this impressive 20$ cam: SANNCE WIFI IP CAM

The cam works quite well, assigning IP with mobile app is some kind of pain, but anyway
After integrating into WLAN with Andorid app (google: sannce wifi cam setup) you can reach the cam on port 81.

The cam has following functionality:

  • pan tilt camera motor
  • auto IR night vision leds
  • motion based alert trigger
    • wlan nic
    • ftp upload on alert
    • email on alert
    • record video on alert


I needed to integrate this cam into mi domoticz home automation system as much as possible.
So I proceeded this way:

  • hack into the cam console
    telnet is running, but no root pw is known
    cam seems to be affected by xss attacks:
    so i tried to configure ftp upload with user: $(telnetd -p25 -l/bin/sh)
    Then hit test, and enjoy telnet server on port 25 without password auth.
  • Modify the scripts to trigger domoticz event on motion
  • /system/init/
    export PATH=/system/system/bin:$PATH
    mkdir -p /tmp/Wireless/RT2870STA
    cp /system/RT2870STA.dat  /tmp/Wireless/RT2870STA/
    mkdir -p /tmp/Wireless/RT2870AP
    cp /system/RT2870AP.dat /tmp/Wireless/RT2870AP/
    ulimit -HSn 4096
    /system/system/bin/wifidaemon &
    /system/bin/ &
    /usr/sbin/telnetd -p24 -l /bin/sh
  • /system/bin/
    while true ; do 
    /usr/bin/tail -fn0 /system/param/log?.txt | /usr/bin/awk '/alarm is happen for motion/ {system("/system/bin/")}
    /alarm is clear/ {system("/system/bin/")}'
    sleep 1 ; done
  • /system/bin/
    echo alert
    wget -q -O -  "http://sensor:sensor@"
    exit 0
  • /system/bin/
    echo clear
    wget -q -O - "http://sensor:sensor@"
    exit 0

That's it, now you have a fully integrated webcam, that can be used as:

  • Virtual switch (motion sensor), triggered by http events above (,
  • domoticz webcam
    User: visitor #set up on cam
    PW: secret
    Image URL: snapshot.cgi?user=visitor&pwd=secret

Now you can trigger push notification and integrate it in your fully armed home automation system!



Newer posts → Home ← Older posts