Ad Widget

Collapse

[1.3.1]: SQLite initial DB creation issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LEM
    Senior Member
    Zabbix Certified Specialist
    • Sep 2004
    • 112

    #1

    [1.3.1]: SQLite initial DB creation issue

    Greetings,

    I'm running a Debian Ubuntu 6.06 LTS box, and tried to use 1.3.1 with SQLite, following 2.4.3 paragraph of the PDF Guide.

    To do so, I compiled from source latest SQLite 3.3.8 (Ubuntu 6.06 come with 3.2.8 at maximum) and ran the DB intialize process... But injection of datas failed:
    Code:
    olem@homebox:/tmp/zabbix-1.3.1/create/data$ sqlite3 -version
    3.3.8
    olem@homebox:/tmp/zabbix-1.3.1/create/sqlite$ cat schema.sql | sqlite3 /tmp/zabbixdb
    olem@homebox:/tmp/zabbix-1.3.1/create/sqlite$ cd ../data/
    olem@homebox:/tmp/zabbix-1.3.1/create/data$ ll
    total 324K
    drwxr-xr-x 2 olem olem 4,0K 2006-12-11 16:41 .
    drwxr-xr-x 5 olem olem 4,0K 2006-12-11 16:41 ..
    -rw-r--r-- 1 olem olem 125K 2006-12-11 16:40 data.sql
    -rw-r--r-- 1 olem olem 112K 2006-12-11 16:40 images_pgsql.sql
    -rw-r--r-- 1 olem olem  64K 2006-12-11 16:40 images.sql
    olem@homebox:/tmp/zabbix-1.3.1/create/data$ cat data.sql  | sqlite3 /tmp/zabbixdb
    SQL error: unrecognized token: "{"
    SQL error: unrecognized token: "{"
    SQL error: unrecognized token: "{"
    SQL error: unrecognized token: "{"
    SQL error: unrecognized token: "{"
    SQL error: unrecognized token: "{"
    Incomplete SQL: INSERT INTO triggers VALUES (10191,'{10242}<10000','Low free disk space on {HOSTNAME}\\\'s volume d:','',0,2,3,0,0,'','',0);
    INSERT INTO triggers VALUES (10163,'{10189}<1','Email (SMTP) server is down on {HOSTNAME}','',0,2,3,0,0,'','',0);
    INSERT INTO triggers VALUES (10164,'{10190}<1','FTP server is down on {HOSTNAME}','',0,2,3,0,0,'','',0);
    INSERT INTO triggers VALUES (10165,'{10194}<1','SSH server is down on {HOSTNAME}','',0,2,3,0,0,'','',0);
    INSERT INTO triggers VALUES (10168,'{10193}<1','POP3 server is down on {HOSTNAME}','',0,2,3,0,0,'','',0);
    ....
    .... LOTS of Outputs (STDOUT)
    .... finishing by
    .... 
    INSERT INTO functions VALUES (11203,17203,12203,NULL,'delta','0');
    INSERT INTO functions VALUES (11204,17204,12204,NULL,'delta','0');
    INSERT INTO functions VALUES (11205,17205,12205,NULL,'delta','0');
    INSERT INTO functions VALUES (11206,17206,12206,NULL,'delta','0');
    INSERT INTO functions VALUES (11207,17207,12207,NULL,'delta','0');
    INSERT INTO functions VALUES (11208,17208,12208,NULL,'delta','0');
    
    olem@homebox:/tmp/zabbix-1.3.1/create/data$
    Not discouraged, I tried to finish the DB initalization phase with images.sql, but this seems to fail too
    Code:
    olem@homebox:/tmp/zabbix-1.3.1/create/data$ cat images.sql | sqlite3 /tmp/zabbixdb
    SQL error: unrecognized token: "0x89504E470D0A1A0A0000000D49484452000000300000003008060000005702F98700000006624B474400FF00FF00FFA0BDA7930000000774494D4507D1011F092B1C4D0C91FA0000074A4944415478DAED994F6C53C91DC73FEFD9982C90C4E06441254542D425DA82A0AC54B5DA1015417B58AA569538A1E5EF023D70415C9A13EA815E809CA844A51050B715A7802A552A69DA882A62D5A8A83D401C017622C85A2B48084996D8CE7B7E33D30333D6C4D889D938660F1DC9CA3CC77E33DFDFEF3BBFDFF7FB0CFF1FEF76383558A3116805A2D67A5F675D057C010CEB3900E11A0068EEE8E8F8D1A953A77EB56EDDBA56A514C52F29E5BCBF666EAE85103C7BF6ECAF6D6D6DBF071E030290B502E0EED9B3E707B158AC756464E47528F5068510F3366FBF675ED96C96EDDBB7D3DCDCFC31F0195007CCE92CA8700D28EAFABE8F9412805DBB76BDF54DB2D92C63636300F5C02A20D01910D502F0D3227E2BE0EF7AEE48295D137980E9CC0C424AFCBC8F9FF7F17CAFEC8DBFFBEDEF009800AC06DE03B2800FE0562BD2D96CB6776666A6B7A7A7E73610D1F47401574AE91A9A00088BDF4A29A4523435C6888423AC5D192B7D825F835F09AC00422660E12AD1
    .....
    ..... LOTS of Outputs too :(
    Well, starting to pray for some black magic, I modified my {PHP FRONTEND PUBLICATION ROOT}/conf/zabbix.conf.php for the following parameters:
    Code:
    //$DB_TYPE      = "MYSQL";
    $DB_TYPE        = "SQLITE3";
    //$DB_SERVER      = "localhost";
    //$DB_DATABASE  = "zabbix";
    $DB_DATABASE    = "/tmp/zabbixdb";
    //$DB_USER        = "root";
    //$DB_PASSWORD    = "mypasswd";
    But only had a blank page ((

    So.. I've started to look for some bugfixes....
    --
    LEM
  • LEM
    Senior Member
    Zabbix Certified Specialist
    • Sep 2004
    • 112

    #2
    [1.3.1] : SQLite initial DB injection issue

    Originally posted by LEM
    For this point :
    Code:
    olem@homebox:/tmp/zabbix-1.3.1/create/data$ cat data.sql  | sqlite3 /tmp/zabbixdb
    SQL error: unrecognized token: "{"
    SQL error: unrecognized token: "{"
    SQL error: unrecognized token: "{"
    SQL error: unrecognized token: "{"
    SQL error: unrecognized token: "{"
    SQL error: unrecognized token: "{"
    Incomplete SQL: INSERT INTO triggers VALUES (10191,'{10242}<10000','Low free disk space on {HOSTNAME}\\\'s volume d:','',0,2,3,0,0,'','',0);
    .... LOTS of Outputs...
    I've find that removing "\\\'s" the {HOSTNAME} macro help populating the database... Seems that to much backslash don't help sqlite 3.3.8 CLI to do the job

    Well, anyway I've still have the "SQL error: unrecognized tocken: "{" ... issue on which I'm still foraging.
    --
    LEM

    Comment

    • Alexei
      Founder, CEO
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2004
      • 5654

      #3
      Sorry for this. SQLite use single ' for escaping character '. We prepared a separate data.sql which abviously is missing in 1.3.1. It is attached.
      Attached Files
      Alexei Vladishev
      Creator of Zabbix, Product manager
      New York | Tokyo | Riga
      My Twitter

      Comment

      • LEM
        Senior Member
        Zabbix Certified Specialist
        • Sep 2004
        • 112

        #4
        Originally posted by Alexei
        Sorry for this. SQLite use single ' for escaping character '. We prepared a separate data.sql which abviously is missing in 1.3.1. It is attached.
        Ok. Thx, works perfect.

        Following the same idea, you should consider 'simple cote-ing' images in images.sql. I used that to have a descent insert in my 3.3.8 SQLite dabase (see attachement) and it seems to work (no complain at injection time, a select * from images grab me what supposed to, after injection).

        Cheers,
        Attached Files
        --
        LEM

        Comment

        • Alexei
          Founder, CEO
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Sep 2004
          • 5654

          #5
          Please use these files to fix displaying and management of images.
          Attached Files
          Alexei Vladishev
          Creator of Zabbix, Product manager
          New York | Tokyo | Riga
          My Twitter

          Comment

          Working...