Jump to content
Калькуляторы

Zabbix экспорт отдельных графиков в png wget

Здравствуйте, есть zabbix 2.0.7, определил ID графика, соответственно URL вида:

 

https://zabbix.myhost.ru/chart2.php?graphid=920&period=86400

 

Вначале беру cookie, потом пытаюсь забрать картинку, выдает:

 

You are not logged in.

You cannot view this URL as a guest. You must login to view this page.

If you think this message is wrong, please consult your administrators about getting the necessary permissions.

 

При этом в cookie:

 

# HTTP cookie file.
# Generated by Wget on 2014-03-12 12:11:29.
# Edit at your own risk.

zabbix.myhost.ru    FALSE   /       FALSE   1397290289      zbx_sessionid   e4a20143a6a4bbbd50cc80f50732f59d

 

Ниже скрипт bash:

 

 

 

#!/bin/bash

 

export PATH="/usr/local/bin:/usr/bin:/bin"

 

MYDIR="/home"

IMG_DIR=${MYDIR}/img

ZABBIX_USER="login"

ZABBIX_PASSWORD="password"

ZABBIX_URL="https://zabbix.myhost.ru"

GRAPH_LIST=${MYDIR}/zabbix_graph.lst

COOKIE=${MYDIR}/cookie.txt

 

getCookie () {

wget -q --post-data='request=""&name='${ZABBIX_USER}'&password='${ZABBIX_PASSWORD}'&autologin=1&enter="Sign in"' \

--no-check-certificate \

--save-cookies=$COOKIE \

--keep-session-cookies "${ZABBIX_URL}" -O /dev/null

}

 

getGraph () {

if [ -f $GRAPH_LIST ];then

while read ID URL

do

if [ "${ID}" ];then

wget --load-cookies=$COOKIE --save-cookies=$COOKIE \

--keep-session-cookies \

--no-check-certificate \

"${URL}" -O $IMG_DIR/$ID.png

fi

done < $GRAPH_LIST

else

echo "Error! Graph list file $GRAPH_LIST not exist ..."

fi

}

 

 

getCookie;

getGraph;

 

 

$ cat zabbix_graph.lst

wan.gw https://zabbix.myhost.ru/chart2.php?graphid=920&period=86400

 

 

 

 

Чего ему надо-то?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this